xref: /openbsd/lib/librpcsvc/nlm_prot.x (revision 0debdebf)
1 /*	$OpenBSD: nlm_prot.x,v 1.8 2008/06/15 04:41:39 sturm Exp $	*/
2 
3 #ifdef RPC_HDR
4 %#define LM_MAXSTRLEN	1024
5 %#define MAXNAMELEN	LM_MAXSTRLEN+1
6 #endif
7 
8 enum nlm_stats {
9 	nlm_granted = 0,
10 	nlm_denied = 1,
11 	nlm_denied_nolocks = 2,
12 	nlm_blocked = 3,
13 	nlm_denied_grace_period = 4
14 };
15 
16 struct nlm_holder {
17 	bool exclusive;
18 	int svid;
19 	netobj oh;
20 	unsigned l_offset;
21 	unsigned l_len;
22 };
23 
24 union nlm_testrply switch (nlm_stats stat) {
25 	case nlm_denied:
26 		struct nlm_holder holder;
27 	default:
28 		void;
29 };
30 
31 struct nlm_stat {
32 	nlm_stats stat;
33 };
34 
35 struct nlm_res {
36 	netobj cookie;
37 	nlm_stat stat;
38 };
39 
40 struct nlm_testres {
41 	netobj cookie;
42 	nlm_testrply stat;
43 };
44 
45 struct nlm_lock {
46 	string caller_name<LM_MAXSTRLEN>;
47 	netobj fh;
48 	netobj oh;
49 	int svid;
50 	unsigned l_offset;
51 	unsigned l_len;
52 };
53 
54 struct nlm_lockargs {
55 	netobj cookie;
56 	bool block;
57 	bool exclusive;
58 	struct nlm_lock alock;
59 	bool reclaim;
60 	int state;
61 };
62 
63 struct nlm_cancargs {
64 	netobj cookie;
65 	bool block;
66 	bool exclusive;
67 	struct nlm_lock alock;
68 };
69 
70 struct nlm_testargs {
71 	netobj cookie;
72 	bool exclusive;
73 	struct nlm_lock alock;
74 };
75 
76 struct nlm_unlockargs {
77 	netobj cookie;
78 	struct nlm_lock alock;
79 };
80 
81 
82 #ifdef RPC_HDR
83 #endif
84 enum	fsh_mode {
85 	fsm_DN  = 0,
86 	fsm_DR  = 1,
87 	fsm_DW  = 2,
88 	fsm_DRW = 3
89 };
90 
91 enum	fsh_access {
92 	fsa_NONE = 0,
93 	fsa_R    = 1,
94 	fsa_W    = 2,
95 	fsa_RW   = 3
96 };
97 
98 struct	nlm_share {
99 	string caller_name<LM_MAXSTRLEN>;
100 	netobj	fh;
101 	netobj	oh;
102 	fsh_mode	mode;
103 	fsh_access	access;
104 };
105 
106 struct	nlm_shareargs {
107 	netobj	cookie;
108 	nlm_share	share;
109 	bool	reclaim;
110 };
111 
112 struct	nlm_shareres {
113 	netobj	cookie;
114 	nlm_stats	stat;
115 	int	sequence;
116 };
117 
118 struct	nlm_notify {
119 	string name<MAXNAMELEN>;
120 	int state;
121 };
122 
123 enum nlm4_stats {
124 	nlm4_granted			= 0,
125 	nlm4_denied			= 1,
126 	nlm4_denied_nolock		= 2,
127 	nlm4_blocked			= 3,
128 	nlm4_denied_grace_period	= 4,
129 	nlm4_deadlck			= 5,
130 	nlm4_rofs			= 6,
131 	nlm4_stale_fh			= 7,
132 	nlm4_fbig			= 8,
133 	nlm4_failed			= 9
134 };
135 
136 struct nlm4_stat {
137 	nlm4_stats stat;
138 };
139 
140 struct nlm4_holder {
141 	bool exclusive;
142 	u_int32_t svid;
143 	netobj oh;
144 	u_int64_t l_offset;
145 	u_int64_t l_len;
146 };
147 
148 struct nlm4_lock {
149 	string caller_name<MAXNAMELEN>;
150 	netobj fh;
151 	netobj oh;
152 	u_int32_t svid;
153 	u_int64_t l_offset;
154 	u_int64_t l_len;
155 };
156 
157 struct nlm4_share {
158 	string caller_name<MAXNAMELEN>;
159 	netobj fh;
160 	netobj oh;
161 	fsh_mode mode;
162 	fsh_access access;
163 };
164 
165 union nlm4_testrply switch (nlm4_stats stat) {
166 	case nlm_denied:
167 		struct nlm4_holder holder;
168 	default:
169 		void;
170 };
171 
172 struct nlm4_testres {
173 	netobj cookie;
174 	nlm4_testrply stat;
175 };
176 
177 struct nlm4_testargs {
178 	netobj cookie;
179 	bool exclusive;
180 	struct nlm4_lock alock;
181 };
182 
183 struct nlm4_res {
184 	netobj cookie;
185 	nlm4_stat stat;
186 };
187 
188 struct nlm4_lockargs {
189 	netobj cookie;
190 	bool block;
191 	bool exclusive;
192 	struct nlm4_lock alock;
193 	bool reclaim;
194 	int state;
195 };
196 
197 struct nlm4_cancargs {
198 	netobj cookie;
199 	bool block;
200 	bool exclusive;
201 	struct nlm4_lock alock;
202 };
203 
204 struct nlm4_unlockargs {
205 	netobj cookie;
206 	struct nlm4_lock alock;
207 };
208 
209 struct	nlm4_shareargs {
210 	netobj	cookie;
211 	nlm4_share	share;
212 	bool	reclaim;
213 };
214 
215 struct	nlm4_shareres {
216 	netobj	cookie;
217 	nlm4_stats	stat;
218 	int	sequence;
219 };
220 
221 struct nlm_sm_status {
222 	string mon_name<LM_MAXSTRLEN>;
223 	int state;
224 	opaque priv[16];
225 };
226 
227 program NLM_PROG {
228 	version NLM_SM {
229 		void NLM_SM_NOTIFY(struct nlm_sm_status) = 1;
230 	} = 0;
231 
232 	version NLM_VERS {
233 
234 		nlm_testres	NLM_TEST(struct nlm_testargs) =	1;
235 
236 		nlm_res		NLM_LOCK(struct nlm_lockargs) =	2;
237 
238 		nlm_res		NLM_CANCEL(struct nlm_cancargs) = 3;
239 
240 		nlm_res		NLM_UNLOCK(struct nlm_unlockargs) = 4;
241 
242 		nlm_res		NLM_GRANTED(struct nlm_testargs)= 5;
243 
244 		void		NLM_TEST_MSG(struct nlm_testargs) = 6;
245 		void		NLM_LOCK_MSG(struct nlm_lockargs) = 7;
246 		void		NLM_CANCEL_MSG(struct nlm_cancargs) = 8;
247 		void		NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
248 		void		NLM_GRANTED_MSG(struct nlm_testargs) = 10;
249 		void		NLM_TEST_RES(nlm_testres) = 11;
250 		void		NLM_LOCK_RES(nlm_res) = 12;
251 		void		NLM_CANCEL_RES(nlm_res) = 13;
252 		void		NLM_UNLOCK_RES(nlm_res) = 14;
253 		void		NLM_GRANTED_RES(nlm_res) = 15;
254 	} = 1;
255 
256 	version NLM_VERSX {
257 		nlm_shareres	NLM_SHARE(nlm_shareargs) = 20;
258 		nlm_shareres	NLM_UNSHARE(nlm_shareargs) = 21;
259 		nlm_res		NLM_NM_LOCK(nlm_lockargs) = 22;
260 		void		NLM_FREE_ALL(nlm_notify) = 23;
261 	} = 3;
262 
263 	version NLM_VERS4 {
264 		nlm4_testres NLM4_TEST(nlm4_testargs) = 1;
265 		nlm4_res NLM4_LOCK(nlm4_lockargs) = 2;
266 		nlm4_res NLM4_CANCEL(nlm4_cancargs) = 3;
267 		nlm4_res NLM4_UNLOCK(nlm4_unlockargs) = 4;
268 		nlm4_res NLM4_GRANTED(nlm4_testargs) = 5;
269 		void NLM4_TEST_MSG(nlm4_testargs) = 6;
270 		void NLM4_LOCK_MSG(nlm4_lockargs) = 7;
271 		void NLM4_CANCEL_MSG(nlm4_cancargs) = 8;
272 		void NLM4_UNLOCK_MSG(nlm4_unlockargs) = 9;
273 		void NLM4_GRANTED_MSG(nlm4_testargs) = 10;
274 		void NLM4_TEST_RES(nlm4_testres) = 11;
275 		void NLM4_LOCK_RES(nlm4_res) = 12;
276 		void NLM4_CANCEL_RES(nlm4_res) = 13;
277 		void NLM4_UNLOCK_RES(nlm4_res) = 14;
278 		void NLM4_GRANTED_RES(nlm4_res) = 15;
279 		nlm4_shareres NLM4_SHARE(nlm4_shareargs) = 20;
280 		nlm4_shareres NLM4_UNSHARE(nlm4_shareargs) = 21;
281 		nlm4_res NLM4_NM_LOCK(nlm4_lockargs) = 22;
282 		void NLM4_FREE_ALL(nlm_notify) = 23;
283 	} = 4;
284 } = 100021;
285 
286