[AGENT++] missing getRowIndicesCloned() function

Claus Klein claus.klein at arcormail.de
Mon Aug 15 23:22:12 CEST 2011


Hi Jochen,

i have missed a function to get the different MibTableRow subindices.

Without such a function, it is really hard to get the 3. index of a  
MibTable like the IP-FORWARD-MIB::inetCidrRouteTable.

./apps/snmptable -Cibw 123 -m ALL -v3 -u claus -l noAuthNoPriv 'tcp6: 
[::1]:161' inetCidrRouteTable
SNMP table: IP-FORWARD-MIB::inetCidrRouteTable

                                                                                                                     index 
                                                                                                IfIndex
ipv6."00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01". 
128.3.0.0.2 
.ipv6."00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"       1
ipv6."fe:80:00:00:00:00:00:00:02:23:6c:ff:fe:8c:45:b1". 
128.3.0.0.3 
.ipv6."00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"       1
   ipv6."ff:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00". 
8.3.0.0.4.ipv6."00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"       3

SNMP table IP-FORWARD-MIB::inetCidrRouteTable, part 2
...


I have prepared a prototype of the missing function and an example  
program to show its usage:

/**
  * Return the all sub index values for the current table row index  
given.
  *
  * @note Return all sub indices as a list of pointers to the
  *      corresponding Oidx values of the current MibTableRow index.
  *
  * @param index - the MibTableRow index
  * @return
  *    a pointer to a cloned array of the rows indices.
  **/
Array<Oidx>* MibTable::getRowIndicesCloned(const Oidx& index) const;


# usage:
Agentpp::Array<Agentpp::Oidx>* indices = getRowIndicesCloned(index);

     Agentpp::Oidx* first = indices->getNth(0);          // I want to  
get only the first subindex

     Agentpp::Oidx* second = indices->getNth(1);     // I want to get  
only the second subindex

     Agentpp::Oidx* third = indices->getNth(2);          // I want to  
get only the third. subindex

     Agentpp::Oidx* fourth = indices->getNth(3);       // I want to  
get only the fourth subindex

...

     Agentpp::Oidx* oid = indices->getNth(n-1);        // I want to  
get only the last subindex


What do you meen about it?

With regards,
Claus



More information about the AGENTPP mailing list