ONC+ Developer's Guide

RPCL Special Cases

Several exceptions to the RPC language rules follow.

RPCL C-style Mode

The features of the C-style mode of rpcgen have implications for the passing of void arguments. No arguments need be passed if their value is void.

RPCL Booleans

C has no built-in Boolean type. However, the RPC library uses a Boolean type called bool_t that is either TRUE or FALSE. Parameters declared as type bool in XDR language are compiled into bool_t in the output header file.

Example:

bool married; --> bool_t married;

RPCL Strings

The C language has no built-in string type, but instead uses the null-terminated char * convention. In C, strings are usually treated as null-terminated single-dimensional arrays.

In XDR language, strings are declared using the string keyword, and compiled into type char * in the output header file. The maximum size contained in the angle brackets specifies the maximum number of characters allowed in the strings, not counting the NULL character. You can omit the maximum size, indicating a string of arbitrary length.

Examples:

string name<32>;   --> char *name;
string longname<>; --> char *longname;

NULL strings cannot be passed; however, a zero-length string (that is, just the terminator or NULL byte) can be passed.

RPCL Opaque Data

Opaque data is used in XDR to describe untyped data, that is, sequences of arbitrary bytes. You can declare opaque data either as a fixed-length or variable-length array.

Examples:

opaque diskblock[512]; --> char diskblock[512];
opaque filedata<1024>; --> struct {
                             u_int filedata_len;
                             char *filedata_val;
                         } filedata;

RPCL Voids

In a void declaration, the variable is not named. The declaration is just void and nothing else. Void declarations can only occur in two places: union definitions and program definitions as the argument or result of a remote procedure; for example, no arguments are passed.