OSF DCE Application Development Guide--Core Components
Writing Internationalized RPC Applications
15.3.6.4 Example Character and Code Set Evaluation Logic
Here is an example client program of the cs_test interface that provides its own character
and code set evaluation logic. This example client uses the rpc_cs_binding_set_tags( )
routine to set the code set tags within the client code rather than using a tag-setting
routine to set them within the stub code.
#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
*/
#define CHECK_STATUS(t, func, returned_st, expected_st) \
{\
if (returned_st == expected_st) { \
; /* No operation */
}else{\
dce_error_inq_text(returned_st,\
(unsigned char *)unexpected, &dce_status); \
dce_error_inq_text(expected_st,\
(unsigned char *)expected, &dce_status); \
printf("FAILED %s()\nresult: %s\nexpected: %s\n\n", \
func, unexpected, expected); \
}\
}\
static unsigned char unexpected[dce_c_error_string_len];
static unsigned char expected[dce_c_error_string_len];
static int dce_status;
void
main(void)
{
rpc_binding_handle_t bind_handle;
rpc_ns_handle_t lookup_context;
rpc_binding_vector_p_t bind_vec_p;
unsigned_char_t *entry_name;
unsigned32 binding_count;
cs_byte net_string[SIZE];
cs_byte loc_string[SIZE];
int i, k, rpc_num;
int model_found, smir_true, cmir_true;
rpc_codeset_mgmt_p_t client, server;
unsigned32 stag;
124245 Tandem Computers Incorporated 15− 31