information about index variable

Hi Juergen and others,
As you recall I am working on an snmp-agent back-end that generates "c" files for the agent. (similar to the idea of -f ucd-c).
So far, accessing the internal data structures and using the compiler api is working very well. Thanks again for the excellent work.
Now to the question: I would like to add some code to support tabular objects. For this I need the index information. Specifically I need the index oid-length.
For example, if the index is (from rfc1213 below) "ipAdEntAddr", the index oid-length is 4 because it is an IpAddress type.
j:/libsmi-0.1.8/mibs/ietf/RFC-1213:932 ================<< start quote ============================ ipAddrEntry OBJECT-TYPE SYNTAX IpAddrEntry ACCESS not-accessible STATUS mandatory DESCRIPTION "The addressing information for one of this entity's IP addresses." INDEX { ipAdEntAddr } ::= { ipAddrTable 1 }
IpAddrEntry ::= SEQUENCE { ipAdEntAddr IpAddress, ipAdEntIfIndex INTEGER, ipAdEntNetMask IpAddress, ipAdEntBcastAddr INTEGER, ipAdEntReasmMaxSize INTEGER (0..65535) }
ipAdEntAddr OBJECT-TYPE SYNTAX IpAddress ACCESS read-only STATUS mandatory DESCRIPTION "The IP address to which this entry's addressing information pertains." ::= { ipAddrEntry 1 }
================== end quote >>==============================
I know I can walk the lost of the index components by
================<< start quote ============================ for (j = 0, smiListItem = smiGetFirstListItem(smiNode); smiListItem; j++, smiListItem = smiGetNextListItem(smiListItem)) { if (j) { print(", "); } printWrapped(INDENTVALUE + 1, smiListItem->name); /* TODO: non-local name if non-local */ } /* TODO: empty? -> print error */ print(");\n"); } /* TODO: else print error */ ================== end quote >>==============================
But I would like to find the type of each index variable to determine the total oid-length of a given index.
Is there a way to get and sminode by it name. Something like:
SmiNode = smiGetNodeByName(ipAdEntAddr);
Thanks,

Yigal Hochberg writes:
Yigal> Now to the question: I would like to add some code to support Yigal> tabular objects. For this I need the index information. Yigal> Specifically I need the index oid-length.
[...]
Yigal> Is there a way to get and sminode by it name. Something like:
Yigal> SmiNode = smiGetNodeByName(ipAdEntAddr);
Please look into the smi_node(3) manual page. You will find
SmiNode *smiGetNode(char *module, char *name);
which does the job you are looking for.
/js
participants (2)
-
Juergen Schoenwaelder
-
Yigal Hochberg