Tables with multiple indexes of variable length

Alex Finogenov afinogenov____malibunet.com
Tue Jul 10 20:27:29 CEST 2001


Hi,

Using Agent++ and agentgen, I am trying to see how hard it is to work out
some patterns for creating and maintaining of stateless agents, i.e. when no
rows, instance indexes or values are known at compile time. I chose to
create my own table class subclassing from the ComplexEntry: I hope this
will improve performance comparing with a simpler direction of creating and
destroying a row on every SNMP request (if I reused the MibTable code
instead.)

One of the problems I am facing is parsing an OID with a few indexes when
only its table entry's OID is known. I assume that the same OID may contain
an arbitrary number of fixed and variable length indexes.

I believe that I can use index_info structure generated by the agentpro in
.cpp files, but I can't find a good explanation in the code.

Agent++'s mib.h has a comment (above the definition of MibTable class), but
I find it ambiguous:

* In AGENT++ the structure of a table's index is given by an array
* of integer values. Each element represents an object of the index.
* A value of -1 represents a implied variable length string or oid.
* A value of 0 a variable length string or oid index object.
* A value greater than 0 determines the length of the index object 
* measured in subidentifiers

If it refers to index_info:


struct index_info {
  SmiUINT32 type;
  boolean   implied;
  unsigned int	    min;
  unsigned int	    max;
};	

which is just above the comment in the mib.h, then it is not clear what
"value" it is referring to. Does this comment refer to a different data
type?

Looking at some index_info structs generated in .cpp files by agentgen, I
assume that if an index has min = max, then it is a fixed length index, and
if it has min < max, it is a variable length index.

Q1: IS THIS ASSUMPTION CORRECT?

Q2: Except MibTable::is_index_valid()  method, is there code in Agent++ or
snmp++ that can be reused for this purpose?

I like the Agent++ and agentgen, I think it's a good package. Agentgen is
stricter regarding the standards and generates much cleaner code than most
of commercial products that I know of, but with the lack of clear
documentation I am running out of time evaluating this product. I will
appreciate any help.

Thanks a lot,
Alex
. 




More information about the AGENTPP mailing list