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