本文整理汇总了C++中SPtr::addExtraOption方法的典型用法代码示例。如果您正苦于以下问题:C++ SPtr::addExtraOption方法的具体用法?C++ SPtr::addExtraOption怎么用?C++ SPtr::addExtraOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPtr
的用法示例。
在下文中一共展示了SPtr::addExtraOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matchParsedSystemInterfaces
/**
* match parsed interfaces with interfaces detected in system.
* ClntCfgIface objects copied to CfgMgr.
*
* @param parser
*
* @return true if ok, false if interface definitions are incorrect
*/
bool TClntCfgMgr::matchParsedSystemInterfaces(ClntParser *parser) {
int cfgIfaceCnt;
cfgIfaceCnt = parser->ClntCfgIfaceLst.count();
Log(Debug) << cfgIfaceCnt << " interface(s) specified in " << CLNTCONF_FILE << LogEnd;
SPtr<TClntCfgIface> cfgIface;
SPtr<TIfaceIface> ifaceIface;
if (cfgIfaceCnt) {
// user specified some interfaces in config file
parser->ClntCfgIfaceLst.first();
while(cfgIface = parser->ClntCfgIfaceLst.get()) {
// for each interface (from config file)
if (cfgIface->getID()==-1) {
ifaceIface = ClntIfaceMgr().getIfaceByName(cfgIface->getName());
} else {
ifaceIface = ClntIfaceMgr().getIfaceByID(cfgIface->getID());
}
if (!ifaceIface) {
if (inactiveMode()) {
Log(Info) << "Interface " << cfgIface->getFullName()
<< " is not currently available (that's ok, inactive-mode enabled)." << LogEnd;
continue;
}
Log(Error) << "Interface " << cfgIface->getFullName()
<< " specified in " << CLNTCONF_FILE << " is not present or does not support IPv6."
<< LogEnd;
return false;
}
if (cfgIface->noConfig()) {
Log(Info) << "Interface " << cfgIface->getFullName()
<< " has flag no-config set, so it is ignored." << LogEnd;
continue;
}
#ifdef MOD_REMOTE_AUTOCONF
if (RemoteAutoconf) {
List(TIPv6Addr) emptyLst;
SPtr<TOpt> optNeighbors = new TOptAddrLst(OPTION_NEIGHBORS, emptyLst, 0);
Log(Debug) << "Enabled Neighbors option on " << cfgIface->getFullName() << LogEnd;
cfgIface->addExtraOption(optNeighbors, false);
}
#endif
cfgIface->setIfaceName(ifaceIface->getName());
cfgIface->setIfaceID(ifaceIface->getID());
// setup default prefix length (used when IPv6 address is added to the interface)
ifaceIface->setPrefixLength(cfgIface->getOnLinkPrefixLength());
if (!ifaceIface->flagUp() || !ifaceIface->countLLAddress()) {
if (inactiveMode()) {
Log(Notice) << "Interface " << ifaceIface->getFullName()
<< " is not operational yet (does not have "
<< "link-local address or is down), skipping it for now." << LogEnd;
addIface(cfgIface);
makeInactiveIface(cfgIface->getID(), true, true, true); // move it to InactiveLst
continue;
}
Log(Crit) << "Interface " << ifaceIface->getFullName()
<< " is down or doesn't have any link-local address." << LogEnd;
return false;
}
// Check if the interface is during bring-up phase
// (i.e. DAD procedure for link-local addr is not complete yet)
char tmp[64];
ifaceIface->firstLLAddress();
inet_ntop6(ifaceIface->getLLAddress(), tmp);
if (is_addr_tentative(ifaceIface->getName(), ifaceIface->getID(), tmp)
== LOWLEVEL_TENTATIVE_YES) {
Log(Notice) << "Interface " << ifaceIface->getFullName()
<< " has link-local address " << tmp
<< ", but it is currently tentative." << LogEnd;
if (this->inactiveMode()) {
Log(Notice) << "Interface " << ifaceIface->getFullName()
<< " is not operational yet (link-local address "
<< "is not ready), skipping it for now." << LogEnd;
addIface(cfgIface);
makeInactiveIface(cfgIface->getID(), true, true, true); // move it to InactiveLst
continue;
}
Log(Crit) << "Interface " << ifaceIface->getFullName()
<< " has tentative link-local address (and inactive-mode is disabled)." << LogEnd;
return false;
}
//.........这里部分代码省略.........
示例2: matchParsedSystemInterfaces
/**
* match parsed interfaces with interfaces detected in system.
* ClntCfgIface objects copied to CfgMgr.
*
* @param parser
*
* @return
*/
bool TClntCfgMgr::matchParsedSystemInterfaces(ClntParser *parser) {
int cfgIfaceCnt;
cfgIfaceCnt = parser->ClntCfgIfaceLst.count();
Log(Debug) << cfgIfaceCnt << " interface(s) specified in " << CLNTCONF_FILE << LogEnd;
SPtr<TClntCfgIface> cfgIface;
SPtr<TIfaceIface> ifaceIface;
if (cfgIfaceCnt) {
// user specified some interfaces in config file
parser->ClntCfgIfaceLst.first();
while(cfgIface = parser->ClntCfgIfaceLst.get()) {
// for each interface (from config file)
if (cfgIface->getID()==-1) {
ifaceIface = ClntIfaceMgr().getIfaceByName(cfgIface->getName());
} else {
ifaceIface = ClntIfaceMgr().getIfaceByID(cfgIface->getID());
}
if (!ifaceIface) {
Log(Error) << "Interface " << cfgIface->getName() << "/" << cfgIface->getID()
<< " specified in " << CLNTCONF_FILE << " is not present or does not support IPv6."
<< LogEnd;
return false;
}
if (cfgIface->noConfig()) {
Log(Info) << "Interface " << cfgIface->getName() << "/" << cfgIface->getID()
<< " has flag no-config set, so it is ignored." << LogEnd;
continue;
}
#ifdef MOD_REMOTE_AUTOCONF
if (RemoteAutoconf) {
List(TIPv6Addr) emptyLst;
SPtr<TOpt> optNeighbors = new TOptAddrLst(OPTION_NEIGHBORS, emptyLst, 0);
Log(Debug) << "Enabled Neighbors option on " << cfgIface->getFullName() << LogEnd;
cfgIface->addExtraOption(optNeighbors, false);
}
#endif
cfgIface->setIfaceName(ifaceIface->getName());
cfgIface->setIfaceID(ifaceIface->getID());
// setup default prefix length (used when IPv6 address is added to the interface)
ifaceIface->setPrefixLength(cfgIface->getPrefixLength());
if (!ifaceIface->countLLAddress()) {
if (this->inactiveMode()) {
Log(Notice) << "Interface " << ifaceIface->getFullName()
<< " is not operational yet (does not have "
<< "link-local address), skipping it for now." << LogEnd;
addIface(cfgIface);
makeInactiveIface(cfgIface->getID(), true); // move it to InactiveLst
return true;
}
Log(Crit) << "Interface " << ifaceIface->getFullName()
<< " is down or doesn't have any link-local address." << LogEnd;
return false;
}
// Check if the interface is during bring-up phase
// (i.e. DAD procedure for link-local addr is not complete yet)
char tmp[64];
ifaceIface->firstLLAddress();
inet_ntop6(ifaceIface->getLLAddress(), tmp);
if (is_addr_tentative(ifaceIface->getName(), ifaceIface->getID(), tmp)
== LOWLEVEL_TENTATIVE_YES) {
Log(Notice) << "Interface " << ifaceIface->getFullName()
<< " has link-local address " << tmp
<< ", but it is currently tentative." << LogEnd;
if (this->inactiveMode()) {
Log(Notice) << "Interface " << ifaceIface->getFullName()
<< " is not operational yet (link-local address "
<< "is not ready), skipping it for now." << LogEnd;
addIface(cfgIface);
makeInactiveIface(cfgIface->getID(), true); // move it to InactiveLst
return true;
}
Log(Crit) << "Interface " << ifaceIface->getFullName()
<< " has tentative link-local address (and inactive-mode is disabled)." << LogEnd;
return false;
}
this->addIface(cfgIface);
Log(Info) << "Interface " << cfgIface->getName() << "/" << cfgIface->getID()
<< " configuation has been loaded." << LogEnd;
}
//.........这里部分代码省略.........