xref: /minix/include/rpc/rpcb_prot.x (revision 00b67f09)
1 %/*
2 % * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 % * unrestricted use provided that this legend is included on all tape
4 % * media and as a part of the software program in whole or part.  Users
5 % * may copy or modify Sun RPC without charge, but are not authorized
6 % * to license or distribute it to anyone else except as part of a product or
7 % * program developed by the user.
8 % *
9 % * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 % * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 % * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12 % *
13 % * Sun RPC is provided with no support and without any obligation on the
14 % * part of Sun Microsystems, Inc. to assist in its use, correction,
15 % * modification or enhancement.
16 % *
17 % * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 % * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 % * OR ANY PART THEREOF.
20 % *
21 % * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 % * or profits or other special, indirect and consequential damages, even if
23 % * Sun has been advised of the possibility of such damages.
24 % *
25 % * Sun Microsystems, Inc.
26 % * 2550 Garcia Avenue
27 % * Mountain View, California  94043
28 % */
29 %/*
30 % * Copyright (c) 1988 by Sun Microsystems, Inc.
31 % */
32 
33 %/* from rpcb_prot.x */
34 
35 #ifdef RPC_HDR
36 %
37 %/* #pragma ident	"@(#)rpcb_prot.x	1.5	94/04/29 SMI" */
38 %
39 %#ifndef _KERNEL
40 %
41 #endif
42 
43 /*
44  * rpcb_prot.x
45  * rpcbind protocol, versions 3 and 4, in RPC Language
46  */
47 %
48 %/*
49 % * The following procedures are supported by the protocol in version 3:
50 % *
51 % * RPCBPROC_NULL() returns ()
52 % * 	takes nothing, returns nothing
53 % *
54 % * RPCBPROC_SET(rpcb) returns (bool_t)
55 % * 	TRUE is success, FALSE is failure.  Registers the tuple
56 % *	[prog, vers, address, owner, netid].
57 % *	Finds out owner and netid information on its own.
58 % *
59 % * RPCBPROC_UNSET(rpcb) returns (bool_t)
60 % *	TRUE is success, FALSE is failure.  Un-registers tuple
61 % *	[prog, vers, netid].  addresses is ignored.
62 % *	If netid is NULL, unregister all.
63 % *
64 % * RPCBPROC_GETADDR(rpcb) returns (string).
65 % *	0 is failure.  Otherwise returns the universal address where the
66 % *	triple [prog, vers, netid] is registered.  Ignore address and owner.
67 % *
68 % * RPCBPROC_DUMP() RETURNS (rpcblist_ptr)
69 % *	used to dump the entire rpcbind maps
70 % *
71 % * RPCBPROC_CALLIT(rpcb_rmtcallargs)
72 % * 	RETURNS (rpcb_rmtcallres);
73 % * 	Calls the procedure on the remote machine.  If it is not registered,
74 % *	this procedure is quiet; i.e. it does not return error information!!!
75 % *	This routine only passes null authentication parameters.
76 % *	It has no interface to xdr routines for RPCBPROC_CALLIT.
77 % *
78 % * RPCBPROC_GETTIME() returns (int).
79 % *	Gets the remote machines time
80 % *
81 % * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)
82 % *	Returns the netbuf address from universal address.
83 % *
84 % * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)
85 % *	Returns the universal address from netbuf address.
86 % *
87 % * END OF RPCBIND VERSION 3 PROCEDURES
88 % */
89 %/*
90 % * Except for RPCBPROC_CALLIT, the procedures above are carried over to
91 % * rpcbind version 4.  Those below are added or modified for version 4.
92 % * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER
93 % * AS RPCBPROC_CALLIT.
94 % *
95 % * RPCBPROC_BCAST(rpcb_rmtcallargs)
96 % * 	RETURNS (rpcb_rmtcallres);
97 % * 	Calls the procedure on the remote machine.  If it is not registered,
98 % *	this procedure IS quiet; i.e. it DOES NOT return error information!!!
99 % *	This routine should be used for broadcasting and nothing else.
100 % *
101 % * RPCBPROC_GETVERSADDR(rpcb) returns (string).
102 % *	0 is failure.  Otherwise returns the universal address where the
103 % *	triple [prog, vers, netid] is registered.  Ignore address and owner.
104 % *	Same as RPCBPROC_GETADDR except that if the given version number
105 % *	is not available, the address is not returned.
106 % *
107 % * RPCBPROC_INDIRECT(rpcb_rmtcallargs)
108 % * 	RETURNS (rpcb_rmtcallres);
109 % * 	Calls the procedure on the remote machine.  If it is not registered,
110 % *	this procedure is NOT quiet; i.e. it DOES return error information!!!
111 % * 	as any normal application would expect.
112 % *
113 % * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).
114 % *	Same as RPCBPROC_GETADDR except that it returns a list of all the
115 % *	addresses registered for the combination (prog, vers) (for all
116 % *	transports).
117 % *
118 % * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)
119 % *	Returns the statistics about the kind of requests received by rpcbind.
120 % */
121 %
122 %/*
123 % * A mapping of (program, version, network ID) to address
124 % */
125 struct rpcb {
126 	rpcprog_t r_prog;		/* program number */
127 	rpcvers_t r_vers;		/* version number */
128 	string r_netid<>;		/* network id */
129 	string r_addr<>;		/* universal address */
130 	string r_owner<>;		/* owner of this service */
131 };
132 #ifdef RPC_HDR
133 %
134 %typedef rpcb RPCB;
135 %
136 #endif
137 %
138 %/*
139 % * A list of mappings
140 % *
141 % * Below are two definitions for the rpcblist structure.  This is done because
142 % * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a
143 % * struct rpcblist * that rpcgen would produce.  One version of the rpcblist
144 % * structure (actually called rp__list) is used with rpcgen, and the other is
145 % * defined only in the header file for compatibility with the specified
146 % * interface.
147 % */
148 
149 struct rp__list {
150 	rpcb rpcb_map;
151 	struct rp__list *rpcb_next;
152 };
153 
154 typedef rp__list *rpcblist_ptr;		/* results of RPCBPROC_DUMP */
155 
156 #ifdef RPC_HDR
157 %
158 %typedef struct rp__list rpcblist;
159 %typedef struct rp__list RPCBLIST;
160 %
161 %#ifndef __cplusplus
162 %struct rpcblist {
163 %	RPCB rpcb_map;
164 %	struct rpcblist *rpcb_next;
165 %};
166 %#endif
167 %
168 %#ifdef __cplusplus
169 %extern "C" {
170 %#endif
171 %#if __STDC__
172 %extern  bool_t xdr_rpcblist(XDR *, rpcblist**);
173 %#else /* K&R C */
174 %bool_t xdr_rpcblist();
175 %#endif
176 %#ifdef	__cplusplus
177 %}
178 %#endif
179 %
180 #endif
181 
182 %
183 %/*
184 % * Arguments of remote calls
185 % */
186 struct rpcb_rmtcallargs {
187 	rpcprog_t prog;			/* program number */
188 	rpcvers_t vers;			/* version number */
189 	rpcproc_t proc;			/* procedure number */
190 	opaque args<>;			/* argument */
191 };
192 #ifdef RPC_HDR
193 %
194 %/*
195 % * Client-side only representation of rpcb_rmtcallargs structure.
196 % *
197 % * The routine that XDRs the rpcb_rmtcallargs structure must deal with the
198 % * opaque arguments in the "args" structure.  xdr_rpcb_rmtcallargs() needs to
199 % * be passed the XDR routine that knows the args' structure.  This routine
200 % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
201 % * the application being called already knows the args structure.  So we use a
202 % * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which
203 % * includes the args' XDR routine.
204 % */
205 %struct r_rpcb_rmtcallargs {
206 %	rpcprog_t prog;
207 %	rpcvers_t vers;
208 %	rpcproc_t proc;
209 %	struct {
210 %		u_int args_len;
211 %		const char *args_val;
212 %	} args;
213 %	xdrproc_t	xdr_args;	/* encodes args */
214 %};
215 %
216 #endif	/* def RPC_HDR */
217 %
218 %/*
219 % * Results of the remote call
220 % */
221 struct rpcb_rmtcallres {
222 	string addr<>;			/* remote universal address */
223 	opaque results<>;		/* result */
224 };
225 #ifdef RPC_HDR
226 %
227 %/*
228 % * Client-side only representation of rpcb_rmtcallres structure.
229 % */
230 %struct r_rpcb_rmtcallres {
231 %	char *addr;
232 %	struct {
233 %		u_int32_t results_len;
234 %		char *results_val;
235 %	} results;
236 %	xdrproc_t	xdr_res;	/* decodes results */
237 %};
238 #endif /* RPC_HDR */
239 %
240 %/*
241 % * rpcb_entry contains a merged address of a service on a particular
242 % * transport, plus associated netconfig information.  A list of rpcb_entrys
243 % * is returned by RPCBPROC_GETADDRLIST.  See netconfig.h for values used
244 % * in r_nc_* fields.
245 % */
246 struct rpcb_entry {
247 	string		r_maddr<>;	/* merged address of service */
248 	string		r_nc_netid<>;	/* netid field */
249 	unsigned int	r_nc_semantics;	/* semantics of transport */
250 	string		r_nc_protofmly<>; /* protocol family */
251 	string		r_nc_proto<>;	/* protocol name */
252 };
253 %
254 %/*
255 % * A list of addresses supported by a service.
256 % */
257 struct rpcb_entry_list {
258 	rpcb_entry rpcb_entry_map;
259 	struct rpcb_entry_list *rpcb_entry_next;
260 };
261 
262 typedef rpcb_entry_list *rpcb_entry_list_ptr;
263 
264 %
265 %/*
266 % * rpcbind statistics
267 % */
268 %
269 const rpcb_highproc_2 = RPCBPROC_CALLIT;
270 const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR;
271 const rpcb_highproc_4 = RPCBPROC_GETSTAT;
272 
273 const RPCBSTAT_HIGHPROC = 13;	/* # of procs in rpcbind V4 plus one */
274 const RPCBVERS_STAT = 3;	/* provide only for rpcbind V2, V3 and V4 */
275 const RPCBVERS_4_STAT = 2;
276 const RPCBVERS_3_STAT = 1;
277 const RPCBVERS_2_STAT = 0;
278 %
279 %/* Link list of all the stats about getport and getaddr */
280 struct rpcbs_addrlist {
281 	rpcprog_t prog;
282 	rpcvers_t vers;
283 	int success;
284 	int failure;
285 	string netid<>;
286 	struct rpcbs_addrlist *next;
287 };
288 %
289 %/* Link list of all the stats about rmtcall */
290 struct rpcbs_rmtcalllist {
291 	rpcprog_t prog;
292 	rpcvers_t vers;
293 	rpcproc_t proc;
294 	int success;
295 	int failure;
296 	int indirect;	/* whether callit or indirect */
297 	string netid<>;
298 	struct rpcbs_rmtcalllist *next;
299 };
300 
301 typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
302 typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
303 typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
304 
305 struct rpcb_stat {
306 	rpcbs_proc		info;
307 	int			setinfo;
308 	int			unsetinfo;
309 	rpcbs_addrlist_ptr	addrinfo;
310 	rpcbs_rmtcalllist_ptr	rmtinfo;
311 };
312 %
313 %/*
314 % * One rpcb_stat structure is returned for each version of rpcbind
315 % * being monitored.
316 % */
317 
318 typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
319 
320 #ifdef RPC_HDR
321 %
322 %/*
323 % * We don't define netbuf in RPCL, since it would contain structure member
324 % * names that would conflict with the definition of struct netbuf in
325 % * <tiuser.h>.  Instead we merely declare the XDR routine xdr_netbuf() here,
326 % * and implement it ourselves in rpc/rpcb_prot.c.
327 % */
328 %#ifdef __cplusplus
329 %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
330 %
331 %#elif __STDC__
332 %extern  bool_t xdr_netbuf(XDR *, struct netbuf *);
333 %
334 %#else /* K&R C */
335 %bool_t xdr_netbuf();
336 %
337 %#endif /* K&R C*/
338 #endif /* def RPC_HDR */
339 
340 /*
341  * rpcbind procedures
342  */
343 program RPCBPROG {
344 	version RPCBVERS {
345 		bool
346 		RPCBPROC_SET(rpcb) = 1;
347 
348 		bool
349 		RPCBPROC_UNSET(rpcb) = 2;
350 
351 		string
352 		RPCBPROC_GETADDR(rpcb) = 3;
353 
354 		rpcblist_ptr
355 		RPCBPROC_DUMP(void) = 4;
356 
357 		rpcb_rmtcallres
358 		RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;
359 
360 		unsigned int
361 		RPCBPROC_GETTIME(void) = 6;
362 
363 		struct netbuf
364 		RPCBPROC_UADDR2TADDR(string) = 7;
365 
366 		string
367 		RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
368 	} = 3;
369 
370 	version RPCBVERS4 {
371 		bool
372 		RPCBPROC_SET(rpcb) = 1;
373 
374 		bool
375 		RPCBPROC_UNSET(rpcb) = 2;
376 
377 		string
378 		RPCBPROC_GETADDR(rpcb) = 3;
379 
380 		rpcblist_ptr
381 		RPCBPROC_DUMP(void) = 4;
382 
383 		/*
384 		 * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT;
385 		 * the new name is intended to indicate that this
386 		 * procedure should be used for broadcast RPC, and
387 		 * RPCBPROC_INDIRECT should be used for indirect calls.
388 		 */
389 		rpcb_rmtcallres
390 		RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT;
391 
392 		unsigned int
393 		RPCBPROC_GETTIME(void) = 6;
394 
395 		struct netbuf
396 		RPCBPROC_UADDR2TADDR(string) = 7;
397 
398 		string
399 		RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
400 
401 		string
402 		RPCBPROC_GETVERSADDR(rpcb) = 9;
403 
404 		rpcb_rmtcallres
405 		RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10;
406 
407 		rpcb_entry_list_ptr
408 		RPCBPROC_GETADDRLIST(rpcb) = 11;
409 
410 		rpcb_stat_byvers
411 		RPCBPROC_GETSTAT(void) = 12;
412 	} = 4;
413 } = 100000;
414 #ifdef RPC_HDR
415 %
416 %#define	RPCBVERS_3		RPCBVERS
417 %#define	RPCBVERS_4		RPCBVERS4
418 %
419 %#define	_PATH_RPCBINDSOCK	"/var/run/rpcbind.sock"
420 %
421 %#else		/* ifndef _KERNEL */
422 %#ifdef __cplusplus
423 %extern "C" {
424 %#endif
425 %
426 %/*
427 % * A mapping of (program, version, network ID) to address
428 % */
429 %struct rpcb {
430 %	rpcprog_t r_prog;		/* program number */
431 %	rpcvers_t r_vers;		/* version number */
432 %	char *r_netid;			/* network id */
433 %	char *r_addr;			/* universal address */
434 %	char *r_owner;			/* owner of the mapping */
435 %};
436 %typedef struct rpcb RPCB;
437 %
438 %/*
439 % * A list of mappings
440 % */
441 %struct rpcblist {
442 %	RPCB rpcb_map;
443 %	struct rpcblist *rpcb_next;
444 %};
445 %typedef struct rpcblist RPCBLIST;
446 %typedef struct rpcblist *rpcblist_ptr;
447 %
448 %/*
449 % * Remote calls arguments
450 % */
451 %struct rpcb_rmtcallargs {
452 %	rpcprog_t prog;			/* program number */
453 %	rpcvers_t vers;			/* version number */
454 %	rpcproc_t proc;			/* procedure number */
455 %	u_int32_t arglen;			/* arg len */
456 %	caddr_t args_ptr;		/* argument */
457 %	xdrproc_t xdr_args;		/* XDR routine for argument */
458 %};
459 %typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;
460 %
461 %/*
462 % * Remote calls results
463 % */
464 %struct rpcb_rmtcallres {
465 %	char *addr_ptr;			/* remote universal address */
466 %	u_int32_t resultslen;		/* results length */
467 %	caddr_t results_ptr;		/* results */
468 %	xdrproc_t xdr_results;		/* XDR routine for result */
469 %};
470 %typedef struct rpcb_rmtcallres rpcb_rmtcallres;
471 %
472 %struct rpcb_entry {
473 %	char *r_maddr;
474 %	char *r_nc_netid;
475 %	unsigned int r_nc_semantics;
476 %	char *r_nc_protofmly;
477 %	char *r_nc_proto;
478 %};
479 %typedef struct rpcb_entry rpcb_entry;
480 %
481 %/*
482 % * A list of addresses supported by a service.
483 % */
484 %
485 %struct rpcb_entry_list {
486 %	rpcb_entry rpcb_entry_map;
487 %	struct rpcb_entry_list *rpcb_entry_next;
488 %};
489 %typedef struct rpcb_entry_list rpcb_entry_list;
490 %
491 %typedef rpcb_entry_list *rpcb_entry_list_ptr;
492 %
493 %/*
494 % * rpcbind statistics
495 % */
496 %
497 %#define	rpcb_highproc_2 RPCBPROC_CALLIT
498 %#define	rpcb_highproc_3 RPCBPROC_TADDR2UADDR
499 %#define	rpcb_highproc_4 RPCBPROC_GETSTAT
500 %#define	RPCBSTAT_HIGHPROC 13
501 %#define	RPCBVERS_STAT 3
502 %#define	RPCBVERS_4_STAT 2
503 %#define	RPCBVERS_3_STAT 1
504 %#define	RPCBVERS_2_STAT 0
505 %
506 %/* Link list of all the stats about getport and getaddr */
507 %
508 %struct rpcbs_addrlist {
509 %	rpcprog_t prog;
510 %	rpcvers_t vers;
511 %	int success;
512 %	int failure;
513 %	char *netid;
514 %	struct rpcbs_addrlist *next;
515 %};
516 %typedef struct rpcbs_addrlist rpcbs_addrlist;
517 %
518 %/* Link list of all the stats about rmtcall */
519 %
520 %struct rpcbs_rmtcalllist {
521 %	rpcprog_t prog;
522 %	rpcvers_t vers;
523 %	rpcproc_t proc;
524 %	int success;
525 %	int failure;
526 %	int indirect;
527 %	char *netid;
528 %	struct rpcbs_rmtcalllist *next;
529 %};
530 %typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;
531 %
532 %typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
533 %
534 %typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
535 %
536 %typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
537 %
538 %struct rpcb_stat {
539 %	rpcbs_proc info;
540 %	int setinfo;
541 %	int unsetinfo;
542 %	rpcbs_addrlist_ptr addrinfo;
543 %	rpcbs_rmtcalllist_ptr rmtinfo;
544 %};
545 %typedef struct rpcb_stat rpcb_stat;
546 %
547 %/*
548 % * One rpcb_stat structure is returned for each version of rpcbind
549 % * being monitored.
550 % */
551 %
552 %typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
553 %
554 %#ifdef __cplusplus
555 %}
556 %#endif
557 %
558 %#endif		/* ifndef _KERNEL */
559 #endif		/* RPC_HDR */
560