37 lines · plain
1/* Sample XDR specification from RFC 1832 Section 5.5 */2 3const MAXUSERNAME = 32; /* max length of a user name */4const MAXFILELEN = 65535; /* max length of a file */5const MAXNAMELEN = 255; /* max length of a file name */6 7/*8 * Types of files:9 */10enum filekind {11 TEXT = 0, /* ascii data */12 DATA = 1, /* raw data */13 EXEC = 2 /* executable */14};15 16/*17 * File information, per kind of file:18 */19union filetype switch (filekind kind) {20case TEXT:21 void; /* no extra information */22case DATA:23 string creator<MAXNAMELEN>; /* data creator */24case EXEC:25 string interpretor<MAXNAMELEN>; /* program interpretor */26};27 28/*29 * A complete file:30 */31struct file {32 string filename<MAXNAMELEN>; /* name of file */33 filetype type; /* info about file */34 string owner<MAXUSERNAME>; /* owner of file */35 opaque data<MAXFILELEN>; /* file data */36};37