PreviousNext

Context Handles

Manager code often maintains state information for a client. A handle to this state information is passed to the client in an output parameter or as an operation result. The client passes the unchanged handle-to-the-state information as an input or input/output parameter of a subsequent manager operation that the client calls to manipulate that data structure. This handle-to-the-state information is called a context handle. A context handle is implemented as an untyped pointer or a pointer to a structure by tag name.

The manager causes the untyped pointer or the structure pointer to point to the state information it will need the next time the client asks the manager to manipulate the context. For the client, the context handle is an opaque pointer (idl_void_p_t or an opaque structure tag). The client receives or supplies the context handle by means of the parameter list, but does not perform any transformations on it.

The RPC runtime maintains the context handle, providing an association between the client and the address space running the manager and the state information within that address space.

If a manager supports multiple interfaces, and a client obtains a context handle by performing an operation from one of these interfaces, the client can then supply the context handle to an operation from another of these interfaces.

A context handle can only be exchanged between the server process that created it and the client process for which it was created. No other client except the one that obtained the context handle can use it without causing an application error.

More:

The context_handle Attribute

The Context Rundown Procedure

Creating New Context

Reclaiming Client Memory Resources for the Context Handle

Relationship of Context Handles and Binding

Rules for Using Context Handles

Examples Using Context Handles