#include <xdm.h>
numBufs
can not be larger than XDM_MAX_IO_BUFFERS. Related, *bufs
and *bufSizes
will never be indexed beyond XDM_MAX_IO_BUFFERS elements.
If *bufs
is a sparse array, *bufSizes
will be a similar sparse array. The NULL
indexes in bufs
will be ignored in bufSizes
.
numBufs
describes the number of buffers in this descriptor. if *bufs
is a sparse array, numBufs
describes the number of non-NULL buffers in this descriptor; this is not necessarily the maximum index of the last buffer pointed to by *bufs
.
An example utilizing XDM_BufDesc as a sparse array would be the following:
XDM_BufDesc outBufs; XDAS_Int32 bufSizeArray[XDM_MAX_IO_BUFFERS]; XDAS_Int8 *pBuffers[XDM_MAX_IO_BUFFERS]; XDAS_Int8 buffer1[4096]; XDAS_Int8 buffer2[1024]; // ensure all pBuffers and bufSizeArray are initially NULL memset(pBuffers, 0, sizeof(pBuffers[0]) * XDM_MAX_IO_BUFFERS); memset(bufSizeArray, 0, sizeof(bufSizeArray[0]) * XDM_MAX_IO_BUFFERS); pBuffers[0] = buffer1; pBuffers[4] = buffer2; bufSizeArray[0] = 4096; bufSizeArray[4] = 1024; outBufs.bufs = pBuffers; outBufs.numBufs = 2; outBufs.bufSizes = bufSizeArray;
The following diagram describes graphically the example above.
Data Fields | |
XDAS_Int8 ** | bufs |
XDAS_Int32 | numBufs |
XDAS_Int32 * | bufSizes |
Pointer to an array containing buffer addresses.
Number of buffers.
Size of each buffer in 8-bit bytes.