xref: /linux/tools/net/sunrpc/xdrgen/tests/test.x (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1 /* Sample XDR specification from RFC 1832 Section 5.5 */
2 
3 const MAXUSERNAME = 32;     /* max length of a user name */
4 const MAXFILELEN = 65535;   /* max length of a file      */
5 const MAXNAMELEN = 255;     /* max length of a file name */
6 
7 /*
8  * Types of files:
9  */
10 enum 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  */
19 union filetype switch (filekind kind) {
20 case TEXT:
21    void;                           /* no extra information */
22 case DATA:
23    string creator<MAXNAMELEN>;     /* data creator         */
24 case EXEC:
25    string interpretor<MAXNAMELEN>; /* program interpretor  */
26 };
27 
28 /*
29  * A complete file:
30  */
31 struct 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