This directory and its subdirectories contain the complete code for the inventory application shown in Appendix D of "Guide to Writing DCE Applications," 2nd edition, by John Shirley, Wei Hu, and David Magid, published by O'Reilly & Associates, Inc. This application offers a number of examples that form the basis for discussions of various topics throughout the book, particularly in Chapters 2 through 4. A makefile is also included in this directory, and in each of the subdirectories. You will probably have to change the libraries listed in the makefiles, because the names and contents can vary from one vendor to another, and from one release to the next. The subdirectories must remain in their current locations in order for their makefiles to work. The purpose of this application, and the RPC programming techniques that it illustrates, are covered in the book. The rest of this README file consists of directions for building and running the application, taken from the text of the appendix. The contents of this directory are: -rw-rw-r-- 1 1390 Jun 2 1992 Makefile -rw-rw-r-- 1 9288 Mar 11 10:28 README drwxr-xr-x 2 512 Mar 11 10:19 explicit -rw-rw-r-- 1 4457 Jun 2 1992 i_client.c -rw-rw-r-- 1 83 Apr 21 1992 i_client.sh -rw-rw-r-- 1 5925 Jun 2 1992 i_procedures.c -rw-rw-r-- 1 5886 Aug 20 1992 i_server.c -rw-rw-r-- 1 6099 Aug 20 1992 implement_inventory.c drwxr-xr-x 2 512 Mar 11 10:19 implicit -rw-rw-r-- 1 3435 Aug 20 1992 inventory.idl explicit: total 14 -rw-rw-r-- 1 1807 Apr 21 1992 Make_OSF -rw-rw-r-- 1 1857 Jun 2 1992 Makefile -rw-rw-r-- 1 4696 Jun 2 1992 explicit_client.c -rw-rw-r-- 1 368 Jun 2 1992 inventory.acf -rw-rw-r-- 1 3768 Jun 2 1992 inventory.h implicit: total 19 -rw-rw-r-- 1 1873 Apr 21 1992 Make_OSF -rw-rw-r-- 1 1926 Jun 2 1992 Makefile -rw-rw-r-- 1 2216 Aug 20 1992 do_import_binding.c -rw-rw-r-- 1 1808 Aug 20 1992 do_interpret_binding.c -rw-rw-r-- 1 4621 Jun 2 1992 implicit_client.c -rw-rw-r-- 1 363 Aug 20 1992 inventory.acf -rw-rw-r-- 1 3261 Jun 2 1992 inventory.h D _________________________________________________________________ The Inventory Application The inventory application allows a user to inquire about, and order from, a simple inventory. Data structures are defined in the interface definition for the following items: Part number (to identify a part) Part name Part description Part price Quantity of part Part list Account number (to identify a user) Procedures are also defined in the interface definition to do the following: Confirm if a part is available. Obtain a part name. Obtain a part description. Obtain a part price. Obtain the quantity of parts available. Obtain a list of subpart numbers. Order a part. The application demonstrates many features of DCE application development including: o Using strings, pointers, structures, a union, and a conformant array. o Allocating new memory in a remote procedure for data returned to the client using stub support routines. The get_part_description and whatare_subparts remote procedures demonstrate server allocation of a string and a conformant structure. The Inventory Application D-1 The Inventory Application o Managing protocol sequences, interpreting binding information, selecting binding information, and using exception handler macros. o Variations on a client using ACFs and the automatic, implicit, and explicit binding methods. o Finding a server by importing from a name service database. How to Run the Application To run the local test of the client, type the following: C> make local C> local_i_client.exe To run the server of the distributed application, type the following: S> make server S> i_server.exe Before you run the client that uses the automatic binding method for the first time, set the RPC environment variable, RPC_DEFAULT_ENTRY, to the name service group name for the inventory application. Type the following: C> make client C> setenv RPC_DEFAULT_ENTRY /.:/inventory_group C> i_client.exe To run a nondistributed local test of the implicit client, type the following in the implicit subdirectory: C> make local C> local_implicit_client.exe To run the implicit client of the distributed application, type the following in the implicit subdirectory: C> make client C> implicit_client.exe To run the explicit client of the distributed application, type the following in the explicit subdirectory: C> make client C> explicit_client.exe D-2 The Inventory Application The Inventory Application Application Files Makefile contains descriptions of how the application is compiled. Some files depend on the header file check_ status.h from the arithmetic application for the CHECK_ STATUS macro. i_client.sh is a shell script to set the environment and execute the client that uses automatic binding management. inventory.idl contains the description of the constants, data types, and procedures for the interface. i_procedures.c is the implementation of all the remote procedures defined in this interface. implement_inventory.c is the implementation of the inventory database. For simplicity, only three inventory items are included. The part numbers for these are printed when the inventory is opened. i_server.c initializes the server with a series of runtime calls prior to servicing remote procedure calls. In addition to the required calls, this server also selects a specific protocol sequence, uses exception handling macros, and does some basic cleanup when the server quits. i_client.c displays the instructions for the user and processes user input in a loop until exit is selected. Each remote procedure is exercised depending on the input from the user. implicit/implicit_client.c imports a binding handle from the name service database. explicit/explicit_client.c imports a binding handle from the name service database. All procedures have a binding handle as the first parameter. implicit/Makefile contains descriptions of how the implicit client is compiled. Some files depend on the header file check_status.h from the arithmetic application for the CHECK_STATUS macro. The server for the implicit client is the same as the one for the automatic client. The Inventory Application D-3 The Inventory Application implicit/inventory.acf customizes how you use an interface. In this application it is used to select the implicit binding method. implicit/do_import_binding.c contains the do_import_binding procedure, that shows how to import a binding handle from the name service database. implicit/do_interpret_binding.c contains the do_interpret_ binding procedure, that shows how to obtain the binding information to which a binding handle refers. explicit/Makefile contains descriptions of how the explicit client is compiled. Some files depend on the header file check_status.h from the arithmetic application for the CHECK_STATUS macro. The compilation depends on some files from the implicit client development. The server for the explicit client is the same as the one for the automatic and implicit clients. explicit/inventory.acf customizes how you use an interface. In this application it is used to select the explicit binding method for all remote procedures in the interface. D-4 The Inventory Application