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

Working with SIP Messages 159
Stand-alone Headers
CREATING A
S
TAND-ALONE HEADER
When constructing a stand-alone header, you must provide the MessageMgr
handle and a memory page. The Construct() function creates the header object
on the given page and returns a handle to the new header object. For more
information about the memory pool, see the Memory Pool chapter.
Sample Code
The following code demonstrates the creation of a stand-alone CSeq header.
/*==========================================================================*/
RvStatus CreateStandAlone(HRPOOL hPool,
HPAGE hPage, RvSipMsgMgrHandle hMgr)
{
RvStatus status;
RvSipCSeqHeaderHandle hCSeq;
/*Constructs a standalone CSeq header.*/
status = RvSipCSeqHeaderConstruct(hMgr, hPool, hPage, &hCSeq);
if(status!= RV_OK)
{
printf("RvSipCSeqHeaderConstruct failed.Status is %d", status);
return status;
}
/*Sets the CSeq header parameters.*/
RvSipCSeqHeaderSetStep(hCSeq, 12);
RvSipCSeqHeaderSetMethodType(hCSeq, RVSIP_METHOD_INVITE, NULL);
return RV_OK;
}
/*==========================================================================*/
SETTING A
S
TAND-ALONE H EADER
IN A MESSAGE
There are two types of functions you can use to insert stand-alone headers in a
message. The function type you use depends on the headers you wish to insert.
The function types you may use are as follows:
Set Functions
Use Set functions to insert To, From, CSeq, Content-length,
Content-Type and Call-ID headers in a message. These headers
are not kept in the header list, so you can set them directly in the
message using the appropriate set function.
Push functions
Use Push functions to insert all headers that are kept in the
header list of the message, such as Allow, Via, Contact and
Other headers.