コード例 #1
0
int TOptVendorSpecInfo::getSize()
{
    SPtr<TOpt> opt;
    unsigned int len = 8; // normal header(4) + enterprise(4)
    firstOption();
    while (opt=getOption()) {
        len += opt->getSize();
    }
    return len;
}
コード例 #2
0
ファイル: Msg.cpp プロジェクト: freman/dibbler
bool TMsg::delOption(int code)
{
    for (TOptList::iterator opt = Options.begin(); opt!=Options.end(); ++opt)
    {
	if ( (*opt)->getOptType() == code) {
	    Options.erase(opt);
	    firstOption();
	    return true;
	}
    }
    return false;
}
コード例 #3
0
std::string TOptVendorSpecInfo::getPlain() {
    std::stringstream tmp;
    tmp << "vendor=" << Vendor_ << " ";

    SPtr<TOpt> opt;
    firstOption();
    while (opt = getOption())
    {
	tmp << opt->getOptType() << "=";
	tmp << opt->getPlain() << " ";
    }
    return tmp.str();
}
コード例 #4
0
SPtr<TIPv6Addr> TClntMsgReply::getFirstAddr() {
    firstOption();
    SPtr<TOpt> opt, subopt;
    while (opt=getOption()) {
        if (opt->getOptType() != OPTION_IA_NA)
            continue;
        opt->firstOption();
        while (subopt=opt->getOption()) {
            if (subopt->getOptType() != OPTION_IAADDR)
                continue;
            SPtr<TOptIAAddress> optAddr = (Ptr*) subopt;
            return optAddr->getAddr();
        }
    }

    return 0;
}
コード例 #5
0
char * TOptVendorSpecInfo::storeSelf( char* buf)
{
    // option-code OPTION_VENDOR_OPTS (2 bytes long)
    buf = writeUint16(buf, OptType);

    // option-len size of total option-data
    buf = writeUint16(buf, getSize()-4);

    // enterprise-number (4 bytes long)
    buf = writeUint32(buf, Vendor_);

    SPtr<TOpt> opt;
    firstOption();
    while (opt = getOption())
    {
        buf = opt->storeSelf(buf);
    }
    
    return buf;
}
コード例 #6
0
//opts - all options list WITHOUT serverDUID including server id
TClntMsgInfRequest::TClntMsgInfRequest(TOptList ReqOpts,
				       int iface)
    :TClntMsg(iface, 0, INFORMATION_REQUEST_MSG) {
    IRT = INF_TIMEOUT;
    MRT = INF_MAX_RT;
    MRC = 0;
    MRD = 0;
    RT=0;

    Iface=iface;
    IsDone=false;
    
    SPtr<TIfaceIface> ptrIface = ClntIfaceMgr().getIfaceByID(iface);
    if (!ptrIface) {
        Log(Error) << "Unable to find interface with ifindex=" << iface 
                   << " while trying to generate INF-REQUEST." << LogEnd;
        IsDone = true;
        return;
    }
    Log(Debug) << "Creating INF-REQUEST on the " << ptrIface->getFullName()
	           << "." << LogEnd;
    
    // copy whole list from Verify ...
    Options = ReqOpts;
    
    SPtr<TOpt> opt;
    firstOption();
    while(opt=getOption())
    {
        switch (opt->getOptType())
        {       
            //These options possibly receipt from verify transaction
            //can't appear in request message and have to be deleted
            case OPTION_UNICAST:
            case OPTION_STATUS_CODE:
            case OPTION_PREFERENCE:
            case OPTION_IA_TA:
            case OPTION_RELAY_MSG:
            case OPTION_SERVERID:
            case OPTION_IA_NA:
            case OPTION_IAADDR:
            case OPTION_RAPID_COMMIT:
            case OPTION_INTERFACE_ID:
            case OPTION_RECONF_MSG:
            case OPTION_AUTH:
            case OPTION_AAAAUTH:
            case OPTION_KEYGEN:
	    case OPTION_ELAPSED_TIME:       //delete the old elapsed option,as we will append a new one
                delOption(opt->getOptType());
                break;        
        }
        //The other options can be included in Information request option
        //CLIENTID,ORO,ELAPSED_TIME,USER_CLASS,VENDOR_CLASS,
        //VENDOR_OPTS,DNS_RESOLVERS,DOMAIN_LIST,NTP_SERVERS,TIME_ZONE,
        //RECONF_ACCEPT - maybe also SERVERID if information request
        //is answer to reconfigure message
    }
    appendElapsedOption();
    appendAuthenticationOption();

    this->send();
}