[AGENT++] MibTable with IpAddress index

Alex Agranov Alex.Agranov at audiocodes.com
Sun May 25 11:03:25 CEST 2008


Hi,

I'm trying to create a MibTable that would represent ipAddrTable from MIB-2.
It has a single index of type IpAddress and a few fields.

My code looks roughly as follows:

const index_info indIpTable[1] = {
      { sNMP_SYNTAX_IPADDR, FALSE, 1, 1 } };

snIpTable::snIpTable():
    MibTable("1.3.6.1.2.1.4.20.1", indIpTable, 1)
{
    add_col(new MibLeaf("1", READONLY, new IpAddress("0.0.0.0")));          // ipAdEntAddr
    add_col(new MibLeaf("1", READONLY, new SnmpInt32(0)));                  // ipAdEntIfIndex
    add_col(new MibLeaf("1", READONLY, new IpAddress("255.255.255.255")));  // ipAdEntNetMask
    add_col(new MibLeaf("1", READONLY, new SnmpInt32(1)));                  // ipAdEntBcastAddr
    add_col(new MibLeaf("1", READONLY, new SnmpInt32(0xFFFF)));             // ipAdEntReasmMaxSize
}

void snIpTable::Update()
{
    mib->lock_mib();
    start_synch();

    clear();

    mib->unlock_mib();

    IpAddress ip("10.1.1.1");
    Oid index;
    index = ip;

    MibTableRow * row = add_row(index);
    if (row != NULL)
    {
         row->get_nth(0)->replace_value(new IpAddress("10.1.1.1"));
         row->get_nth(1)->replace_value(new SnmpInt32 (1));
         row->get_nth(2)->replace_value(new IpAddress("255.255.0.0"));
    }

    end_synch();
}

However for some reason it looks like AGENT++ doesn't understand that my table has an index. When I issue GET-NEXT on 1.3.6.1.2.1.4.20, my agent responds with 1.3.6.1.2.1.4.20.1.1 with no index.

What am I doing wrong?

Thank you in advance,
       Alex

________________________________
This email and any files transmitted with it are confidential material. They are intended solely for the use of the designated individual or entity to whom they are addressed. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful.

If you have received this email in error please immediately notify the sender and delete or destroy any copy of this message



More information about the AGENTPP mailing list