shared_ptr<Interface> ThriftConfigApplier::updateInterface( const shared_ptr<Interface>& orig, const cfg::Interface* config, const Interface::Addresses& addrs) { CHECK_EQ(orig->getID(), config->intfID); cfg::NdpConfig ndp; if (config->__isset.ndp) { ndp = config->ndp; } auto name = getInterfaceName(config); auto mac = getInterfaceMac(config); auto mtu = config->__isset.mtu ? config->mtu : Interface::kDefaultMtu; if (orig->getRouterID() == RouterID(config->routerID) && orig->getVlanID() == VlanID(config->vlanID) && orig->getName() == name && orig->getMac() == mac && orig->getAddresses() == addrs && orig->getNdpConfig() == ndp && orig->getMtu() == mtu) { // No change return nullptr; } auto newIntf = orig->clone(); newIntf->setRouterID(RouterID(config->routerID)); newIntf->setVlanID(VlanID(config->vlanID)); newIntf->setName(name); newIntf->setMac(mac); newIntf->setAddresses(addrs); newIntf->setNdpConfig(ndp); newIntf->setMtu(mtu); return newIntf; }
NetworkManager::PppSetting::PppSetting(const Ptr &other): Setting(other), d_ptr(new PppSettingPrivate()) { setNoAuth(other->noAuth()); setRefuseEap(other->refuseEap()); setRefusePap(other->refusePap()); setRefuseChap(other->refuseChap()); setRefuseMschap(other->refuseMschap()); setRefuseMschapv2(other->refuseMschapv2()); setNoBsdComp(other->noBsdComp()); setNoDeflate(other->noDeflate()); setNoVjComp(other->noVjComp()); setRequireMppe(other->requireMppe()); setRequireMppe128(other->requireMppe128()); setMppeStateful(other->mppeStateful()); setCRtsCts(other->cRtsCts()); setBaud(other->baud()); setMru(other->mru()); setMtu(other->mtu()); setLcpEchoFailure(other->lcpEchoFailure()); setLcpEchoInterval(other->lcpEchoInterval()); }
void NetworkManager::PppSetting::fromMap(const QVariantMap &setting) { if (setting.contains(QLatin1String(NM_SETTING_PPP_NOAUTH))) { setNoAuth(setting.value(QLatin1String(NM_SETTING_PPP_NOAUTH)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_REFUSE_EAP))) { setRefuseEap(setting.value(QLatin1String(NM_SETTING_PPP_REFUSE_EAP)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_REFUSE_PAP))) { setRefusePap(setting.value(QLatin1String(NM_SETTING_PPP_REFUSE_PAP)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_REFUSE_CHAP))) { setRefuseChap(setting.value(QLatin1String(NM_SETTING_PPP_REFUSE_CHAP)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_REFUSE_MSCHAP))) { setRefuseMschap(setting.value(QLatin1String(NM_SETTING_PPP_REFUSE_MSCHAP)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_REFUSE_MSCHAPV2))) { setRefuseMschapv2(setting.value(QLatin1String(NM_SETTING_PPP_REFUSE_MSCHAPV2)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_NOBSDCOMP))) { setNoBsdComp(setting.value(QLatin1String(NM_SETTING_PPP_NOBSDCOMP)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_NODEFLATE))) { setNoDeflate(setting.value(QLatin1String(NM_SETTING_PPP_NODEFLATE)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_NO_VJ_COMP))) { setNoVjComp(setting.value(QLatin1String(NM_SETTING_PPP_NO_VJ_COMP)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_REQUIRE_MPPE))) { setRequireMppe(setting.value(QLatin1String(NM_SETTING_PPP_REQUIRE_MPPE)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_REQUIRE_MPPE_128))) { setRequireMppe128(setting.value(QLatin1String(NM_SETTING_PPP_REQUIRE_MPPE_128)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_MPPE_STATEFUL))) { setMppeStateful(setting.value(QLatin1String(NM_SETTING_PPP_MPPE_STATEFUL)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_CRTSCTS))) { setCRtsCts(setting.value(QLatin1String(NM_SETTING_PPP_CRTSCTS)).toBool()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_BAUD))) { setBaud(setting.value(QLatin1String(NM_SETTING_PPP_BAUD)).toUInt()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_MRU))) { setMru(setting.value(QLatin1String(NM_SETTING_PPP_MRU)).toUInt()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_MTU))) { setMtu(setting.value(QLatin1String(NM_SETTING_PPP_MTU)).toUInt()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_LCP_ECHO_FAILURE))) { setLcpEchoFailure(setting.value(QLatin1String(NM_SETTING_PPP_LCP_ECHO_FAILURE)).toUInt()); } if (setting.contains(QLatin1String(NM_SETTING_PPP_LCP_ECHO_INTERVAL))) { setLcpEchoInterval(setting.value(QLatin1String(NM_SETTING_PPP_LCP_ECHO_INTERVAL)).toUInt()); } }