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