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; }
/* important interface functions */ void ArduinoiDigiInterfaceClass::setup(uint8_t *mac, IPAddress ip, uint32_t vendorId) { setMac(mac); setIp(ip); setVendorId(vendorId); idigi_handle = idigi_init((idigi_callback_t) &ArduinoiDigiInterfaceClass::appCallback); AR_DEBUG_PRINTF("idigi_init complete.\r\n"); }