PreviousNext

Context Handles in the Interface

The .idl file declarations for the store interface are as follows:

/*

* store.idl

* A sample interface that demonstrates server maintained context.

* The client requests temporary storage of a specified size,

* and the server returns a handle that can be used to read and

* write to storage. The interface doesn't care how the

* server implements the storage.

*/

[

uuid(0019b8c5-e8b5-1c84-9a41-0000c0d4de56),

pointer_default(ref),

version(1.0)

]

interface store

{

/* A context handle used to access remote storage: */

typedef [context_handle] void* store_handle_t;

/* A storage object name string: */

/* typedef [string] char* store_name_t; */

/* A buffer type for data: */

typedef byte store_buf_t[*];

/* Note that the context handle is an [out] parameter of the open */

/* routine, an [in, out] parameter of the close routine, and an */

/* [in] parameter of the other routines. If the context handle */

/* were treated as an [in] parameter of the close routine, the */

/* stubs would never learn that the context had been set to NULL, */

/* and would consider the context to still be live. This would */

/* result in the rundown routine's being called when the client */

/* terminated, even though there would be no context to run down. */

void store_open(

[in] handle_t binding,

[in] unsigned32 store_size,

[out] store_handle_t *store_h,

[out] error_status_t *status

);

void store_close(

[in,out] store_handle_t *store_h,

[out] error_status_t *status

);

void store_set_ptr(

[in] store_handle_t store_h,

[in] unsigned32 offset,

[out] error_status_t *status

);

void store_read(

[in] store_handle_t store_h,

[in] unsigned32 buf_size,

[out, size_is(buf_size), length_is(*data_size)] \

store_buf_t buffer,

[out] unsigned32 *data_size,

[out] error_status_t *status

);

void store_write(

[in] store_handle_t store_h,

[in] unsigned32 buf_size,

[in, size_is(buf_size)] store_buf_t buffer,

[out] unsigned32 *data_size,

[out] error_status_t *status

);

}