File: simple.x

package info (click to toggle)
libvirt 11.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 211,168 kB
  • sloc: ansic: 537,214; xml: 335,516; python: 12,041; perl: 2,626; sh: 2,175; makefile: 448; javascript: 126; cpp: 22
file content (35 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Example from https://www.rfc-editor.org/rfc/rfc4506#section-7 */

const MAXUSERNAME = 32; /* max length of a user name */
const MAXFILELEN = 65535; /* max length of a file */
const MAXNAMELEN = 255; /* max length of a file name */

/*
 * Types of files:
 */
enum filekind {
   TEXT = 0, /* ascii data */
   DATA = 1, /* raw data   */
   EXEC = 2  /* executable */
};

/*
 * File information, per kind of file:
 */
union filetype switch (filekind kind) {
case TEXT:
   void; /* no extra information */
case DATA:
   string creator<MAXNAMELEN>; /* data creator */
case EXEC:
   string interpretor<MAXNAMELEN>; /* program interpretor */
};
/*
 * A complete file:
 */
struct file {
   string filename<MAXNAMELEN>; /* name of file */
   filetype type; /* info about file */
   string owner<MAXUSERNAME>; /* owner of file */
   opaque data<MAXFILELEN>; /* file data */
};