OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
wchar_t_local_size()—Calculates the necessary buffer size for code set conversion
from a network code set to a local code set when the wchar_t data type has been
specified as the local data type in the .acf file.
If your internationalized RPC application uses either of these data types as the local type
in the ACF, it can use these DCE RPC buffer-sizing routines; in order to do so, simply
link with the DCE library when compiling your application. The example ACF shown
earlier in this chapter uses the cs_byte type as the local type. Consequently, the client
and server stubs will use the cs_byte_ buffer-sizing routines. Refer to the
cs_byte_*(3rpc) and wchar_t_*(3rpc) reference pages for a description of the cs_byte_
and wchar_t_ routine signatures and functions.
Applications that use data types other than cs_byte or wchar_t as their local data types
will need to provide their own buffer-sizing routines. User-provided buffer-sizing
routines must follow the same signature as the DCE RPC-provided buffer-sizing
routines. See the cs_byte_*(3rpc) and wchar_t_*(3rpc) reference pages for a
description of the required routine signatures.
15.3.3.2 Code Set Conversion Routines
When RPC clients and servers exchange international character data, the data being
exchanged needs to be understood by both client and server. Both client and server need
to understand a character set, and both client and server need to understand the way that
character set is expressed. Code set conversion provides a way for a character set to be
represented in a form that both client and server can understand, given that the client and
server are using a compatible character set. (In general, character set conversion is not
recommended; it is unlikely that clients and servers would want to map, for example,
German characters to Chinese characters due to the data loss that would occur as a
result.)
The stub support routines for code set conversion provide the mechanism for the stubs to
use to convert between different code sets, given that character set compatibility has
been established. The code set conversion routines translate a character set from one
encoding to another. Consequently, the code set conversion routines provide the way for
a character set to be represented in a form that both client and server can understand.
You must provide the following code set conversion routines for each local type that you
define with the cs_char attribute:
local_type_name_to_netcs( )—Converts international character data from a local
code set to a network code set. Client and server stubs call this routine before they
marshall any international character data.
local_type_name_from_netcs()—Converts international character data from a
network code set to a local code set. Client and server stubs call this routine before
they unmarshall any international character data.
You specify the name for the local data type in the local_type_name portion of the
function name and the appropriate suffix name (_to_netcs or _from_netcs).
DCE RPC provides code set conversion routines for the cs_byte and wchar_t data types.
These routines are
15 12 Tandem Computers Incorporated 124245