HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
182 HP-UX C SIP Stack Programmer’s Guide
Working With Multipart MIME
/*=========================================================================================*/
void AppCreateMultipartBodyFromBodyParts(
IN RvChar *strBodyPart1,
IN RvChar *strBodyPart2,
INOUT RvSipBodyHandle hBody)
{
RvSipBodyPartHandle hBodyPart;
RvSipContentTypeHeaderHandle hContentType;
RvStatus rv;
/*Constructs the Content-Type header within the given body object. Note that the
received Body was constructed outside of this function.*/
rv = RvSipContentTypeHeaderConstructInBody (hBody, &hContentType);
if (RV_OK != rv)
{
printf("Failed to construct Content-Type header");
return;
}
/*Sets the Content-Type to be of type multipart. A unique boundary will be generated by
the Stack when you encode the Body object.*/
RvSipContentTypeHeaderSetMediaType(hContentType, RVSIP_MEDIATYPE_MULTIPART, NULL);
RvSipContentTypeHeaderSetMediaSubType(hContentType, RVSIP_MEDIASUBTYPE_ALTERNATIVE,
NULL);
/*Constructs a new Body Part within the given body object. The body part is constructed
at the end of the body parts list.*/
rv = RvSipBodyPartConstructInBody(hBody, RV_FALSE, &hBodyPart);
if (RV_OK != rv)
{
printf("Failed to construct body part");
return;
}
/*Parses a body part string.*/
rv = RvSipBodyPartParse(hBodyPart, strBodyPart1,
strlen(strBodyPart1));
if (RV_OK != rv)
{
printf("Failed to parse body part");
return;
}