Manual Pages for UNIX Darwin command on man netsnmp_handler
MyWebUniversity

Manual Pages for UNIX Darwin command on man netsnmp_handler

Net-SNMP Agent handler and extenNseitb-iSlNiMtPyAAgPeIn(t3)handler and extensibility API(3)

NAME

netsnmphandler - Net-SNMP Agent handler and extensibility API.

MMoodduulleess groupuuttiilliittyyhhaannddlleerrss:: ssiimmpplliiffyy rreeqquueesstt pprroocceessssiinngg A group of handlers intended to simplify certain aspects of processing a request for a MIB object. grouplleeaaffhhaannddlleerrss:: pprroocceessss iinnddiivviidduuaall lleeaaff oobbjjeeccttss A group of handlers to implement individual leaf objects and instances (both scalar objects, and individual objects and instances within a table). groupbbaabbyysstteeppss:: ccaallllss yyoouurr hhaannddlleerr iinn bbaabbyysstteeppss ffoorr sseett pprroocceessssiinngg.. groupoollddaappii:: CCaallllss mmiibb mmoodduullee ccooddee wwrriitttteenn iinn tthhee oolldd ssttyyllee ooff ccooddee.. This is a backwards compatilibity module that allows code written in the old API to be run under the new handler based architecture. groupssttaasshhccaacchhee:: aauuttoommaattiiccaallllyy ccaacchheess ddaattaa ffoorr cceerrttaaiinn hhaannddlleerrss.. This handler caches data in an optimized way which may aleviate the need for the lower level handlers to perform as much optimization. groupttaabbllee:: HHeellppss yyoouu iimmpplleemmeenntt aa ttaabbllee.. This handler helps you implement a table by doing some of the processing for you. DDaattaa SSttrruuccttuurreess struct nneettssnnmmppmmiibbhhaannddlleerrss the mib handler structure to be registered struct nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnss Root registration info. struct nneettssnnmmpphhaannddlleerraarrggssss struct nneettssnnmmppddeelleeggaatteeddccaacchheess struct nneettssnnmmppmmiibbhhaannddlleerrss the mib handler structure to be registered struct nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnss Root registration info. DDeeffiinneess

#define MMIIBBHHAANNDDLLEERRAAUUTTOONNEEXXTT 0x00000001

#define MMIIBBHHAANNDDLLEERRAAUUTTOONNEEXXTTOOVVEERRRRIIDDEEOONNCCEE 0x00000002

#define MMIIBBHHAANNDDLLEERRCCUUSSTTOOMM44 0x10000000

#define MMIIBBHHAANNDDLLEERRCCUUSSTTOOMM33 0x20000000

#define MMIIBBHHAANNDDLLEERRCCUUSSTTOOMM22 0x40000000

#define MMIIBBHHAANNDDLLEERRCCUUSSTTOOMM11 0x80000000

#define HHAANNDDLLEERRCCAANNGGEETTAANNDDGGEETTNNEEXXTT 0x01 /* must be able to do

both */

#define HHAANNDDLLEERRCCAANNSSEETT 0x02 /* implies create, too */

#define HHAANNDDLLEERRCCAANNGGEETTBBUULLKK 0x04

#define HHAANNDDLLEERRCCAANNNNOOTTCCRREEAATTEE 0x08 /* auto set if ! CANSET

*/

#define HHAANNDDLLEERRCCAANNBBAABBYYSSTTEEPP 0x10

#define HHAANNDDLLEERRCCAANNRROONNLLYY (HANDLERCANGETANDGETNEXT)

#define HHAANNDDLLEERRCCAANNRRWWRRIITTEE (HANDLERCANGETANDGETNEXT |

HANDLERCANSET)

#define HHAANNDDLLEERRCCAANNSSEETTOONNLLYY (HANDLERCANSET |

HANDLERCANNOTCREATE)

#define HHAANNDDLLEERRCCAANNDDEEFFAAUULLTT (HANDLERCANRONLY |

HANDLERCANNOTCREATE)

#define RREEQQUUEESSTTIISSDDEELLEEGGAATTEEDD 1

#define RREEQQUUEESSTTIISSNNOOTTDDEELLEEGGAATTEEDD 0

TTyyppeeddeeffss typedef nneettssnnmmppmmiibbhhaannddlleerrss nneettssnnmmppmmiibbhhaannddlleerr Typedefs the nneettssnnmmppmmiibbhhaannddlleerrss struct into netsnmpmibhandler. typedef nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnss nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn Typedefs the nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnss struct into netsnmphandlerregistration. typedef int( NNeettssnnmmppNNooddeeHHaannddlleerr )(nneettssnnmmppmmiibbhhaannddlleerr *handler, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo *reqinfo, nneettssnnmmpprreeqquueessttiinnffoo *requests) typedef netsnmphandlerargss nneettssnnmmpphhaannddlleerraarrggss typedef netsnmpdelegatedcaches nneettssnnmmppddeelleeggaatteeddccaacchhee FFuunnccttiioonnss nneettssnnmmppmmiibbhhaannddlleerr * nneettssnnmmppccrreeaatteehhaannddlleerr (const char *name, NetsnmpNodeHandler *handleraccessmethod) creates a netsnmpmibhandler structure given a name and a access method. nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn * nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnccrreeaattee (const char *name, nneettssnnmmppmmiibbhhaannddlleerr *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. nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn * nneettssnnmmppccrreeaatteehhaannddlleerrrreeggiissttrraattiioonn (const char *name, NetsnmpNodeHandler *handleraccessmethod, oid *regoid, sizet regoidlen, int modes) int nneettssnnmmpprreeggiisstteerrhhaannddlleerr (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo) register a handler, as defined by the netsnmphandlerregistration pointer. int nneettssnnmmppuunnrreeggiisstteerrhhaannddlleerr (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo) unregister a handler, as defined by the netsnmphandlerregistration pointer. int nneettssnnmmpprreeggiisstteerrhhaannddlleerrnnooccaallllbbaacckk (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo) register a handler, as defined by the netsnmphandlerregistration pointer. int nneettssnnmmppiinnjjeecctthhaannddlleerrbbeeffoorree (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, nneettssnnmmppmmiibbhhaannddlleerr *handler, const char *beforewhat) inject a new handler into the calling chain of the handlers definedy by the netsnmphandlerregistration pointer. int nneettssnnmmppiinnjjeecctthhaannddlleerr (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, nneettssnnmmppmmiibbhhaannddlleerr *handler) inject a new handler into the calling chain of the handlers definedy by the netsnmphandlerregistration pointer. NETSNMPINLINE int nneettssnnmmppccaallllhhaannddlleerr (nneettssnnmmppmmiibbhhaannddlleerr *nexthandler, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo *reqinfo, nneettssnnmmpprreeqquueessttiinnffoo *requests) calls a handler with with appropriate NULL checking of arguments, etc. int nneettssnnmmppccaallllhhaannddlleerrss (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo *reqinfo, nneettssnnmmpprreeqquueessttiinnffoo *requests) NETSNMPINLINE int nneettssnnmmppccaallllnneexxtthhaannddlleerr (nneettssnnmmppmmiibbhhaannddlleerr *current, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo *reqinfo, nneettssnnmmpprreeqquueessttiinnffoo *requests) calls the next handler in the chain after the current one with with appropriate NULL checking, etc. NETSNMPINLINE int nneettssnnmmppccaallllnneexxtthhaannddlleerroonneerreeqquueesstt (nneettssnnmmppmmiibbhhaannddlleerr *current, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo *reqinfo, nneettssnnmmpprreeqquueessttiinnffoo *requests) calls the next handler in the chain after the current one with with appropriate NULL checking, etc. void nneettssnnmmpphhaannddlleerrffrreeee (nneettssnnmmppmmiibbhhaannddlleerr *handler) free's the resourceses associated with a given handler nneettssnnmmppmmiibbhhaannddlleerr * nneettssnnmmpphhaannddlleerrdduupp (nneettssnnmmppmmiibbhhaannddlleerr *handler) dulpicates a handler and all subsequent handlers see also clonehandler void nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnffrreeee (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo) free the resources associated with a handler registration object nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn * nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonndduupp (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo) duplicates the handler registration object NETSNMPINLINE netsnmpdelegatedcache * nneettssnnmmppccrreeaatteeddeelleeggaatteeddccaacchhee (nneettssnnmmppmmiibbhhaannddlleerr *handler, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo *reqinfo, nneettssnnmmpprreeqquueessttiinnffoo *requests, void *localinfo) creates a cache of information which can be saved for future reference. NETSNMPINLINE netsnmpdelegatedcache * nneettssnnmmpphhaannddlleerrcchheecckkccaacchhee (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 nneettssnnmmppffrreeeeddeelleeggaatteeddccaacchhee (netsnmpdelegatedcache *dcache) frees a cache once you're finished using it void nneettssnnmmpphhaannddlleerrmmaarrkkrreeqquueessttssaassddeelleeggaatteedd (nneettssnnmmpprreeqquueessttiinnffoo *requests, int isdelegated) marks a list of requests as delegated (or not if isdelegaded = 0) NETSNMPINLINE void nneettssnnmmpprreeqquueessttaaddddlliissttddaattaa (nneettssnnmmpprreeqquueessttiinnffoo *request, nneettssnnmmppddaattaalliisstt *node) add data to a request that can be extracted later by submodules NETSNMPINLINE int nneettssnnmmpprreeqquueessttrreemmoovveelliissttddaattaa (nneettssnnmmpprreeqquueessttiinnffoo *request, const char *name) remove data from a request NETSNMPINLINE void * nneettssnnmmpprreeqquueessttggeettlliissttddaattaa (nneettssnnmmpprreeqquueessttiinnffoo *request, const char *name) extract data from a request that was added previously by a parent module NETSNMPINLINE void nneettssnnmmppffrreeeerreeqquueessttddaattaasseett (nneettssnnmmpprreeqquueessttiinnffoo *request) Free the extra data stored in a request. NETSNMPINLINE void nneettssnnmmppffrreeeerreeqquueessttddaattaasseettss (nneettssnnmmpprreeqquueessttiinnffoo *request) Free the extra data stored in a bunch of requests (all data in the chain). nneettssnnmmppmmiibbhhaannddlleerr * nneettssnnmmppffiinnddhhaannddlleerrbbyynnaammee (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, const char *name) Returns a handler from a chain based on the name. void * nneettssnnmmppffiinnddhhaannddlleerrddaattaabbyynnaammee (nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn *reginfo, const char *name) Returns a handler's void * pointer from a chain based on the name. void hhaannddlleerrffrreeeeccaallllbbaacckk (void *free) void nneettssnnmmpprreeggiisstteerrhhaannddlleerrbbyynnaammee (const char *name, nneettssnnmmppmmiibbhhaannddlleerr *handler) registers a given handler by name so that it can be found easily later. void nneettssnnmmppcclleeaarrhhaannddlleerrlliisstt (void)

clears the entire handler-registration list

void nneettssnnmmppiinnjjeecctthhaannddlleerriinnttoossuubbttrreeee (netsnmpsubtree *tp, const char *name, nneettssnnmmppmmiibbhhaannddlleerr *handler, const char *beforewhat) void ppaarrsseeiinnjjeeccttHHaannddlleerrccoonnff (const char *token, char *cptr) void nneettssnnmmppiinniitthhaannddlleerrccoonnff (void) void * nneettssnnmmpphhaannddlleerrggeettppaarreennttddaattaa (nneettssnnmmpprreeqquueessttiinnffoo *, const char *) DDeettaaiilleedd DDeessccrriippttiioonn 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 OO languages like C++). Functionally, the notion of what a handler does is the same as the older api: A handler is ccrreeaatteedd and then rreeggiisstteerreedd 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 iinnssttaannccee, ttaabbllee, ttaabblleeiitteerraattoorr, ttaabblleeddaattaa, or ttaabblleeddaattaasseett helpers to make their life easier. These 'helpers' interpert important aspects of the request and pass them on to you. For instance, the ttaabbllee helper is designed to hand you a list of extracted index values from an incoming request. THe ttaabblleeiitteerraattoorr 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 ttaabblleeiitteerraattoorr hheellppeerr@@,, aass wweellll aass tthhee iinnssttaannccee iinnssttaannccee@@ hheellppeerr iiss tthhaatt tthheeyy ttaakkee ccaarree ooff tthhee ccoommpplleexx GGEETTNNEEXXTT pprroocceessssiinngg eennttiirreellyy ffoorr yyoouu aanndd hhaanndd yyoouu eevveerryytthhiinngg yyoouu nneeeedd ttoo mmeerreellyy rreettuurrnn tthhee ddaattaa aass iiff iitt wwaass aa GGEETT rreeqquueesstt.. MMuucchh lleessss ccooddee aanndd hhaaiirr ppuulllliinngg.. II''vvee ppuulllleedd aallll mmyy hhaaiirr oouutt ttoo hheellpp yyoouu ssoo tthhaatt oonnllyy oonnee ooff uuss hhaass ttoo bbee bbaalldd.. TTyyppeeddeeff DDooccuummeennttaattiioonn ssttrruucctt nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnss nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn Typedefs the nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnss 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(). ssttrruucctt nneettssnnmmppmmiibbhhaannddlleerrss nneettssnnmmppmmiibbhhaannddlleerr Typedefs the nneettssnnmmppmmiibbhhaannddlleerrss 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(). FFuunnccttiioonn DDooccuummeennttaattiioonn iinntt nneettssnnmmppccaallllhhaannddlleerr ((nneettssnnmmppmmiibbhhaannddlleerr ** nneexxtthhaannddlleerr,, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo,, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo ** rreeqqiinnffoo,, nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueessttss)) calls a handler with with appropriate NULL 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(). iinntt nneettssnnmmppccaallllnneexxtthhaannddlleerr ((nneettssnnmmppmmiibbhhaannddlleerr ** ccuurrrreenntt,, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo,, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo ** rreeqqiinnffoo,, nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueessttss)) calls the next handler in the chain after the current one with with appropriate NULL 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(). iinntt nneettssnnmmppccaallllnneexxtthhaannddlleerroonneerreeqquueesstt ((nneettssnnmmppmmiibbhhaannddlleerr ** ccuurrrreenntt,, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo,, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo ** rreeqqiinnffoo,, nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueessttss)) calls the next handler in the chain after the current one with with appropriate NULL checking, etc. Definition at line 534 of file agenthandler.c. References netsnmpcallhandler(), netsnmphandlerregistration, netsnmpmibhandler, netsnmpmibhandlers::next, netsnmprequestinfos::next, and snmplog(). vvooiidd nneettssnnmmppcclleeaarrhhaannddlleerrlliisstt ((vvooiidd))

clears the entire handler-registration list Definition at line 892 of

file agenthandler.c. References netsnmpfreealllistdata(). NNEETTSSNNMMPPIINNLLIINNEE nneettssnnmmppddeelleeggaatteeddccaacchhee ** nneettssnnmmppccrreeaatteeddeelleeggaatteeddccaacchhee ((nneettssnnmmppmmiibbhhaannddlleerr ** hhaannddlleerr,, nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo,, nneettssnnmmppaaggeennttrreeqquueessttiinnffoo ** rreeqqiinnffoo,, nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueessttss,, vvooiidd ** llooccaalliinnffoo)) creates a cache of information which can be saved for future reference. Use nneettssnnmmpphhaannddlleerrcchheecckkccaacchhee(()) later to make sure it's still valid before referencing it in the future. EExxaammpplleess:: ddeellaayyeeddiinnssttaannccee..cc. Definition at line 683 of file agenthandler.c. References netsnmpagentrequestinfos::asp, netsnmphandlerregistration, netsnmpmibhandler, and SNMPMALLOCTYPEDEF. nneettssnnmmppmmiibbhhaannddlleerr ** nneettssnnmmppccrreeaatteehhaannddlleerr ((ccoonnsstt cchhaarr ** nnaammee,, NNeettssnnmmppNNooddeeHHaannddlleerr ** hhaannddlleerraacccceessssmmeetthhoodd)) creates a netsnmpmibhandler structure given a name and a access method. The returned handler should then be rreeggiisstteerreedd.. PPaarraammeetteerrss:: 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. RReettuurrnnss:: a pointer to a populated netsnmpmibhandler struct to be registered SSeeee aallssoo:: netsnmpcreatehandlerregistration() nneettssnnmmpprreeggiisstteerrhhaannddlleerr(()) Definition at line 105 of file agenthandler.c. References netsnmpmibhandlers::accessmethod, netsnmpmibhandlers::handlername, netsnmpmibhandler, SNMPFREE, and SNMPMALLOCTYPEDEF. Referenced by getoldapihandler(), netsnmpbabystepsaccessmultiplexerget(), netsnmpbabystepshandlerget(), netsnmpcachehandlerget(), netsnmpcontainertablehandlerget(), netsnmpgetbulktonexthandler(), netsnmpgetdebughandler(), netsnmpgetinstancehandler(), netsnmpgetmodeendcallhandler(), netsnmpgetmultiplexerhandler(), netsnmpgetreadonlyhandler(), netsnmpgetrowmergehandler(), netsnmpgetscalarhandler(), netsnmpgetserializehandler(), netsnmpgetstashcachehandler(), netsnmpgettabledatahandler(), netsnmpgettabledatasethandler(), netsnmpgettablehandler(), netsnmpgettableiteratorhandler(), netsnmpsparsetablehandlerget(), and netsnmpsparsetableregister(). nneettssnnmmppmmiibbhhaannddlleerr ** nneettssnnmmppffiinnddhhaannddlleerrbbyynnaammee ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo,, ccoonnsstt cchhaarr ** nnaammee)) 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(). vvooiidd ** nneettssnnmmppffiinnddhhaannddlleerrddaattaabbyynnaammee ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo,, ccoonnsstt cchhaarr ** nnaammee)) 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(). NNEETTSSNNMMPPIINNLLIINNEE vvooiidd nneettssnnmmppffrreeeeddeelleeggaatteeddccaacchhee ((nneettssnnmmppddeelleeggaatteeddccaacchhee ** ddccaacchhee)) frees a cache once you're finished using it EExxaammpplleess:: ddeellaayyeeddiinnssttaannccee..cc. Definition at line 721 of file agenthandler.c. References SNMPFREE. NNEETTSSNNMMPPIINNLLIINNEE vvooiidd nneettssnnmmppffrreeeerreeqquueessttddaattaasseett ((nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueesstt)) Free the extra data stored in a request. Definition at line 807 of file agenthandler.c. References netsnmpfreelistdata(), and netsnmprequestinfos::parentdata. NNEETTSSNNMMPPIINNLLIINNEE vvooiidd nneettssnnmmppffrreeeerreeqquueessttddaattaasseettss ((nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueesstt)) 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(). NNEETTSSNNMMPPIINNLLIINNEE nneettssnnmmppddeelleeggaatteeddccaacchhee ** nneettssnnmmpphhaannddlleerrcchheecckkccaacchhee ((nneettssnnmmppddeelleeggaatteeddccaacchhee ** ddccaacchhee)) 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 NULL if it's no longer valid. EExxaammpplleess:: ddeellaayyeeddiinnssttaannccee..cc. Definition at line 707 of file agenthandler.c. References netsnmpchecktransactionid(). nneettssnnmmppmmiibbhhaannddlleerr ** nneettssnnmmpphhaannddlleerrdduupp ((nneettssnnmmppmmiibbhhaannddlleerr ** hhaannddlleerr)) 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(). vvooiidd nneettssnnmmpphhaannddlleerrffrreeee ((nneettssnnmmppmmiibbhhaannddlleerr ** hhaannddlleerr)) free's the resourceses associated with a given handler make sure we aren't pointing to ourselves. XXX : 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 SNMPFREE. Referenced by netsnmpbabystepshandlerget(), netsnmphandlerdup(), and netsnmphandlerregistrationfree(). vvooiidd nneettssnnmmpphhaannddlleerrmmaarrkkrreeqquueessttssaassddeelleeggaatteedd ((nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueessttss,, iinntt iissddeelleeggaatteedd)) 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. nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnccrreeaattee ((ccoonnsstt cchhaarr ** nnaammee,, nneettssnnmmppmmiibbhhaannddlleerr ** hhaannddlleerr,, ooiidd ** rreeggooiidd,, ssiizzeett rreeggooiiddlleenn,, iinntt mmooddeess)) 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. NNoottee:: This ends up calling netsnmpcreatehandler(name, handleraccessmethod) PPaarraammeetteerrss:: 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 RReettuurrnnss:: Returns a pointer to a netsnmphandlerregistration struct. NULL is returned only when memory could not be allocated for the netsnmphandlerregistration struct. SSeeee aallssoo:: nneettssnnmmppccrreeaatteehhaannddlleerr(()) nneettssnnmmpprreeggiisstteerrhhaannddlleerr(()) 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 SNMPMALLOCTYPEDEF. nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonndduupp ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo)) 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. vvooiidd nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonnffrreeee ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo)) 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 SNMPFREE. Referenced by netsnmphandlerregistrationdup(), and netsnmpregistermibtablerow(). iinntt nneettssnnmmppiinnjjeecctthhaannddlleerr ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo,, nneettssnnmmppmmiibbhhaannddlleerr ** hhaannddlleerr)) 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(). iinntt nneettssnnmmppiinnjjeecctthhaannddlleerrbbeeffoorree ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo,, nneettssnnmmppmmiibbhhaannddlleerr ** hhaannddlleerr,, ccoonnsstt cchhaarr ** bbeeffoorreewwhhaatt)) 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 NULL 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(). iinntt nneettssnnmmpprreeggiisstteerrhhaannddlleerr ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo)) 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(). vvooiidd nneettssnnmmpprreeggiisstteerrhhaannddlleerrbbyynnaammee ((ccoonnsstt cchhaarr ** nnaammee,, nneettssnnmmppmmiibbhhaannddlleerr ** hhaannddlleerr)) 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(). iinntt nneettssnnmmpprreeggiisstteerrhhaannddlleerrnnooccaallllbbaacckk ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo)) 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(). NNEETTSSNNMMPPIINNLLIINNEE vvooiidd nneettssnnmmpprreeqquueessttaaddddlliissttddaattaa ((nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueesstt,, nneettssnnmmppddaattaalliisstt ** nnooddee)) add data to a request that can be extracted later by submodules PPaarraammeetteerrss:: requset the netsnmp request info structure node this is the data to be added to the linked list

request->parentdata

RReettuurrnnss:: void EExxaammpplleess:: ddeellaayyeeddiinnssttaannccee..cc. Definition at line 755 of file agenthandler.c. References netsnmpaddlistdata(), and netsnmprequestinfos::parentdata. Referenced by netsnmpinsertiteratorcontext(), netsnmpinserttablerow(), netsnmpoldapihelper(), netsnmptabledatahelperhandler(), netsnmptabledatasethelperhandler(), netsnmptableiteratorhelperhandler(), and tablehelperhandler(). NNEETTSSNNMMPPIINNLLIINNEE vvooiidd ** nneettssnnmmpprreeqquueessttggeettlliissttddaattaa ((nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueesstt,, ccoonnsstt cchhaarr ** nnaammee)) extract data from a request that was added previously by a parent module PPaarraammeetteerrss:: 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

RReettuurrnnss::

a void pointer(request->parentdata->data), otherwise NULL is

returned if request is NULL or request->parentdata is NULL or

request->parentdata object is not found.

EExxaammpplleess:: ddeellaayyeeddiinnssttaannccee..cc. Definition at line 797 of file agenthandler.c. References netsnmpgetlistdata(), and netsnmprequestinfos::parentdata. Referenced by netsnmpextractarraycontext(), netsnmpextractiteratorcontext(), netsnmpextracttable(), netsnmpextracttabledataset(), netsnmpextracttableinfo(), netsnmpextracttablerow(), netsnmpoldapihelper(), and netsnmptableiteratorhelperhandler(). NNEETTSSNNMMPPIINNLLIINNEE iinntt nneettssnnmmpprreeqquueessttrreemmoovveelliissttddaattaa ((nneettssnnmmpprreeqquueessttiinnffoo ** rreeqquueesstt,, ccoonnsstt cchhaarr ** nnaammee)) remove data from a request PPaarraammeetteerrss:: requset the netsnmp request info structure name this is the name of the previously added data RReettuurrnnss::

0 on successful find-and-delete, 1 otherwise.

Definition at line 776 of file agenthandler.c. References netsnmpremovelistnode(), and netsnmprequestinfos::parentdata. iinntt nneettssnnmmppuunnrreeggiisstteerrhhaannddlleerr ((nneettssnnmmpphhaannddlleerrrreeggiissttrraattiioonn ** rreeggiinnffoo)) 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 Net2-4SNJMaPnA2g0e0n5t handler and extensibility API(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™