msg_out.c File Reference


Functions

void snmp_trap_dst_enable (u8_t dst_idx, u8_t enable)
void snmp_trap_dst_ip_set (u8_t dst_idx, struct ip_addr *dst)
err_t snmp_send_response (struct snmp_msg_pstat *m_stat)
err_t snmp_send_trap (s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap)

Variables

struct snmp_msg_trap trap_msg

Detailed Description

SNMP output message processing (RFC1157).

Output responses and traps are build in two passes:

Pass 0: iterate over the output message backwards to determine encoding lengths Pass 1: the actual forward encoding of internal form into ASN1

The single-pass encoding method described by Comer & Stevens requires extra buffer space and copying for reversal of the packet. The buffer requirement can be prohibitively large for big payloads (>= 484) therefore we use the two encoding passes.


Function Documentation

err_t snmp_send_response ( struct snmp_msg_pstat *  m_stat  ) 

Sends a 'getresponse' message to the request originator.

Parameters:
m_stat points to the current message request state source
Returns:
ERR_OK when success, ERR_MEM if we're out of memory
Note:
the caller is responsible for filling in outvb in the m_stat and provide error-status and index (except for tooBig errors) ...

Todo:
do we need separate rx and tx pcbs for threaded case?

connect to the originating source

Todo:
release some memory, retry and return tooBig? tooMuchHassle?

disassociate remote address and port with this pcb

err_t snmp_send_trap ( s8_t  generic_trap,
struct snmp_obj_id eoid,
s32_t  specific_trap 
)

Sends an generic or enterprise specific trap message.

Parameters:
generic_trap is the trap code
eoid points to enterprise object identifier
specific_trap used for enterprise traps when generic_trap == 6
Returns:
ERR_OK when success, ERR_MEM if we're out of memory
Note:
the caller is responsible for filling in outvb in the trap_msg

the use of the enterpise identifier field is per RFC1215. Use .iso.org.dod.internet.mgmt.mib-2.snmp for generic traps and .iso.org.dod.internet.private.enterprises.yourenterprise (sysObjectID) for specific traps.

connect to the TRAP destination

disassociate remote address and port with this pcb

void snmp_trap_dst_enable ( u8_t  dst_idx,
u8_t  enable 
)

Sets enable switch for this trap destination.

Parameters:
dst_idx index in 0 .. SNMP_TRAP_DESTINATIONS-1
enable switch if 0 destination is disabled >0 enabled.

void snmp_trap_dst_ip_set ( u8_t  dst_idx,
struct ip_addr *  dst 
)

Sets IPv4 address for this trap destination.

Parameters:
dst_idx index in 0 .. SNMP_TRAP_DESTINATIONS-1
dst IPv4 address in host order.


Variable Documentation

struct snmp_msg_trap trap_msg

TRAP message structure


Generated on Sun Mar 23 19:22:46 2008 for lwIP 1.3.0 by  doxygen 1.5.4