Net-SNMP Agent handler and exteNet-SNPyAgPeInt3handler and extensibility API(3)
NAME
netsnmphandler - Net-SNMP Agent handler and extensibility API.
odules
grouputilityhandlers:: simplify request processing
A group of handlers intended to simplify certain aspects of
processing a request for a MIB object.
groupleafhandlers:: process individual leaf objects
A group of handlers to implement individual leaf objects and
instances (both scalar objects, and individual objects and
instances within a table).
groupbabysteps:: calls your handler in babysteps for set processing.
groupoldapi:: Calls mib module code written in the old style of code.
This is a backwards compatilibity module that allows code written
in the old API to be run under the new handler based architecture.
groupstashcache:: automatically caches data for certain handlers.
This handler caches data in an optimized way which may aleviate the
need for the lower level handlers to perform as much optimization.
grouptable:: Helps you implement a table.
This handler helps you implement a table by doing some of the
processing for you.
Data Structures
struct netsnmpmibhandlers
the mib handler structure to be registered
struct netsnmphandlerregistrations
Root registration info.
struct netsnmphandlerargss
struct netsnmpdelegatedcaches
struct netsnmpmibhandlers
the mib handler structure to be registered
struct netsnmphandlerregistrations
Root registration info.
Defines
#define MIBHANDLERAUTONEXT 0x00000001
#define MIBHANDLERAUTONEXTOVERIDEONCE 0x00000002
#define MIBHANDLERCUSTO4 0x10000000
#define MIBHANDLERCUSTO3 0x20000000
#define MIBHANDLERCUSTO2 0x40000000
#define MIBHANDLERCUSTO1 0x80000000
#define HANDLERCANGETANDGETNEXT 0x01 /* must be able to do
both */
#define HANDLERCANSET 0x02 /* implies create, too */
#define HANDLERCANGETBULK 0x04
#define HANDLERCANOTCREATE 0x08 /* auto set if ! CANSET
*/
#define HANDLERCANBABYSTEP 0x10
#define HANDLERCANRONLY (HANDLERCANGETANDGETNEXT)
#define HANDLERCANRWRITE (HANDLERCANGETANDGETNEXT
HANDLERCANSET)
#define HANDLERCANSETONLY (HANDLERCANSET
HANDLERCANOTCREATE)
#define HANDLERCANDEFAULT (HANDLERCANRONLY
HANDLERCANOTCREATE)
#define REQUESTISDELEGATED 1
#define REQUESTISNOTDELEGATED 0
Typedefs
typedef netsnmpmibhandlers netsnmpmibhandler
Typedefs the netsnmpmibhandlers struct into netsnmpmibhandler.
typedef netsnmphandlerregistrations netsnmphandlerregistration
Typedefs the netsnmphandlerregistrations struct into
netsnmphandlerregistration.
typedef int( NetsnmpNodeHandler )(netsnmpmibhandler **handler,,
netsnmphandlerregistration **reginfo,, netsnmpagentrequestinfo
**reqinfo,, netsnmprequestinfo **requests)
typedef netsnmphandlerargss netsnmphandlerargs
typedef netsnmpdelegatedcaches netsnmpdelegatedcache
Functions
netsnmpmibhandler * netsnmpcreatehandler (const char *name,
NetsnmpNodeHandler *handleraccessmethod)
creates a netsnmpmibhandler structure given a name and a access
method.
netsnmphandlerregistration * netsnmphandlerregistrationcreate
(const char *name, netsnmpmibhandler *handler, oid *regoid,
sizet regoidlen, int modes)
creates a handler registration structure given a name, a
accessmethod function, a registration location oid and the modes
the handler supports.
netsnmphandlerregistration * netsnmpcreatehandlerregistration
(const char *name, NetsnmpNodeHandler *handleraccessmethod, oid
*regoid, sizet regoidlen, int modes)
int netsnmpregisterhandler (netsnmphandlerregistration *reginfo)
register a handler, as defined by the netsnmphandlerregistration
pointer.
int netsnmpunregisterhandler (netsnmphandlerregistration *reginfo)
unregister a handler, as defined by the
netsnmphandlerregistration pointer.
int netsnmpregisterhandlernocallback (netsnmphandlerregistration
*reginfo)
register a handler, as defined by the netsnmphandlerregistration
pointer.
int netsnmpinjecthandlerbefore (netsnmphandlerregistration
*reginfo, netsnmpmibhandler *handler, const char *beforewhat)
inject a new handler into the calling chain of the handlers
definedy by the netsnmphandlerregistration pointer.
int netsnmpinjecthandler (netsnmphandlerregistration *reginfo,
netsnmpmibhandler *handler)
inject a new handler into the calling chain of the handlers
definedy by the netsnmphandlerregistration pointer.
NETSNMPINLINE int netsnmpcallhandler (netsnmpmibhandler
*nexthandler, netsnmphandlerregistration *reginfo,
netsnmpagentrequestinfo *reqinfo, netsnmprequestinfo
*requests)
calls a handler with with appropriate NUL checking of arguments,
etc.
int netsnmpcallhandlers (netsnmphandlerregistration *reginfo,
netsnmpagentrequestinfo *reqinfo, netsnmprequestinfo
*requests)
NETSNMPINLINE int netsnmpcallnexthandler (netsnmpmibhandler
*current, netsnmphandlerregistration *reginfo,
netsnmpagentrequestinfo *reqinfo, netsnmprequestinfo
*requests)
calls the next handler in the chain after the current one with with
appropriate NUL checking, etc.
NETSNMPINLINE int netsnmpcallnexthandleronerequest
(netsnmpmibhandler *current, netsnmphandlerregistration
*reginfo, netsnmpagentrequestinfo *reqinfo, netsnmprequestinfo
*requests)
calls the next handler in the chain after the current one with with
appropriate NUL checking, etc.
void netsnmphandlerfree (netsnmpmibhandler *handler)
free's the resourceses associated with a given handler
netsnmpmibhandler * netsnmphandlerdup (netsnmpmibhandler
*handler)
dulpicates a handler and all subsequent handlers see also
clonehandler
void netsnmphandlerregistrationfree (netsnmphandlerregistration
*reginfo)
free the resources associated with a handler registration object
netsnmphandlerregistration * netsnmphandlerregistrationdup
(netsnmphandlerregistration *reginfo)
duplicates the handler registration object
NETSNMPINLINE netsnmpdelegatedcache * netsnmpcreatedelegatedcache
(netsnmpmibhandler *handler, netsnmphandlerregistration
*reginfo, netsnmpagentrequestinfo *reqinfo, netsnmprequestinfo
*requests, void *localinfo)
creates a cache of information which can be saved for future
reference.
NETSNMPINLINE netsnmpdelegatedcache * netsnmphandlercheckcache
(netsnmpdelegatedcache *dcache)
check's a given cache and returns it if it is still valid (ie, the
agent still considers it to be an outstanding request.
NETSNMPINLINE void netsnmpfreedelegatedcache
(netsnmpdelegatedcache *dcache)
frees a cache once you're finished using it
void netsnmphandlermarkrequestsasdelegated (netsnmprequestinfo
*requests, int isdelegated)
marks a list of requests as delegated (or not if isdelegaded = 0)
NETSNMPINLINE void netsnmprequestaddlistdata (netsnmprequestinfo
*request, netsnmpdatalist *node)
add data to a request that can be extracted later by submodules
NETSNMPINLINE int netsnmprequestremovelistdata
(netsnmprequestinfo *request, const char *name)
remove data from a request
NETSNMPINLINE void * netsnmprequestgetlistdata
(netsnmprequestinfo *request, const char *name)
extract data from a request that was added previously by a parent
module
NETSNMPINLINE void netsnmpfreerequestdataset (netsnmprequestinfo
*request)
Free the extra data stored in a request.
NETSNMPINLINE void netsnmpfreerequestdatasets
(netsnmprequestinfo *request)
Free the extra data stored in a bunch of requests (all data in the
chain).
netsnmpmibhandler * netsnmpfindhandlerbyname
(netsnmphandlerregistration *reginfo, const char *name)
Returns a handler from a chain based on the name.
void * netsnmpfindhandlerdatabyname (netsnmphandlerregistration
*reginfo, const char *name)
Returns a handler's void * pointer from a chain based on the name.
void handlerfreecallback (void *free)
void netsnmpregisterhandlerbyname (const char *name,
netsnmpmibhandler *handler)
registers a given handler by name so that it can be found easily
later.
void netsnmpclearhandlerlist (void)
clears the entire handler-registration list
void netsnmpinjecthandlerintosubtree (netsnmpsubtree *tp, const
char *name, netsnmpmibhandler *handler, const char *beforewhat)
void parseinjectHandlerconf (const char *token, char *cptr)
void netsnmpinithandlerconf (void)
void * netsnmphandlergetparentdata (netsnmprequestinfo *, const
char *)
Detailed Description
The basic theory goes something like this: In the past, with the
original mib module api (which derived from the original CMU SNMP code)
the underlying mib modules were passed very little information (only
the truly most basic information about a request). This worked well at
the time but in todays world of subagents, device instrumentation, low
resource consumption, etc, it just isn't flexible enough. 'handlers'
are here to fix all that.
With the rewrite of the agent internals for the net-snmp 5.0 release,
we introduce a modular calling scheme that allows agent modules to be
written in a very flexible manner, and more importantly allows reuse of
code in a decent way (and without the memory and speed overheads of O
languages like C]).
Functionally, the notion of what a handler does is the same as the
older api: A handler is created and then registered with the main agent
at a given OID in the OID tree and gets called any time a request is
made that it should respond to. You probably should use one of the
convenience helpers instead of doing anything else yourself though:
Most importantly, though, is that the handlers are built on the notion
of modularity and reuse. Specifically, rather than do all the really
hard work (like parsing table indexes out of an incoming oid request)
in each module, the API is designed to make it easy to write 'helper'
handlers that merely process some aspect of the request before passing
it along to the final handler that returns the real answer. Most people
will want to make use of the instance, table, tableiterator,
tabledata, or tabledataset helpers to make their life easier. These
'helpers' interpert important aspects of the request and pass them on
to you.
For instance, the table helper is designed to hand you a list of
extracted index values from an incoming request. THe tableiterator
helper is built on top of the table helper, and is designed to help you
iterate through data stored elsewhere (like in a kernel) that is not in
OID lexographical order (ie, don't write your own index/oid sorting
routine, use this helper instead). The beauty of the tableiterator
helper@@,, as well as the instance instance@@ helper is that they take
care of the complex GETNEXT processing entirely for you and hand you
everything you need to merely return the data as if it was a GET
request. uch less code and hair pulling. I''ve pulled all my hair out
to help you so that only one of us has to be bald.
Typedef Documentation
struct netsnmphandlerregistrations netsnmphandlerregistration
Typedefs the netsnmphandlerregistrations struct into
netsnmphandlerregistration. Referenced by
netsnmpcachehelperhandler(), netsnmpcallhandler(),
netsnmpcallnexthandler(), netsnmpcallnexthandleronerequest(),
netsnmpcreatedelegatedcache(), netsnmpfindhandlerbyname(),
netsnmpfindhandlerdatabyname(),
netsnmpfindtablearrayhandler(),
netsnmpfindtableregistrationinfo(),
netsnmphandlerregistrationcreate(),
netsnmphandlerregistrationdup(),
netsnmphandlerregistrationfree(), netsnmpinjecthandler(),
netsnmpinjecthandlerbefore(), netsnmpmultiplexerhelperhandler(),
netsnmpoldapihelper(), netsnmpregisterhandler(),
netsnmpregisterhandlernocallback(), netsnmpregisterinstance(),
netsnmpregisterintinstance(), netsnmpregistermibtablerow(),
netsnmpregisteroldapi(), netsnmpregisterreadonlyinstance(),
netsnmpregisterreadonlyscalar(),
netsnmpregisterreadonlytabledata(), netsnmpregisterrowmerge(),
netsnmpregisterscalar(), netsnmpregisterserialize(),
netsnmpregistertable(), netsnmpregistertabledata(),
netsnmpregistertabledataset(), netsnmpregistertableiterator(),
netsnmprowmergehelperhandler(), netsnmpserializehelperhandler(),
netsnmpsparsetableregister(), netsnmpstashcacheupdate(),
netsnmptablebuildoid(), netsnmptablebuildoidfromindex(),
netsnmptablebuildresult(), netsnmptablecontainerregister(),
netsnmptabledatabuildresult(), netsnmptabledatahelperhandler(),
netsnmptabledatasethelperhandler(),
netsnmptableiteratorhelperhandler(), netsnmpunregisterhandler(),
and tablehelperhandler().
struct netsnmpmibhandlers netsnmpmibhandler
Typedefs the netsnmpmibhandlers struct into netsnmpmibhandler.
Referenced by netsnmpbabystepsaccessmultiplexerget(),
netsnmpbabystepshandlerget(), netsnmpcachehandlerget(),
netsnmpcachehandlerregister(), netsnmpcallhandler(),
netsnmpcallnexthandler(), netsnmpcallnexthandleronerequest(),
netsnmpcontainertablehandlerget(),
netsnmpcreatedelegatedcache(), netsnmpcreatehandler(),
netsnmpfindhandlerbyname(), netsnmpfindhandlerdatabyname(),
netsnmpfindtablearrayhandler(), netsnmpgetbulktonexthandler(),
netsnmpgetcachehandler(), netsnmpgetmodeendcallhandler(),
netsnmpgetmultiplexerhandler(), netsnmpgetreadonlyhandler(),
netsnmpgetrowmergehandler(), netsnmpgetstashcachehandler(),
netsnmpgettabledatahandler(), netsnmpgettabledatasethandler(),
netsnmpgettablehandler(), netsnmpgettableiteratorhandler(),
netsnmphandlerdup(), netsnmphandlerfree(),
netsnmphandlerregistrationcreate(), netsnmpinjecthandler(),
netsnmpinjecthandlerbefore(),
netsnmpmodeendcalladdmodecallback(),
netsnmpmultiplexerhelperhandler(), netsnmpoldapihelper(),
netsnmpregistercachehandler(), netsnmpregisterhandler(),
netsnmpregisterhandlerbyname(),
netsnmpregisterhandlernocallback(),
netsnmprowmergehelperhandler(), netsnmpserializehelperhandler(),
netsnmpstashcacheupdate(), netsnmptabledatahelperhandler(),
netsnmptabledatasethelperhandler(),
netsnmptableiteratorhelperhandler(), and tablehelperhandler().
Function Documentation
int netsnmpcallhandler (netsnmpmibhandler ** nexthandler,,
netsnmphandlerregistration ** reginfo,, netsnmpagentrequestinfo **
reqinfo,, netsnmprequestinfo ** requests)
calls a handler with with appropriate NUL checking of arguments, etc.
Definition at line 382 of file agenthandler.c.
References netsnmpmibhandlers::accessmethod,
netsnmpmibhandlers::handlername,
netsnmpagentrequestinfos::mode, netsnmphandlerregistration,
netsnmpmibhandler, netsnmpmibhandlers::next, and snmplog().
Referenced by netsnmpcallnexthandler(),
netsnmpcallnexthandleronerequest(), and
netsnmpmultiplexerhelperhandler().
int netsnmpcallnexthandler (netsnmpmibhandler ** current,,
netsnmphandlerregistration ** reginfo,, netsnmpagentrequestinfo **
reqinfo,, netsnmprequestinfo ** requests)
calls the next handler in the chain after the current one with with
appropriate NUL checking, etc. Definition at line 512 of file
agenthandler.c.
References netsnmpcallhandler(), netsnmphandlerregistration,
netsnmpmibhandler, netsnmpmibhandlers::next, and snmplog().
Referenced by netsnmprowmergehelperhandler(),
netsnmpserializehelperhandler(), netsnmpstashcacheupdate(),
netsnmptabledatahelperhandler(),
netsnmptableiteratorhelperhandler(), and tablehelperhandler().
int netsnmpcallnexthandleronerequest (netsnmpmibhandler ** current,,
netsnmphandlerregistration ** reginfo,, netsnmpagentrequestinfo **
reqinfo,, netsnmprequestinfo ** requests)
calls the next handler in the chain after the current one with with
appropriate NUL checking, etc. Definition at line 534 of file
agenthandler.c.
References netsnmpcallhandler(), netsnmphandlerregistration,
netsnmpmibhandler, netsnmpmibhandlers::next,
netsnmprequestinfos::next, and snmplog().
void netsnmpclearhandlerlist (void)
clears the entire handler-registration list Definition at line 892 of
file agenthandler.c.
References netsnmpfreealllistdata().
NETSNMPINLINE netsnmpdelegatedcache ** netsnmpcreatedelegatedcache
(netsnmpmibhandler ** handler,, netsnmphandlerregistration ** reginfo,,
netsnmpagentrequestinfo ** reqinfo,, netsnmprequestinfo ** requests,,
void ** localinfo)
creates a cache of information which can be saved for future reference.
Use netsnmphandlercheckcache() later to make sure it's still valid
before referencing it in the future.
Examples::
delayedinstance.c.
Definition at line 683 of file agenthandler.c.
References netsnmpagentrequestinfos::asp,
netsnmphandlerregistration, netsnmpmibhandler, and
SNMPMALOCTYPEDEF.
netsnmpmibhandler ** netsnmpcreatehandler (const char ** name,,
NetsnmpNodeHandler ** handleraccessmethod)
creates a netsnmpmibhandler structure given a name and a access
method. The returned handler should then be registered.
Parameters::
name is the handler name and is copied then assigned to
netsnmpmibhandler->handlername
handleraccessmethod is a function pointer used as the access
method for this handler registration instance for whatever required
needs.
Returns::
a pointer to a populated netsnmpmibhandler struct to be
registered
See also::
netsnmpcreatehandlerregistration()
netsnmpregisterhandler()
Definition at line 105 of file agenthandler.c.
References netsnmpmibhandlers::accessmethod,
netsnmpmibhandlers::handlername, netsnmpmibhandler, SNMPFRE,
and SNMPMALOCTYPEDEF.
Referenced by getoldapihandler(),
netsnmpbabystepsaccessmultiplexerget(),
netsnmpbabystepshandlerget(), netsnmpcachehandlerget(),
netsnmpcontainertablehandlerget(),
netsnmpgetbulktonexthandler(), netsnmpgetdebughandler(),
netsnmpgetinstancehandler(), netsnmpgetmodeendcallhandler(),
netsnmpgetmultiplexerhandler(), netsnmpgetreadonlyhandler(),
netsnmpgetrowmergehandler(), netsnmpgetscalarhandler(),
netsnmpgetserializehandler(), netsnmpgetstashcachehandler(),
netsnmpgettabledatahandler(), netsnmpgettabledatasethandler(),
netsnmpgettablehandler(), netsnmpgettableiteratorhandler(),
netsnmpsparsetablehandlerget(), and
netsnmpsparsetableregister().
netsnmpmibhandler ** netsnmpfindhandlerbyname
(netsnmphandlerregistration ** reginfo,, const char ** name)
Returns a handler from a chain based on the name. Definition at line
825 of file agenthandler.c.
References netsnmphandlerregistrations::handler,
netsnmpmibhandlers::handlername, netsnmphandlerregistration,
netsnmpmibhandler, and netsnmpmibhandlers::next.
Referenced by netsnmpfindhandlerdatabyname().
void ** netsnmpfindhandlerdatabyname (netsnmphandlerregistration **
reginfo,, const char ** name)
Returns a handler's void * pointer from a chain based on the name. This
probably shouldn't be used by the general public as the void * data may
change as a handler evolves. Handlers should really advertise some
function for you to use instead. Definition at line 842 of file
agenthandler.c.
References netsnmpmibhandlers::myvoid,
netsnmpfindhandlerbyname(), netsnmphandlerregistration, and
netsnmpmibhandler.
Referenced by netsnmpfindtableregistrationinfo().
NETSNMPINLINE void netsnmpfreedelegatedcache (netsnmpdelegatedcache **
dcache)
frees a cache once you're finished using it
Examples::
delayedinstance.c.
Definition at line 721 of file agenthandler.c.
References SNMPFRE.
NETSNMPINLINE void netsnmpfreerequestdataset (netsnmprequestinfo **
request)
Free the extra data stored in a request. Definition at line 807 of file
agenthandler.c.
References netsnmpfreelistdata(), and
netsnmprequestinfos::parentdata.
NETSNMPINLINE void netsnmpfreerequestdatasets (netsnmprequestinfo **
request)
Free the extra data stored in a bunch of requests (all data in the
chain). Definition at line 815 of file agenthandler.c.
References netsnmpfreealllistdata(), and
netsnmprequestinfos::parentdata.
Referenced by netsnmpaddvarbindtocache(), and
netsnmptableiteratorhelperhandler().
NETSNMPINLINE netsnmpdelegatedcache ** netsnmphandlercheckcache
(netsnmpdelegatedcache ** dcache)
check's a given cache and returns it if it is still valid (ie, the
agent still considers it to be an outstanding request. Returns NUL if
it's no longer valid.
Examples::
delayedinstance.c.
Definition at line 707 of file agenthandler.c.
References netsnmpchecktransactionid().
netsnmpmibhandler ** netsnmphandlerdup (netsnmpmibhandler ** handler)
dulpicates a handler and all subsequent handlers see also
clonehandler Definition at line 579 of file agenthandler.c.
References netsnmpmibhandlers::myvoid, netsnmphandlerfree(),
netsnmpmibhandler, and netsnmpmibhandlers::next.
Referenced by netsnmphandlerregistrationdup().
void netsnmphandlerfree (netsnmpmibhandler ** handler)
free's the resourceses associated with a given handler make sure we
aren't pointing to ourselves.
X : segv here at shutdown if SHUTDOWNAGENTCLEANLY defined. About 30
functions down the stack, starting in clearcontext() ->
clearsubtree() Definition at line 557 of file agenthandler.c.
References netsnmpmibhandlers::handlername, netsnmpmibhandler,
netsnmpmibhandlers::next, and SNMPFRE.
Referenced by netsnmpbabystepshandlerget(), netsnmphandlerdup(),
and netsnmphandlerregistrationfree().
void netsnmphandlermarkrequestsasdelegated (netsnmprequestinfo **
requests,, int isdelegated)
marks a list of requests as delegated (or not if isdelegaded = 0)
Definition at line 735 of file agenthandler.c.
References netsnmprequestinfos::delegated, and
netsnmprequestinfos::next.
netsnmphandlerregistration ** netsnmphandlerregistrationcreate (const
char ** name,, netsnmpmibhandler ** handler,, oid ** regoid,, sizet
regoidlen,, int modes)
creates a handler registration structure given a name, a accessmethod
function, a registration location oid and the modes the handler
supports. If modes == 0, then modes will automatically be set to the
default value of only HANDLERCANDEFAULT, which is by default read-
only GET and GETNEXT requests. A hander which supports sets but not row
creation should set us a mode of HANDLERCANSETONLY.
Note::
This ends up calling netsnmpcreatehandler(name,
handleraccessmethod)
Parameters::
name is the handler name and is copied then assigned to
netsnmphandlerregistration->handlerName.
handleraccessmethod is a function pointer used as the access
method for this handler registration instance for whatever required
needs.
regoid is the registration location oid.
regoidlen is the length of regoid, can use the macro, OIDLENGTH
modes is used to configure read/write access. If modes == 0, then
modes will automatically be set to the default value of only
HANDLERCANDEFAULT, which is by default read-only GET and GETNEXT
requests. The other two mode options are read only,
HANDLERCANRONLY, and read/write, HANDLERCANRWRITE.
]o HANDLERCANGETANDGETNEXT
]o HANDLERCANSET
]o HANDLERCANGETBULK
]o HANDLERCANRONLY (HANDLERCANGETANDGETNEXT)
]o HANDLERCANRWRITE (HANDLERCANGETANDGETNEXT HANDLERCANSET)
]o HANDLERCANDEFAULT HANDLERCANRONLY
Returns::
Returns a pointer to a netsnmphandlerregistration struct. NUL is
returned only when memory could not be allocated for the
netsnmphandlerregistration struct.
See also::
netsnmpcreatehandler()
netsnmpregisterhandler()
Definition at line 163 of file agenthandler.c.
References netsnmphandlerregistrations::handler,
netsnmphandlerregistrations::handlerName, memdup(),
netsnmphandlerregistrations::modes, netsnmphandlerregistration,
netsnmpmibhandler, netsnmphandlerregistrations::priority,
netsnmphandlerregistrations::rootoid,
netsnmphandlerregistrations::rootoidlen, and SNMPMALOCTYPEDEF.
netsnmphandlerregistration ** netsnmphandlerregistrationdup
(netsnmphandlerregistration ** reginfo)
duplicates the handler registration object Definition at line 621 of
file agenthandler.c.
References netsnmphandlerregistrations::contextName,
netsnmphandlerregistrations::handler,
netsnmphandlerregistrations::handlerName, memdup(),
netsnmphandlerregistrations::modes, netsnmphandlerdup(),
netsnmphandlerregistration, netsnmphandlerregistrationfree(),
netsnmphandlerregistrations::priority,
netsnmphandlerregistrations::rangesubid,
netsnmphandlerregistrations::rangeubound,
netsnmphandlerregistrations::rootoid,
netsnmphandlerregistrations::rootoidlen, and
netsnmphandlerregistrations::timeout.
void netsnmphandlerregistrationfree (netsnmphandlerregistration **
reginfo)
free the resources associated with a handler registration object
Definition at line 608 of file agenthandler.c.
References netsnmphandlerregistrations::contextName,
netsnmphandlerregistrations::handler,
netsnmphandlerregistrations::handlerName, netsnmphandlerfree(),
netsnmphandlerregistration, netsnmphandlerregistrations::rootoid,
and SNMPFRE.
Referenced by netsnmphandlerregistrationdup(), and
netsnmpregistermibtablerow().
int netsnmpinjecthandler (netsnmphandlerregistration ** reginfo,,
netsnmpmibhandler ** handler)
inject a new handler into the calling chain of the handlers definedy by
the netsnmphandlerregistration pointer. The new handler is injected
at the top of the list and hence will be the new handler to be called
first. Definition at line 374 of file agenthandler.c.
References netsnmphandlerregistration,
netsnmpinjecthandlerbefore(), and netsnmpmibhandler.
Referenced by netsnmpcachehandlerregister(),
netsnmpregistercachehandler(), netsnmpregisterhandler(),
netsnmpregisterinstance(), netsnmpregisterreadonlyinstance(),
netsnmpregisterreadonlyscalar(),
netsnmpregisterreadonlytabledata(), netsnmpregisterrowmerge(),
netsnmpregisterscalar(), netsnmpregisterserialize(),
netsnmpregistertable(), netsnmpregistertabledata(),
netsnmpregistertabledataset(), netsnmpregistertableiterator(),
and netsnmpsparsetableregister().
int netsnmpinjecthandlerbefore (netsnmphandlerregistration ** reginfo,,
netsnmpmibhandler ** handler,, const char ** beforewhat)
inject a new handler into the calling chain of the handlers definedy by
the netsnmphandlerregistration pointer. The new handler is injected
after the beforewhat handler, or if NUL at the top of the list and
hence will be the new handler to be called first. Definition at line
322 of file agenthandler.c.
References netsnmphandlerregistrations::handler,
netsnmpmibhandlers::handlername, netsnmphandlerregistration,
netsnmpmibhandler, netsnmpmibhandlers::next,
netsnmpmibhandlers::prev, and snmplog().
Referenced by netsnmpinjecthandler().
int netsnmpregisterhandler (netsnmphandlerregistration ** reginfo)
register a handler, as defined by the netsnmphandlerregistration
pointer. Definition at line 202 of file agenthandler.c.
References netsnmphandlerregistrations::contextName,
netsnmphandlerregistrations::handler,
netsnmpmibhandlers::handlername,
netsnmphandlerregistrations::handlerName,
netsnmphandlerregistrations::modes,
netsnmpgetbulktonexthandler(), netsnmphandlerregistration,
netsnmpinjecthandler(), netsnmpmibhandler,
netsnmpmibhandlers::next, netsnmphandlerregistrations::priority,
netsnmphandlerregistrations::rangesubid,
netsnmphandlerregistrations::rangeubound,
netsnmphandlerregistrations::rootoid,
netsnmphandlerregistrations::rootoidlen, snmplog(), and
netsnmphandlerregistrations::timeout.
Referenced by netsnmpcachehandlerregister(),
netsnmpregistercachehandler(), netsnmpregisteroldapi(),
netsnmpregisterrowmerge(), netsnmpregisterserialize(),
netsnmpregistertable(), and netsnmpsparsetableregister().
void netsnmpregisterhandlerbyname (const char ** name,,
netsnmpmibhandler ** handler)
registers a given handler by name so that it can be found easily later.
Definition at line 880 of file agenthandler.c.
References netsnmpaddlistdata(), netsnmpcreatedatalist(), and
netsnmpmibhandler.
Referenced by netsnmpbabystepshandlerinit(),
netsnmpinitbulktonexthelper(), netsnmpinitdebughelper(),
netsnmpinitreadonlyhelper(), netsnmpinitrowmerge(),
netsnmpinitserialize(), and netsnmpinitstashcachehelper().
int netsnmpregisterhandlernocallback (netsnmphandlerregistration **
reginfo)
register a handler, as defined by the netsnmphandlerregistration
pointer. Definition at line 270 of file agenthandler.c.
References netsnmphandlerregistrations::contextName,
netsnmphandlerregistrations::handler,
netsnmpmibhandlers::handlername,
netsnmphandlerregistrations::modes, netsnmphandlerregistration,
netsnmpmibhandler, netsnmpmibhandlers::next,
netsnmphandlerregistrations::priority,
netsnmphandlerregistrations::rangesubid,
netsnmphandlerregistrations::rangeubound,
netsnmphandlerregistrations::rootoid,
netsnmphandlerregistrations::rootoidlen, snmplog(), and
netsnmphandlerregistrations::timeout.
Referenced by netsnmpregistermibtablerow().
NETSNMPINLINE void netsnmprequestaddlistdata (netsnmprequestinfo **
request,, netsnmpdatalist ** node)
add data to a request that can be extracted later by submodules
Parameters::
requset the netsnmp request info structure
node this is the data to be added to the linked list
request->parentdata
Returns::
void
Examples::
delayedinstance.c.
Definition at line 755 of file agenthandler.c.
References netsnmpaddlistdata(), and
netsnmprequestinfos::parentdata.
Referenced by netsnmpinsertiteratorcontext(),
netsnmpinserttablerow(), netsnmpoldapihelper(),
netsnmptabledatahelperhandler(),
netsnmptabledatasethelperhandler(),
netsnmptableiteratorhelperhandler(), and tablehelperhandler().
NETSNMPINLINE void ** netsnmprequestgetlistdata (netsnmprequestinfo **
request,, const char ** name)
extract data from a request that was added previously by a parent
module Parameters::
request the netsnmp request info function
name used to compare against the request->parentdata->name value,
if a match is found request->parentdata->data is returned
Returns::
a void pointer(request->parentdata->data), otherwise NUL is
returned if request is NUL or request->parentdata is NUL or
request->parentdata object is not found.
Examples::
delayedinstance.c.
Definition at line 797 of file agenthandler.c.
References netsnmpgetlistdata(), and
netsnmprequestinfos::parentdata.
Referenced by netsnmpextractarraycontext(),
netsnmpextractiteratorcontext(), netsnmpextracttable(),
netsnmpextracttabledataset(), netsnmpextracttableinfo(),
netsnmpextracttablerow(), netsnmpoldapihelper(), and
netsnmptableiteratorhelperhandler().
NETSNMPINLINE int netsnmprequestremovelistdata (netsnmprequestinfo **
request,, const char ** name)
remove data from a request Parameters::
requset the netsnmp request info structure
name this is the name of the previously added data
Returns::
0 on successful find-and-delete, 1 otherwise.
Definition at line 776 of file agenthandler.c.
References netsnmpremovelistnode(), and
netsnmprequestinfos::parentdata.
int netsnmpunregisterhandler (netsnmphandlerregistration ** reginfo)
unregister a handler, as defined by the netsnmphandlerregistration
pointer. Definition at line 260 of file agenthandler.c.
References netsnmphandlerregistrations::contextName,
netsnmphandlerregistration, netsnmphandlerregistrations::priority,
netsnmphandlerregistrations::rangesubid,
netsnmphandlerregistrations::rangeubound,
netsnmphandlerregistrations::rootoid,
netsnmphandlerregistrations::rootoidlen, and
unregistermibcontext().
net-snmp Net-SNJPnAg0e0nt handler and extensibility API(3)
|