|
|
#include <snmp/snmp.h>SNMP_SMUX_PDU * decode_SMUX_PDU(packet, length) u_char *packet; /* packet received */ long length; /* packet's length */
short encode_SMUX_PDU(pdu_ptr) SNMP_SMUX_PDU *pdu_ptr; /* pointer to the structure */
void free_SNMP_SMUX_PDU(pdu_ptr) SNMP_SMUX_PDU *pdu_ptr;
void free_SMUX_SimpleOpen(open_ptr) SMUX_SimpleOpen *open_ptr;
void free_SMUX_ClosePDU(close_ptr) SMUX_ClosePDU *close_ptr;
void free_SMUX_RReqPDU(rreq_ptr) SMUX_RReqPDU *rreq_ptr;
void free_SMUX_RRspPDU(rrsp_ptr) SMUX_RRrspPDU *rrsp_ptr;
void free_SMUX_GetPDU(get_ptr) SMUX_Data_PDU *get_ptr;
void free_SMUX_SOutPDU(sout_ptr) SMUX_SOutPDU *sout_ptr;
void free_SMUX_TrapPDU(trap_ptr) SMUX_Trap_PDU *trap_ptr;
encode_SMUX_PDU creates an ASN.1 encoded SMUX PDU from the SMUX PDU structure specified by pdu_ptr. ASN.1 encoding is required for the transfer of an SMUX PDU from an agent to a peer and vice versa. encode_SMUX_PDU traces down the structure of VarBinds that have been added to the SMUX PDU and builds the ASN.1 encoding of the SMUX PDU in the packlet pointer of the SMUX PDU data structure specified by pdu_ptr. When this ASN.1 encoding is complete, SMUX PDU processing is complete, and the structure is ready to be transferred. If successful, encode_SMUX_PDU returns 0, if unsuccessful, it returns -1.
free_SNMP_SMUX_pdu frees all memory associated with the PDU header data structure, including the actual packlet and all the VarBindList structures that were linked to the PDU. To accomplish this, free_SNMP_SMUX_pdu invokes one of the following functions, depending on the type of PDU that pdu_ptr points to: free_SMUX_SimpleOpen, free_SMUX_ClosePDU, free_SMUX_RReqPDU, free_SMUX_RRspPDU, free_SMUX_GetPDU, free_SMUX_SOutPDU, or free_SMUX_TrapPDU.