DCE Application Programming Guide

Sample Application Listings
HP NonStop DCE Application Programming Guide429551-003
A-6
The Server File
rpc_server_inq_bindings( &bindings, /* (3) */
&status);
ERR_CHK(status,"Could not get binding vector");
/* Bindings are exported to the namespace by the install program. */
/* Therefore we do not do it here */
rpc_ep_register( infpls_v1_0_s_ifspec, /* (4) */
bindings,
NULL,
annotation,
&status);
ERR_CHK(status,"Could not register endpoint");
printf("Information Server is now available\n");
TRY {
rpc_server_listen( max_threads, /* (5) */
&status);
ERR_CHK(status,"Could not listen"); /* (b) */
}
FINALLY {
rpc_ep_unregister( infpls_v1_0_s_ifspec, /* (6) */
bindings,
NULL,
&status);
} ENDTRY;
} /* End of Server Control Routine */
/************************* Server Operations *************************/
error_status_t get_system_info(
rpc_binding_handle_t binding, /* binding handle is not used */
sys_info_t *system_info_p)
{
struct utsname *info_p;
info_p=rpc_ss_allocate (sizeof (struct utsname));
if (info_p==NULL)
{
return (-1);
}
if (uname (info_p) < 0)
{
return ((error_status_t)errno); /* (c) */
}
else
{
system_info_p->sysname_p = (idl_char *) &info_p->sysname;
system_info_p->nodename_p = (idl_char *) &info_p->nodename;
system_info_p->release_p = (idl_char *) &info_p->release;
system_info_p->version_p = (idl_char *) &info_p->version;
system_info_p->machine_p = (idl_char *) &info_p->machine;
return (rpc_s_ok);
}
]
Figure A-4. The Server File in a Straight Port (page 2 of 2)