本文整理汇总了C++中SPtr::checkReceivedAuthOption方法的典型用法代码示例。如果您正苦于以下问题:C++ SPtr::checkReceivedAuthOption方法的具体用法?C++ SPtr::checkReceivedAuthOption怎么用?C++ SPtr::checkReceivedAuthOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPtr
的用法示例。
在下文中一共展示了SPtr::checkReceivedAuthOption方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: answer
/**
* method is used to process received REPLY message (as an answer for REQUEST or
* as an answer for SOLICIT with RAPID COMMIT option)
*
* @param reply
*/
void TClntMsg::answer(SPtr<TClntMsg> reply)
{
SPtr<TOptDUID> ptrDUID;
ptrDUID = (Ptr*) reply->getOption(OPTION_SERVERID);
if (!ptrDUID) {
Log(Warning) << "Received REPLY message without SERVER ID option. Message ignored." << LogEnd;
return;
}
SPtr<TDUID> duid = ptrDUID->getDUID();
SPtr<TClntIfaceIface> iface = (Ptr*)ClntIfaceMgr().getIfaceByID(getIface());
if (!iface) {
Log(Error) << "Unable to find physical interface with ifindex=" << getIface() << LogEnd;
return;
}
SPtr<TClntCfgIface> cfgIface = ClntCfgMgr().getIface( getIface() );
if (!cfgIface) {
Log(Error) << "Unable to find configuration interface with ifindex=" << getIface() << LogEnd;
}
// analyse all options received
SPtr<TOpt> option;
// Check authentication first. If the checks fail, we need to drop the whole message
// without using its contents.
if (!reply->checkReceivedAuthOption()) {
Log(Warning) << "AUTH: AUTH option verification failed. Ignoring message." << LogEnd;
return;
}
// find ORO in received options
SPtr<TClntOptOptionRequest> optORO = (Ptr*) this->getOption(OPTION_ORO);
reply->firstOption();
while (option = reply->getOption() ) {
if (optORO)
optORO->delOption(option->getOptType()); // delete received option from ORO
switch (option->getOptType())
{
case OPTION_IA_NA:
{
SPtr<TClntOptIA_NA> clntOpt = (Ptr*)option;
if (clntOpt->getStatusCode()!=STATUSCODE_SUCCESS) {
Log(Warning) << "Received IA (IAID=" << clntOpt->getIAID() << ") with non-success status:"
<< clntOpt->getStatusCode() << ", IA ignored." << LogEnd;
break;
}
// configure received IA
clntOpt->setContext(duid, 0/* srvAddr used is unicast */, this->Iface);
clntOpt->doDuties();
// delete that IA from request list
for (TOptList::iterator requestOpt = Options.begin(); requestOpt!=Options.end(); ++requestOpt)
{
if ( (*requestOpt)->getOptType()!=OPTION_IA_NA)
continue;
SPtr<TClntOptIA_NA> ptrIA = (Ptr*) (*requestOpt);
if ( ptrIA->getIAID() == clntOpt->getIAID() )
{
requestOpt = Options.erase(requestOpt);
break;
}
}
// delete request for IA, if it was mentioned in Option Request
if ( optORO && optORO->isOption(OPTION_IA_NA) )
optORO->delOption(OPTION_IA_NA);
break;
}
case OPTION_IA_TA:
{
SPtr<TClntOptTA> ta = (Ptr*) option;
if (ta->getStatusCode()!=STATUSCODE_SUCCESS) {
Log(Warning) << "Received TA (IAID=" << ta->getIAID() << ") with non-success status:"
<< ta->getStatusCode() << ", TA ignored." << LogEnd;
break;
}
SPtr<TOpt> requestOpt;
// delete that TA from request list
for (TOptList::iterator requestOpt = Options.begin(); requestOpt!=Options.end(); ++requestOpt)
{
if ( (*requestOpt)->getOptType()!=OPTION_IA_TA)
continue;
SPtr<TClntOptTA> ptrTA = (Ptr*) (*requestOpt);
if ( ta->getIAID() == ptrTA->getIAID() )
{
//.........这里部分代码省略.........