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.
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---