HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
180 HP-UX C SIP Stack Programmer’s Guide
Working With Multipart MIME
/*==================================================================================*/
void AppParseMultipartMixedBody(IN RvSipMsgHandle hMsg)
{
RvSipBodyHandle hBody;
RvSipBodyPartHandle hBodyPart;
RvUint32 length;
RvChar *strBody;
RvStatus rv;
/*Gets the body object of the message.*/
hBody = RvSipMsgGetBodyObject(hMsg);
if (NULL == hBody)
{
return;
}
/*Gets the body string from the body object.*/
length = RvSipBodyGetBodyStrLength(hBody);
strBody = malloc((length)*sizeof(RvChar));
rv = RvSipBodyGetBodyStr(hBody, strBody, length, &length);
if (RV_OK != rv)
{
free(strBody);
printf("Get body string failed");
return;
}
/*Parse the body string.*/
rv = RvSipBodyMultipartParse(hBody, strBody, length);
if (RV_OK != rv)
{
free(strBody);
printf("Parse multipart body failed");
return;
}
free(strBody);
/*Views the list of body parts.*/
rv = RvSipBodyGetBodyPart(hBody, RVSIP_FIRST_ELEMENT, NULL, &hBodyPart);