net-snmp agent related processing
[The Net-SNMP agent]


データ構造

struct  addrCache
struct  _agent_nsap
struct  agent_set_cache_s

マクロ定義

#define SNMP_NEED_REQUEST_LIST
#define SNMP_ADDRCACHE_SIZE   10
#define SNMP_ADDRCACHE_MAXAGE   300

型定義

typedef _agent_nsap agent_nsap
typedef agent_set_cache_s agent_set_cache

列挙型

enum  { SNMP_ADDRCACHE_UNUSED = 0, SNMP_ADDRCACHE_USED = 1 }

関数

int netsnmp_agent_check_packet (netsnmp_session *, struct netsnmp_transport_s *, void *, int)
int netsnmp_agent_check_parse (netsnmp_session *, netsnmp_pdu *, int)
void delete_subnetsnmp_tree_cache (netsnmp_agent_session *asp)
int handle_pdu (netsnmp_agent_session *asp)
 This function calls into netsnmp_set_mode_request_error, sets error_value given a reqinfo->mode value.
int netsnmp_handle_request (netsnmp_agent_session *asp, int status)
int netsnmp_wrap_up_request (netsnmp_agent_session *asp, int status)
int check_delayed_request (netsnmp_agent_session *asp)
int handle_getnext_loop (netsnmp_agent_session *asp)
 repeatedly calls getnext handlers looking for an answer till all requests are satisified.
int handle_set_loop (netsnmp_agent_session *asp)
int netsnmp_check_queued_chain_for (netsnmp_agent_session *asp)
int netsnmp_add_queued (netsnmp_agent_session *asp)
int netsnmp_remove_from_delegated (netsnmp_agent_session *asp)
int netsnmp_allocate_globalcacheid (void)
int netsnmp_get_local_cachid (netsnmp_cachemap *cache_store, int globalid)
netsnmp_cachemapnetsnmp_get_or_add_local_cachid (netsnmp_cachemap **cache_store, int globalid, int localid)
void netsnmp_free_cachemap (netsnmp_cachemap *cache_store)
agent_set_cachesave_set_cache (netsnmp_agent_session *asp)
int get_set_cache (netsnmp_agent_session *asp)
NETSNMP_STATIC_INLINE void _reorder_getbulk (netsnmp_agent_session *asp)
NETSNMP_STATIC_INLINE void _fix_endofmibview (netsnmp_agent_session *asp)
int getNextSessID ()
int agent_check_and_process (int block)
 This function checks for packets arriving on the SNMP port and processes them(snmp_read) if some are found, using the select().
void netsnmp_addrcache_initialise (void)
int netsnmp_addrcache_add (const char *addr)
void netsnmp_addrcache_age (void)
int netsnmp_register_agent_nsap (netsnmp_transport *t)
void netsnmp_deregister_agent_nsap (int handle)
int init_master_agent (void)
void clear_nsap_list (void)
void shutdown_master_agent (void)
netsnmp_agent_sessioninit_agent_snmp_session (netsnmp_session *session, netsnmp_pdu *pdu)
void free_agent_snmp_session (netsnmp_agent_session *asp)
int netsnmp_check_for_delegated (netsnmp_agent_session *asp)
int netsnmp_check_delegated_chain_for (netsnmp_agent_session *asp)
int netsnmp_check_for_delegated_and_add (netsnmp_agent_session *asp)
int netsnmp_remove_delegated_requests_for_session (netsnmp_session *sess)
void dump_sess_list (void)
void netsnmp_remove_and_free_agent_snmp_session (netsnmp_agent_session *asp)
void netsnmp_free_agent_snmp_session_by_session (netsnmp_session *sess, void(*free_request)(netsnmp_request_list *))
int handle_snmp_packet (int op, netsnmp_session *session, int reqid, netsnmp_pdu *pdu, void *magic)
 handles an incoming SNMP packet into the agent
netsnmp_request_infonetsnmp_add_varbind_to_cache (netsnmp_agent_session *asp, int vbcount, netsnmp_variable_list *varbind_ptr, netsnmp_subtree *tp)
int check_acm (netsnmp_agent_session *asp, u_char type)
int netsnmp_create_subtree_cache (netsnmp_agent_session *asp)
int netsnmp_reassign_requests (netsnmp_agent_session *asp)
void netsnmp_delete_request_infos (netsnmp_request_info *reqlist)
void netsnmp_delete_subtree_cache (netsnmp_agent_session *asp)
int netsnmp_check_all_requests_error (netsnmp_agent_session *asp, int look_for_specific)
int netsnmp_check_requests_error (netsnmp_request_info *requests)
int netsnmp_check_requests_status (netsnmp_agent_session *asp, netsnmp_request_info *requests, int look_for_specific)
int netsnmp_check_all_requests_status (netsnmp_agent_session *asp, int look_for_specific)
int handle_var_requests (netsnmp_agent_session *asp)
void netsnmp_check_outstanding_agent_requests (void)
int netsnmp_check_transaction_id (int transaction_id)
 Decide if the requested transaction_id is still being processed within the agent.
int check_getnext_results (netsnmp_agent_session *asp)
 returns 1 if there are valid GETNEXT requests left.
int handle_set (netsnmp_agent_session *asp)
NETSNMP_STATIC_INLINE int _request_set_error (netsnmp_request_info *request, int mode, int error_value)
 set error for a request
int netsnmp_request_set_error (netsnmp_request_info *request, int error_value)
 set error for a request
int netsnmp_request_set_error_idx (netsnmp_request_info *request, int error_value, int idx)
 set error for a request within a request list
NETSNMP_INLINE int netsnmp_request_set_error_all (netsnmp_request_info *requests, int error)
 set error for all requests
u_long netsnmp_marker_uptime (marker_t pm)
u_long netsnmp_timeval_uptime (struct timeval *tv)
u_long netsnmp_get_agent_uptime (void)
NETSNMP_INLINE void netsnmp_agent_add_list_data (netsnmp_agent_request_info *ari, netsnmp_data_list *node)
NETSNMP_INLINE int netsnmp_agent_remove_list_data (netsnmp_agent_request_info *ari, const char *name)
NETSNMP_INLINE void * netsnmp_agent_get_list_data (netsnmp_agent_request_info *ari, const char *name)
NETSNMP_INLINE void netsnmp_free_agent_data_set (netsnmp_agent_request_info *ari)
NETSNMP_INLINE void netsnmp_free_agent_data_sets (netsnmp_agent_request_info *ari)
NETSNMP_INLINE void netsnmp_free_agent_request_info (netsnmp_agent_request_info *ari)
int netsnmp_set_request_error (netsnmp_agent_request_info *reqinfo, netsnmp_request_info *request, int error_value)
 deprecated, use netsnmp_request_set_error instead
int netsnmp_set_mode_request_error (int mode, netsnmp_request_info *request, int error_value)
 deprecated, use netsnmp_request_set_error instead
int netsnmp_set_all_requests_error (netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests, int error_value)
 set error for all request

変数

oid version_sysoid [] = { SYSTEM_MIB }
int version_sysoid_len = OID_LENGTH(version_sysoid)
int log_addresses = 0
netsnmp_agent_sessionnetsnmp_processing_set = NULL
netsnmp_agent_sessionagent_delegated_list = NULL
netsnmp_agent_sessionnetsnmp_agent_queued_list = NULL
int netsnmp_running = 1
netsnmp_sessionmain_session = NULL
timeval starttime

関数

NETSNMP_STATIC_INLINE int _request_set_error ( netsnmp_request_info request,
int  mode,
int  error_value 
)

set error for a request

snmp_agent.c3411 行で定義されています。

参照先 netsnmp_request_info_s::delegatednetsnmp_request_info_s::processedREQUEST_IS_NOT_DELEGATEDnetsnmp_request_info_s::requestvbsnmp_log()netsnmp_request_info_s::statusvariable_list::type.

参照元 netsnmp_request_set_error()netsnmp_request_set_error_all()netsnmp_request_set_error_idx()netsnmp_set_mode_request_error()netsnmp_set_request_error().

int agent_check_and_process ( int  block  ) 

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

引数:
block used to control blocking in the select() function, 1 = block forever, and 0 = don't block
戻り値:
Returns a positive integer if packets were processed, and -1 if an error was found.

snmp_agent.c567 行で定義されています。

参照先 FD_ZEROnetsnmp_check_outstanding_agent_requests()NULLrun_alarms()snmp_log()snmp_log_perror()snmp_read()snmp_select_info()snmp_timeout().

int check_getnext_results ( netsnmp_agent_session asp  ) 

returns 1 if there are valid GETNEXT requests left.

Returns 0 if not.

snmp_agent.c2813 行で定義されています。

参照先 netsnmp_request_info_s::inclusivenetsnmp_request_info_s::indexnetsnmp_agent_session_s::modevariable_list::namevariable_list::name_lengthnetsnmp_request_info_s::nextNULLnetsnmp_agent_session_s::oldmodenetsnmp_request_info_s::range_endnetsnmp_request_info_s::range_end_lennetsnmp_request_info_s::requestvbsnmp_oid_compare()snmp_set_var_objid()snmp_set_var_typed_value()netsnmp_agent_session_s::treecachenetsnmp_agent_session_s::treecache_numvariable_list::type.

参照元 handle_getnext_loop().

int handle_getnext_loop ( netsnmp_agent_session asp  ) 

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

snmp_agent.c2929 行で定義されています。

参照先 check_acm()check_getnext_results()handle_var_requests()netsnmp_check_for_delegated()netsnmp_reassign_requests()netsnmp_runningvariable_list::next_variable.

参照元 check_delayed_request()handle_pdu().

int handle_pdu ( netsnmp_agent_session asp  ) 

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.

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.

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.

引数:
reqinfo 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.
request is a pointer to the netsnmp_request_info struct. The error_value is set to request->requestvb->type
error_value is the exception value you want to set, below are possible values.
  • SNMP_NOSUCHOBJECT
  • SNMP_NOSUCHINSTANCE
  • SNMP_ENDOFMIBVIEW
  • SNMP_ERR_NOERROR
  • SNMP_ERR_TOOBIG
  • SNMP_ERR_NOSUCHNAME
  • SNMP_ERR_BADVALUE
  • SNMP_ERR_READONLY
  • SNMP_ERR_GENERR
  • SNMP_ERR_NOACCESS
  • SNMP_ERR_WRONGTYPE
  • SNMP_ERR_WRONGLENGTH
  • SNMP_ERR_WRONGENCODING
  • SNMP_ERR_WRONGVALUE
  • SNMP_ERR_NOCREATION
  • SNMP_ERR_INCONSISTENTVALUE
  • SNMP_ERR_RESOURCEUNAVAILABLE
  • SNMP_ERR_COMMITFAILED
  • SNMP_ERR_UNDOFAILED
  • SNMP_ERR_AUTHORIZATIONERROR
  • SNMP_ERR_NOTWRITABLE
  • SNMP_ERR_INCONSISTENTNAME
戻り値:
Returns error_value under all conditions.

snmp_agent.c3223 行で定義されています。

参照先 check_acm()snmp_pdu::commandcount_varbinds()snmp_pdu::flagsget_set_cache()handle_getnext_loop()handle_set_loop()handle_var_requests()netsnmp_agent_session_s::modenetsnmp_create_subtree_cache()variable_list::next_variableNULLnetsnmp_agent_session_s::oldmodenetsnmp_agent_session_s::pdunetsnmp_agent_session_s::requestssnmp_increment_statistic()snmp_replace_var_types()snmp_set_var_typed_value()netsnmp_agent_session_s::statusvariable_list::typesnmp_pdu::variablesnetsnmp_agent_session_s::vbcount.

参照元 netsnmp_handle_request().

int handle_snmp_packet ( int  op,
netsnmp_session session,
int  reqid,
netsnmp_pdu pdu,
void *  magic 
)

handles an incoming SNMP packet into the agent

snmp_agent.c1769 行で定義されています。

参照先 check_access()snmp_pdu::commandsnmp_pdu::errstatinit_agent_snmp_session()netsnmp_handle_request()netsnmp_remove_and_free_agent_snmp_session()NULLnetsnmp_agent_session_s::pdusnmp_session::s_snmp_errnosend_easy_trap()netsnmp_agent_session_s::sessionsnmp_free_pdu()snmp_increment_statistic()snmp_send()netsnmp_agent_session_s::statussnmp_pdu::version.

参照元 netsnmp_register_agent_nsap().

netsnmp_request_info* netsnmp_add_varbind_to_cache ( netsnmp_agent_session asp,
int  vbcount,
netsnmp_variable_list varbind_ptr,
netsnmp_subtree tp 
)

snmp_agent.c1878 行で定義されています。

参照先 netsnmp_request_info_s::agent_req_infonetsnmp_agent_session_s::cache_storenetsnmp_subtree_s::cacheidsnmp_pdu::commandnetsnmp_request_info_s::delegatednetsnmp_subtree_s::end_anetsnmp_subtree_s::end_lennetsnmp_subtree_s::global_cacheidnetsnmp_request_info_s::inclusivenetsnmp_request_info_s::indexvariable_list::namevariable_list::name_lengthnetsnmp_acm_check_subtree()netsnmp_free_request_data_sets()netsnmp_get_local_cachid()netsnmp_get_or_add_local_cachid()netsnmp_oid_find_prefix()netsnmp_request_info_s::nextnetsnmp_subtree_s::nextNULLnetsnmp_request_info_s::parent_datanetsnmp_agent_session_s::pdunetsnmp_request_info_s::prevnetsnmp_request_info_s::processednetsnmp_request_info_s::range_endnetsnmp_request_info_s::range_end_lennetsnmp_agent_session_s::reqinfonetsnmp_agent_session_s::requestsnetsnmp_tree_cache_s::requests_beginnetsnmp_tree_cache_s::requests_endnetsnmp_request_info_s::requestvbnetsnmp_request_info_s::requestvb_startnetsnmp_subtree_s::start_anetsnmp_subtree_s::start_lennetsnmp_request_info_s::statusnetsnmp_tree_cache_s::subtreenetsnmp_request_info_s::subtreenetsnmp_agent_session_s::treecachenetsnmp_agent_session_s::treecache_lennetsnmp_agent_session_s::treecache_numvariable_list::type.

参照元 netsnmp_create_subtree_cache()netsnmp_reassign_requests().

int netsnmp_check_transaction_id ( int  transaction_id  ) 

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.

returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not.

snmp_agent.c2716 行で定義されています。

参照先 agent_delegated_listnetsnmp_agent_session_s::nextNULL.

参照元 check_delayed_request()netsnmp_handler_check_cache().

int netsnmp_request_set_error ( netsnmp_request_info request,
int  error_value 
)

set error for a request

引数:
request request which has error
error_value error value for request

snmp_agent.c3479 行で定義されています。

参照先 _request_set_error()netsnmp_request_info_s::agent_req_infonetsnmp_agent_request_info_s::mode.

参照元 netsnmp_remove_delegated_requests_for_session().

NETSNMP_INLINE int netsnmp_request_set_error_all ( netsnmp_request_info requests,
int  error 
)

set error for all requests

引数:
requests request list
error error value for requests
戻り値:
SNMPERR_SUCCESS, or an error code

paranoid sanity checks

snmp_agent.c3522 行で定義されています。

参照先 _request_set_error()netsnmp_request_info_s::agent_req_infonetsnmp_agent_request_info_s::modenetsnmp_request_info_s::nextNULLsnmp_log().

参照元 netsnmp_cache_helper_handler()netsnmp_multiplexer_helper_handler()netsnmp_read_only_helper()netsnmp_set_all_requests_error().

int netsnmp_request_set_error_idx ( netsnmp_request_info request,
int  error_value,
int  idx 
)

set error for a request within a request list

引数:
request head of the request list
error_value error value for request
idx index of the request which has the error

snmp_agent.c3494 行で定義されています。

参照先 _request_set_error()netsnmp_request_info_s::agent_req_infonetsnmp_agent_request_info_s::modenetsnmp_request_info_s::next.

int netsnmp_set_all_requests_error ( netsnmp_agent_request_info reqinfo,
netsnmp_request_info requests,
int  error_value 
)

set error for all request

非推奨:
use netsnmp_request_set_error_all
引数:
reqinfo agent_request_info pointer for requests
requests request list
error_value error value for requests
戻り値:
error_value

snmp_agent.c3696 行で定義されています。

参照先 netsnmp_request_set_error_all().

int netsnmp_set_mode_request_error ( int  mode,
netsnmp_request_info request,
int  error_value 
)

deprecated, use netsnmp_request_set_error instead

非推奨:
, use netsnmp_request_set_error instead
引数:
mode Net-SNMP agent processing mode
request request_info pointer
error_value error value for requests
戻り値:
error_value

snmp_agent.c3680 行で定義されています。

参照先 _request_set_error().

int netsnmp_set_request_error ( netsnmp_agent_request_info reqinfo,
netsnmp_request_info request,
int  error_value 
)

deprecated, use netsnmp_request_set_error instead

非推奨:
, use netsnmp_request_set_error instead
引数:
reqinfo agent_request_info pointer for request
request request_info pointer
error_value error value for requests
戻り値:
error_value
例:
delayed_instance.c.

snmp_agent.c3661 行で定義されています。

参照先 _request_set_error()netsnmp_agent_request_info_s::mode.

参照元 netsnmp_call_handlers()netsnmp_instance_counter32_handler()netsnmp_instance_helper_handler()netsnmp_instance_int_handler()netsnmp_instance_long_handler()netsnmp_instance_num_file_handler()netsnmp_instance_ulong_handler()netsnmp_scalar_group_helper_handler()netsnmp_scalar_helper_handler()netsnmp_table_data_set_helper_handler()netsnmp_watched_spinlock_handler()netsnmp_watched_timestamp_handler()netsnmp_watcher_helper_handler()table_helper_handler().

int netsnmp_wrap_up_request ( netsnmp_agent_session asp,
int  status 
)

snmp_agent.c1510 行で定義されています。

参照先 _fix_endofmibview()_reorder_getbulk()snmp_pdu::commandcount_varbinds()snmp_pdu::errindexsnmp_pdu::errstatnetsnmp_agent_session_s::indexvariable_list::namevariable_list::name_lengthnetsnmp_processing_setnetsnmp_remove_and_free_agent_snmp_session()variable_list::next_variableNULLnetsnmp_agent_session_s::orig_pdunetsnmp_agent_session_s::pdusave_set_cache()netsnmp_agent_session_s::sessionSNMP_FREEsnmp_free_pdu()snmp_increment_statistic()snmp_increment_statistic_by()snmp_log()snmp_perror()snmp_send()sprint_realloc_objid()netsnmp_agent_session_s::statusvariable_list::typesnmp_pdu::variablessnmp_pdu::version.

参照元 check_delayed_request()netsnmp_handle_request().


net-snmpに対してSat Sep 5 13:14:28 2009に生成されました。  doxygen 1.4.7