tabledata:tHabledata:iHelpseyouaimplementta tableawith datamatted)storage.(3)
NAME
netsnmptabledata - Helps you implement a table with datamatted
storage.
odules
grouptabledataset:: Helps you implement a table with automatted
storage.
This handler helps you implement a table where all the data is
expected to be stored within the agent itself and not in some
external storage location.
Functions
void netsnmptabledatagenerateindexoid (netsnmptablerow *row)
generates the index portion of an table oid from a varlist.
int netsnmptabledataaddrow (netsnmptabledata *table,
netsnmptablerow *row)
Adds a row of data to a given table (stored in proper lexographical
order).
netsnmptablerow * netsnmptabledataremoverow (netsnmptabledata
*table, netsnmptablerow *row)
removes a row of data to a given table and returns it (no free's
called)
void * netsnmptabledatadeleterow (netsnmptablerow *row)
deletes a row's memory.
void * netsnmptabledataremoveanddeleterow (netsnmptabledata
*table, netsnmptablerow *row)
removes and frees a row of data to a given table and returns the
void *
NETSNMPINLINE void netsnmptabledatareplacerow (netsnmptabledata
*table, netsnmptablerow *origrow, netsnmptablerow *newrow)
swaps out origrow with newrow.
netsnmptablerow * netsnmptabledataget (netsnmptabledata *table,
netsnmpvariablelist *indexes)
finds the data in 'datalist' stored at 'indexes'
netsnmptablerow * netsnmptabledatagetfromoid (netsnmptabledata
*table, oid *searchfor, sizet searchforlen)
finds the data in 'datalist' stored at the searchfor oid
netsnmpmibhandler * netsnmpgettabledatahandler
(netsnmptabledata *table)
Creates a tabledata handler and returns it.
int netsnmpregistertabledata (netsnmphandlerregistration *reginfo,
netsnmptabledata *table, netsnmptableregistrationinfo
*tableinfo)
registers a handler as a data table.
int netsnmpregisterreadonlytabledata (netsnmphandlerregistration
*reginfo, netsnmptabledata *table,
netsnmptableregistrationinfo *tableinfo)
registers a handler as a read-only data table If tableinfo !=
NUL, it registers it as a normal table too.
int netsnmptabledatahelperhandler (netsnmpmibhandler *handler,
netsnmphandlerregistration *reginfo, netsnmpagentrequestinfo
*reqinfo, netsnmprequestinfo *requests)
The helper handler that takes care of passing a specific row of
data down to the lower handler(s).
netsnmptabledata * netsnmpcreatetabledata (const char *name)
creates and returns a pointer to table data set
netsnmptablerow * netsnmpcreatetabledatarow (void)
creates and returns a pointer to table data set
NETSNMPINLINE void netsnmpinserttablerow (netsnmprequestinfo
*request, netsnmptablerow *row)
inserts a newly created tabledata row into a request
netsnmptablerow * netsnmpextracttablerow (netsnmprequestinfo
*request)
extracts the row being accessed passed from the tabledata helper
netsnmptabledata * netsnmpextracttable (netsnmprequestinfo
*request)
extracts the table being accessed passed from the tabledata helper
void * netsnmpextracttablerowdata (netsnmprequestinfo *request)
extracts the data from the row being accessed passed from the
tabledata helper
int netsnmptabledatabuildresult (netsnmphandlerregistration
*reginfo, netsnmpagentrequestinfo *reqinfo, netsnmprequestinfo
*request, netsnmptablerow *row, int column, uchar type, uchar
*resultdata, sizet resultdatalen)
builds a result given a row, a varbind to set and the data
netsnmptablerow * netsnmptabledataclonerow (netsnmptablerow
*row)
clones a data row.
int netsnmptabledatanumrows (netsnmptabledata *table)
Detailed Description
This helper helps you implement a table where all the indexes are
expected to be stored within the agent itself and not in some external
storage location. It can be used to store a list of rows, where a row
consists of the indexes to the table and a generic data pointer. You
can then implement a subhandler which is passed the exact row
definition and data it must return data for or accept data for. Complex
GETNEXT handling is greatly simplified in this case.
Function Documentation
netsnmptabledata** netsnmpcreatetabledata (const char ** name)
creates and returns a pointer to table data set Definition at line 544
of file tabledata.c.
References SNMPMALOCTYPEDEF.
Referenced by netsnmpcreatetabledataset().
netsnmptablerow** netsnmpcreatetabledatarow (void)
creates and returns a pointer to table data set
Examples::
dataset.c.
Definition at line 554 of file tabledata.c.
References SNMPMALOCTYPEDEF.
Referenced by netsnmptabledatasetcreaterowfromdefaults().
netsnmptabledata** netsnmpextracttable (netsnmprequestinfo ** request)
extracts the table being accessed passed from the tabledata helper
Definition at line 635 of file tabledata.c.
References netsnmprequestgetlistdata().
netsnmptablerow** netsnmpextracttablerow (netsnmprequestinfo **
request)
extracts the row being accessed passed from the tabledata helper
Definition at line 627 of file tabledata.c.
References netsnmprequestgetlistdata().
Referenced by netsnmpextracttablerowdata(), and
netsnmptabledatasethelperhandler().
void** netsnmpextracttablerowdata (netsnmprequestinfo ** request)
extracts the data from the row being accessed passed from the
tabledata helper Definition at line 644 of file tabledata.c.
References netsnmpextracttablerow().
Referenced by netsnmpextracttabledatasetcolumn().
netsnmpmibhandler** netsnmpgettabledatahandler (netsnmptabledata **
table)
Creates a tabledata handler and returns it. Definition at line 263 of
file tabledata.c.
References netsnmpmibhandlers::flags, netsnmpmibhandlers::myvoid,
netsnmpcreatehandler(), netsnmpmibhandler, and snmplog().
Referenced by netsnmpregistertabledata().
NETSNMPINLINE void netsnmpinserttablerow (netsnmprequestinfo **
request,, netsnmptablerow ** row)
inserts a newly created tabledata row into a request Definition at
line 562 of file tabledata.c.
References netsnmptablerequestinfos::indexes,
netsnmpcreatedatalist(), netsnmpextracttableinfo(),
netsnmprequestaddlistdata(), netsnmprequestinfos::next,
netsnmprequestinfos::prev, and snmpoidcompare().
int netsnmpregisterreadonlytabledata (netsnmphandlerregistration **
reginfo,, netsnmptabledata ** table,, netsnmptableregistrationinfo **
tableinfo)
registers a handler as a read-only data table If tableinfo != NUL, it
registers it as a normal table too. Definition at line 297 of file
tabledata.c.
References netsnmpgetreadonlyhandler(),
netsnmphandlerregistration, netsnmpinjecthandler(), and
netsnmpregistertabledata().
int netsnmpregistertabledata (netsnmphandlerregistration ** reginfo,,
netsnmptabledata ** table,, netsnmptableregistrationinfo **
tableinfo)
registers a handler as a data table. If tableinfo != NUL, it
registers it as a normal table too. Definition at line 286 of file
tabledata.c.
References netsnmpgettabledatahandler(),
netsnmphandlerregistration, netsnmpinjecthandler(), and
netsnmpregistertable().
Referenced by netsnmpregisterreadonlytabledata(), and
netsnmpregistertabledataset().
int netsnmptabledataaddrow (netsnmptabledata ** table,,
netsnmptablerow ** row)
Adds a row of data to a given table (stored in proper lexographical
order). returns SNMPERSUCES on successful addition. or
SNMPERGENER on failure (E.G., indexes already existed) xxx-rks:
remove invalid row? Definition at line 51 of file tabledata.c.
References netsnmptabledatagenerateindexoid(), snmplog(), and
snmpoidcompare().
Referenced by netsnmptabledatareplacerow(), and
netsnmptabledatasetaddrow().
int netsnmptabledatabuildresult (netsnmphandlerregistration **
reginfo,, netsnmpagentrequestinfo ** reqinfo,, netsnmprequestinfo **
request,, netsnmptablerow ** row,, int column,, uchar type,, uchar **
resultdata,, sizet resultdatalen)
builds a result given a row, a varbind to set and the data Definition
at line 656 of file tabledata.c.
References netsnmpagentrequestinfos::mode,
netsnmphandlerregistration, netsnmprequestinfos::requestvb,
netsnmphandlerregistrations::rootoid,
netsnmphandlerregistrations::rootoidlen, and
snmpsetvartypedvalue().
Referenced by netsnmptabledatahelperhandler(), and
netsnmptabledatasethelperhandler().
netsnmptablerow** netsnmptabledataclonerow (netsnmptablerow ** row)
clones a data row. DOES NOT CLONE THE CONTAINED DATA. Definition at
line 690 of file tabledata.c.
References memdup().
Referenced by netsnmptabledatasetclonerow().
void** netsnmptabledatadeleterow (netsnmptablerow ** row)
deletes a row's memory. returns the void data that it doesn't know how
to delete. Definition at line 177 of file tabledata.c.
References SNMPFRE.
Referenced by netsnmptabledataremoveanddeleterow(), and
netsnmptabledatasetdeleterow().
void netsnmptabledatagenerateindexoid (netsnmptablerow ** row)
generates the index portion of an table oid from a varlist. Definition
at line 39 of file tabledata.c.
References buildoid().
Referenced by netsnmptabledataaddrow().
netsnmptablerow** netsnmptabledataget (netsnmptabledata ** table,,
netsnmpvariablelist ** indexes)
finds the data in 'datalist' stored at 'indexes' Definition at line 231
of file tabledata.c.
References netsnmptabledatagetfromoid().
netsnmptablerow** netsnmptabledatagetfromoid (netsnmptabledata **
table,, oid ** searchfor,, sizet searchforlen)
finds the data in 'datalist' stored at the searchfor oid Definition at
line 245 of file tabledata.c.
References snmpoidcompare().
Referenced by netsnmptabledataget(), and
netsnmptabledatahelperhandler().
int netsnmptabledatahelperhandler (netsnmpmibhandler ** handler,,
netsnmphandlerregistration ** reginfo,, netsnmpagentrequestinfo **
reqinfo,, netsnmprequestinfo ** requests)
The helper handler that takes care of passing a specific row of data
down to the lower handler(s). It sets request->processed if the request
should not be handled. Definition at line 313 of file tabledata.c.
References netsnmptablerequestinfos::colnum,
netsnmpmibhandlers::flags,
netsnmptableregistrationinfos::maxcolumn,
netsnmptableregistrationinfos::mincolumn,
netsnmpagentrequestinfos::mode, netsnmpmibhandlers::myvoid,
variablelist::name, variablelist::namelength,
netsnmpcallnexthandler(), netsnmpcreatedatalist(),
netsnmpextracttableinfo(), netsnmpfindtableregistrationinfo(),
netsnmphandlerregistration, netsnmpmibhandler,
netsnmprequestaddlistdata(), netsnmpsetrequesterror(),
netsnmptabledatabuildresult(), netsnmptabledatagetfromoid(),
netsnmprequestinfos::next, netsnmprequestinfos::processed,
netsnmprequestinfos::requestvb,
netsnmphandlerregistrations::rootoid,
netsnmphandlerregistrations::rootoidlen, SNMPMIN,
snmpoidcompare(), and variablelist::type.
void** netsnmptabledataremoveanddeleterow (netsnmptabledata ** table,,
netsnmptablerow ** row)
removes and frees a row of data to a given table and returns the void *
returns the void * data on successful deletion. or NUL on failure (bad
arguments) Definition at line 206 of file tabledata.c.
References netsnmptabledatadeleterow(), and
netsnmptabledataremoverow().
Referenced by netsnmptabledatasetremoveanddeleterow(), and
netsnmptabledatasetremoverow().
netsnmptablerow** netsnmptabledataremoverow (netsnmptabledata **
table,, netsnmptablerow ** row)
removes a row of data to a given table and returns it (no free's
called) returns the row pointer itself on successful removing. or NUL
on failure (bad arguments) Definition at line 155 of file tabledata.c.
Referenced by netsnmptabledataremoveanddeleterow(), and
netsnmptabledatareplacerow().
NETSNMPINLINE void netsnmptabledatareplacerow (netsnmptabledata **
table,, netsnmptablerow ** origrow,, netsnmptablerow ** newrow)
swaps out origrow with newrow. This does *not* delete/free anything!
Definition at line 221 of file tabledata.c.
References netsnmptabledataaddrow(), and
netsnmptabledataremoverow().
Referenced by netsnmptabledatasetreplacerow().
net-snmp tabledata: Helps you implJement00a5table with datamatted storage.(3)
|