Next: bpipe_new, Previous: bpipe_map, Up: BPipe Manipulations
create transformation maps for data packet fields and allocate data packets
#include <bpipe/bpipe.h>void *bpipe_map_alloc( BPipe *bpipe, int ndpkts, size_t *size_p );
BPipe *bpipe
- a pointer to a binary pipe structure
int ndpkts
- the number of data packets to allocate
size_t *size_p
- if not ‘NULL’, a location where the size of the data packet will be stored
bpipe_map_alloc
is a convenience routine that calls
bpipe_map
to map the data packet, then allocates space for
the requested number of data packets. The space allocated is
managed by BPipe
; the calling program should not free
it. If the parameter size_p
is not ‘NULL’, it should
point to an integer where the size of the data packet will be
stored.
This routine should only be called once. It will not re-map an
already mapped BPipe
.
It returns a pointer to the allocated space upon sucess.
Upon error it returns ‘NULL’ and sets bpipe_errno
.
Upon error bpipe_errno
is set to one of the following:
BPEBADARG
BPipe
has already been mapped
BPipe
has an input stream and data packets
are defined on the input stream, yet all of the
data packet fields have been deleted
BPEBADPIPE
BPENOMEM