Loading...
Searching...
No Matches
Parser Building Blocks

This submodule contains the functions and types for building a protocol-specific parser. More...

## Files

file | msg_date.h
| Types and functions for handling dates and times.
file | msg_mclass.h
| Parser table and message factory object.
file | msg_mclass_hash.h
| Hash function for header names.
file | msg_parser.h
| Message parser interface.

## Functions

issize_t | msg_auth_d (su_home_t *home, msg_header_t *h, char *s, isize_t slen)
| Parse security headers.
msg_time_t | msg_now (void)
| Return current time as seconds since Mon, 01 Jan 1900 00:00:00 GMT.
msg_mclass_t * | msg_mclass_clone (msg_mclass_t const *old, int newsize, int empty)
| Clone a message class.
msg_mclass_t * | msg_mclass_clone (msg_mclass_t const *old, int newsize, int empty)
| Clone a message class.

## Detailed Description

This submodule contains the functions and types for building a protocol-specific parser.

## Function Documentation

## msg_mclass_clone() [1/2]

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.

Parameters

  [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

Returns
  The function msg_mclass_clone() returns a pointer to a newly copied message class object, or NULL upon an error. The returned message class object can be freed with free().

Errors:

\n ENOMEM
  A memory allocation failed.

\n EINVAL
  The function was given invalid arguments.

Note
  The empty parser can handle request/status line. All headers are put into list of unknown headers (unless they are malformed, and they are put into list of erronous headers). However, SIP, RTSP, and HTTP protocols all require that the parser recognizes Content-Length header before they can extract the message body from the data received from network.

## msg_mclass_clone() [2/2]

msg_mclass_t * msg_mclass_clone | ( | msg_mclass_t const * | old,
|  | int | newsize,
|  | int | empty )

related

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.

Parameters

  [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

Returns
  The function msg_mclass_clone() returns a pointer to a newly copied message class object, or NULL upon an error. The returned message class object can be freed with free().

Errors:

\n ENOMEM
  A memory allocation failed.

\n EINVAL
  The function was given invalid arguments.

Note
  The empty parser can handle request/status line. All headers are put into list of unknown headers (unless they are malformed, and they are put into list of erronous headers). However, SIP, RTSP, and HTTP protocols all require that the parser recognizes Content-Length header before they can extract the message body from the data received from network.

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.