OSF DCE Application Development Guide--Core Components
Writing Internationalized RPC Applications
between the local and network code sets. And, if you use the cs_tag_rtn attribute, you
must provide the routine that sets the code set tag parameters for the operations in the
application that transfer international characters.
DCE RPC provides several buffer-sizing routines and one tag-setting routine. You can
use the DCE RPC routines, or you can develop your own customized buffer-sizing and
tag-setting routines; the choice depends upon your application’s requirements. The next
sections describe these types of stub support routines in more detail.
15.3.3.1 Buffer-Sizing Routines
Different code sets use different numbers of bytes to encode a single character.
Consequently, there is always the possibility that the converted string can be larger than
the original string when converting data from one code set to another. The function of
the buffer-sizing routines is to calculate the necessary buffer size for code set conversion
between local and network code sets and return their findings to the client and server
stubs, which call these buffer-sizing routines before marshalling and unmarshalling any
international character data. The stubs then allocate a new buffer, if necessary, before
calling the code set conversion routines.
You must provide the following buffer-sizing routines for each local type that you define
with the cs_char attribute:
• local_type_name_net_size( )—Calculates the necessary buffer size for code set
conversion 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_local_size()—Calculates the necessary buffer size for code set
conversion 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 (_net_size or _local_size).
DCE RPC provides buffer-sizing routines for the cs_byte and wchar_t data types. The
cs_byte data type is equivalen to the byte type, while the wchar_t data type is a
platform-dependent data type whose range of values can represent encodings for all
members of the largest international character set that exists within the set of
character/code sets supported on the host.
The DCE RPC buffer-sizing routines are
• cs_byte_net_size( )—Calculates the necessary buffer size for code set conversion
from a local code set to a network code set when the cs_byte type has been specified
as the local data type in the .acf file.
• cs_byte_local_size()—Calculates the necessary buffer size for code set conversion
from a network code set to a local code set when the cs_byte type has been specified
as the local data type in the .acf file.
• wchar_t_net_size()—Calculates the necessary buffer size for code set conversion
from a local code set to a network code set when the wchar_t data type has been
specified as the local data type in the .acf file.
124245 Tandem Computers Incorporated 15− 11