SNMP_MSG(3)SNMP_MSG(3)NAME
snmp_msg_Encode, snmp_msg_Decode - Encode and Decode an ASN1/BER
encoded SNMP packet
SYNOPSIS
cc [ flag ... ] file ... -lsnmp [ library ... ]
#include <sys/types.h>
#include <snmp/snmp.h>
unsigned char *snmp_msg_Encode(unsigned char * Buf, int * BufLenP,
unsigned char * Community, int CommLen, int Version, struct snmp_pdu *
PDU);
unsigned char *snmp_msg_Decode(unsigned char * Buf, int * BufLenP,
unsigned char * Community, int *CommLen, int *Version, struct snmp_pdu
* PDU);
DESCRIPTION
These functions encode/decode an SNMP PDU to/from an ASN1/BER stream.
Buf points to a buffer containing (or about to contain) the stream, and
BuflenP points to the number of bytes left in the buffer. Community is
the community string to use (length CommLen). When decoding, this buf‐
fer is filled, and must contain enough space for the data. Version is
the version (or is set to the version) of this SNMP transaction. PDU
is an empty PDU structure to fill in with the decoded data.
RETURN VALUES
Upon error, both functions return NULL. Otherwise, they return a
pointer to the next byte in Buf, and set BufLenP to the number of bytes
remaining in the buffer.
ERRORS
If any of these return unsuccessfully, snmp_api_error() will be set.
NOTES
ASN parsing errors are counted and available via snmpInASNParseErrs(3)
and snmpInBadVersions(3)RFCS
Related RFCs: 1065, 1066, 1067
Related SNMPv2 RFCs: 1901, 1902, 1902, 1904, 1905, 1906, 1907, 1908,
1909
RELATED URLS
CMU Networking Group: http://www.net.cmu.edu/
CMU SNMP Home Page: http://www.net.cmu.edu/projects/snmp
SEE ALSOsnmp_api(3), snmp_api_errors(3), snmp_client(3), snmp_coexistance(3),
snmp_error(3), snmp_extra(3), snmp_mib(3), snmp_mibii(3),
snmp_mini_client(3), snmp_msg(3), snmp_packet_dump(3), snmp_pdu(3),
snmp_sess_api(3), snmp_vars(3), snmp_version_info(3), snmp_oid(5)snmp(3)4th Berkeley Distribution Tue Sep 24 11:13:15 2002SNMP_MSG(3)