OSF DCE Application Development Guide--Core Components

Writing Internationalized RPC Applications
15.3.4.3 Registering the Server’s Supported Code Sets in the Namespace
The next step in writing an internationalized RPC server is to make a call in the server’s
initialization code to the DCE RPC routine rpc_ns_mgmt_set_attribute( ), which takes
the code sets array returned by rpc_rgy_get_codesets() and exports it to the server’s
entry in the name service database. The routine creates a ‘‘code sets’’ NSI attribute in
the name service database and associates it with the server entry created by the NSI
export operation.
The purpose of this step is to register the server’s supported code sets into the name
service database so that clients can gain access to the information. Note, then, that
server entries for internationalized RPC servers will have code sets attributes in addition
to the binding attributes and object attributes for the servers. For a general discussion of
NSI attributes, see Chapter 14. Refer to the rpc_ns_mgmt_set_attribute(3rpc)
reference page for a description of the rpc_ns_mgmt_set_attribute( ) routine’s signature
and arguments.
15.3.4.4 Establishing a Cleanup Function for the Namespace
The last step in writing an internationalized RPC server is to add a call to the DCE RPC
routine rpc_ns_mgmt_remove_attribute( ) to the cleanup code within the server’s
initialization code. This DCE RPC routine will remove the code sets attribute associated
with the server entry from the name service database when it is called from the cleanup
code as the result of a server crash or exit. See the
rpc_ns_mgmt_remove_attribute(3rpc) reference page for a description of the
rpc_ns_mgmt_remove_attribute() routine’s signature and arguments.
15.3.4.5 Sample Server Code
Here is an example of an internationalized RPC server that exports the cs_test interface
defined in Section 15.3.1.
#include <stdio.h>
#include <stdlib.h>
#include <dce/rpc.h>
#include <dce/nsattrid.h>
#include <dce/dce_error.h>
#include <locale.h>
#include <pthread.h>
#include <dce/codesets.h>
#include "cs_test.h"
/*
* Macro for result checking
*/
#define CHECK_STATUS(t, func, returned_st, expected_st) \
124245 Tandem Computers Incorporated 15 17