ONC+ Developer's Guide

RPCL Structures

An RPC/XDR struct is declared almost exactly like its C counterpart. It looks like the following.

struct-definition:
 	struct struct-ident "{"
      declaration-list
 	"}" 
declaration-list:
 	declaration ";"
 	declaration ";" declaration-list

The following XDR structure is an example of a 2–D coordinate and the C structure that it compiles into.

struct coord {                 struct coord {
 	int x;            -->           int x;
 	int y;                          int y;
};                             };
                               typedef struct coord coord;

The output is identical to the input, except for the added typedef at the end of the output. This typedef enables you to use coord instead of struct coord when declaring items.