#include "config.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <limits.h>
#include <errno.h>
#include <stdarg.h>
#include <sofia-sip/su_tagarg.h>
#include <sofia-sip/su.h>
#include <sofia-sip/su_alloc.h>
#include "msg_internal.h"
#include "sofia-sip/msg_parser.h"
#include "sofia-sip/msg_mclass.h"
#include "sofia-sip/msg_mclass_hash.h"
Include dependency graph for msg_mclass.c:
Defines | |
#define | CRLF_TEST(cr, lf) |
Calculate length of line ending (0, 1 or 2). | |
Functions | |
msg_mclass_t * | msg_mclass_clone (msg_mclass_t const *old, int newsize, int empty) |
Clone a message class. | |
int | msg_mclass_insert_header (msg_mclass_t *mc, msg_hclass_t *hc, unsigned short offset) |
Add a new header to the message class. | |
int | msg_mclass_insert_with_mask (msg_mclass_t *mc, msg_hclass_t *hc, unsigned short offset, unsigned short flags) |
Add a new header to the message class. | |
int | msg_mclass_insert (msg_mclass_t *mc, msg_href_t const *hr) |
Add a header reference to the message class. | |
msg_href_t const * | msg_find_hclass (msg_mclass_t const *mc, char const *s, isize_t *return_start_of_content) |
Search for a header class. |
#define CRLF_TEST | ( | cr, | |||
lf | ) |
Calculate length of line ending (0, 1 or 2).
msg_href_t const* msg_find_hclass | ( | msg_mclass_t const * | mc, | |
char const * | s, | |||
isize_t * | return_start_of_content | |||
) |
Search for a header class.
The function msg_find_hclass() searches for a header class from a message class based on the contents of the header to be parsed. The buffer s should point to the first character in the header name.
[in] | mc | message class object |
[in] | s | header contents |
[out] | return_start_of_content | start of header content (may be NULL) |
msg_mclass_t* msg_mclass_clone | ( | msg_mclass_t const * | old, | |
int | newsize, | |||
int | empty | |||
) |
Clone a message class.
The function msg_mclass_clone() makes a copy of message class object old. It is possible to resize the hash table by giving a non-zero newsize. If newsize is 0, the size of hash table is not changed. If empty is true, the copied message class object will not recognize any headers. This is useful if more fine-grained control of parsing process is required, for instance.
[in] | old | pointer to the message class object to be copied |
[in] | newsize | size of hash table in the copied object |
[in] | empty | if true, resulting copy does not contain any headers |
int msg_mclass_insert | ( | msg_mclass_t * | mc, | |
msg_href_t const * | hr | |||
) |
Add a header reference to the message class.
[in,out] | mc | pointer to a message class object |
[in] | hr | header reference object |
int msg_mclass_insert_header | ( | msg_mclass_t * | mc, | |
msg_hclass_t * | hc, | |||
unsigned short | offset | |||
) |
Add a new header to the message class.
Insert a header class hc to the message class object mc. If the given offset of the header in public message structure" is zero, the function extends the public message structure in order to store newly inserted header there.
[in,out] | mc | pointer to a message class object |
[in] | hc | pointer to a header class object |
[in] | offset | offset of the header in public message structure |
int msg_mclass_insert_with_mask | ( | msg_mclass_t * | mc, | |
msg_hclass_t * | hc, | |||
unsigned short | offset, | |||
unsigned short | flags | |||
) |
Add a new header to the message class.
Insert a header class hc to the message class mc. If the given offset of the header in public message structure is zero, extend the size of the public message structure in order to store headers at the end of structure.
[in,out] | mc | pointer to a message class |
[in] | hc | pointer to a header class |
[in] | offset | offset of the header in public message structure |
[in] | flags | classification flags for the header |