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