OSF DCE Application Development Guide--Introduction and Style Guide

RPC Parameters
in,out parameters
For reference pointers, the client application must allocate memory for
the pointed-to nodes. For full pointers, on making the call, the client
application must allocate memory for the pointed-to node. On return, the
stub keeps track of whether each parameter is the original full pointer
passed by the client, or a new pointer allocated by the server. If a
pointer is unchanged, the returned data overwrites the existing pointed-
to node. If a pointer is new, the stub allocates memory for the pointed-to
node. When a parameter contains pointers, such as an element in a
linked list, the stub keeps track of the chain of references, allocating
nodes as necessary.
It is the client application’s responsibility to free any memory allocated
by the stub for new nodes. Clients can call the routine
rpc_sm_client_free( ) for this purpose.
If the server deletes or eliminates a reference to a pointed to node, an
orphaned node may be created on the client side. It is the client
application’s responsibility to keep track of memory that it has allocated
for pointed-to nodes and to deal with any nodes for which the server no
longer has references.
6.2.3 Server Side Allocation
in parameters
For all pointer types, the stub manages all memory for pointed-to nodes.
out parameters
For reference pointers, the stub allocates memory for the pointed-to
nodes as long as the size of the targets can be determined at compile
time. When the manager routine is entered, such reference pointers
point to valid storage. For parameters that contain full pointers, the
server manager code must allocate memory for pointed-to nodes.
Servers can call the routine rpc_sm_allocate( ) for this purpose.
in,out parameters
For reference pointers, the stub allocates memory for pointed-to nodes if
either the size of the pointed to nodes can be determined at compile time
or the reference pointers point to values received from the client. When
the manager routine is entered, such reference pointers point to valid
storage. For full pointers, the stub allocates memory for the original
pointed-to nodes. The server manager code must allocate memory if it
creates new references. Servers can call the routine rpc_sm_allocate()
for this purpose.
The server stub automatically frees all memory allocated with rpc_sm_allocate().
124246 Tandem Computers Incorporated 65