HP-UX C SIP Stack Programmer's Guide (Novembery 2007)

166 HP-UX C SIP Stack Programmers Guide
Handling Messages with Syntax Errors
In the callback functions, the application can query the message for its bad
message parts and fix syntax errors. The application should then instruct the
Stack on how to continue with the message processing with one of the following
options:
Discard the message
Reject the message
Continue message processing
The three options are defined in the RvSipTransportBsAction enumeration,
where “Bs” stands for bad syntax. For more information, see the SIP Stack
Reference Guide.
“D
ISCARD MESSAGE
OPTION
The application can instruct the Stack to discard bad syntax messages using the
RVSIP_TRANSPORT_BS_ACTION_DISCARD_MSG option. Using this
option will cause the Stack to ignore the message as if it was never received.
This option can be used to maintain the behavior of version 2.2 applications.
This is also the default behavior of the Stack.
“R
EJECT MESSAGE
O
PTION
The application can instruct the Stack to reject bad syntax messages using the
RVSIP_TRANSPORT_BS_ACTION_REJECT_MSG option. This option is
relevant only for defected request messages. Choosing this option causes the
Stack to reject incoming bad syntax requests with 400 response code. The reject
message reason phrase will include the syntax-error information. If you choose
the reject message option on a bad syntax response, the Stack will discard this
response message.
“C
ONTINUE MESSAGE
P
ROCESSING” OPTION
The application can instruct the Stack to continue processing bad syntax
messages using the
RVSIP_TRANSPORT_BS_ACTION_CONTINUE_PROCESS option.
Choosing this option instructs the Stack to continue the message processing
even though the message contains bad syntax elements. If, in any of the
processing stages, the stack finds that an essential header has syntax errors,
requests will still be rejected with 400 response code and responses will be
ignored.
If, for example, the Stack receives a bad syntax INVITE request and the error is
in the Via header, the Stack will not be able to create a transaction, since the Via
header is part of the transaction key. In this case, the Stack will reject the
request with 400 response code.
However, if the Stack receives a bad syntax INVITE request and the syntax
error is in a Date header, which has no logical meaning for the SIP Stack, the
message will be handled as usual.