Loading...
Searching...
No Matches
SIP Parser

This part of the Sofia documentation describes the internal working of SIP parser.

It documents the internal functions and macros used when a new parser is added.

The sip module contains interface to the SIP headers and message objects. The interface is abstracted using objects known as header classes and message classes.

The message class defines how a message is handled: parsed and encoded. It contains a parser table with references to header classes. It also contains function pointers used by the parser to handle message body and other details that vary between protocols.

A header class defines how a single header is parsed. Each header has its own header class. There are also header classes for message elements that are not really headers, like request and status line, separator between headers and message body (which is also known as payload). There is also a header classes for unknown headers and headers that contained parsing errors.

# Adding Headers to Parser

Sofia SIP Parser can be extended easily, either by application or by internally extending the sofia-sip library itself.

Create a header template for your header just like sip_rfc2543.h.in, e.g, sip_example.h.in:

␌
#ifndef SIP_EXAMPLE_H
#define SIP_EXAMPLE_H
#ifndef SIP_H
#include <sofia-sip/sip.h>
#endif
struct sip_also_s
{
sip_common_t also_common[1];
sip_also_t *also_next;
char const *also_display;
url_t also_url[1];
};
typedef struct sip_also_s sip_also_t;
typedef sip_generic_t sip_hide_t;
typedef sip_auth_t sip_encryption_t;
typedef sip_auth_t sip_response_key_t;
struct sip_example_dummy_structure {
/* === Headers start here */
sip_also_t *sip_also;
sip_hide_t *sip_hide;
sip_encryption_t *sip_encryption;
sip_response_key_t *sip_response_key;
/* === Headers end here */
};
␌
␌
#endif
--->8---->8---->8---->8---->8---->8---->8---->8---->8---->8---->8---->8---
*
sip.h
SIP objects.
sip_generic_t
struct msg_generic_s sip_generic_t
Type of a generic SIP header.
Definition sip.h:117
sip_common_t
msg_common_t sip_common_t
Common part of all the header structures.
Definition sip.h:121
sip_auth_t
msg_auth_t sip_auth_t
Authorization, Proxy-Authenticate, WWW-Authenticate
Definition sip.h:130
url_t

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