8ec6614ddb8ac714d8580b2235d1b7a0175504fc
[deb_libnfs.git] / nlm / nlm.x
1 /* based on rfc1813 and wireshark */
2
3 typedef unsigned hyper uint64;
4
5 struct nlm_fh4 {
6 opaque data<>;
7 };
8
9 typedef string nlm4_oh<>;
10
11 struct nlm_cookie {
12 opaque data<>;
13 };
14
15 enum nlmstat4 {
16 NLM4_GRANTED = 0,
17 NLM4_DENIED = 1,
18 NLM4_DENIED_NOLOCKS = 2,
19 NLM4_BLOCKED = 3,
20 NLM4_DENIED_GRACE_PERIOD = 4,
21 NLM4_DEADLCK = 5,
22 NLM4_ROFS = 6,
23 NLM4_STALE_FH = 7,
24 NLM4_FBIG = 8,
25 NLM4_FAILED = 9
26 };
27
28 struct nlm4_holder {
29 bool exclusive;
30 unsigned int svid;
31 nlm4_oh oh;
32 uint64 l_offset;
33 uint64 l_len;
34 };
35
36 const NLM_MAXNAME = 256;
37 struct nlm4_lock {
38 string caller_name<NLM_MAXNAME>;
39 struct nlm_fh4 fh;
40 nlm4_oh oh;
41 unsigned int svid;
42 uint64 l_offset;
43 uint64 l_len;
44 };
45
46 struct nlm4_share {
47 string caller_name<NLM_MAXNAME>;
48 struct nlm_fh4 fh;
49 nlm4_oh oh;
50 unsigned int mode;
51 unsigned int access;
52 };
53
54 struct nlm4_testres_denied {
55 nlm4_holder holder;
56 };
57
58 union nlm4_testreply switch (nlmstat4 status) {
59 case NLM4_DENIED:
60 nlm4_testres_denied lock;
61 default:
62 void;
63 };
64
65 struct NLM4_TESTres {
66 nlm_cookie cookie;
67 nlm4_testreply reply;
68 };
69
70 struct NLM4_TESTargs {
71 nlm_cookie cookie;
72 bool exclusive;
73 nlm4_lock lock;
74 };
75
76 struct NLM4_CANCres {
77 nlm_cookie cookie;
78 nlmstat4 status;
79 };
80
81 struct NLM4_CANCargs {
82 nlm_cookie cookie;
83 bool block;
84 bool exclusive;
85 nlm4_lock lock;
86 };
87
88 struct NLM4_UNLOCKres {
89 nlm_cookie cookie;
90 nlmstat4 status;
91 };
92
93 struct NLM4_UNLOCKargs {
94 nlm_cookie cookie;
95 nlm4_lock lock;
96 };
97
98 struct NLM4_LOCKres {
99 nlm_cookie cookie;
100 nlmstat4 status;
101 };
102
103 struct NLM4_LOCKargs {
104 nlm_cookie cookie;
105 bool block;
106 bool exclusive;
107 nlm4_lock lock;
108 bool reclaim;
109 int state;
110 };
111
112 struct NLM4_GRANTEDargs {
113 nlm_cookie cookie;
114 bool exclusive;
115 nlm4_lock lock;
116 };
117
118 struct NLM4_GRANTEDres {
119 nlm_cookie cookie;
120 nlmstat4 status;
121 };
122
123 program NLM_PROGRAM {
124 version NLM_V4 {
125 void
126 NLM4_NULL(void) = 0;
127
128 NLM4_TESTres
129 NLM4_TEST(NLM4_TESTargs) = 1;
130
131 NLM4_LOCKres
132 NLM4_LOCK(NLM4_LOCKargs) = 2;
133
134 NLM4_CANCres
135 NLM4_CANCEL(NLM4_CANCargs) = 3;
136
137 NLM4_UNLOCKres
138 NLM4_UNLOCK(NLM4_UNLOCKargs) = 4;
139
140 NLM4_GRANTEDres
141 NLM4_GRANT(NLM4_GRANTEDargs) = 5;
142
143 void
144 NLM4_TEST_MSG(NLM4_TESTargs) = 6;
145
146 void
147 NLM4_LOCK_MSG(NLM4_LOCKargs) = 7;
148
149 void
150 NLM4_CANCEL_MSG(NLM4_CANCargs) = 8;
151
152 void
153 NLM4_UNLOCK_MSG(NLM4_UNLOCKargs) = 9;
154
155 void
156 NLM4_GRANT_MSG(NLM4_GRANTEDargs) = 10;
157
158 void
159 NLM4_TEST_RES(NLM4_TESTres) = 11;
160
161 void
162 NLM4_LOCK_RES(NLM4_LOCKres) = 12;
163
164 void
165 NLM4_CANCEL_RES(NLM4_CANCres) = 13;
166
167 void
168 NLM4_UNLOCK_RES(NLM4_UNLOCKres) = 14;
169
170 void
171 NLM4_GRANT_RES(NLM4_GRANTEDres) = 15;
172
173 /* nlm4_shareres */
174 /* NLM4_SHARE(nlm4_shareargs) = 20; */
175
176 /* nlm4_shareres */
177 /* NLM4_UNSHARE(nlm4_shareargs) = 21; */
178
179 /* nlm4_res */
180 /* NLM4_NM_LOCK(nlm4_lockargs) = 22; */
181
182 /* void */
183 /* NLM4_FREE_ALL(nlm4_notify) = 23; */
184 } = 4;
185 } = 100021;