OSF DCE Application Development Guide--Introduction and Style Guide

Appendix A. A Sample Application
This chapter presents the complete code for a generic sample application that illustrates
the recommended policies. The code is as generic as possible in the sense that it
demonstrates things that most servers need to do. This generic server code is contained in
the sample_server.c and sample_server.h modules. The application-specific portion
consists of a set of simple examples to illustrate various styles of RPC data usage,
including pointers, pipes, and context handles. These illustrations are contained in
sample_manager.c (the server side) and sample_client.c (the client side). sample.idl
contains a set of sample interface definitions for the illustrated usages.
A.1 The Generic Server
The generic server implemented by sample_server.c demonstrates a variety of tasks that
most servers need to carry out, such as exporting bindings, creating an authentication
identity, establishing an ACL manager, and handling asynchronous signals. As much as
possible, the bulk of each task is implemented as one or more separate functions. This
modularity makes it easier to understand the requirements for coding each task since
each function or related set of functions can be studied separately. Also, because the
tasks performed are fairly generic, the functions should be reusable in something close to
the form presented here by many servers.
The IDL file sample.idl is included here mainly to demonstrate the data type
declarations used for the ACL manager. A more complete IDL file is given in Section
A.2 to show how the illustrated RPC data types are declared.
/****************************************************************************/
/* [27.VI.94] */
/* */
/* sample.idl -- */
/* */
/* */
/* */
/* -77 cols- */
/****************************************************************************/
124246 Tandem Computers Incorporated A1