SNMP Manager Programmer's Guide

Encoding and Decoding Packets
SNMP Manager Programmer’s Guide–134249
6-13
EBufferStart()
The sample manager SNMPGET dynamically allocates a 2000-byte buffer for the
encoded-packet buffer, then calls EBufferSetup() to prepare the buffer for receiving the
encoded packet:
EBUFFER_T ebuff;
int need;
char *buffp;
need = 2000;
if ((buffp = (char *)SNMP_memory_alloc(need)) ==0
return (-1);
EBufferSetup(BFL_IS_DYNAMIC, &ebuff, buffp, need);
EBufferStart()
This function returns the value of start_bp, the EBUFFER_T descriptor that points to the
first byte of interest in a buffer.
start-ptr
identifies where to return the value of start_bp.
buffer
is a pointer to the descriptor structure for the buffer for which you want to retrieve
the location of the first byte of interest.
The following call to EBufferStart() retrieves the location of start_bp in ebuff:
OCTET_T *start-pointer;
EBUFFER_T ebuff;
start-pointer = EBufferStart(&ebuff);
EBufferUsed()
This function returns the number of used bytes in an EBUFFER_T buffer. This value is
derived by counting the number of bytes between start_bp and next_bp.
used-bytes
is an integer indicating the number of used bytes in the buffer.
start-ptr = EBufferStart(buffer);
OCTET_T* EBufferStart(*buffer);
used-bytes = EBufferUsed(buffer);
ALENGTH_T EbufferUsed(EBUFFER_T *buffer);