ACSE/Presentation and ROSE Interface Programmer's Guide

Chapter 4 53
Programming Guide
2. Manage the A/P Environment
Isolate the allocations and freeing of memory passed to the A/P
library to a single function. For example:
void *ubuf_ptr;
user_get_osi_buf (&ubuf_ptr, len,”data to put in ubuf”);
ap_snd (.., ubuf_ptr);
Do not statically initialize a cdata structure. For example, do not
use the statement:
a_assoc_req_env_t peer_application = {...};
Do not use the udata_length part of the cdata parameter for
inbound indications. Instead, calculate the length from the osi_buf
that is returned. Isolate this calculation to one routine.