tablearray: Helps you implement a table when data can be stored locally.bTheadata:iHsestoreduinmalsortedaarray, usingdatbinarybsearcheforolookupsT.(3)data is stored in a sorted array, using a binary search for lookups.(3)
NAME
netsnmptablearray - Helps you implement a table when data can be
stored locally.
Functions
int netsnmptablecontainerregister (netsnmphandlerregistration
*reginfo, netsnmptableregistrationinfo *tabreg,
netsnmptablearraycallbacks *cb, netsnmpcontainer *container,
int grouprows)
register specified callbacks for the specified table/oid.
netsnmpmibhandler * netsnmpfindtablearrayhandler
(netsnmphandlerregistration *reginfo)
find the handler for the tablearray helper.
netsnmpcontainer * netsnmpextractarraycontext (netsnmprequestinfo
*request)
find the context data used by the tablearray helper
int netsnmptablearraycheckrowstatus (netsnmptablearraycallbacks
*cb, netsnmprequestgroup *ag, long *rsnew, long *rsold)
this function is called to validate RowStatus transitions.
Detailed Description
The tablearray handler is used (automatically) in conjuntion with the
table handler. It is primarily intended to be used with the mib2c
configuration file mib2c.array-user.conf.
The code generated by mib2c is useful when you have control of the data
for each row. If you cannot control when rows are added and deleted (or
at least be notified of changes to row data), then this handler is
probably not for you.
This handler makes use of callbacks (function pointers) to handle
various tasks. Code is generated for each callback, but will need to be
reviewed and flushed out by the user.
NOTE NOTE NOTE: Once place where mib2c is somewhat lacking is with
regards to tables with external indices. If your table makes use of one
or more external indices, please review the generated code very
carefully for comments regarding external indices.
NOTE NOTE NOTE: This helper, the API and callbacks are still being
tested and may change.
The generated code will define a structure for storage of table related
data. This structure must be used, as it contains the index OID for the
row, which is used for keeping the array sorted. You can add addition
fields or data to the structure for your own use.
The generated code will also have code to handle SNMP-SET processing.
If your table does not support any SET operations, simply comment out
the #define SETHANDLING (where is your table name) in the header
file.
SET processing modifies the row in-place. The duplicaterow callback
will be called to save a copy of the original row. In the event of a
failure before the commite phase, the rowcopy callback will be called
to restore the original row from the copy.
Code will be generated to handle row creation. This code may be
disabled by commenting out the #define ROWCREATION in the header
file.
If your table contains a RowStatus object, by default the code will not
allow object in an active row to be modified. To allow active rows to
be modified, remove the comment block around the #define
CANMODIFYACTIVEROW in the header file.
Code will be generated to maintain a secondary index for all rows,
stored in a binary tree. This is very useful for finding rows by a key
other than the OID index. By default, the functions for maintaining
this tree will be based on a character string. NOTE: this will likely
be made into a more generic mechanism, using new callback methods, in
the near future.
The generated code contains many TODO comments. Make sure you check
each one to see if it applies to your code. Examples include checking
indices for syntax (ranges, etc), initializing default values in newly
created rows, checking for row activation and deactivation
requirements, etc.
Function Documentation
netsnmpcontainer** netsnmpextractarraycontext (netsnmprequestinfo **
request)
find the context data used by the tablearray helper Definition at line
213 of file tablearray.c.
References netsnmprequestgetlistdata().
netsnmpmibhandler** netsnmpfindtablearrayhandler
(netsnmphandlerregistration ** reginfo)
find the handler for the tablearray helper. Definition at line 196 of
file tablearray.c.
References netsnmpmibhandlers::accessmethod,
netsnmphandlerregistrations::handler, netsnmphandlerregistration,
netsnmpmibhandler, and netsnmpmibhandlers::next.
int netsnmptablearraycheckrowstatus (netsnmptablearraycallbacks **
cb,, netsnmprequestgroup ** ag,, long ** rsnew,, long ** rsold)
this function is called to validate RowStatus transitions. Definition
at line 220 of file tablearray.c.
int netsnmptablecontainerregister (netsnmphandlerregistration **
reginfo,, netsnmptableregistrationinfo ** tabreg,,
netsnmptablearraycallbacks ** cb,, netsnmpcontainer ** container,, int
grouprows)
register specified callbacks for the specified table/oid. If the
grouprows parameter is set, the row related callbacks will be called
once for each unique row index. Otherwise, each callback will be called
only once, for all objects. Definition at line 152 of file
tablearray.c.
References netsnmphandlerregistrations::handler,
netsnmpmibhandlers::myvoid, netsnmphandlerregistration,
netsnmpregistertable(), snmplog(), and SNMPMALOCTYPEDEF.
tablearray: Helps you implement a table when data can be stored locally.tThemdata is stored in a sorted arrJay, u0s0ing a binary search for lookups.(3)
|