OSF DCE Application Development Guide--Core Components
Writing Internationalized RPC Applications
‘‘universal’’ code set. The DCE RPC functions for character and code set
interoperability use the universal code set as the default ‘‘intermediate’’ code set into
which a client or server can convert if there are no other compatible code sets between
them. Section 15.3.6 discusses intermediate code sets in more detail.
15.3.5.2 Establishing the Compatibility Evaluation Routine
The last step in writing an internationalized RPC client is to call the DCE RPC NSI
routine rpc_ns_import_ctx_add_eval(). The purpose of this NSI routine is to add
evaluation routines to the import context created by the rpc_ns_binding_import_-
begin( ) routine that the NSI routine rpc_ns_binding_import_next( ) will call to perform
additional compatibility evaluation on potential servers.
The internationalized RPC client code calls the rpc_ns_import_ctx_add_eval( ) routine
to set up one or more character and code set compatibility evaluation routines to be
called from rpc_ns_binding_import_next( ). The client code must make the call to
rpc_ns_import_ctx_add_eval() once for each compatibility routine that it wants to add
to the import context for rpc_ns_binding_import_next(). See the rpc_ns_import_-
ctx_add_eval(3rpc) reference page for a description of the rpc_ns_import_ctx_add_-
eval( ) routine’s signature and arguments.
The rpc_ns_import_ctx_add_eval() must be used in conjunction with the
rpc_ns_binding_import_begin/next/done( ) suite of RPC NSI binding functions
because these functions provide an import context argument. If you want to use the
rpc_ns_binding_lookup_begin/next/done/select( ) suite of RPC NSI routines, your
client code will need to perform character and code set evaluation logic on the binding
handle returned by rpc_ns_binding_select(). Section 15.3.6.4 provides a sample client
that performs character and code set evaluation in conjunction with the lookup and
select RPC NSI routines.
15.3.5.3 Sample Client Code
Here is an example of an internationalized RPC client that calls the operation defined in
the cs_test interface shown in Section 15.3.1. The client establishes the DCE RPC
evaluation routine rpc_cs_eval_without_universal() as the character and code set
evaluation routine to use.
#include <stdio.h>
#include <locale.h>
#include <dce/rpc.h>
#include <dce/rpcsts.h>
#include <dce/dce_error.h>
#include "cs_test.h" /* IDL generated header file */
/*
* Result check MACRO
124245 Tandem Computers Incorporated 15− 23