snmp_agent.c File Reference

Go to the source code of this file.

Functions

int SnmpAgentProcessRequest (SNMP_SESSION *sess, CONST u_char *in_data, size_t in_len, u_char *out_data, size_t *out_len)
 Parse incoming and create outgoing packet.
int SnmpAgent (UDPSOCKET *sock)
 Run SNMP agent.


Function Documentation

int SnmpAgentProcessRequest ( SNMP_SESSION sess,
CONST u_char in_data,
size_t  in_len,
u_char out_data,
size_t *  out_len 
)

Parse incoming and create outgoing packet.

Parameters:
in_data Pointer to the incoming packet.
in_len Number of valid bytes in the incoming packet.
out_data Pointer to a buffer for the outgoing packet.
out_len Pointer to the variable that receives the number of bytes in the outgoing packet.
out_len Pointer to a variable which contains the size of the output buffer on entry. On exit, it is returned as the number of valid bytes in the output buffer.
Returns:
0 upon success and -1 upon failure.

Definition at line 301 of file snmp_agent.c.

References ASN_INTEGER, ASN_PRIMITIVE, ASN_UNIVERSAL, AsnHeaderParse(), AsnIntegerBuild(), AsnIntegerParse(), AsnSequenceBuild(), CONST, SNMP_SESSION::sess_id, SNMP_SESSION::sess_id_len, SNMP_SESSION::sess_read_view, SNMP_SESSION::sess_version, SNMP_SESSION::sess_write_view, SNMP_ACT_ACTION, SNMP_ACT_COMMIT, SNMP_ACT_FREE, SNMP_ACT_RESERVE1, SNMP_ACT_RESERVE2, SNMP_MSG_GET, SNMP_MSG_GETBULK, SNMP_MSG_GETNEXT, SNMP_MSG_RESPONSE, SNMP_MSG_SET, SNMP_STAT_INASNPARSEERRS, SNMP_STAT_INBADCOMMUNITYNAMES, SNMP_STAT_INBADVERSIONS, SNMP_STAT_INPKTS, SNMP_VERSION_1, SNMP_VERSION_2C, SnmpAuthBuild(), SnmpAuthParse(), SnmpCommunityFind(), and SnmpStatsInc().

Referenced by SnmpAgent().

int SnmpAgent ( UDPSOCKET sock  ) 

Run SNMP agent.

Normally runs in an endless loop, which is only left in case of an error.

Parameters:
sock UDP socket to use.
Returns:
Always -1.

Definition at line 462 of file snmp_agent.c.

References free, malloc, memset(), NutUdpReceiveFrom(), NutUdpSendTo(), SNMP_MAX_LEN, SNMP_STAT_OUTPKTS, SnmpAgentProcessRequest(), and SnmpStatsInc().


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/