OSF DCE Application Development Guide--Core Components
Attribute Configuration Language
The cs_char attribute differs from the [transmit_as] attribute in that it does not affect
the network contract between the client and server. It differs from the [represent_as]
attribute in that multiple data items (for example, the characters of an array or string)
can be converted with a single stub call to user-written conversion code, and that the
conversion can modify array size and data limit information between what is transmitted
over the network and what is used by application code.
The cs_char attribute has the following syntax. (See the examples at the end of this
section.)
typedef [cs_char (local_type_name)] net_type_name;
The local_type_name is the local data type that the application code uses. You can
define it in the IDL file or in an application header file. If you do not define it in the IDL
file, use the include statement in the ACF to make its definition available to the stubs.
The net_type_name is the data type that is defined in the IDL file. When used with the
cs_char attribute, this data type is always byte in the IDL file.
If you use the cs_char attribute, you must write the following stub support routines for
each local type that you define:
• Routines that check the buffer storage requirements for international character data
to be converted to determine whether or not more buffer space needs to be allocated
to hold the converted data
• Routines to perform conversion between local and network code sets
The suffix for the routine names, the function of each, and where they are used (client or
server) appear in the following list:
• 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.
• 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. The name that you specify cannot exceed 20 characters because the
entire generated name must not exceed the 31-character limit for C identifiers.
For each piece of international character data being marshalled, the _net_size and
_to_netcs routines are called once each. For each piece of international character data
being unmarshalled, the _local_size and _from_netcs routines are called once each.
DCE RPC provides buffer sizing and code set conversion routines for the cs_byte and
wchar_t data types (the cs_byte type is equivalent to the byte type). If they meet the
124245 Tandem Computers Incorporated 18− 21