SNMP Manager Programmer's Guide
Encoding and Decoding Packets
SNMP Manager Programmer’s Guide–134249
6-8
EBufferClone()
The sample managers call this function after packet processing is finished and before 
terminating:
EBUFFER_T ebuff;
EBufferClean(&ebuff);
SNMPWALK uses EBufferClean() to release memory associated with an octet string in 
a response packet when rebuilding the response packet to become the next request 
packet.  EBufferClean() can be used because MIB object string values are stored in 
packets as EBUFFER_T buffers:
VB_T *vbp;
switch (vbp->vb_data_flags_n_type) {
case VT_STRING:
case VT_OPAQUE:
 if (vbp->value_u.v_string.start_bp != (OCTET_T *)0)
 EBufferClean(&(vbp->value_u.v_string));
The variable vbp points to the description of a variable binding in the packet. Refer to 
Section 4, Using Header Files, Data Structures, and Defines, for a complete description 
of VB_T.
EBufferClone()
This function copies an EBUFFER_T buffer into a second EBUFFER_T buffer it 
dynamically allocates, duplicating the contents of the source buffer and its buffer 
descriptors in the destination buffer. 
rcode
is an integer describing the outcome of the call. A value of 0 indicates success; a 
value of -1 indicates failure.
source-buffer
a pointer to the descriptor structure for the buffer you want to duplicate.
dest-buffer
a pointer to the descriptor structure for the buffer you want created.
rcode = EBufferClone(source-buffer, dest-buffer);
int EBufferClone(EBUFFER_T *source-buffer,
 EBUFFER_T *dest-buffer);










