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

Working with SIP Messages 157
Working with SIP Messages
PARSING To get a header object from a string encoded according to the specifications of
RFC 3261, you should use the Parse() or ParseValue() function.
Sample Code
The following code demonstrates how to parse a textual Contact header into a
Contact header object.
/*==================================================================================*/
void ContactHeaderParse(IN RvSipContactHeaderHandle hContact)
{
RvStatus status;
RvChar* strContact = "Contact: Carol Lee<sip:carol.lee@example.com>";
status = RvSipContactHeaderParse(hContact,strContact);
if(status != RV_OK)
{
printf("RvSipContactHeaderParse failed");
return;
}
}
/*==================================================================================*/
There are also general functions which are not specific to a header type for
encoding and parsing headers. The names of these functions are
RVSipHeaderXXX, where XXX = Encode, Parse, ParseValue.
ADDING N EW H EADERS
TO A MESSAGE
To add new headers to a message, you should use the xxxConstructInMsg()
functions.
If you want to add the new header to the header list, you should also declare
whether you want it to be added to the top or bottom of the list.
Sample Code
The following code demonstrates the creation of new From and Contact headers.