コード例 #1
0
ファイル: SrvCfgMgr.cpp プロジェクト: DamianManelski/dibbler
bool TSrvCfgMgr::incrPrefixCount(int ifindex, SPtr<TIPv6Addr> prefix)
{
    SPtr<TSrvCfgIface> iface;
    iface = getIfaceByID(ifindex);
    if (!iface) {
	Log(Error) << "Unable to find interface with ifindex=" << ifindex << ", prefix increase count aborted." << LogEnd;
	return false;
    }
    return iface->addClntPrefix(prefix);
}
コード例 #2
0
/**
 * sets pool usage counters (used during bringup, after AddrDB is loaded from file)
 *
 */
void TSrvCfgMgr::setCounters()
{
    int iaCnt = 0, pdCnt = 0;
    SrvAddrMgr().firstClient();
    SPtr<TAddrClient> client;
    SPtr<TSrvCfgIface> iface;
    while (client = SrvAddrMgr().getClient()) {

        // addresses
        SPtr<TAddrIA> ia;
        client->firstIA();
        while ( ia=client->getIA() ) {
            iface = getIfaceByID(ia->getIface());
            if (!iface)
                continue;

            SPtr<TAddrAddr> addr;
            ia->firstAddr();
            while ( addr=ia->getAddr() ) {
                iface->addClntAddr(addr->get(), true/*quiet*/);
                iaCnt++;
            }
        }

        // prefixes
        client->firstPD();
        while (ia = client->getPD() ) {
            iface = getIfaceByID(ia->getIface());
            if (!iface)
                continue;
            SPtr<TAddrPrefix> prefix;
            ia->firstPrefix();
            while ( prefix=ia->getPrefix() ) {
                iface->addClntPrefix(prefix->get(), true);
                pdCnt++;
            }
        }
    }
    Log(Debug) << "Increased pools usage: currently " << iaCnt << " address(es) and " << pdCnt << " prefix(es) are leased." << LogEnd;
}