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