HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
358 HP-UX C SIP Stack Programmer’s Guide
Using the Memory Pool
RPOOL_Construct()
Constructs a new memory pool. The memory for the new pool is allocated when
calling this function. This function receives parameters that indicate the number
of pages and the size of each page in the newly constructed pool.
RPOOL_Destruct()
Destroys a memory pool. Memory allocated to the pool is freed.
RPOOL_GetPage()
Gets one page from the memory pool.
RPOOL_FreePage()
Releases a given page. This function returns the released page to the memory
pool.
RPOOL_CopyToExternal()
Copies a given number of bytes from a given page into a given buffer.
RPOOL_AppendFromExternalToPage()
Copies a given number of bytes from a given buffer onto a given page. The
function output is the offset of the string on the page.
RPOOL_Strlen()
Returns the length of a NULL terminated string located on the specified page in
a specified offset.
Note RPOOL_CopyToExternal() copies non-consecutive memory into a
consecutive buffer. RPOOL_AppendFromExternalToPage() copies a consecutive
buffer to a non-consecutive memory.
USING THE
M
EMORY POOL
The sample codes in this section demonstrate how to use the SIP Stack memory
pool.
CONSTRUCTING AND
DESTRUCTING A
M
EMORY POOL
The following code demonstrates how to construct and destruct a memory pool
and how to get a new page for using in calls to SIP Stack API functions.