table of contents
other versions
- wheezy 5.4.3~dfsg-2.8+deb7u1
Net-SNMP Agent handler and extensibility API(3snmp) | net-snmp | Net-SNMP Agent handler and extensibility API(3snmp) |
NAME¶
netsnmp_handler - 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).Data Structures¶
struct netsnmp_mib_handler_s
Modules¶
utility_handlers
Defines¶
#define MIB_HANDLER_AUTO_NEXT 0x00000001
Typedefs¶
typedef struct netsnmp_mib_handler_s netsnmp_mib_handler
Functions¶
netsnmp_mib_handler * netsnmp_create_handler (const char *name, Netsnmp_Node_Handler *handler_access_method)
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).Typedef Documentation¶
struct netsnmp_handler_registration_s netsnmp_handler_registration¶
Typedefs the netsnmp_handler_registration_s struct into netsnmp_handler_registration.struct netsnmp_mib_handler_s netsnmp_mib_handler¶
Typedefs the netsnmp_mib_handler_s struct into netsnmp_mib_handler.Function Documentation¶
int netsnmp_call_handler (netsnmp_mib_handler * next_handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)¶
calls a handler with with appropriate NULL checking of arguments, etc.int netsnmp_call_next_handler (netsnmp_mib_handler * current, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)¶
calls the next handler in the chain after the current one with with appropriate NULL checking, etc.int netsnmp_call_next_handler_one_request (netsnmp_mib_handler * current, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)¶
calls the next handler in the chain after the current one with with appropriate NULL checking, etc.void netsnmp_clear_handler_list (void)¶
clears the entire handler-registration listnetsnmp_delegated_cache * netsnmp_create_delegated_cache (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests, void * localinfo)¶
creates a cache of information which can be saved for future reference. Use netsnmp_handler_check_cache() later to make sure it's still valid before referencing it in the future. Examples:delayed_instance.c.
netsnmp_mib_handler * netsnmp_create_handler (const char * name, Netsnmp_Node_Handler * handler_access_method)¶
creates a netsnmp_mib_handler 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 netsnmp_mib_handler->handler_name
handler_access_method is a function pointer used as the access method for
this handler registration instance for whatever required needs.
Returns:
a pointer to a populated netsnmp_mib_handler
struct to be registered
See also:
netsnmp_create_handler_registration()
netsnmp_register_handler()
netsnmp_mib_handler * netsnmp_find_handler_by_name (netsnmp_handler_registration * reginfo, const char * name)¶
Returns a handler from a chain based on the name.void * netsnmp_find_handler_data_by_name (netsnmp_handler_registration * 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.void netsnmp_free_delegated_cache (netsnmp_delegated_cache * dcache)¶
frees a cache once you're finished using it Examples:delayed_instance.c.
void netsnmp_free_request_data_set (netsnmp_request_info * request)¶
Free the extra data stored in a request.void netsnmp_free_request_data_sets (netsnmp_request_info * request)¶
Free the extra data stored in a bunch of requests (all data in the chain).netsnmp_delegated_cache * netsnmp_handler_check_cache (netsnmp_delegated_cache * 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 NULL if it's no longer valid. Examples:delayed_instance.c.
netsnmp_mib_handler * netsnmp_handler_dup (netsnmp_mib_handler * handler)¶
dulpicates a handler and all subsequent handlers see also _clone_handlervoid netsnmp_handler_free (netsnmp_mib_handler * handler)¶
free's the resourceses associated with a given handler make sure we aren't pointing to ourselves. XXX : segv here at shutdown if SHUTDOWN_AGENT_CLEANLY defined. About 30 functions down the stack, starting in clear_context() -> clear_subtree()void netsnmp_handler_mark_requests_as_delegated (netsnmp_request_info * requests, int isdelegated)¶
marks a list of requests as delegated (or not if isdelegaded = 0)netsnmp_handler_registration * netsnmp_handler_registration_create (const char * name, netsnmp_mib_handler * handler, oid * reg_oid, size_t reg_oid_len, int modes)¶
creates a handler registration structure given a name, a access_method 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 HANDLER_CAN_DEFAULT, 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 HANDLER_CAN_SET_ONLY. Note:This ends up calling
netsnmp_create_handler(name, handler_access_method)
Parameters:
name is the handler name and is copied
then assigned to netsnmp_handler_registration->handlerName.
handler is a function pointer used as the access method for this handler
registration instance for whatever required needs.
reg_oid is the registration location oid.
reg_oid_len is the length of reg_oid, can use the macro, OID_LENGTH
modes is used to configure read/write access. If modes == 0, then modes
will automatically be set to the default value of only HANDLER_CAN_DEFAULT,
which is by default read-only GET and GETNEXT requests. The other two mode
options are read only, HANDLER_CAN_RONLY, and read/write,
HANDLER_CAN_RWRITE.
- •
- HANDLER_CAN_GETANDGETNEXT
- •
- HANDLER_CAN_SET
- •
- HANDLER_CAN_GETBULK
- •
- HANDLER_CAN_RONLY (HANDLER_CAN_GETANDGETNEXT)
- •
- HANDLER_CAN_RWRITE (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)
- •
- HANDLER_CAN_DEFAULT HANDLER_CAN_RONLY
Returns a pointer to a
netsnmp_handler_registration struct. NULL is returned only when memory could
not be allocated for the netsnmp_handler_registration struct.
See also:
netsnmp_create_handler()
netsnmp_register_handler()
netsnmp_handler_registration * netsnmp_handler_registration_dup ( netsnmp_handler_registration * reginfo)¶
duplicates the handler registration objectvoid netsnmp_handler_registration_free (netsnmp_handler_registration * reginfo)¶
free the resources associated with a handler registration objectint netsnmp_inject_handler (netsnmp_handler_registration * reginfo, netsnmp_mib_handler * handler)¶
inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registration pointer. The new handler is injected at the top of the list and hence will be the new handler to be called first.int netsnmp_inject_handler_before (netsnmp_handler_registration * reginfo, netsnmp_mib_handler * handler, const char * before_what)¶
inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registration pointer. The new handler is injected after the before_what handler, or if NULL at the top of the list and hence will be the new handler to be called first.int netsnmp_register_handler (netsnmp_handler_registration * reginfo)¶
register a handler, as defined by the netsnmp_handler_registration pointer.void netsnmp_register_handler_by_name (const char * name, netsnmp_mib_handler * handler)¶
registers a given handler by name so that it can be found easily later.int netsnmp_register_handler_nocallback (netsnmp_handler_registration * reginfo)¶
register a handler, as defined by the netsnmp_handler_registration pointer.void netsnmp_request_add_list_data (netsnmp_request_info * request, netsnmp_data_list * node)¶
add data to a request that can be extracted later by submodules Parameters:request the netsnmp request info
structure
node this is the data to be added to the linked list
request->parent_data
Returns:
void
delayed_instance.c.
void * netsnmp_request_get_list_data (netsnmp_request_info * 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->parent_data->name value,
if a match is found request->parent_data->data is returned
Returns:
a void
pointer(request->parent_data->data), otherwise NULL is returned if
request is NULL or request->parent_data is NULL or request->parent_data
object is not found.
delayed_instance.c.
int netsnmp_request_remove_list_data (netsnmp_request_info * request, const char * name)¶
remove data from a request Parameters:request the netsnmp request info
structure
name this is the name of the previously added data
Returns:
0 on successful find-and-delete, 1
otherwise.
int netsnmp_unregister_handler (netsnmp_handler_registration * reginfo)¶
unregister a handler, as defined by the netsnmp_handler_registration pointer.Author¶
Generated automatically by Doxygen for net-snmp from the source code.23 May 2010 | Version 5.4.3.pre1 |