XDR/RPC protocol specification

The XDR language specification

This specification uses a modified Backus-Naur Form notation for describing the XDR language. This is a brief description of the notation:

For example, consider the following pattern:

a very (, very)* [cold and] rainy (day | night)

An infinite number of strings match this pattern. A few of them are:

a very rainy day
a very, very rainy day
a very cold and rainy day
a very, very, very cold and rainy night

Lexical notes

  1. Comments begin with ``/*'' and end with ``*/''.

  2. White space serves to separate items and is otherwise ignored.

  3. An identifier is a letter followed by an optional sequence of letters, digits or underbars (``_''). The case of identifiers is significant.

  4. A constant is a sequence of one or more decimal digits, optionally preceded by a minus-sign (``-'').

Syntax information

	type-specifier identifier
	| type-specifier identifier [ value ]
	| type-specifier identifier < [ value ] >
	| opaque identifier [ value ]
	| opaque identifier < [ value ] >
	| string identifier < [ value ] >
	| type-specifier * identifier
	| void

value: constant | identifier

type-specifier: [ unsigned ] int | [ unsigned ] hyper | float | double | bool | enum-type-spec | struct-type-spec | union-type-spec | identifier

enum-type-spec: enum enum-body

enum-body: { ( identifier = value ) ( , identifier = value )* }

struct-type-spec: struct struct-body

struct-body: { ( declaration ; ) ( declaration ; )* }

union-type-spec: union union-body

union-body: switch ( declaration ) { ( case value : declaration ; ) ( case value : declaration ; )* [ default : declaration ; ] }

constant-def: const identifier = constant ;

type-def: typedef declaration ; | enum identifier enum-body ; | struct identifier struct-body ; | union identifier union-body ;

definition: type-def | constant-def

specification: definition *

Syntax notes

  1. The following are keywords and cannot be used as identifiers:

    bool const enum int struct union
    case default float opaque switch unsigned
    char double hyper string typedef void

  2. Only unsigned constants may be used as size specifications for arrays. If an identifier is used, it must have been declared previously as an unsigned constant in a const definition.

  3. Constant and type identifiers within the scope of a specification are in the same name space and must be declared uniquely within this scope.

  4. Similarly, variable names must be unique within the scope of struct and union declarations. Nested struct and union declarations create new scopes.

  5. The discriminant of a union must be of a type that evaluates to an integer. That is, int, unsigned int, bool, an enum type or any typedefed type that evaluates to one of these. Also, the case values must be valid discriminant values. Finally, a case value may not be specified more than once within the scope of a union declaration.

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005