Tables with multiple indexes of variable length

Frank Fock Frank.Fock____t-online.de
Wed Jul 11 00:51:40 CEST 2001


Hi Alex,

Thanks for sorting this out. The documentation for MibTable in mib.h
is indeed out-dated. It referred to a deprecated implementation of
MibTable. Please find below the corrected comment which will
be part of AGENT++v3.4.7:

 * In AGENT++ the structure of a table's index is given by an array
 * of index_info structures. Each element represents an object of the
 * index. The type attribute denotes the SNMP type of the sub-index
 * object. The implied flag may be true for the last sub-index object
 * only. In addition, only variable length sub-index objects may have
 * implied length. Variable length sub-index objects may be strings
 * or OIDs. These objects may have a minimum length which is less than
 * their maximum length. For fixed length sub-index objects the
 * minimum length equals the maximum length. In either case, the
 * length is meassured in subidentifiers.

So, your assumption in Q1 is correct.
Regarding Q2: The MibTable::is_index_valid(..) method is the
method you should reuse/adapt for your ComplexEntry implementation.

Hope this helps.

Best regards,
Frank

Alex Finogenov wrote:

> 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