|
c-icap-doc
0.1
|
Headers manipulation related API. More...
Typedefs | |
| typedef struct ci_headers_list | ci_headers_list_t |
| This is a struct which can store a set of headers. More... | |
Functions | |
| ci_headers_list_t * | ci_headers_create () |
| Allocate memory for a ci_headers_list_t object and initialize it. More... | |
| void | ci_headers_destroy (ci_headers_list_t *heads) |
| Destroy a ci_headers_list_t object. More... | |
| void | ci_headers_reset (ci_headers_list_t *heads) |
| Resets and initialize a ci_headers_list_t object. More... | |
| const char * | ci_headers_add (ci_headers_list_t *heads, const char *header) |
| Add a header to a ci_headers_list_t object. More... | |
| int | ci_headers_addheaders (ci_headers_list_t *heads, const ci_headers_list_t *someheaders) |
| Append a headers list object to an other headers list. More... | |
| int | ci_headers_remove (ci_headers_list_t *heads, const char *header) |
| Removes a header from a header list. More... | |
| const char * | ci_headers_search (ci_headers_list_t *heads, const char *header) |
| Search for a header in a header list. More... | |
| const char * | ci_headers_search2 (ci_headers_list_t *h, const char *header, size_t *return_size) |
| Similar to ci_headers_search but also sets to a parameter the size of returned header. | |
| const char * | ci_headers_value (ci_headers_list_t *heads, const char *header) |
| Search for a header in a header list and return the value of the first occurrence of this header. More... | |
| const char * | ci_headers_value2 (ci_headers_list_t *h, const char *header, size_t *return_size) |
| Similar to ci_headers_search but also sets to a parameter the size of returned header value. | |
| const char * | ci_headers_copy_value (ci_headers_list_t *heads, const char *header, char *buf, size_t len) |
| Search for a header in a header list and copy the value to a buffer if exist. More... | |
| int | ci_headers_iterate (ci_headers_list_t *heads, void *data, void(*fn)(void *data, const char *header_name, const char *header_value)) |
| Run the given function for each header name/value pair. More... | |
| size_t | ci_headers_pack_to_buffer (ci_headers_list_t *heads, char *buf, size_t size) |
| Copy the headers to a buffer in a form they can be transmitted to the network. More... | |
| const char * | ci_headers_first_line (ci_headers_list_t *heads) |
| Get the first line of headers. More... | |
| const char * | ci_headers_first_line2 (ci_headers_list_t *heads, size_t *return_size) |
| Get the first line of headers and its size. More... | |
Headers manipulation related API.
This is a struct which can store a set of headers.
The developers should not touch ci_headers_list_t objects directly but they should use the documented macros and functions
| const char* ci_headers_add | ( | ci_headers_list_t * | heads, |
| const char * | header | ||
| ) |
Add a header to a ci_headers_list_t object.
| heads | is a pointer to the ci_headers_list_t object in which the header will be added |
| header | is the header to be added |
example usage:
| int ci_headers_addheaders | ( | ci_headers_list_t * | heads, |
| const ci_headers_list_t * | someheaders | ||
| ) |
Append a headers list object to an other headers list.
| heads | is a pointer to the ci_headers_list_t object in which the headers will be added |
| someheaders | is a ci_headers_list_t object which contains the headers will be added to the heads |
| const char* ci_headers_copy_value | ( | ci_headers_list_t * | heads, |
| const char * | header, | ||
| char * | buf, | ||
| size_t | len | ||
| ) |
Search for a header in a header list and copy the value to a buffer if exist.
| heads | is a pointer to the ci_headers_list_t object |
| header | is the name of the header |
| buf | is the buffer to store header value |
| len | is the size of the buffer buf |
example usage:
| ci_headers_list_t* ci_headers_create | ( | ) |
Allocate memory for a ci_headers_list_t object and initialize it.
| void ci_headers_destroy | ( | ci_headers_list_t * | heads | ) |
Destroy a ci_headers_list_t object.
| heads | is a pointer to the ci_headers_list_t object to be destroyed |
| const char* ci_headers_first_line | ( | ci_headers_list_t * | heads | ) |
Get the first line of headers.
| heads | is a pointer to the ci_headers_list_t object |
| const char* ci_headers_first_line2 | ( | ci_headers_list_t * | heads, |
| size_t * | return_size | ||
| ) |
Get the first line of headers and its size.
| heads | is a pointer to the ci_headers_list_t object |
| return_size | where to store the size of first line in bytes |
| int ci_headers_iterate | ( | ci_headers_list_t * | heads, |
| void * | data, | ||
| void(*)(void *data, const char *header_name, const char *header_value) | fn | ||
| ) |
Run the given function for each header name/value pair.
| heads | is a pointer to the ci_headers_list_t object |
| data | is a pointer to data which will passed as first argument to the fn function |
| fn | is a pointer to a function which will run for each header name/value pair. |
| size_t ci_headers_pack_to_buffer | ( | ci_headers_list_t * | heads, |
| char * | buf, | ||
| size_t | size | ||
| ) |
Copy the headers to a buffer in a form they can be transmitted to the network.
WARNING: It produces an non-NULL-terminated string.
| heads | is a pointer to the ci_headers_list_t object |
| buf | the buffer to store data. |
| size | the size of buffer. |
| int ci_headers_remove | ( | ci_headers_list_t * | heads, |
| const char * | header | ||
| ) |
Removes a header from a header list.
| heads | is a pointer to the ci_headers_list_t object |
| header | is the name of the header to be removed |
example usage:
| void ci_headers_reset | ( | ci_headers_list_t * | heads | ) |
Resets and initialize a ci_headers_list_t object.
| heads | pointer to the ci_headers_list_t object to be reset |
| const char* ci_headers_search | ( | ci_headers_list_t * | heads, |
| const char * | header | ||
| ) |
Search for a header in a header list.
| heads | is a pointer to the ci_headers_list_t object |
| header | is the name of the header |
example usage:
In this example on success the head pointer will point to a "Content-Lenght: 1025" string
| const char* ci_headers_value | ( | ci_headers_list_t * | heads, |
| const char * | header | ||
| ) |
Search for a header in a header list and return the value of the first occurrence of this header.
| heads | is a pointer to the ci_headers_list_t object |
| header | is the name of the header |
example usage:
1.8.5