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

360 HP-UX C SIP Stack Programmers Guide
Using the Memory Pool
Note You can construct the application memory pool when you initialize your
application and keep using the memory pool until the application terminates.
COPYING A PAGE INTO
A BUFFER
The following code demonstrates how to copy the content of a page into a
consecutive buffer.
Sample Code
/*=========================================================================================*/
RvStatus PrintPageContent(IN HRPOOL memoryPool,
IN HPAGE memoryPage)
{
RvStatus retStatus;
/* Defines a consecutive buffer of size 21.*/
RvChar memoryString[21];
/* Copies 20 bytes from the memoryPage page to the memoryString buffer. The
copying begins at the beginning of the page. Note that the memoryPage page
belongs to the memoryPool memory pool.*/
retStatus = RPOOL_CopyToExternal(memoryPool, memoryPage, 0, memoryString, 20);
if (retStatus != RV_OK)
{
return retStatus;
}
memoryString[20] = '\0';
/* Prints the memory string to screen.*/
printf("The memory string is %s", memoryString);
return RV_OK;
}
/*=========================================================================================*/
COPYING A BUFFER TO
A PAGE
The following code demonstrates how to copy one buffer to another buffer using
a memory page.