Initial import from FreeBSD RELENG_4:
[dragonfly.git] / include / rpcsvc / nlm_prot.x
1 /* @(#)nlm_prot.x       2.1 88/08/01 4.0 RPCSRC */
2 /* @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro */
3
4 /*
5  * Network lock manager protocol definition
6  * Copyright (C) 1986 Sun Microsystems, Inc.
7  *
8  * protocol used between local lock manager and remote lock manager
9  */
10
11 #ifdef RPC_HDR
12 %#define LM_MAXSTRLEN   1024
13 %#define MAXNAMELEN     LM_MAXSTRLEN+1
14 %#include <sys/types.h>
15 #else
16 %#ifndef lint
17 %static const char rcsid[] =
18 %  "$FreeBSD: src/include/rpcsvc/nlm_prot.x,v 1.8.2.1 2001/08/01 06:39:36 alfred Exp $";
19 %#endif /* not lint */
20 #endif
21
22 /*
23  * status of a call to the lock manager
24  */
25 enum nlm_stats {
26         nlm_granted = 0,
27         nlm_denied = 1,
28         nlm_denied_nolocks = 2,
29         nlm_blocked = 3,
30         nlm_denied_grace_period = 4
31 };
32
33 struct nlm_holder {
34         bool exclusive;
35         int svid;
36         netobj oh;
37         u_int32_t l_offset;
38         u_int32_t l_len;
39 };
40
41 union nlm_testrply switch (nlm_stats stat) {
42         case nlm_denied:
43                 struct nlm_holder holder;
44         default:
45                 void;
46 };
47
48 struct nlm_stat {
49         nlm_stats stat;
50 };
51
52 struct nlm_res {
53         netobj cookie;
54         nlm_stat stat;
55 };
56
57 struct nlm_testres {
58         netobj cookie;
59         nlm_testrply stat;
60 };
61
62 struct nlm_lock {
63         string caller_name<LM_MAXSTRLEN>;
64         netobj fh;              /* identify a file */
65         netobj oh;              /* identify owner of a lock */
66         int32_t svid;           /* generated from pid for svid */
67         u_int32_t l_offset;
68         u_int32_t l_len;
69 };
70
71 struct nlm_lockargs {
72         netobj cookie;
73         bool block;
74         bool exclusive;
75         struct nlm_lock alock;
76         bool reclaim;           /* used for recovering locks */
77         int32_t state;          /* specify local status monitor state */
78 };
79
80 struct nlm_cancargs {
81         netobj cookie;          
82         bool block;
83         bool exclusive;
84         struct nlm_lock alock;
85 };
86
87 struct nlm_testargs {
88         netobj cookie;          
89         bool exclusive;
90         struct nlm_lock alock;
91 };
92
93 struct nlm_unlockargs {
94         netobj cookie;          
95         struct nlm_lock alock;
96 };
97
98
99 #ifdef RPC_HDR
100 %/*
101 % * The following enums are actually bit encoded for efficient
102 % * boolean algebra.... DON'T change them.....
103 % */
104 #endif
105 enum    fsh_mode {
106         fsm_DN  = 0,    /* deny none */
107         fsm_DR  = 1,    /* deny read */
108         fsm_DW  = 2,    /* deny write */
109         fsm_DRW = 3     /* deny read/write */
110 };
111
112 enum    fsh_access {
113         fsa_NONE = 0,   /* for completeness */
114         fsa_R    = 1,   /* read only */
115         fsa_W    = 2,   /* write only */
116         fsa_RW   = 3    /* read/write */
117 };
118
119 struct  nlm_share {
120         string caller_name<LM_MAXSTRLEN>;
121         netobj  fh;
122         netobj  oh;
123         fsh_mode        mode;
124         fsh_access      access;
125 };
126
127 struct  nlm_shareargs {
128         netobj  cookie;
129         nlm_share       share;
130         bool    reclaim;
131 };
132
133 struct  nlm_shareres {
134         netobj  cookie;
135         nlm_stats       stat;
136         int32_t sequence;
137 };
138
139 struct  nlm_notify {
140         string name<MAXNAMELEN>;
141         int32_t state;
142 };
143
144 enum nlm4_stats {
145         nlm4_granted = 0,
146         nlm4_denied = 1,
147         nlm4_denied_nolocks = 2,
148         nlm4_blocked = 3,
149         nlm4_denied_grace_period = 4,
150         nlm4_deadlck = 5,
151         nlm4_rofs = 6,
152         nlm4_stale_fh = 7,
153         nlm4_fbig = 8,
154         nlm4_failed = 9
155 };
156
157 struct nlm4_holder {
158         bool    exclusive;
159         int32_t svid;
160         netobj  oh;
161         u_int64_t       l_offset;
162         u_int64_t       l_len;
163 };
164
165 struct nlm4_stat {
166         nlm4_stats stat;
167 };
168
169 union nlm4_testrply switch (nlm4_stats stat) {
170         case nlm4_denied:
171                 struct nlm4_holder holder;
172         default:
173                 void;
174 };
175
176 struct nlm4_res {
177         netobj cookie;
178         nlm4_stat stat;
179 };
180
181 struct nlm4_testres {
182         netobj cookie;
183         nlm4_testrply stat;
184 };
185
186
187 struct nlm4_lock {
188         string caller_name<LM_MAXSTRLEN>;
189         netobj fh;              /* identify a file */
190         netobj oh;              /* identify owner of a lock */
191         int32_t svid;           /* generated from pid for svid */
192         int64_t l_offset;
193         int64_t l_len;
194 };
195
196 struct nlm4_lockargs {
197         netobj cookie;
198         bool block;
199         bool exclusive;
200         struct nlm4_lock alock;
201         bool reclaim;           /* used for recovering locks */
202         int32_t state;          /* specify local status monitor state */
203 };
204
205
206 struct nlm4_cancargs {
207         netobj cookie;          
208         bool block;
209         bool exclusive;
210         struct nlm4_lock alock;
211 };
212
213 struct nlm4_testargs {
214         netobj cookie;          
215         bool exclusive;
216         struct nlm4_lock alock;
217 };
218
219 struct nlm4_unlockargs {
220         netobj cookie;          
221         struct nlm4_lock alock;
222 };
223
224 struct  nlm4_share {
225         string caller_name<LM_MAXSTRLEN>;
226         netobj  fh;
227         netobj  oh;
228         fsh_mode        mode;
229         fsh_access      access;
230 };
231
232 struct  nlm4_shareargs {
233         netobj  cookie;
234         nlm4_share      share;
235         bool    reclaim;
236 };
237
238 struct  nlm4_shareres {
239         netobj  cookie;
240         nlm4_stats      stat;
241         int32_t sequence;
242 };
243
244 struct  nlm4_notify {
245         string name<MAXNAMELEN>;
246         int32_t state;
247 };
248
249 /*
250  * Over-the-wire protocol used between the network lock managers
251  */
252
253 program NLM_PROG {
254         version NLM_VERS {
255
256                 nlm_testres     NLM_TEST(struct nlm_testargs) = 1;
257
258                 nlm_res         NLM_LOCK(struct nlm_lockargs) = 2;
259
260                 nlm_res         NLM_CANCEL(struct nlm_cancargs) = 3;
261                 nlm_res         NLM_UNLOCK(struct nlm_unlockargs) =     4;
262
263                 /*
264                  * remote lock manager call-back to grant lock
265                  */
266                 nlm_res         NLM_GRANTED(struct nlm_testargs)= 5;
267                 /*
268                  * message passing style of requesting lock
269                  */
270                 void            NLM_TEST_MSG(struct nlm_testargs) = 6;
271                 void            NLM_LOCK_MSG(struct nlm_lockargs) = 7;
272                 void            NLM_CANCEL_MSG(struct nlm_cancargs) =8;
273                 void            NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
274                 void            NLM_GRANTED_MSG(struct nlm_testargs) = 10;
275                 void            NLM_TEST_RES(nlm_testres) = 11;
276                 void            NLM_LOCK_RES(nlm_res) = 12;
277                 void            NLM_CANCEL_RES(nlm_res) = 13;
278                 void            NLM_UNLOCK_RES(nlm_res) = 14;
279                 void            NLM_GRANTED_RES(nlm_res) = 15;
280         } = 1;
281
282         version NLM_VERSX {
283                 nlm_shareres    NLM_SHARE(nlm_shareargs) = 20;
284                 nlm_shareres    NLM_UNSHARE(nlm_shareargs) = 21;
285                 nlm_res         NLM_NM_LOCK(nlm_lockargs) = 22;
286                 void            NLM_FREE_ALL(nlm_notify) = 23;
287         } = 3;
288
289         version NLM4_VERS {
290                 void            NLMPROC4_NULL(void) = 0;
291                 
292                 nlm4_testres NLMPROC4_TEST(struct nlm4_testargs) = 1;
293
294                 nlm4_res        NLMPROC4_LOCK(struct nlm4_lockargs) = 2;
295
296                 nlm4_res        NLMPROC4_CANCEL(struct nlm4_cancargs) = 3;
297                 nlm4_res        NLMPROC4_UNLOCK(struct nlm4_unlockargs) = 4;
298
299                 /*
300                  * remote lock manager call-back to grant lock
301                  */
302                 nlm4_res                NLMPROC4_GRANTED(struct nlm4_testargs)= 5;
303                 /*
304                  * message passing style of requesting lock
305                  */
306                 void            NLMPROC4_TEST_MSG(struct nlm4_testargs) = 6;
307                 void            NLMPROC4_LOCK_MSG(struct nlm4_lockargs) = 7;
308                 void            NLMPROC4_CANCEL_MSG(struct nlm4_cancargs) =8;
309                 void            NLMPROC4_UNLOCK_MSG(struct nlm4_unlockargs) = 9;
310                 void            NLMPROC4_GRANTED_MSG(struct nlm4_testargs) = 10;
311                 void            NLMPROC4_TEST_RES(nlm4_testres) = 11;
312                 void            NLMPROC4_LOCK_RES(nlm4_res) = 12;
313                 void            NLMPROC4_CANCEL_RES(nlm4_res) = 13;
314                 void            NLMPROC4_UNLOCK_RES(nlm4_res) = 14;
315                 void            NLMPROC4_GRANTED_RES(nlm4_res) = 15;
316                 
317                 nlm4_shareres   NLMPROC4_SHARE(nlm4_shareargs) = 20;
318                 nlm4_shareres   NLMPROC4_UNSHARE(nlm4_shareargs) = 21;
319                 nlm4_res        NLMPROC4_NM_LOCK(nlm4_lockargs) = 22;
320                 void            NLMPROC4_FREE_ALL(nlm4_notify) = 23;
321         } = 4;
322
323 } = 100021;
324