HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
154 HP-UX C SIP Stack Programmer’s Guide
Working with SIP Messages
return RV_ERROR_UNKNOWN;
}
/*Gets the From header value--direct access.*/
fromHeader = RvSipMsgGetFromHeader(hMsg);
if(fromHeader != NULL)
{
/*Performs an action with the From Header.*/
}
/*Gets all the Via header values using the header list functions.*/
viaHeader =
(RvSipViaHeaderHandle)RvSipMsgGetHeaderByType(hMsg,
RVSIP_HEADERTYPE_VIA,
RVSIP_FIRST_HEADER,
&listElem);
while (viaHeader != NULL)
{
/*Performs an action with the Via header that was received.*/
/*Gets the next one.*/
viaHeader =
(RvSipViaHeaderHandle)RvSipMsgGetHeaderByType(hMsg,
RVSIP_HEADERTYPE_VIA,
RVSIP_NEXT_HEADER,
&listElem);
}
return RV_OK;
}
/*===================================================================================*/
ENCODING AND
P
ARSING
The Message API provides a set of functions for encoding and parsing SIP
messages.
E
NCODING To get the encoded format of a SIP message according to the specifications of
RFC 3261, you should use the encoding functions. There are encode functions
for messages and for each header of a message.
All the encode functions work in the same way, by getting the memory pool
handle and constructing a new page for the encoded string. The function returns
the handle to the page and the length of the encoded string. If you need the
encoded string on a regular buffer, you should allocate the buffer and copy the
encoded string from the page to the buffer.
For more information about the memory pool, see the Memory Pool chapter.