header.h File Reference

Go to the source code of this file.

Data Structures

struct  header_t

Enumerations

enum  { HLM_OVERRIDE, HLM_KEEP, HLM_ADD }

Functions

int header_create (header_t **)
int header_load (header_t *, io_t *)
int header_load_from_cgienv (header_t *h)
int header_load_ex (header_t *h, io_t *io, int mode)
int header_free (header_t *)
int header_add_field (header_t *h, field_t *f)
int header_del_field (header_t *h, field_t *f)
field_theader_get_field (header_t *h, const char *name)
int header_clear (header_t *h)
const char * header_get_field_value (header_t *h, const char *name)
int header_set_field (header_t *h, const char *name, const char *value)
field_theader_get_fieldn (header_t *h, size_t idx)
size_t header_field_count (header_t *h)

Enumeration Type Documentation

anonymous enum
Enumerator:
HLM_OVERRIDE 
HLM_KEEP 

if a field with the same name already exists override it

HLM_ADD 

if a field with the same name already exists keep it if a field with the same name already exists add another field with the same name

Definition at line 22 of file header.h.


Function Documentation

int header_add_field ( header_t h,
field_t f 
)

Add a field to a header.

Add a field f to header h.

Parameters:
h header object
f field to be added
Returns:
0 on success, non-zero otherwise

Definition at line 211 of file header.c.

int header_clear ( header_t h  ) 

Clear a header.

Clear all items in header h.

Parameters:
h header object
Returns:
0 if successful, non-zero on error

Definition at line 62 of file header.c.

int header_create ( header_t **   ) 

Definition at line 371 of file header.c.

int header_del_field ( header_t h,
field_t f 
)

Delete a field from a header.

Delete the supplied field f in header h.

Parameters:
h header object
f field to be deleted
Returns:
0 on success, non-zero otherwise

Definition at line 189 of file header.c.

size_t header_field_count ( header_t h  ) 

Count fields in a header.

Return the number of fields in header h.

Parameters:
h header object
Returns:
the number of fields found in h

Definition at line 88 of file header.c.

int header_free ( header_t  ) 

Definition at line 389 of file header.c.

field_t* header_get_field ( header_t h,
const char *  name 
)

Get a field given a name.

Return the first matching field_t object with name name in header h

Parameters:
h header object
name name of the field to be searched
Returns:
  • the field string corresponding to name
  • NULL if no field could be found

Definition at line 138 of file header.c.

const char* header_get_field_value ( header_t h,
const char *  name 
)

Get field value.

Return a string representation of the field with name name in header h

Parameters:
h header object
name name of the field
Returns:
  • the field string corresponding to name
  • NULL if no field could be found

Definition at line 166 of file header.c.

field_t* header_get_fieldn ( header_t h,
size_t  idx 
)

Get ith field in a header.

Return the field_t object at index idx in header h.

Parameters:
h header object
idx index
Returns:
the pointer to the field or NULL if no field could be found

Definition at line 106 of file header.c.

int header_load ( header_t ,
io_t  
)

Definition at line 366 of file header.c.

int header_load_ex ( header_t h,
io_t io,
int  mode 
)

Definition at line 309 of file header.c.

int header_load_from_cgienv ( header_t h  ) 

Definition at line 272 of file header.c.

int header_set_field ( header_t h,
const char *  name,
const char *  value 
)

Set the value of a field in a header.

Set the value of field name to value in header h.

Parameters:
h header object
name name of the field
value value of the field
Returns:
0 if successful, non-zero on error

Definition at line 29 of file header.c.