OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
The MANAGER.C Example
#include <stdio.h>
#include "string_tree.h"
/*
** Prune the left subtree of the specified tree and return
** it as the function value.
*/
st_node_t *st_prune_left (tree)
/* [in,out] */ st_node_t *tree;
{
st_node_t *left_sub_tree = tree->left;
tree->left = (st_node_t *)NULL;
return left_sub_tree;
}
The SERVER.C Example
#include <stdio.h>
#include "string_tree.h" /* header created by idl compiler */
#define check_error(s, msg) if(s != rpc_s_ok) \
{fprintf(stderr, "%s", msg); exit(1);}
main ()
{
unsigned32 status; /* error status (nbase.h) */
rpc_binding_vector_p_t binding_vector;
/* set of binding handles (rpc.h) */
rpc_server_register_if( /* register interface with RPC runtime */
string_tree_v0_0_s_ifspec,
/* interface specification (string_tree.h) */
NULL,
NULL,
&status /* error status */
);
check_error(status, "Can’t register interface\n");
rpc_server_use_all_protseqs( /* establish protocol sequences */
rpc_c_protseq_max_calls_default,
/* concurrent calls server takes (rpc.h) */
&status
);
check_error(status, "Can’t establish protocol sequences\n");
rpc_server_inq_bindings( /* get set of this server’s binding handles */
&binding_vector,
&status
);
check_error(status, "Can’t get binding handles\n");
17 56 Tandem Computers Incorporated 124245