#include <stdarg.h>
#include <string.h>
#include <sofia-sip/su_types.h>
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/msg.h>
#include <sofia-sip/url.h>
#include <sofia-sip/msg_protos.h>
Include dependency graph for msg_header.h:

Go to the source code of this file.
Defines | |
| #define | MSG_CHUNK_BUFFER(pl) |
| Get pointer to beginning of available buffer space. | |
| #define | MSG_CHUNK_AVAIL(pl) |
| Get size of available buffer space. | |
| #define | MSG_CHUNK_NEXT(pl) |
| Get next chunk in list. | |
| #define | MSG_HEADER_INIT(h, msg_class, size) |
| Initialize a header structure. | |
| #define | MSG_HEADER_NONE |
| No header. | |
Functions | |
| msg_header_t * | msg_header_alloc (su_home_t *, msg_hclass_t *hc, isize_t extra)) |
| Allocate a header structure. | |
| isize_t | msg_header_size (msg_header_t const *h) |
| Calculate the size of a duplicate of a header structure. | |
| msg_header_t ** | msg_header_offset (msg_t const *, msg_pub_t const *, msg_header_t const *) |
| Get offset of header h from structure mo. | |
| msg_header_t ** | msg_hclass_offset (msg_mclass_t const *, msg_pub_t const *, msg_hclass_t *) |
| Find place to insert header of the class hc. | |
| msg_header_t * | msg_header_access (msg_pub_t const *pub, msg_hclass_t *hc) |
| Get a header from the public message structure. | |
| msg_header_t * | msg_header_copy_as (su_home_t *home, msg_hclass_t *hc, msg_header_t const *o)) |
| Copy a list of header objects. | |
| msg_header_t * | msg_header_copy (su_home_t *home, msg_header_t const *o)) |
| Copy a header list. | |
| msg_header_t * | msg_header_copy_one (su_home_t *home, msg_header_t const *o)) |
| Copy a single header. | |
| msg_header_t * | msg_header_dup_as (su_home_t *home, msg_hclass_t *hc, msg_header_t const *o)) |
| Duplicate a header as class hc. | |
| msg_header_t * | msg_header_dup (su_home_t *home, msg_header_t const *h)) |
| Duplicate a header list. | |
| msg_header_t * | msg_header_dup_one (su_home_t *home, msg_header_t const *h)) |
| Duplicate a sigle header. | |
| msg_header_t * | msg_header_d (su_home_t *home, msg_t const *msg, char const *b) |
| Decode a message header. | |
| issize_t | msg_header_e (char b[], isize_t bsiz, msg_header_t const *h, int flags) |
| Encode a header. | |
| issize_t | msg_object_e (char b[], isize_t size, msg_pub_t const *mo, int flags) |
| Encode a message to the buffer. | |
| issize_t | msg_header_field_e (char b[], isize_t bsiz, msg_header_t const *h, int flags) |
| Encode header contents. | |
| int | msg_header_remove (msg_t *msg, msg_pub_t *mo, msg_header_t *h) |
| Remove a header from the header structure and fragment chain. | |
| int | msg_header_remove_all (msg_t *msg, msg_pub_t *mo, msg_header_t *h) |
| Remove a header list from the header structure and fragment chain. | |
| int | msg_header_insert (msg_t *msg, msg_pub_t *mo, msg_header_t *h) |
| Insert a (list of) header(s) to the fragment chain. | |
| int | msg_header_replace (msg_t *msg, msg_pub_t *mo, msg_header_t *old_header, msg_header_t *new_header) |
| Replace a header item with a (list of) header(s). | |
| int | msg_header_add_dup (msg_t *msg, msg_pub_t *pub, msg_header_t const *o) |
| Duplicate and add a (list of) header(s) to the message. | |
| int | msg_header_add_str (msg_t *msg, msg_pub_t *pub, char const *str) |
| Add string contents to message. | |
| int | msg_header_parse_str (msg_t *msg, msg_pub_t *pub, char *s) |
| Add string to message. | |
| int | msg_header_add_dup_as (msg_t *msg, msg_pub_t *pub, msg_hclass_t *hc, msg_header_t const *o) |
| Duplicate a header as a given type and add the duplicate into message. | |
| int | msg_header_add_make (msg_t *msg, msg_pub_t *pub, msg_hclass_t *hc, char const *s) |
| Parse a string as a given header field and add result to the message. | |
| int | msg_header_add_format (msg_t *msg, msg_pub_t *pub, msg_hclass_t *hc, char const *fmt,...) |
| Add formatting result to message. | |
| int | msg_header_prepend (msg_t *msg, msg_pub_t *pub, msg_header_t **hh, msg_header_t *h) |
| Prepend a (list of) header(s) to the header structure and fragment chain. | |
| msg_header_t * | msg_header_make (su_home_t *home, msg_hclass_t *hc, char const *s)) |
| Make a header from a value string. | |
| msg_header_t * | msg_header_vformat (su_home_t *home, msg_hclass_t *hc, char const *fmt, va_list ap)) |
| Make a MSG header with formatting provided. | |
| void | msg_header_free (su_home_t *home, msg_header_t *h) |
| Free a header structure. | |
| void | msg_header_free_all (su_home_t *home, msg_header_t *h) |
| Free a (list of) header structures. | |
| msg_payload_t * | msg_payload_create (su_home_t *home, void const *data, usize_t len)) |
| Create a MIME payload. | |
| issize_t | msg_headers_prepare (msg_t *, msg_header_t *headers, int flags) |
| Encode headers in chain. | |
| void | msg_fragment_clear (msg_common_t *h) |
| Clear encoded data from header structure. | |
| msg_param_t ** | msg_header_params (msg_common_t const *h) |
| Pointer to header parameters. | |
| char const * | msg_header_find_param (msg_common_t const *, char const *name) |
| Find a header parameter. | |
| int | msg_header_add_param (su_home_t *, msg_common_t *h, char const *param) |
| Add a parameter to a header. | |
| int | msg_header_replace_param (su_home_t *, msg_common_t *h, char const *param) |
| Replace or add a parameter to a header. | |
| int | msg_header_remove_param (msg_common_t *h, char const *name) |
| Remove a parameter from header. | |
| char const * | msg_header_find_item (msg_common_t const *h, char const *item) |
| Find a header item. | |
| int | msg_header_replace_item (su_home_t *, msg_common_t *h, char const *item) |
| Add an item to a header. | |
| int | msg_header_remove_item (msg_common_t *h, char const *name) |
| Remove an item from a header. | |
| int | msg_list_append_items (su_home_t *home, msg_list_t *k, msg_param_t const items[]) |
| Append a list of constant items to a list. | |
| int | msg_list_replace_items (su_home_t *home, msg_list_t *k, msg_param_t const items[]) |
| Replace a list of constant items on a list. | |
| int | msg_header_join_items (su_home_t *home, msg_common_t *dst, msg_common_t const *src, int duplicate) |
| Join header item lists. | |
| issize_t | msg_random_token (char token[], isize_t tlen, void const *d, isize_t dlen) |
| Generates a random token. | |
| int | msg_params_cmp (char const *const a[], char const *const b[]) |
| Compare parameter lists. | |
| size_t | msg_params_length (char const *const *params) |
| Calculate number of parameters in a parameter list. | |
| char * | msg_unquote_dup (su_home_t *home, char const *q)) |
| Unquote a string, return a duplicate. | |
| char * | msg_unquote (char *dst, char const *s) |
| Unquote string. | |
| unsigned long | msg_hash_string (char const *id) |
| Calculate a hash over a string. | |
|
||||||||||||
|
Get a header from the public message structure. Gets a pointer to header from a message structure.
|
|
||||||||||||||||
|
Duplicate and add a (list of) header(s) to the message.
The function When inserting headers into the fragment chain, a request (or status) is inserted first and replaces the existing request (or status). Other headers are inserted after the request or status. If the header is a singleton, existing headers with the same class are removed.
|
|
||||||||||||||||||||
|
Duplicate a header as a given type and add the duplicate into message.
The function When inserting headers into the fragment chain, a request (or status) is inserted first and replaces the existing request (or status). Other headers are inserted after the request or status. If the header is a singleton, existing headers with the same class are removed.
|
|
||||||||||||||||||||||||
|
Add formatting result to message. Parse result from printf-formatted params as a given header field and add result to the message.
|
|
||||||||||||||||
|
Add a parameter to a header. You should use this function only when the header accepts multiple parameters (or list items) with the same name. If that is not the case, you should use msg_header_replace_param().
|
|
||||||||||||||||
|
Add string contents to message. Duplicate a string containing headers (or a message body, if the string starts with linefeed), parse it and add resulting header objects to the message object.
|
|
||||||||||||||||
|
Allocate a header structure. The msg_header_alloc() function allocates a generic MO header structure and returns a pointer to it.
|
|
||||||||||||||||
|
Copy a list of header objects.
The function
|
|
||||||||||||
|
Duplicate a header list.
The function
|
|
||||||||||||||||
|
Duplicate a header as class hc.
The function
|
|
||||||||||||
|
Duplicate a sigle header. Deeply copy a single header.
|
|
||||||||||||||||||||
|
Encode a header.
The function msg_header_e() encodes a header field in the buffer b[]. The encoding includes its name and trailing CRLF. The function returns the length of the encoding in bytes, excluding the final
The flags parameter define how the encoding is done. If the flags specify |
|
||||||||||||
|
Find a header item. Searches for given item name from the header. If item is found, the function returns a non-NULL pointer to the item.
|
|
||||||||||||
|
Find a header parameter. Searches for given parameter name from the header. If parameter is found, it returns a non-NULL pointer to the parameter value. If there is no value for the name (in form "name" or "name=value"), the returned pointer points to a NUL character.
|
|
||||||||||||||||
|
Insert a (list of) header(s) to the fragment chain.
The function When inserting headers into the fragment chain, a request (or status) is inserted first and replaces the existing request (or status). Other headers are inserted after the request or status. If there can be only one header field of this type (hc_kind is msg_kind_single), existing header objects with the same class are removed.
|
|
||||||||||||||||||||
|
Join header item lists. Join items from a source header to the destination header. The item are compared with the existing ones. If a match is found, it is not added to the list. If duplicate is true, the entries are duplicated while they are added to the list.
|
|
||||||||||||||||
|
Add string to message. Parse a string containing headers (or a message body, if the string starts with linefeed) and add resulting header objects to the message object.
|
|
||||||||||||||||||||
|
Prepend a (list of) header(s) to the header structure and fragment chain.
The function Unlike msg_header_add(), msg_header_prepend() always inserts header h before other headers of the same class. If the header is a singleton, existing headers of the same class are removed. If the header is a list header, the values in the new header are prepended to the existing list.
|
|
||||||||||||||||
|
Remove a header from the header structure and fragment chain.
The function
|
|
||||||||||||||||
|
Remove a header list from the header structure and fragment chain.
The function
|
|
||||||||||||
|
Remove an item from a header. This function treats a msg_header_t as set of C strings. The item is a C string. If identical string is found from the list, it is removed. The shortcuts, if any, to item values are updated accordingly.
|
|
||||||||||||
|
Remove a parameter from header. The parameter name is given as token optionally followed by "=" sign and value. The "=" and value after it are ignored when selecting a parameter to remove. The possible shortcuts to parameter values are updated. For example, the "received" parameter in Via header has shortcut in structure sip_via_t, the v_received field. The shortcut to removed parameter would be set to NULL.
|
|
||||||||||||||||||||
|
Replace a header item with a (list of) header(s).
The function
|
|
||||||||||||||||
|
Add an item to a header. This function treats a msg_header_t as set of C strings. The item is a C string. If no identical string is found from the list, it is added to the list. The shortcuts, if any, to item values are updated accordingly.
|
|
||||||||||||||||
|
Replace or add a parameter to a header. A header parameter param is a string of format name "=" value or just name. The value part following "=" is ignored when selecting a parameter to replace.
|
|
||||||||||||||||
|
Encode headers in chain. The function msg_headers_prepare() encodes all the headers in the header chain. You have to call msg_serialize() before calling msg_headers_prepare() in order to make sure that all the heades and other message fragments are included in the chain.
|
|
||||||||||||||||
|
Append a list of constant items to a list.
|
|
||||||||||||||||
|
Replace a list of constant items on a list.
|
|
||||||||||||||||||||
|
Encode a message to the buffer. The function msg_encode_e encodes a message to a given buffer. It returns the length of the message to be encoded, even if the buffer is too small (just like snprintf() is supposed to do).
|
|
||||||||||||
|
Compare parameter lists. Compares parameter lists.
|
|
||||||||||||
|
Unquote a string, return a duplicate. Duplicates the string q in unquoted form. |