Next: , Previous: bpipe_hdrf_n, Up: Header Field Manipulations


A.2.7 bpipe_hdrf_next

Get the name of the next header field in the header.

Synopsis

     #include <bpipe/bpipe.h>
     
     
     
int bpipe_hdrf_next( BPipe *bpipe, char **p_name, size_t *p_index, void **p_last );

Parameters

BPipe *bpipe
binary pipe with which this data is associated
char **p_name
a place to store a pointer to the field name
size_t *p_index
the index of the field
void **p_last
the address of a pointer used to traverse the list

Description

It may be necessary to process the header data fields in the order that they appear in the header. This function provides the name and index of the next field. It requires that the user allocate three variables: a char * which will point to the name of the field, an int which will contain the field's index, and a void *, which is used by bpipe_hdrf_next to keep track of where it is. The last variable should be set to NULL the first time bpipe_hdrf_next is called. The invoking routine passes addresses of these three variables to this routine.

Do not add or delete header data fields in between calls to bpipe_hdrf_next.

Returns

It returns non-zero if a field is available, zero if the entire list has been traversed. The name and index are returned via the p_name and p_index arguments. Please note that the pointer returned via p_name points to the original copy of the field's name. Do not change this data!.