mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-29 12:14:28 +00:00
Implement request by Marco Veeneman: Make snmp_send_trap() public
This commit is contained in:
parent
8dbd1abdc4
commit
58c8e0f8ca
@ -149,9 +149,10 @@ snmp_get_auth_traps_enabled(void)
|
|||||||
/**
|
/**
|
||||||
* Sends an generic or enterprise specific trap message.
|
* Sends an generic or enterprise specific trap message.
|
||||||
*
|
*
|
||||||
* @param generic_trap is the trap code
|
|
||||||
* @param eoid points to enterprise object identifier
|
* @param eoid points to enterprise object identifier
|
||||||
|
* @param generic_trap is the trap code
|
||||||
* @param specific_trap used for enterprise traps when generic_trap == 6
|
* @param specific_trap used for enterprise traps when generic_trap == 6
|
||||||
|
* @param varbinds linked list of varbinds to be sent
|
||||||
* @return ERR_OK when success, ERR_MEM if we're out of memory
|
* @return ERR_OK when success, ERR_MEM if we're out of memory
|
||||||
*
|
*
|
||||||
* @note the use of the enterprise identifier field
|
* @note the use of the enterprise identifier field
|
||||||
@ -160,8 +161,8 @@ snmp_get_auth_traps_enabled(void)
|
|||||||
* and .iso.org.dod.internet.private.enterprises.yourenterprise
|
* and .iso.org.dod.internet.private.enterprises.yourenterprise
|
||||||
* (sysObjectID) for specific traps.
|
* (sysObjectID) for specific traps.
|
||||||
*/
|
*/
|
||||||
static err_t
|
err_t
|
||||||
snmp_send_trap(const struct snmp_obj_id *device_enterprise_oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds)
|
snmp_send_trap(const struct snmp_obj_id* eoid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds)
|
||||||
{
|
{
|
||||||
struct snmp_msg_trap trap_msg;
|
struct snmp_msg_trap trap_msg;
|
||||||
struct snmp_trap_dst *td;
|
struct snmp_trap_dst *td;
|
||||||
@ -175,10 +176,10 @@ snmp_send_trap(const struct snmp_obj_id *device_enterprise_oid, s32_t generic_tr
|
|||||||
if ((td->enable != 0) && !ip_addr_isany(&td->dip)) {
|
if ((td->enable != 0) && !ip_addr_isany(&td->dip)) {
|
||||||
/* lookup current source address for this dst */
|
/* lookup current source address for this dst */
|
||||||
if (snmp_get_local_ip_for_dst(snmp_traps_handle, &td->dip, &trap_msg.sip)) {
|
if (snmp_get_local_ip_for_dst(snmp_traps_handle, &td->dip, &trap_msg.sip)) {
|
||||||
if (device_enterprise_oid == NULL) {
|
if (eoid == NULL) {
|
||||||
trap_msg.enterprise = snmp_get_device_enterprise_oid();
|
trap_msg.enterprise = snmp_get_device_enterprise_oid();
|
||||||
} else {
|
} else {
|
||||||
trap_msg.enterprise = device_enterprise_oid;
|
trap_msg.enterprise = eoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
trap_msg.gen_trap = generic_trap;
|
trap_msg.gen_trap = generic_trap;
|
||||||
|
@ -99,6 +99,7 @@ void snmp_trap_dst_ip_set(u8_t dst_idx, const ip_addr_t *dst);
|
|||||||
|
|
||||||
err_t snmp_send_trap_generic(s32_t generic_trap);
|
err_t snmp_send_trap_generic(s32_t generic_trap);
|
||||||
err_t snmp_send_trap_specific(s32_t specific_trap, struct snmp_varbind *varbinds);
|
err_t snmp_send_trap_specific(s32_t specific_trap, struct snmp_varbind *varbinds);
|
||||||
|
err_t snmp_send_trap(const struct snmp_obj_id* oid, s32_t generic_trap, s32_t specific_trap, struct snmp_varbind *varbinds);
|
||||||
|
|
||||||
#define SNMP_AUTH_TRAPS_DISABLED 0
|
#define SNMP_AUTH_TRAPS_DISABLED 0
|
||||||
#define SNMP_AUTH_TRAPS_ENABLED 1
|
#define SNMP_AUTH_TRAPS_ENABLED 1
|
||||||
|
Loading…
Reference in New Issue
Block a user