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

172 HP-UX C SIP Stack Programmers Guide
Handling Messages with Syntax Errors
/*===================================================================================*/
RvStatus RVCALLCONV AppTransportBadSyntaxMsgEv(
IN RvSipTransportMgrHandle hTransportMgr,
IN RvSipAppTransportMgrHandle hAppTransportMgr,
IN RvSipMsgHandle hMsgReceived,
OUT RvSipTransportBsAction *peAction)
{
RvStatus rv = RV_OK;
void* pHeader = NULL;
RvSipHeaderType eHeaderType;
RvSipHeaderListElemHandle hElem;
*peAction = RVSIP_TRANSPORT_BS_ACTION_CONTINUE_PROCESS;
/*Loops and gets all headers with syntax errors.*/
pHeader = RvSipMsgGetBadSyntaxHeader (hMsgReceived, RVSIP_FIRST_HEADER, &hElem,
&eHeaderType);
while (pHeader != NULL)
{
/*Tries to fix the bad syntax header.*/
rv = AppFixHeader(pHeader, eHeaderType);
if(rv != RV_OK)
{
printf("fixing header failed. reject message");
*peAction = RVSIP_TRANSPORT_BS_ACTION_REJECT_MSG;
return RV_OK;
}
pHeader = RvSipMsgGetBadSyntaxHeader (hMsgReceived, RVSIP_NEXT_HEADER, &hElem,
&eHeaderType);
}
printf("all headers were fixed. Continue processing the message");
return RV_OK;
}
/*===================================================================================*/
Sample Two: Fixing a bad syntax CSeq header
The following sample code demonstrates how to fix a bad syntax CSeq header.
A CSeq header has the following format: CSeq: 3 UPDATE