/home/dcp1990/prog/fakedbfs/include/fakedbfs/fields.h File Reference

fields and answer stuff. More...

Go to the source code of this file.

Functions

fields_tfdbfs_free_field (fields_t *e)
 Free fields_t object.
void fdbfs_free_field_list (fields_t *h)
 Free list of fields_t's.
fields_tfdbfs_find_field_by_name (fields_t *h, const char *name)
 Search for fields_t in a list by name.
fields_tfdbfs_find_field_by_ehead (fields_t *h, struct EnumHead *e)
 Search for fields_t in a list by enumhead.
fields_tfdbfs_find_field_by_ename (fields_t *h, const char *e)
 Search for fields_t in a list by enumhead name.
fields_tfdbfs_fields_from_dsp (fdbfs_t *f, const char *tsp)
 Parse defspec and create fields_t list from it.
void fdbfs_free_answer_t (answer_t *e)
 Free answer_t object.
int fdbfs_field_add_int (const char *name, const char *fmtname, fields_t **th, fields_t **tc, int value)
 Add integer element to fields_t list.
int fdbfs_field_add_string (const char *name, const char *fmtname, fields_t **th, fields_t **tc, char *value)
 Add string element to fields_t list.
int fdbfs_field_add_image (const char *name, const char *fmtname, fields_t **th, fields_t **tc, void *value, size_t sz)
 Add image element to fields_t list.
fields_tfdbfs_find_field_by_next (fields_t *h, fields_t *next)
 Searches for a field by its next member.
int fdbfs_fields_set_mime (const char *mimetype, fields_t **th, fields_t **tc)
 Sets the MIME type of a fields list.
int fdbfs_field_append (const char *name, const char *fmtname, fields_t **th, fields_t **tc, enum DataType type, void *value, size_t len)
 Appends field to a field list.


Detailed Description

fields and answer stuff.


Function Documentation

int fdbfs_field_add_image const char *  name,
const char *  fmtname,
fields_t **  th,
fields_t **  tc,
void *  value,
size_t  sz
 

Add image element to fields_t list.

Parameters:
name Name of element.
fmtname Friendly name of element.
[in,out] th Pointer to pointer containing address of head of list (will initialise if NULL)
[in,out] tc Pointer to pointer containing address of last element on list (will set to last element).
value The value to set the element to. (not copied)
sz The length of the data.
Returns:
0 on error (*th and *tc will remain unchanged)

int fdbfs_field_add_int const char *  name,
const char *  fmtname,
fields_t **  th,
fields_t **  tc,
int  value
 

Add integer element to fields_t list.

Parameters:
name Name of element.
fmtname Friendly name of element.
[in,out] th Pointer to pointer containing address of head of list (will initialise if NULL)
[in,out] tc Pointer to pointer containing address of last element on list (will set to last element).
value The value to set the element to.
Returns:
0 on error (*th and *tc will remain unchanged)

int fdbfs_field_add_string const char *  name,
const char *  fmtname,
fields_t **  th,
fields_t **  tc,
char *  value
 

Add string element to fields_t list.

Parameters:
name Name of element.
fmtname Friendly name of element.
[in,out] th Pointer to pointer containing address of head of list (will initialise if NULL)
[in,out] tc Pointer to pointer containing address of last element on list (will set to last element).
value The value to set the element to. (not copied)
Returns:
0 on error (*th and *tc will remain unchanged)

int fdbfs_field_append const char *  name,
const char *  fmtname,
fields_t **  th,
fields_t **  tc,
enum DataType  type,
void *  value,
size_t  len
 

Appends field to a field list.

It is recommended to use the fdbfs_field_int()/string()/whatever functions. This is mostly for internal use.

Parameters:
name Name of field.
fmtname Alias of field.
[in,out] th Pointer to pointer to head of field list. Will be initialised if (*th == NULL).
[in,out] tc Pointer to pointer to last element in list. Will be reset.
type Datatype of field.
value Pointer to data to set to.
len Size of data.

fields_t* fdbfs_fields_from_dsp fdbfs_t f,
const char *  tsp
 

Parse defspec and create fields_t list from it.

Parameters:
f Fakedbfs instance to operate on.
tsp Defspec to parse.
Returns:
fields_t list from defspec, or NULL on error.

int fdbfs_fields_set_mime const char *  mimetype,
fields_t **  th,
fields_t **  tc
 

Sets the MIME type of a fields list.

Sets the MIME type. Will remove any previously-existing mime fields.

Parameters:
mimetype The mimetype to set to.
[in,out] Pointer to pointer to head of list.
[in,out] Pointer to pointer to last element of list.
Returns:
0 on error.

fields_t* fdbfs_find_field_by_ehead fields_t h,
struct EnumHead e
 

Search for fields_t in a list by enumhead.

Parameters:
h List to traverse.
e EnumHead to search for.
Returns:
fields_t that matches, or NULL if not found.

fields_t* fdbfs_find_field_by_ename fields_t h,
const char *  e
 

Search for fields_t in a list by enumhead name.

Parameters:
h List to traverse.
e EnumHead name to search for.
Returns:
fields_t that matches, or NULL if not found.

fields_t* fdbfs_find_field_by_name fields_t h,
const char *  name
 

Search for fields_t in a list by name.

Parameters:
h List to traverse.
name Name to search for.
Returns:
fields_t that matches, or NULL if not found.

fields_t* fdbfs_find_field_by_next fields_t h,
fields_t next
 

Searches for a field by its next member.

Parameters:
h Head of list to search.
next Value to search for.
Returns:
Element found or NULL on not found.

void fdbfs_free_answer_t answer_t e  ) 
 

Free answer_t object.

Parameters:
e Object to free.

fields_t* fdbfs_free_field fields_t e  ) 
 

Free fields_t object.

If e->flags has the FIELDS_FLAG_MMAPED bit set, it will be munmap()ed, but only if HAVE_MMAP was defined at compile time.

Parameters:
e fields_t object to free.
Returns:
Next element, or NULL on error.

void fdbfs_free_field_list fields_t h  ) 
 

Free list of fields_t's.

Parameters:
h Head of list to traverse and free.


Generated on Wed Apr 19 16:26:23 2006 for fakedbfs by  doxygen 1.4.6