[AGENT++] Problems with GET-NEXT and MibComplexEntry

Alex Agranov Alex.Agranov at audiocodes.com
Thu Mar 6 11:04:13 CET 2008


Hi,

First of all, let me apologize for this post containing too many
details. I tried my best to make it as short as possible, and still
provide meaningful explanation of my problem... 

I'm trying to create a MIB via AGENT++ with all data stored in my own
database (not inside AGENT++ classes). In order to do that I sub-class
MibComplexEntry and implement the following methods: get_request(),
get_next_request() and find_succ(). My MIB consists of a few tables,
therefore I create an instance of MibComplexEntry for each table and add
all these instances to my MibGroup:

    myTable1::myTable1() : myMibComplexEntry("1.3.6.1.4.1.5003.9.1.1.1")
        {...}
    myTable2::myTable2() :
myMibComplexEntry("1.3.6.1.4.1.5003.9.1.1.2.1.1")
        {...}
    myTable3::myTable3() :
myMibComplexEntry("1.3.6.1.4.1.5003.9.1.1.2.2.1")
        {...}
    myTable4::myTable4() :
myMibComplexEntry("1.3.6.1.4.1.5003.9.1.1.2.3.1")
        {...}
    
    myGroup::myGroup(): MibGroup("1.3.6.1.4.1.5003.9.1", "my_group")
    {
        add(new myTable1());
        add(new myTable2());
        add(new myTable3());
        add(new myTable4());
        ...
    }

GET method seems to work perfectly fine. GET-NEXT within the same table
also works fine. However when I try to GET-NEXT on the last entry in,
for example, Table 2 - 1.3.6.1.4.1.5003.9.1.1.2.1.1.22.0, AGENT++ enters
into the endless loop:
    1) it calls myTable2->find_next() and I return empty Oidx() object, 
       since there are no more entries in this table
    2) then it calls myTable3->find_next() and I return empty Oidx()
object
       again, because currently table 3 is empty
    3) then I'd expect it to call myTable4->find_next(), but instead
       it calls myTable2->find_next() again and we're back to square 1) 

I debugged Mib::process_request() and found that it does the following:
    1) it calls find_next() for oid 1.3.6.1.4.1.5003.9.1.1.2.1.1.22.0
    2) find_next() does the following:
        2.1) calls find_managing_object() and finds myTable2
        2.2) calls myTable2->find_succ()
        2.3) calls context->find_next() for myTable2 oid
("1.3.6.1.4.1.5003.9.1.1.2.1.1")
             and finds myTable3
    3) we're back to process_request() - enter switch(entry->type()),
       and call myTable3->find_succ()
    4) but then it does "goto reprocess", because myTable3->find_succ()
       returned empty oid (remember, I told you that there are no
entries
       in Table 3)
    5) so we're back to square 2 - tmpoid wasn't changed, so we find
myTable2
       again - and voila we're in the endless loop
       
So, am I doing something wrong in myMibComplexEntry class? I thought
that I'm supposed to return empty Oidx() when there are no entries in my
table. Is this wrong?

Thank you in advance,
    Alex Agranov



More information about the AGENTPP mailing list