本文整理汇总了C++中SPtr::addTA方法的典型用法代码示例。如果您正苦于以下问题:C++ SPtr::addTA方法的具体用法?C++ SPtr::addTA怎么用?C++ SPtr::addTA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPtr
的用法示例。
在下文中一共展示了SPtr::addTA方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTAAddr
/**
* @brief adds TA address to AddrMgr
*
* adds temporary address. Add missing client or TA, if necessary.
*
* @param clntDuid
* @param clntAddr
* @param iface
* @param iaid
* @param addr
* @param pref
* @param valid
*
* @return
*/
bool TSrvAddrMgr::addTAAddr(SPtr<TDUID> clntDuid , SPtr<TIPv6Addr> clntAddr,
int iface, unsigned long iaid, SPtr<TIPv6Addr> addr,
unsigned long pref, unsigned long valid) {
// find this client
SPtr <TAddrClient> ptrClient;
this->firstClient();
while ( ptrClient = this->getClient() ) {
if ( (*ptrClient->getDUID()) == (*clntDuid) )
break;
}
// have we found this client?
if (!ptrClient) {
Log(Debug) << "Adding client (DUID=" << clntDuid->getPlain() << ") to the addrDB." << LogEnd;
ptrClient = new TAddrClient(clntDuid);
this->addClient(ptrClient);
}
// find this TA
SPtr <TAddrIA> ta;
ptrClient->firstTA();
while ( ta = ptrClient->getTA() ) {
if ( ta->getIAID() == iaid)
break;
}
// have we found this TA?
if (!ta) {
ta = new TAddrIA(iface, TAddrIA::TYPE_TA, clntAddr, clntDuid,
DHCPV6_INFINITY, DHCPV6_INFINITY, iaid);
ptrClient->addTA(ta);
Log(Debug) << "Adding TA (IAID=" << iaid << ") to the addrDB." << LogEnd;
}
SPtr <TAddrAddr> ptrAddr;
ta->firstAddr();
while ( ptrAddr = ta->getAddr() ) {
if (*ptrAddr->get()==*addr)
break;
}
// address already exists
if (ptrAddr) {
Log(Warning) << "Address " << *ptrAddr << " is already assigned to TA (iaid="
<< iaid << ")." << LogEnd;
return false;
}
// add address
ptrAddr = new TAddrAddr(addr, pref, valid);
ta->addAddr(ptrAddr);
Log(Debug) << "Adding " << ptrAddr->get()->getPlain() << " to TA (IAID=" << iaid
<< ") to addrDB." << LogEnd;
return true;
}