xref: /onnv-gate/usr/src/uts/common/avs/ns/rdc/rdc_prot.x (revision 7836:4e95154b5b7a)
1 %/*
2 % * CDDL HEADER START
3 % *
4 % * The contents of this file are subject to the terms of the
5 % * Common Development and Distribution License (the "License").
6 % * You may not use this file except in compliance with the License.
7 % *
8 % * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 % * or http://www.opensolaris.org/os/licensing.
10 % * See the License for the specific language governing permissions
11 % * and limitations under the License.
12 % *
13 % * When distributing Covered Code, include this CDDL HEADER in each
14 % * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 % * If applicable, add the following below this CDDL HEADER, with the
16 % * fields enclosed by brackets "[]" replaced with your own identifying
17 % * information: Portions Copyright [yyyy] [name of copyright owner]
18 % *
19 % * CDDL HEADER END
20 % */
21 %
22 %
23 %/*
24 % * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25 % * Use is subject to license terms.
26 % */
27 %
28 %/*
29 % * Auto generated from rdc_prot.x
30 % */
31 %
32 %/*
33 % * Network Replicator RPC spec
34 % */
35 
36 %
37 %/*
38 % * We don't define netbuf in RPCL, since it would contain structure member
39 % * names that would conflict with the definition of struct netbuf in
40 % * <tiuser.h>.  Instead we merely declare the XDR routine xdr_netbuf() here,
41 % * and implement it ourselves in rpc/rpcb_prot.c.
42 % */
43 %#define xdr_netbuf	rdc_xdr_netbuf
44 %#ifdef __cplusplus
45 %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
46 %
47 %#elif __STDC__
48 %extern  bool_t xdr_netbuf(XDR *, struct netbuf *);
49 %
50 %#else /* K&R C */
51 %bool_t xdr_netbuf();
52 %
53 %#endif /* K&R C */
54 const RDC_PORT          = 121;
55 const RDC_MAXDATA       = 32768;
56 const RDC_MAXNAMLEN	= 64;
57 const RDC_BMAPBLKSIZE	= 1024;
58 const RDC_MAXADDR	= 32;
59 const RDC_MAXPENDQ	= 64;
60 
61 %/*
62 % * Use this to limit the size of the net_pendvec_t array
63 % * to ~ 32k
64 % */
65 const RDC_PENDQLIM	= 1365;
66 %
67 %/*
68 % * Error status
69 % */
70 enum rdcstat {
71 	RDC_OK = 0,
72 	RDCERR_PERM = 1,
73 	RDCERR_NOENT = 2,
74 	RDCERR_NOMEM = 3
75 };
76 
77 %
78 %/*
79 %* Set state (V4)
80 %*/
81 
82 struct set_state4 {
83 	opaque		netaddr[RDC_MAXADDR];
84 	opaque		rnetaddr[RDC_MAXADDR];
85 	int		netaddrlen;
86 	int		rnetaddrlen;
87 	unsigned	flag;
88 	opaque 		pfile[RDC_MAXNAMLEN];
89 	opaque		sfile[RDC_MAXNAMLEN];
90 };
91 
92 const RDC_XDR_MAXNAMLEN = RDC_MAXNAMLEN;
93 
94 struct set_state {
95 	struct netbuf		netaddr;
96 	struct netbuf		rnetaddr;
97 	int		netaddrlen;
98 	int		rnetaddrlen;
99 	unsigned	flag;
100 	string 		pfile<RDC_XDR_MAXNAMLEN>;
101 	string		sfile<RDC_XDR_MAXNAMLEN>;
102 };
103 
104 %
105 %/*
106 % * Get size of volume
107 % */
108 struct getsize {
109 	int cd;
110 };
111 
112 %
113 %/*
114 % * Remote read (v5)
115 % */
116 struct rread {
117 	int cd;
118 	int len;
119 	int pos;
120 	int idx;
121 	int flag;
122 };
123 
124 %
125 %/*
126 % * Remote read (v6)
127 % */
128 struct rread6 {
129 	int cd;
130 	int len;
131 	u_longlong_t pos;
132 	int idx;
133 	int flag;
134 };
135 
136 %
137 %/*
138 % * status OK from remote read
139 % */
140 struct readok {
141 	opaque data<RDC_MAXDATA>;
142 };
143 union readres switch (rdcstat status) {
144 case RDC_OK:
145 	readok reply;
146 default:
147 	void;
148 };
149 
150 %
151 %/*
152 % * Initiate bit map scoreboard transfer (v5)
153 % */
154 struct bmap {
155 	int cd;
156 	int dual;
157 	int size;
158 };
159 
160 %
161 %/*
162 % * Initiate bit map scoreboard transfer (v6)
163 % */
164 struct bmap6 {
165 	int cd;
166 	int dual;
167 	u_longlong_t size;
168 };
169 
170 %
171 %/*
172 % * Scoreboard bitmap data (v5)
173 % */
174 struct net_bdata {
175 	int cd;
176 	int offset;
177 	int size;
178 	opaque data<RDC_BMAPBLKSIZE>;
179 };
180 
181 %
182 %/*
183 % * Scoreboard bitmap data (v6)
184 % */
185 struct net_bdata6 {
186 	u_longlong_t offset;
187 	int size;
188 	int cd;
189 	int endoblk;
190 	opaque data<RDC_BMAPBLKSIZE>;
191 };
192 
193 %
194 %/*
195 % * Data transfer and allocation (v5)
196 % */
197 struct net_data5 {
198 	int local_cd;
199 	int cd;
200 	int pos;
201 	int len;
202 	int flag;
203 	int idx;
204 	int seq;
205 	int sfba;
206 	int endoblk;
207 	int nfba;
208 	opaque data<RDC_MAXDATA>;
209 };
210 
211 %
212 %/*
213 % * Data transfer and allocation (v6)
214 % */
215 struct net_data6 {
216 	int local_cd;
217 	int cd;
218 	u_longlong_t pos;
219 	u_longlong_t qpos;
220 	u_longlong_t sfba;
221 	int nfba;
222 	int len;
223 	int flag;
224 	int idx;
225 	unsigned int seq;
226 	int endoblk;
227 	opaque data<RDC_MAXDATA>;
228 };
229 
230 
231 struct net_pendvec {
232 	u_longlong_t	apos;
233 	u_longlong_t	qpos;
234 	int		alen;
235 	unsigned int	seq;
236 	int		pindex;
237 };
238 typedef net_pendvec net_pendvec_t;
239 
240 
241 
242 %/*
243 % * results returned from a netwrite request. (v6)
244 % * index = index number of request assigned by server when
245 % * requests is broken down into smaller chunks.
246 % * result = 0 request ok.
247 % * result = 1 request is pending.
248 % * result < 0 failure, set with -errno.
249 % * If the vecdata array is not empty, then it contains
250 % * a list of apos and alen
251 % * pairs of previously pending requests that have been written.
252 % */
253 struct netwriteres {
254 	int index;
255 	int result;
256 	unsigned int seq;
257 	net_pendvec_t vecdata<RDC_PENDQLIM>;
258 };
259 
260 
261 
262 %
263 %/*
264 % * Ping
265 % */
266 struct rdc_ping6 {
267 	opaque p_ifaddr[RDC_MAXADDR];
268 	opaque s_ifaddr[RDC_MAXADDR];
269 };
270 
271 struct rdc_ping {
272 	struct netbuf p_ifaddr;
273 	struct netbuf s_ifaddr;
274 };
275 
276 
277 /*
278  * Remote file service routines
279  */
280 
281 program RDC_PROGRAM {
282 
283 	/*
284 	 * This is protocol version 5 that shipped with SNDR 3.1
285 	 * We must support this protocol until (protocol
286 	 * version 7) is released.
287 	 * I.e. N-1 protocol support.
288 	 */
289 
290 	version RDC_VERSION5 {
291 
292 		void
293 		RDCPROC_NULL(void) = 0;
294 
295 		int
296 		RDCPROC_GETSIZE(int) = 2;
297 
298 		int
299 		RDCPROC_WRITE5(net_data5) = 4;
300 
301 		readres
302 		RDCPROC_READ5(rread) = 5;
303 
304 		int
305 		RDCPROC_STATE(set_state4) = 7;
306 
307 		int
308 		RDCPROC_PING4(rdc_ping6) = 8;
309 
310 		int
311 		RDCPROC_BMAP(net_bmap) = 9;
312 
313 		int
314 		RDCPROC_BDATA(net_bdata) = 10;
315 
316 		int
317 		RDCPROC_GETSTATE4(set_state4) = 12;
318 	} = 5;
319 
320 	/*
321 	 * This is protocol version 6 that shipped with SNDR 3.2
322 	 * We must support this protocol until (protocol
323 	 * version 8) is released.
324 	 * I.e. N-1 protocol support.
325 	 *
326 	 * Changed to support multiple transmitting async threads
327 	 * (sequence numbers and write reply structure)
328 	 * and 64bit datapath.
329 	 */
330 
331 	version RDC_VERSION6 {
332 
333 		void
334 		RDCPROC_NULL(void) = 0;
335 
336 		u_longlong_t
337 		RDCPROC_GETSIZE6(int) = 2;
338 
339 		netwriteres
340 		RDCPROC_WRITE6(net_data6) = 4;
341 
342 		readres
343 		RDCPROC_READ6(rread6) = 5;
344 
345 		int
346 		RDCPROC_STATE(set_state4) = 7;
347 
348 		int
349 		RDCPROC_PING4(rdc_ping6) = 8;
350 
351 		int
352 		RDCPROC_BMAP6(net_bmap6) = 9;
353 
354 		int
355 		RDCPROC_BDATA6(net_bdata6) = 10;
356 
357 		int
358 		RDCPROC_GETSTATE4(set_state4) = 12;
359 	} = 6;
360 
361 	version RDC_VERSION7 {
362 
363 		void
364 		RDCPROC_NULL(void) = 0;
365 
366 		u_longlong_t
367 		RDCPROC_GETSIZE6(int) = 2;
368 
369 		netwriteres
370 		RDCPROC_WRITE6(net_data6) = 4;
371 
372 		readres
373 		RDCPROC_READ6(rread6) = 5;
374 
375 		int
376 		RDCPROC_STATE(set_state) = 7;
377 
378 		int
379 		RDCPROC_PING4(rdc_ping) = 8;
380 
381 		int
382 		RDCPROC_BMAP6(net_bmap6) = 9;
383 
384 		int
385 		RDCPROC_BDATA6(net_bdata6) = 10;
386 
387 		int
388 		RDCPROC_GETSTATE4(set_state) = 12;
389 	} = 7;
390 
391 } = 100143;
392