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