Trap generation routines for mib modules to use
[The Net-SNMP agent]


データ構造

struct  trap_sink

マクロ定義

#define SNMPV2_TRAPS_PREFIX   SNMP_OID_SNMPMODULES,1,1,5
#define SNMPV2_TRAP_OBJS_PREFIX   SNMP_OID_SNMPMODULES,1,1,4
#define SNMPV2_COMM_OBJS_PREFIX   SNMP_OID_SNMPMODULES,18,1
#define SNMP_AUTHENTICATED_TRAPS_ENABLED   1
#define SNMP_AUTHENTICATED_TRAPS_DISABLED   2
#define MAX_ARGS   128

関数

void init_traps (void)
int add_trap_session (netsnmp_session *ss, int pdutype, int confirm, int version)
int remove_trap_session (netsnmp_session *ss)
int create_trap_session (char *sink, u_short sinkport, char *com, int version, int pdutype)
void snmpd_free_trapsinks (void)
netsnmp_pduconvert_v2pdu_to_v1 (netsnmp_pdu *template_v2pdu)
netsnmp_pduconvert_v1pdu_to_v2 (netsnmp_pdu *template_v1pdu)
int netsnmp_send_traps (int trap, int specific, oid *enterprise, int enterprise_length, netsnmp_variable_list *vars, char *context, int flags)
 This function allows you to make a distinction between generic traps from different classes of equipment.
void send_enterprise_trap_vars (int trap, int specific, oid *enterprise, int enterprise_length, netsnmp_variable_list *vars)
int handle_inform_response (int op, netsnmp_session *session, int reqid, netsnmp_pdu *pdu, void *magic)
 Captures responses or the lack there of from INFORMs that were sent 1) a response is received from an INFORM 2) one isn't received and the retries/timeouts have failed
void send_trap_to_sess (netsnmp_session *sess, netsnmp_pdu *template_pdu)
void send_trap_vars (int trap, int specific, netsnmp_variable_list *vars)
void send_easy_trap (int trap, int specific)
 Sends an SNMPv1 trap (or the SNMPv2 equivalent) to the list of configured trap destinations (or "sinks"), using the provided values for the generic trap type and specific trap value.
void send_v2trap (netsnmp_variable_list *vars)
 Uses the supplied list of variable bindings to form an SNMPv2 trap, which is sent to SNMPv2-capable sinks on the configured list.
void send_trap_pdu (netsnmp_pdu *pdu)
void snmpd_parse_config_authtrap (const char *token, char *cptr)
void snmpd_parse_config_trapsink (const char *token, char *cptr)
void snmpd_parse_config_trap2sink (const char *word, char *cptr)
void snmpd_parse_config_informsink (const char *word, char *cptr)
void snmpd_parse_config_trapsess (const char *word, char *cptr)
void snmpd_parse_config_trapcommunity (const char *word, char *cptr)
void snmpd_free_trapcommunity (void)

変数

trap_sinksinks = NULL
timeval starttime
oid objid_enterprisetrap [] = { NOTIFICATION_MIB }
oid trap_version_id [] = { SYSTEM_MIB }
int enterprisetrap_len
int trap_version_id_len
oid trap_prefix [] = { SNMPV2_TRAPS_PREFIX }
oid cold_start_oid [] = { SNMPV2_TRAPS_PREFIX, 1 }
oid warm_start_oid [] = { SNMPV2_TRAPS_PREFIX, 2 }
oid link_down_oid [] = { SNMPV2_TRAPS_PREFIX, 3 }
oid link_up_oid [] = { SNMPV2_TRAPS_PREFIX, 4 }
oid auth_fail_oid [] = { SNMPV2_TRAPS_PREFIX, 5 }
oid egp_xxx_oid [] = { SNMPV2_TRAPS_PREFIX, 99 }
oid snmptrap_oid [] = { SNMPV2_TRAP_OBJS_PREFIX, 1, 0 }
oid snmptrapenterprise_oid []
oid sysuptime_oid [] = { SNMP_OID_MIB2, 1, 3, 0 }
size_t snmptrap_oid_len
size_t snmptrapenterprise_oid_len
size_t sysuptime_oid_len
oid agentaddr_oid [] = { SNMPV2_COMM_OBJS_PREFIX, 3, 0 }
size_t agentaddr_oid_len
oid community_oid [] = { SNMPV2_COMM_OBJS_PREFIX, 4, 0 }
size_t community_oid_len
char * snmp_trapcommunity = NULL
int snmp_enableauthentraps = SNMP_AUTHENTICATED_TRAPS_DISABLED
int snmp_enableauthentrapsset = 0

関数

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

Captures responses or the lack there of from INFORMs that were sent 1) a response is received from an INFORM 2) one isn't received and the retries/timeouts have failed

agent_trap.c857 行で定義されています。

参照先 snmp_increment_statistic().

参照元 send_trap_to_sess().

int netsnmp_send_traps ( int  trap,
int  specific,
oid *  enterprise,
int  enterprise_length,
netsnmp_variable_list vars,
char *  context,
int  flags 
)

This function allows you to make a distinction between generic traps from different classes of equipment.

For example, you may want to handle a SNMP_TRAP_LINKDOWN trap for a particular device in a different manner to a generic system SNMP_TRAP_LINKDOWN trap.

引数:
trap is the generic trap type. The trap types are:
  • SNMP_TRAP_COLDSTART: cold start
  • SNMP_TRAP_WARMSTART: warm start
  • SNMP_TRAP_LINKDOWN: link down
  • SNMP_TRAP_LINKUP: link up
  • SNMP_TRAP_AUTHFAIL: authentication failure
  • SNMP_TRAP_EGPNEIGHBORLOSS: egp neighbor loss
  • SNMP_TRAP_ENTERPRISESPECIFIC: enterprise specific
specific is the specific trap value.
enterprise is an enterprise oid in which you want to send specifc traps from.
enterprise_length is the length of the enterprise oid, use macro, OID_LENGTH, to compute length.
vars is used to supply list of variable bindings to form an SNMPv2 trap.
context currently unused
flags currently unused
戻り値:
void
参照:
send_easy_trap

send_v2trap

agent_trap.c623 行で定義されています。

参照先 snmp_pdu::agent_addrconvert_v1pdu_to_v2()convert_v2pdu_to_v1()snmp_pdu::enterprisesnmp_pdu::enterprise_lengthfind_varbind_in_list()snmp_pdu::flagsvariable_list::namevariable_list::name_lengthnetsnmp_ds_get_string()netsnmp_get_agent_uptime()trap_sink::nextvariable_list::next_variableNULLnetsnmp_vardata::objidtrap_sink::pdutypesend_trap_to_sess()trap_sink::sespsinksSNMP_AUTHENTICATED_TRAPS_DISABLEDsnmp_clone_mem()snmp_clone_varbind()snmp_enableauthentrapssnmp_free_pdu()snmp_free_varbind()snmp_log()snmp_oid_compare()snmp_pdu_create()snmp_varlist_add_variable()snmptrap_oidsnmptrap_oid_lensnmptrapenterprise_oidsnmptrapenterprise_oid_lensnmp_pdu::specific_typesysuptime_oidsysuptime_oid_lensnmp_pdu::timetrap_prefixsnmp_pdu::trap_typevariable_list::valsnmp_pdu::variablestrap_sink::version.

参照元 send_enterprise_trap_vars().

void send_easy_trap ( int  trap,
int  specific 
)

Sends an SNMPv1 trap (or the SNMPv2 equivalent) to the list of configured trap destinations (or "sinks"), using the provided values for the generic trap type and specific trap value.

This function eventually calls send_enterprise_trap_vars. If the trap type is not set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length paramater is set to the pre defined SYSTEM_MIB oid and length respectively. If the trap type is set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length parameters are set to the pre-defined NOTIFICATION_MIB oid and length respectively.

引数:
trap is the generic trap type.
specific is the specific trap value.
戻り値:
void
参照:
send_enterprise_trap_vars

send_v2trap

agent_trap.c985 行で定義されています。

参照先 NULLsend_trap_vars().

参照元 handle_snmp_packet().

void send_v2trap ( netsnmp_variable_list vars  ) 

Uses the supplied list of variable bindings to form an SNMPv2 trap, which is sent to SNMPv2-capable sinks on the configured list.

An equivalent INFORM is sent to the configured list of inform sinks. Sinks that can only handle SNMPv1 traps are skipped.

This function eventually calls send_enterprise_trap_vars. If the trap type is not set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length paramater is set to the pre defined SYSTEM_MIB oid and length respectively. If the trap type is set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length parameters are set to the pre-defined NOTIFICATION_MIB oid and length respectively.

引数:
vars is used to supply list of variable bindings to form an SNMPv2 trap.
戻り値:
void
参照:
send_easy_trap

send_enterprise_trap_vars

例:
notification.c.

agent_trap.c1014 行で定義されています。

参照先 send_trap_vars().


変数

oid snmptrapenterprise_oid[]

初期値:

agent_trap.c100 行で定義されています。

参照元 convert_v1pdu_to_v2()convert_v2pdu_to_v1()init_traps()netsnmp_send_traps().


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