nlm_prot.x revision 1.3 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 */
7
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.3 1997/10/09 14:21:22 lukem Exp $");
17 %#endif /* not lint */
18 #endif
19
20 /*
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
29 };
30
31 struct nlm_holder {
32 bool exclusive;
33 int svid;
34 netobj oh;
35 unsigned l_offset;
36 unsigned l_len;
37 };
38
39 union nlm_testrply switch (nlm_stats stat) {
40 case nlm_denied:
41 struct nlm_holder holder;
42 default:
43 void;
44 };
45
46 struct nlm_stat {
47 nlm_stats stat;
48 };
49
50 struct nlm_res {
51 netobj cookie;
52 nlm_stat stat;
53 };
54
55 struct nlm_testres {
56 netobj cookie;
57 nlm_testrply stat;
58 };
59
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;
67 };
68
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 */
76 };
77
78 struct nlm_cancargs {
79 netobj cookie;
80 bool block;
81 bool exclusive;
82 struct nlm_lock alock;
83 };
84
85 struct nlm_testargs {
86 netobj cookie;
87 bool exclusive;
88 struct nlm_lock alock;
89 };
90
91 struct nlm_unlockargs {
92 netobj cookie;
93 struct nlm_lock alock;
94 };
95
96
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 */
108 };
109
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 */
115 };
116
117 struct nlm_share {
118 string caller_name<LM_MAXSTRLEN>;
119 netobj fh;
120 netobj oh;
121 fsh_mode mode;
122 fsh_access access;
123 };
124
125 struct nlm_shareargs {
126 netobj cookie;
127 nlm_share share;
128 bool reclaim;
129 };
130
131 struct nlm_shareres {
132 netobj cookie;
133 nlm_stats stat;
134 int sequence;
135 };
136
137 struct nlm_notify {
138 string name<MAXNAMELEN>;
139 long state;
140 };
141
142 /*
143 * Over-the-wire protocol used between the network lock managers
144 */
145
146 program NLM_PROG {
147 version NLM_VERS {
148
149 nlm_testres NLM_TEST(struct nlm_testargs) = 1;
150
151 nlm_res NLM_LOCK(struct nlm_lockargs) = 2;
152
153 nlm_res NLM_CANCEL(struct nlm_cancargs) = 3;
154 nlm_res NLM_UNLOCK(struct nlm_unlockargs) = 4;
155
156 /*
157 * remote lock manager call-back to grant lock
158 */
159 nlm_res NLM_GRANTED(struct nlm_testargs)= 5;
160 /*
161 * message passing style of requesting lock
162 */
163 void NLM_TEST_MSG(struct nlm_testargs) = 6;
164 void NLM_LOCK_MSG(struct nlm_lockargs) = 7;
165 void NLM_CANCEL_MSG(struct nlm_cancargs) =8;
166 void NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
167 void NLM_GRANTED_MSG(struct nlm_testargs) = 10;
168 void NLM_TEST_RES(nlm_testres) = 11;
169 void NLM_LOCK_RES(nlm_res) = 12;
170 void NLM_CANCEL_RES(nlm_res) = 13;
171 void NLM_UNLOCK_RES(nlm_res) = 14;
172 void NLM_GRANTED_RES(nlm_res) = 15;
173 } = 1;
174
175 version NLM_VERSX {
176 nlm_shareres NLM_SHARE(nlm_shareargs) = 20;
177 nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21;
178 nlm_res NLM_NM_LOCK(nlm_lockargs) = 22;
179 void NLM_FREE_ALL(nlm_notify) = 23;
180 } = 3;
181
182 } = 100021;
183
184