Interface Definition Language (IDL)

Use the Interface Definition Language (IDL) to define the necessary data types and declare the remote procedures for an interface. Declarations in IDl are similar to declarations in C, with additional attributes.

Interface header attributes

These specify RPC features that apply to an entire interface. One is the name you have chosen but choosing a name is not enough because someone could create another application with same name and a client would be confused about which to use. That is where the interface UUID and the version number come in.

You generate a UUID with uuidgen. The creators of DCE recognised that an interface does not stay the same forever; you are likely to update it regularly. So they are also allow for a version number in the interface header. The complete version number consists of a major and a minor version number.

During a remote procedure call, the following rules determine wheter a client can use an interface than a server supports:

When you create new versions of an interface by adding new decorations and definitions, increase the minor version number. Any other changes to an interface require a major version number change.

Type definitions, Data attributes

In C a data type can map to different sizes on different systems. For example a long data type in C may be 16, 32, or 64 bits, depending on the system. The size of an IDL data type, however, must be the same on all systems so that DCE applications can exchange data.

When you compile the interface definition, the IDL compiler generates C code dta types that begin with idl_, and places them in the header file. For example, a typedef in an interface definition uses the IDL data type long as follows:

typedef long TPartNum;

The IDL compiler generates the data type idl_long_int, corresponding to the long IDL type, and places it in the hedader file as follows:

typedef idl_long_int TPartNum;

You use the new data type, TPartNum, in your application code. Although the size of a particular IDL data type is always the same, it may map to different standard C data types on different systems. The idl_ data types are defined in a DCE RPC-supplied header file to map to the proper sized C data types for the system on which the compile took place.

The next table shows the basic IDL data types, the sizes of each in bits, and the corresponding idl_ data types. Use the IDL data types in interface definitions for type definitions, constant declarations, and procedure declarations. Use idl_ data types in your RPC application code for all return values and parameters in remote procedure calls.

IDL Data TypeSizeC Code Data Type
boolean8 bitsidl_boolean
byte8 bitsidl_byte
char8 bitsidl_char
void-void
void *opaqueapplication specific
handle_topaque rpc_binding_handle_t,
handle_t
error_status_t 32 bitsunsigned32,
unsigned long,
error_status_t
Integers
small8 bitsidl_small_int
short16 bitsidl_short_int
long32 bitsidl_long_int
hyper64 bitsidl_hyper_int
unsigned small8 bitsidl_usmall_int
unsigned short16 bitsidl_ushort_int
unsigned long32 bitsidl_ulong_int
unsigned hyper64 bitsidl_uhyper_int
Float Point
float32 bitsidl_short_float
double64 bitsidl_long_float
International Characters
ISO_LATIN_18 bitsISO_LATIN_1
ISO_UCS32 bits in a structureISO_UCS
ISO_MULTI_LINGUAL16 bits in a structureISO_MULTI_LINGUAL
Table 1. IDL data types

For 32 bit systems you can use the standard C data types (long, float, and so on) for remote procedure return values and parameters. However, to assure that your DCE application code will port to other systems, use the C code data types from Table 1 in your application code. Next table contains notes about some of IDL data types.

IDL_ TypeNotes
booleanData that is either idl_true or idl_false.
byte Data is not automatically converted when transmitted over the network to a system with a different data format. Use this type to transmit data that is untyped or opaque so that no conversion is performed on it.
char An unsigned, 8 bit character. C uses the char data type to represent 8 bit integers as well as characters, and it interprets them as signed on some systems and unsigned on others. Use the IDL char data type for true character data and use small or unsigned small to represent 8 bit integers in interface definitions.
void Indicates that a procedure does not return a value.
void * Used with the context_handle attribute to define context handles. It refers to opaque data.
handle_t Data that denotes a binding handle.
error_status_t Data that denotes an RPC communication status.
ISO_LATIN_1 The Latin character set defined by the Internatonal Standards Organization.
ISO_UCS The universal character set defined by the International Standards Oranization.
ISO_MULTI_LINGUAL A sunbset of the characters of type ISO_UCS that can be represented in two bytes.
Table 2. Notes about IDL data types


Back to my home page.