HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
168 HP-UX C SIP Stack Programmer’s Guide
Handling Messages with Syntax Errors
FIXING BAD SYNTAX
M
ESSAGES
There are cases where the application knows in advance that a certain header
from the remote party will be received with a syntax error. This is usually the
case when the application needs to work with another application that is not
fully standard-compliant. The error can sometimes be crucial for SIP Stack
message processing, such as an error in the top Via header.
The SIP Stack gives the application the option of fixing such syntax errors using
a dedicated API. When the bad syntax callback is called, the application can
query the message for the bad syntax element, fix the element with the relevant
API function and then choose the “continue processing” option.
BAD SYNTAX EVENTS
(CALLBACKS)
The SIP Stack supplies two events, in the form of callback functions, for bad
syntax message control. If these events are not implemented, the Stack uses its
default behavior.
In order to receive an event, your application should define the event handler
function and pass the event handler pointer to the TransportMgr. When a bad
syntax message is received, the relevant event handler will be called using the
supplied pointer.
The following events for bad syntax message handling are supplied with the
Transport API:
RvSipTransportBadSyntaxMsgEv()
Notifies the application that a bad syntax message was received. This callback
indicates that the syntax error is in one of the message headers. The callback
supplies the application with the bad syntax message. The application can use
the Message API and retrieve all the bad-syntax headers, fix, or remove them
from the message. Using this callback the application should instruct the Stack
on how to handle the message—discard, reject or continue processing.
If you do not implement this event, the Stack will discard bad syntax messages.
RvSipTransportBadSyntaxStartLineMsgEv()
Notifies the application that a bad syntax message was received. This callback
indicates that the syntax error is in the message start line. The callback supplies
the application with the bad syntax message. The application can use the