blob: b921dad2eb743c69a488477d5bb173c40fa6dc7a [file] [log] [blame]
.TH "net-snmp agent related processing" 3 "24 Jun 2011" "Version 5.4.3.pre1" "net-snmp" \" -*- nroff -*-
.ad l
.nh
.SH NAME
net-snmp agent related processing \-
.SS "Data Structures"
.in +1c
.ti -1c
.RI "struct \fBaddrCache\fP"
.br
.ti -1c
.RI "struct \fB_agent_nsap\fP"
.br
.ti -1c
.RI "struct \fBagent_set_cache_s\fP"
.br
.in -1c
.SS "Defines"
.in +1c
.ti -1c
.RI "#define \fBSNMP_NEED_REQUEST_LIST\fP"
.br
.ti -1c
.RI "#define \fBSNMP_ADDRCACHE_SIZE\fP 10"
.br
.ti -1c
.RI "#define \fBSNMP_ADDRCACHE_MAXAGE\fP 300"
.br
.in -1c
.SS "Typedefs"
.in +1c
.ti -1c
.RI "typedef struct \fB_agent_nsap\fP \fBagent_nsap\fP"
.br
.ti -1c
.RI "typedef struct \fBagent_set_cache_s\fP \fBagent_set_cache\fP"
.br
.in -1c
.SS "Enumerations"
.in +1c
.ti -1c
.RI "enum { \fBSNMP_ADDRCACHE_UNUSED\fP = 0, \fBSNMP_ADDRCACHE_USED\fP = 1 }"
.br
.in -1c
.SS "Functions"
.in +1c
.ti -1c
.RI "int \fBnetsnmp_agent_check_packet\fP (\fBnetsnmp_session\fP *, struct \fBnetsnmp_transport_s\fP *, void *, int)"
.br
.ti -1c
.RI "int \fBnetsnmp_agent_check_parse\fP (\fBnetsnmp_session\fP *, \fBnetsnmp_pdu\fP *, int)"
.br
.ti -1c
.RI "void \fBdelete_subnetsnmp_tree_cache\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBhandle_pdu\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.RI "\fIThis function calls into netsnmp_set_mode_request_error, sets error_value given a reqinfo->mode value. \fP"
.ti -1c
.RI "int \fBnetsnmp_handle_request\fP (\fBnetsnmp_agent_session\fP *asp, int status)"
.br
.ti -1c
.RI "int \fBnetsnmp_wrap_up_request\fP (\fBnetsnmp_agent_session\fP *asp, int status)"
.br
.ti -1c
.RI "int \fBcheck_delayed_request\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBhandle_getnext_loop\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.RI "\fIrepeatedly calls getnext handlers looking for an answer till all requests are satisified. \fP"
.ti -1c
.RI "int \fBhandle_set_loop\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_queued_chain_for\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_add_queued\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_remove_from_delegated\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_allocate_globalcacheid\fP (void)"
.br
.ti -1c
.RI "int \fBnetsnmp_get_local_cachid\fP (\fBnetsnmp_cachemap\fP *cache_store, int globalid)"
.br
.ti -1c
.RI "\fBnetsnmp_cachemap\fP * \fBnetsnmp_get_or_add_local_cachid\fP (\fBnetsnmp_cachemap\fP **cache_store, int globalid, int localid)"
.br
.ti -1c
.RI "void \fBnetsnmp_free_cachemap\fP (\fBnetsnmp_cachemap\fP *cache_store)"
.br
.ti -1c
.RI "\fBagent_set_cache\fP * \fBsave_set_cache\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBget_set_cache\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "NETSNMP_STATIC_INLINE void \fB_reorder_getbulk\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "NETSNMP_STATIC_INLINE void \fB_fix_endofmibview\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBgetNextSessID\fP ()"
.br
.ti -1c
.RI "int \fBagent_check_and_process\fP (int block)"
.br
.RI "\fIThis function checks for packets arriving on the SNMP port and processes them(snmp_read) if some are found, using the select(). \fP"
.ti -1c
.RI "void \fBnetsnmp_addrcache_initialise\fP (void)"
.br
.ti -1c
.RI "void \fBnetsnmp_addrcache_destroy\fP (void)"
.br
.ti -1c
.RI "int \fBnetsnmp_addrcache_add\fP (const char *addr)"
.br
.ti -1c
.RI "void \fBnetsnmp_addrcache_age\fP (void)"
.br
.ti -1c
.RI "int \fBnetsnmp_register_agent_nsap\fP (\fBnetsnmp_transport\fP *t)"
.br
.ti -1c
.RI "void \fBnetsnmp_deregister_agent_nsap\fP (int handle)"
.br
.ti -1c
.RI "int \fBinit_master_agent\fP (void)"
.br
.ti -1c
.RI "void \fBclear_nsap_list\fP (void)"
.br
.ti -1c
.RI "void \fBshutdown_master_agent\fP (void)"
.br
.ti -1c
.RI "\fBnetsnmp_agent_session\fP * \fBinit_agent_snmp_session\fP (\fBnetsnmp_session\fP *session, \fBnetsnmp_pdu\fP *pdu)"
.br
.ti -1c
.RI "void \fBfree_agent_snmp_session\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_for_delegated\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_delegated_chain_for\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_for_delegated_and_add\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_remove_delegated_requests_for_session\fP (\fBnetsnmp_session\fP *sess)"
.br
.ti -1c
.RI "void \fBdump_sess_list\fP (void)"
.br
.ti -1c
.RI "void \fBnetsnmp_remove_and_free_agent_snmp_session\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "void \fBnetsnmp_free_agent_snmp_session_by_session\fP (\fBnetsnmp_session\fP *sess, void(*free_request)(\fBnetsnmp_request_list\fP *))"
.br
.ti -1c
.RI "int \fBhandle_snmp_packet\fP (int op, \fBnetsnmp_session\fP *session, int reqid, \fBnetsnmp_pdu\fP *pdu, void *magic)"
.br
.RI "\fIhandles an incoming SNMP packet into the agent \fP"
.ti -1c
.RI "\fBnetsnmp_request_info\fP * \fBnetsnmp_add_varbind_to_cache\fP (\fBnetsnmp_agent_session\fP *asp, int vbcount, \fBnetsnmp_variable_list\fP *varbind_ptr, \fBnetsnmp_subtree\fP *tp)"
.br
.ti -1c
.RI "int \fBcheck_acm\fP (\fBnetsnmp_agent_session\fP *asp, u_char type)"
.br
.ti -1c
.RI "int \fBnetsnmp_create_subtree_cache\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_reassign_requests\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "void \fBnetsnmp_delete_request_infos\fP (\fBnetsnmp_request_info\fP *reqlist)"
.br
.ti -1c
.RI "void \fBnetsnmp_delete_subtree_cache\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_all_requests_error\fP (\fBnetsnmp_agent_session\fP *asp, int look_for_specific)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_requests_error\fP (\fBnetsnmp_request_info\fP *requests)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_requests_status\fP (\fBnetsnmp_agent_session\fP *asp, \fBnetsnmp_request_info\fP *requests, int look_for_specific)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_all_requests_status\fP (\fBnetsnmp_agent_session\fP *asp, int look_for_specific)"
.br
.ti -1c
.RI "int \fBhandle_var_requests\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "void \fBnetsnmp_check_outstanding_agent_requests\fP (void)"
.br
.ti -1c
.RI "int \fBnetsnmp_check_transaction_id\fP (int transaction_id)"
.br
.RI "\fIDecide if the requested transaction_id is still being processed within the agent. \fP"
.ti -1c
.RI "int \fBcheck_getnext_results\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.RI "\fIreturns 1 if there are valid GETNEXT requests left. \fP"
.ti -1c
.RI "int \fBhandle_set\fP (\fBnetsnmp_agent_session\fP *asp)"
.br
.ti -1c
.RI "NETSNMP_STATIC_INLINE int \fB_request_set_error\fP (\fBnetsnmp_request_info\fP *request, int mode, int error_value)"
.br
.RI "\fIset error for a request \fP"
.ti -1c
.RI "int \fBnetsnmp_request_set_error\fP (\fBnetsnmp_request_info\fP *request, int error_value)"
.br
.RI "\fIset error for a request \fP"
.ti -1c
.RI "int \fBnetsnmp_request_set_error_idx\fP (\fBnetsnmp_request_info\fP *request, int error_value, int idx)"
.br
.RI "\fIset error for a request within a request list \fP"
.ti -1c
.RI "NETSNMP_INLINE int \fBnetsnmp_request_set_error_all\fP (\fBnetsnmp_request_info\fP *requests, int error)"
.br
.RI "\fIset error for all requests \fP"
.ti -1c
.RI "u_long \fBnetsnmp_marker_uptime\fP (marker_t pm)"
.br
.ti -1c
.RI "u_long \fBnetsnmp_timeval_uptime\fP (struct timeval *tv)"
.br
.ti -1c
.RI "u_long \fBnetsnmp_get_agent_uptime\fP (void)"
.br
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_agent_add_list_data\fP (\fBnetsnmp_agent_request_info\fP *ari, \fBnetsnmp_data_list\fP *\fBnode\fP)"
.br
.ti -1c
.RI "NETSNMP_INLINE int \fBnetsnmp_agent_remove_list_data\fP (\fBnetsnmp_agent_request_info\fP *ari, const char *name)"
.br
.ti -1c
.RI "NETSNMP_INLINE void * \fBnetsnmp_agent_get_list_data\fP (\fBnetsnmp_agent_request_info\fP *ari, const char *name)"
.br
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_free_agent_data_set\fP (\fBnetsnmp_agent_request_info\fP *ari)"
.br
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_free_agent_data_sets\fP (\fBnetsnmp_agent_request_info\fP *ari)"
.br
.ti -1c
.RI "NETSNMP_INLINE void \fBnetsnmp_free_agent_request_info\fP (\fBnetsnmp_agent_request_info\fP *ari)"
.br
.ti -1c
.RI "int \fBnetsnmp_set_request_error\fP (\fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *request, int error_value)"
.br
.RI "\fIset error for a request \fP"
.ti -1c
.RI "int \fBnetsnmp_set_mode_request_error\fP (int mode, \fBnetsnmp_request_info\fP *request, int error_value)"
.br
.RI "\fIset error for a request \fP"
.ti -1c
.RI "int \fBnetsnmp_set_all_requests_error\fP (\fBnetsnmp_agent_request_info\fP *reqinfo, \fBnetsnmp_request_info\fP *requests, int error_value)"
.br
.RI "\fIset error for all request \fP"
.in -1c
.SS "Variables"
.in +1c
.ti -1c
.RI "oid \fBversion_sysoid\fP [] = { NETSNMP_SYSTEM_MIB }"
.br
.ti -1c
.RI "int \fBversion_sysoid_len\fP = OID_LENGTH(version_sysoid)"
.br
.ti -1c
.RI "int \fBlog_addresses\fP = 0"
.br
.ti -1c
.RI "\fBnetsnmp_agent_session\fP * \fBnetsnmp_processing_set\fP = NULL"
.br
.ti -1c
.RI "\fBnetsnmp_agent_session\fP * \fBagent_delegated_list\fP = NULL"
.br
.ti -1c
.RI "\fBnetsnmp_agent_session\fP * \fBnetsnmp_agent_queued_list\fP = NULL"
.br
.ti -1c
.RI "int \fBnetsnmp_running\fP = 1"
.br
.ti -1c
.RI "\fBnetsnmp_session\fP * \fBmain_session\fP = NULL"
.br
.ti -1c
.RI "struct timeval \fBstarttime\fP"
.br
.in -1c
.SH "Function Documentation"
.PP
.SS "NETSNMP_STATIC_INLINE int _request_set_error (\fBnetsnmp_request_info\fP * request, int mode, int error_value)"
.PP
set error for a request
.PP
Definition at line 3417 of file snmp_agent.c.
.SS "int agent_check_and_process (int block)"
.PP
This function checks for packets arriving on the SNMP port and processes them(snmp_read) if some are found, using the select(). If block is non zero, the function call blocks until a packet arrives
.PP
\fBParameters:\fP
.RS 4
\fIblock\fP used to control blocking in the select() function, 1 = block forever, and 0 = don't block
.RE
.PP
\fBReturns:\fP
.RS 4
Returns a positive integer if packets were processed, and -1 if an error was found.
.RE
.PP
.PP
Definition at line 566 of file snmp_agent.c.
.SS "int check_getnext_results (\fBnetsnmp_agent_session\fP * asp)"
.PP
returns 1 if there are valid GETNEXT requests left. Returns 0 if not.
.PP
Definition at line 2818 of file snmp_agent.c.
.SS "int handle_getnext_loop (\fBnetsnmp_agent_session\fP * asp)"
.PP
repeatedly calls getnext handlers looking for an answer till all requests are satisified. It's expected that one pass has been made before entering this function
.PP
Definition at line 2935 of file snmp_agent.c.
.SS "int handle_pdu (\fBnetsnmp_agent_session\fP * asp)"
.PP
This function calls into netsnmp_set_mode_request_error, sets error_value given a reqinfo->mode value. It's used to send specific errors back to the agent to process accordingly.
.PP
If error_value is set to SNMP_NOSUCHOBJECT, SNMP_NOSUCHINSTANCE, or SNMP_ENDOFMIBVIEW the following is applicable: Sets the error_value to request->requestvb->type if reqinfo->mode value is set to MODE_GET. If the reqinfo->mode value is set to MODE_GETNEXT or MODE_GETBULK the code calls snmp_log logging an error message.
.PP
Otherwise, the request->status value is checked, if it's < 0 snmp_log is called with an error message and SNMP_ERR_GENERR is assigned to request->status. If the request->status value is >= 0 the error_value is set to request->status.
.PP
\fBParameters:\fP
.RS 4
\fIreqinfo\fP is a pointer to the netsnmp_agent_request_info struct. It contains the reqinfo->mode which is required to set error_value or log error messages.
.br
\fIrequest\fP is a pointer to the netsnmp_request_info struct. The error_value is set to request->requestvb->type
.br
\fIerror_value\fP is the exception value you want to set, below are possible values.
.IP "\(bu" 2
SNMP_NOSUCHOBJECT
.IP "\(bu" 2
SNMP_NOSUCHINSTANCE
.IP "\(bu" 2
SNMP_ENDOFMIBVIEW
.IP "\(bu" 2
SNMP_ERR_NOERROR
.IP "\(bu" 2
SNMP_ERR_TOOBIG
.IP "\(bu" 2
SNMP_ERR_NOSUCHNAME
.IP "\(bu" 2
SNMP_ERR_BADVALUE
.IP "\(bu" 2
SNMP_ERR_READONLY
.IP "\(bu" 2
SNMP_ERR_GENERR
.IP "\(bu" 2
SNMP_ERR_NOACCESS
.IP "\(bu" 2
SNMP_ERR_WRONGTYPE
.IP "\(bu" 2
SNMP_ERR_WRONGLENGTH
.IP "\(bu" 2
SNMP_ERR_WRONGENCODING
.IP "\(bu" 2
SNMP_ERR_WRONGVALUE
.IP "\(bu" 2
SNMP_ERR_NOCREATION
.IP "\(bu" 2
SNMP_ERR_INCONSISTENTVALUE
.IP "\(bu" 2
SNMP_ERR_RESOURCEUNAVAILABLE
.IP "\(bu" 2
SNMP_ERR_COMMITFAILED
.IP "\(bu" 2
SNMP_ERR_UNDOFAILED
.IP "\(bu" 2
SNMP_ERR_AUTHORIZATIONERROR
.IP "\(bu" 2
SNMP_ERR_NOTWRITABLE
.IP "\(bu" 2
SNMP_ERR_INCONSISTENTNAME
.PP
.RE
.PP
\fBReturns:\fP
.RS 4
Returns error_value under all conditions.
.RE
.PP
.PP
Definition at line 3229 of file snmp_agent.c.
.SS "int handle_snmp_packet (int op, \fBnetsnmp_session\fP * session, int reqid, \fBnetsnmp_pdu\fP * pdu, void * magic)"
.PP
handles an incoming SNMP packet into the agent
.PP
Definition at line 1774 of file snmp_agent.c.
.SS "\fBnetsnmp_request_info\fP* netsnmp_add_varbind_to_cache (\fBnetsnmp_agent_session\fP * asp, int vbcount, \fBnetsnmp_variable_list\fP * varbind_ptr, \fBnetsnmp_subtree\fP * tp)"
.PP
\fBTodo\fP
.RS 4
make this be more intelligent about ranges. Right now we merely take the highest level commonality of a registration range and use that. At times we might be able to be smarter about checking the range itself as opposed to the \fBnode\fP above where the range exists, but I doubt this will come up all that frequently.
.RE
.PP
.PP
Definition at line 1883 of file snmp_agent.c.
.SS "int netsnmp_check_transaction_id (int transaction_id)"
.PP
Decide if the requested transaction_id is still being processed within the agent. This is used to validate whether a delayed cache (containing possibly freed pointers) is still usable.
.PP
returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not.
.PP
Definition at line 2721 of file snmp_agent.c.
.SS "int netsnmp_request_set_error (\fBnetsnmp_request_info\fP * request, int error_value)"
.PP
set error for a request \fBParameters:\fP
.RS 4
\fIrequest\fP request which has error
.br
\fIerror_value\fP error value for request
.RE
.PP
.PP
Definition at line 3485 of file snmp_agent.c.
.SS "NETSNMP_INLINE int netsnmp_request_set_error_all (\fBnetsnmp_request_info\fP * requests, int error)"
.PP
set error for all requests \fBParameters:\fP
.RS 4
\fIrequests\fP request list
.br
\fIerror\fP error value for requests
.RE
.PP
\fBReturns:\fP
.RS 4
SNMPERR_SUCCESS, or an error code
.RE
.PP
.PP
paranoid sanity checks
.PP
Definition at line 3528 of file snmp_agent.c.
.SS "int netsnmp_request_set_error_idx (\fBnetsnmp_request_info\fP * request, int error_value, int idx)"
.PP
set error for a request within a request list \fBParameters:\fP
.RS 4
\fIrequest\fP head of the request list
.br
\fIerror_value\fP error value for request
.br
\fIidx\fP index of the request which has the error
.RE
.PP
.PP
Definition at line 3500 of file snmp_agent.c.
.SS "int netsnmp_set_all_requests_error (\fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * requests, int error_value)"
.PP
set error for all request \fBDeprecated\fP
.RS 4
use netsnmp_request_set_error_all
.RE
.PP
\fBParameters:\fP
.RS 4
\fIreqinfo\fP agent_request_info pointer for requests
.br
\fIrequests\fP request list
.br
\fIerror_value\fP error value for requests
.RE
.PP
\fBReturns:\fP
.RS 4
error_value
.RE
.PP
.PP
Definition at line 3702 of file snmp_agent.c.
.SS "int netsnmp_set_mode_request_error (int mode, \fBnetsnmp_request_info\fP * request, int error_value)"
.PP
set error for a request deprecated, use netsnmp_request_set_error instead
.PP
\fBDeprecated\fP
.RS 4
, use netsnmp_request_set_error instead
.RE
.PP
\fBParameters:\fP
.RS 4
\fImode\fP Net-SNMP agent processing mode
.br
\fIrequest\fP request_info pointer
.br
\fIerror_value\fP error value for requests
.RE
.PP
\fBReturns:\fP
.RS 4
error_value
.RE
.PP
.PP
Definition at line 3686 of file snmp_agent.c.
.SS "int netsnmp_set_request_error (\fBnetsnmp_agent_request_info\fP * reqinfo, \fBnetsnmp_request_info\fP * request, int error_value)"
.PP
set error for a request deprecated, use netsnmp_request_set_error instead
.PP
\fBDeprecated\fP
.RS 4
, use netsnmp_request_set_error instead
.RE
.PP
\fBParameters:\fP
.RS 4
\fIreqinfo\fP agent_request_info pointer for request
.br
\fIrequest\fP request_info pointer
.br
\fIerror_value\fP error value for requests
.RE
.PP
\fBReturns:\fP
.RS 4
error_value
.RE
.PP
.PP
\fBExamples: \fP
.in +1c
\fBdelayed_instance.c\fP.
.PP
Definition at line 3667 of file snmp_agent.c.
.SS "int netsnmp_wrap_up_request (\fBnetsnmp_agent_session\fP * asp, int status)"
.PP
if asp->pdu
.PP
Definition at line 1520 of file snmp_agent.c.
.SH "Author"
.PP
Generated automatically by Doxygen for net-snmp from the source code.