OSF DCE Application Development Guide--Introduction and Style Guide
Errors and Messaging
The following fragments illustrate remote error handling using a common status
parameter. The .idl file for the sample interface includes the following declarations:
void sample_call(
[in] handle_t binding,
[out] long *status,
[in,out] error_status_t *remote_status);
This is matched in the .acf file by the following:
interface sample
{
sample_call([comm_status,fault_status] remote_status);
}
Then, for example, the server implementation of the sample_call( ) remote call can
return the smp_s_no_perms status code on authorization failure:
void
sample_call(
rpc_binding_handle_t binding, /* Client binding. */
idl_long_int *status,
error_status_t *remote_status)
{
extern uuid_t sample_acl_mgr_uuid, sample_acl_uuid;
boolean32 authorized = 0;
/* We have to explicitly initialize the remote status value; */
/* otherwise, if no error occurs in the transmission (which */
/* would cause the runtime to assign an error value to this */
/* variable), its value will be whatever it happened to be */
/* when the RPC was made by the client... */
*remote_status = rpc_s_ok;
DCE_SVC_DEBUG((smp_svc_handle,
smp_s_manager,
svc_c_debug6,
"Entering sample_call()..."));
/* Check whether client is authorized or not... */
DCE_SVC_DEBUG((smp_svc_handle,
smp_s_manager,
svc_c_debug6,
"Calling dce_acl_is_client_authorized()..."));
124246 Tandem Computers Incorporated 7− 11