net-snmp 5.7
|
Defines | |
#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 |
Functions | |
netsnmp_feature_child_of (agent_trap_all, libnetsnmpagent) | |
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_pdu * | convert_v2pdu_to_v1 (netsnmp_pdu *template_v2pdu) |
netsnmp_pdu * | convert_v1pdu_to_v2 (netsnmp_pdu *template_v1pdu) |
int | netsnmp_send_traps (int trap, int specific, const oid *enterprise, int enterprise_length, netsnmp_variable_list *vars, const 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, const 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_trap_vars_with_context (int trap, int specific, netsnmp_variable_list *vars, const char *context) |
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_v3trap (netsnmp_variable_list *vars, const char *context) |
Similar to send_v2trap(), with the added ability to specify a context. | |
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) |
Variables | |
struct trap_sink * | sinks = NULL |
const oid | objid_enterprisetrap [] = { NETSNMP_NOTIFICATION_MIB } |
const oid | trap_version_id [] = { NETSNMP_SYSTEM_MIB } |
const int | enterprisetrap_len = OID_LENGTH(objid_enterprisetrap) |
const int | trap_version_id_len = OID_LENGTH(trap_version_id) |
const oid | trap_prefix [] = { SNMPV2_TRAPS_PREFIX } |
const oid | cold_start_oid [] = { SNMPV2_TRAPS_PREFIX, 1 } |
const oid | snmptrap_oid [] = { SNMPV2_TRAP_OBJS_PREFIX, 1, 0 } |
const oid | snmptrapenterprise_oid [] = { SNMPV2_TRAP_OBJS_PREFIX, 3, 0 } |
const oid | sysuptime_oid [] = { SNMP_OID_MIB2, 1, 3, 0 } |
const size_t | snmptrap_oid_len = OID_LENGTH(snmptrap_oid) |
const size_t | snmptrapenterprise_oid_len = OID_LENGTH(snmptrapenterprise_oid) |
const size_t | sysuptime_oid_len = OID_LENGTH(sysuptime_oid) |
const oid | agentaddr_oid [] = { SNMPV2_COMM_OBJS_PREFIX, 3, 0 } |
const size_t | agentaddr_oid_len = OID_LENGTH(agentaddr_oid) |
const oid | community_oid [] = { SNMPV2_COMM_OBJS_PREFIX, 4, 0 } |
const size_t | community_oid_len = OID_LENGTH(community_oid) |
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.
Definition at line 865 of file agent_trap.c.
int netsnmp_send_traps | ( | int | trap, |
int | specific, | ||
const oid * | enterprise, | ||
int | enterprise_length, | ||
netsnmp_variable_list * | vars, | ||
const 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:
|
specific | is the specific trap value. |
enterprise | is an enterprise oid in which you want to send specific 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 |
Definition at line 624 of file agent_trap.c.
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 NETSNMP_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 NETSNMP_NOTIFICATION_MIB oid and length respectively.
trap | is the generic trap type. |
specific | is the specific trap value. |
Definition at line 1009 of file agent_trap.c.
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 NETSNMP_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 NETSNMP_NOTIFICATION_MIB oid and length respectively.
vars | is used to supply list of variable bindings to form an SNMPv2 trap. |
Definition at line 1038 of file agent_trap.c.
void send_v3trap | ( | netsnmp_variable_list * | vars, |
const char * | context | ||
) |
Similar to send_v2trap(), with the added ability to specify a context.
If the last parameter is NULL, then this call is equivalent to send_v2trap().
vars | is used to supply the list of variable bindings for the trap. |
context | is used to specify the context of the trap. |
Definition at line 1056 of file agent_trap.c.