HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Working with SIP Messages 165
Handling Messages with Syntax Errors
BAD SYNTAX HEADER The general grammar of any SIP header is “header-name: header-value”. When
the SIP Stack parses a header, it first constructs the header object according to
the header-name part and then parses the header-value into the object-specific
fields.
If the header-value contains syntax errors, it is kept in the object as a single
string in the StrBadSyntax parameter. All other header fields are set to NULL or
UNDEFINED. Figure 9-4 illustrates how the message holds a To header object
with a syntax error.
Figure 9-4 Example of Syntax Error
BAD SYNTAX START
L
INE
The start-line of a message can also include syntax errors. The message has
specific fields to hold start line parameters of requests and responses.
When a message has a defected start line, the start line string is kept entirely in
the StrBadSyntaxStartLine parameter and all other start line parameters remain
empty. A SIP message with a bad syntax start line does not have a defined type
and the message is not recognized as a request or response.
HANDLING BAD
S
YNTAX MESSAGES
As explained above, the SIP Stack parses messages with syntax errors into
regular message and header objects. The SIP Stack consults the application on
how to handle incoming messages with syntax errors using callback functions.
Whenever a message is received with a syntax error a suitable callback function
is called.
Party
Header
Object
To: Bob <sip:UserB@th<ere.com>;tag=314159>
Display name = NULL
Tag = NULL
AddrSpec = NULL
Other params = NULL
StrBadSyntax = Bob <sip:UserB@th<ere.com>;tag=314159