3 % * Copyright (c) 2009, Sun Microsystems, Inc.
4 % * All rights reserved.
6 % * Redistribution and use in source and binary forms, with or without
7 % * modification, are permitted provided that the following conditions are met:
8 % * - Redistributions of source code must retain the above copyright notice,
9 % * this list of conditions and the following disclaimer.
10 % * - Redistributions in binary form must reproduce the above copyright notice,
11 % * this list of conditions and the following disclaimer in the documentation
12 % * and/or other materials provided with the distribution.
13 % * - Neither the name of Sun Microsystems, Inc. nor the names of its
14 % * contributors may be used to endorse or promote products derived
15 % * from this software without specific prior written permission.
17 % * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 % * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 % * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 % * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 % * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 % * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 % * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 % * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 % * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 % * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 % * POSSIBILITY OF SUCH DAMAGE.
29 % * $FreeBSD: src/include/rpc/rpcb_prot.x,v 1.3 2002/03/13 10:29:06 obrien Exp $
32 % * Copyright (c) 1988 by Sun Microsystems, Inc.
35 %/* from rpcb_prot.x */
39 %/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */
47 * rpcbind protocol, versions 3 and 4, in RPC Language
51 % * The following procedures are supported by the protocol in version 3:
53 % * RPCBPROC_NULL() returns ()
54 % * takes nothing, returns nothing
56 % * RPCBPROC_SET(rpcb) returns (bool_t)
57 % * TRUE is success, FALSE is failure. Registers the tuple
58 % * [prog, vers, address, owner, netid].
59 % * Finds out owner and netid information on its own.
61 % * RPCBPROC_UNSET(rpcb) returns (bool_t)
62 % * TRUE is success, FALSE is failure. Un-registers tuple
63 % * [prog, vers, netid]. addresses is ignored.
64 % * If netid is NULL, unregister all.
66 % * RPCBPROC_GETADDR(rpcb) returns (string).
67 % * 0 is failure. Otherwise returns the universal address where the
68 % * triple [prog, vers, netid] is registered. Ignore address and owner.
70 % * RPCBPROC_DUMP() RETURNS (rpcblist_ptr)
71 % * used to dump the entire rpcbind maps
73 % * RPCBPROC_CALLIT(rpcb_rmtcallargs)
74 % * RETURNS (rpcb_rmtcallres);
75 % * Calls the procedure on the remote machine. If it is not registered,
76 % * this procedure is quiet; i.e. it does not return error information!!!
77 % * This routine only passes null authentication parameters.
78 % * It has no interface to xdr routines for RPCBPROC_CALLIT.
80 % * RPCBPROC_GETTIME() returns (int).
81 % * Gets the remote machines time
83 % * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)
84 % * Returns the netbuf address from universal address.
86 % * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)
87 % * Returns the universal address from netbuf address.
89 % * END OF RPCBIND VERSION 3 PROCEDURES
92 % * Except for RPCBPROC_CALLIT, the procedures above are carried over to
93 % * rpcbind version 4. Those below are added or modified for version 4.
94 % * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER
95 % * AS RPCBPROC_CALLIT.
97 % * RPCBPROC_BCAST(rpcb_rmtcallargs)
98 % * RETURNS (rpcb_rmtcallres);
99 % * Calls the procedure on the remote machine. If it is not registered,
100 % * this procedure IS quiet; i.e. it DOES NOT return error information!!!
101 % * This routine should be used for broadcasting and nothing else.
103 % * RPCBPROC_GETVERSADDR(rpcb) returns (string).
104 % * 0 is failure. Otherwise returns the universal address where the
105 % * triple [prog, vers, netid] is registered. Ignore address and owner.
106 % * Same as RPCBPROC_GETADDR except that if the given version number
107 % * is not available, the address is not returned.
109 % * RPCBPROC_INDIRECT(rpcb_rmtcallargs)
110 % * RETURNS (rpcb_rmtcallres);
111 % * Calls the procedure on the remote machine. If it is not registered,
112 % * this procedure is NOT quiet; i.e. it DOES return error information!!!
113 % * as any normal application would expect.
115 % * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).
116 % * Same as RPCBPROC_GETADDR except that it returns a list of all the
117 % * addresses registered for the combination (prog, vers) (for all
120 % * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)
121 % * Returns the statistics about the kind of requests received by rpcbind.
125 % * A mapping of (program, version, network ID) to address
128 rpcprog_t r_prog; /* program number */
129 rpcvers_t r_vers; /* version number */
130 string r_netid<>; /* network id */
131 string r_addr<>; /* universal address */
132 string r_owner<>; /* owner of this service */
141 % * A list of mappings
143 % * Below are two definitions for the rpcblist structure. This is done because
144 % * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a
145 % * struct rpcblist * that rpcgen would produce. One version of the rpcblist
146 % * structure (actually called rp__list) is used with rpcgen, and the other is
147 % * defined only in the header file for compatibility with the specified
153 struct rp__list *rpcb_next;
156 typedef rp__list *rpcblist_ptr; /* results of RPCBPROC_DUMP */
160 %typedef struct rp__list rpcblist;
161 %typedef struct rp__list RPCBLIST;
166 % struct rpcblist *rpcb_next;
173 %extern bool_t xdr_rpcblist(XDR *, rpcblist**);
182 % * Arguments of remote calls
184 struct rpcb_rmtcallargs {
185 rpcprog_t prog; /* program number */
186 rpcvers_t vers; /* version number */
187 rpcproc_t proc; /* procedure number */
188 opaque args<>; /* argument */
193 % * Client-side only representation of rpcb_rmtcallargs structure.
195 % * The routine that XDRs the rpcb_rmtcallargs structure must deal with the
196 % * opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to
197 % * be passed the XDR routine that knows the args' structure. This routine
198 % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
199 % * the application being called already knows the args structure. So we use a
200 % * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which
201 % * includes the args' XDR routine.
203 %struct r_rpcb_rmtcallargs {
211 % xdrproc_t xdr_args; /* encodes args */
214 #endif /* def RPC_HDR */
217 % * Results of the remote call
219 struct rpcb_rmtcallres {
220 string addr<>; /* remote universal address */
221 opaque results<>; /* result */
226 % * Client-side only representation of rpcb_rmtcallres structure.
228 %struct r_rpcb_rmtcallres {
231 % u_int32_t results_len;
234 % xdrproc_t xdr_res; /* decodes results */
239 % * rpcb_entry contains a merged address of a service on a particular
240 % * transport, plus associated netconfig information. A list of rpcb_entrys
241 % * is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used
242 % * in r_nc_* fields.
245 string r_maddr<>; /* merged address of service */
246 string r_nc_netid<>; /* netid field */
247 unsigned int r_nc_semantics; /* semantics of transport */
248 string r_nc_protofmly<>; /* protocol family */
249 string r_nc_proto<>; /* protocol name */
253 % * A list of addresses supported by a service.
255 struct rpcb_entry_list {
256 rpcb_entry rpcb_entry_map;
257 struct rpcb_entry_list *rpcb_entry_next;
260 typedef rpcb_entry_list *rpcb_entry_list_ptr;
264 % * rpcbind statistics
267 const rpcb_highproc_2 = RPCBPROC_CALLIT;
268 const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR;
269 const rpcb_highproc_4 = RPCBPROC_GETSTAT;
271 const RPCBSTAT_HIGHPROC = 13; /* # of procs in rpcbind V4 plus one */
272 const RPCBVERS_STAT = 3; /* provide only for rpcbind V2, V3 and V4 */
273 const RPCBVERS_4_STAT = 2;
274 const RPCBVERS_3_STAT = 1;
275 const RPCBVERS_2_STAT = 0;
277 %/* Link list of all the stats about getport and getaddr */
278 struct rpcbs_addrlist {
284 struct rpcbs_addrlist *next;
287 %/* Link list of all the stats about rmtcall */
288 struct rpcbs_rmtcalllist {
294 int indirect; /* whether callit or indirect */
296 struct rpcbs_rmtcalllist *next;
299 typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
300 typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
301 typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
307 rpcbs_addrlist_ptr addrinfo;
308 rpcbs_rmtcalllist_ptr rmtinfo;
312 % * One rpcb_stat structure is returned for each version of rpcbind
316 typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
321 % * We don't define netbuf in RPCL, since it would contain structure member
322 % * names that would conflict with the definition of struct netbuf in
323 % * <tiuser.h>. Instead we merely declare the XDR routine xdr_netbuf() here,
324 % * and implement it ourselves in rpc/rpcb_prot.c.
327 %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
329 %#else /* __STDC__ */
330 %extern bool_t xdr_netbuf(XDR *, struct netbuf *);
333 #endif /* def RPC_HDR */
341 RPCBPROC_SET(rpcb) = 1;
344 RPCBPROC_UNSET(rpcb) = 2;
347 RPCBPROC_GETADDR(rpcb) = 3;
350 RPCBPROC_DUMP(void) = 4;
353 RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;
356 RPCBPROC_GETTIME(void) = 6;
359 RPCBPROC_UADDR2TADDR(string) = 7;
362 RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
367 RPCBPROC_SET(rpcb) = 1;
370 RPCBPROC_UNSET(rpcb) = 2;
373 RPCBPROC_GETADDR(rpcb) = 3;
376 RPCBPROC_DUMP(void) = 4;
379 * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT;
380 * the new name is intended to indicate that this
381 * procedure should be used for broadcast RPC, and
382 * RPCBPROC_INDIRECT should be used for indirect calls.
385 RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT;
388 RPCBPROC_GETTIME(void) = 6;
391 RPCBPROC_UADDR2TADDR(string) = 7;
394 RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
397 RPCBPROC_GETVERSADDR(rpcb) = 9;
400 RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10;
403 RPCBPROC_GETADDRLIST(rpcb) = 11;
406 RPCBPROC_GETSTAT(void) = 12;
411 %#define RPCBVERS_3 RPCBVERS
412 %#define RPCBVERS_4 RPCBVERS4
414 %#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock"
416 %#else /* ndef _KERNEL */
422 % * A mapping of (program, version, network ID) to address
425 % rpcprog_t r_prog; /* program number */
426 % rpcvers_t r_vers; /* version number */
427 % char *r_netid; /* network id */
428 % char *r_addr; /* universal address */
429 % char *r_owner; /* owner of the mapping */
431 %typedef struct rpcb RPCB;
434 % * A list of mappings
438 % struct rpcblist *rpcb_next;
440 %typedef struct rpcblist RPCBLIST;
441 %typedef struct rpcblist *rpcblist_ptr;
444 % * Remote calls arguments
446 %struct rpcb_rmtcallargs {
447 % rpcprog_t prog; /* program number */
448 % rpcvers_t vers; /* version number */
449 % rpcproc_t proc; /* procedure number */
450 % u_int32_t arglen; /* arg len */
451 % caddr_t args_ptr; /* argument */
452 % xdrproc_t xdr_args; /* XDR routine for argument */
454 %typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;
457 % * Remote calls results
459 %struct rpcb_rmtcallres {
460 % char *addr_ptr; /* remote universal address */
461 % u_int32_t resultslen; /* results length */
462 % caddr_t results_ptr; /* results */
463 % xdrproc_t xdr_results; /* XDR routine for result */
465 %typedef struct rpcb_rmtcallres rpcb_rmtcallres;
470 % unsigned int r_nc_semantics;
471 % char *r_nc_protofmly;
474 %typedef struct rpcb_entry rpcb_entry;
477 % * A list of addresses supported by a service.
480 %struct rpcb_entry_list {
481 % rpcb_entry rpcb_entry_map;
482 % struct rpcb_entry_list *rpcb_entry_next;
484 %typedef struct rpcb_entry_list rpcb_entry_list;
486 %typedef rpcb_entry_list *rpcb_entry_list_ptr;
489 % * rpcbind statistics
492 %#define rpcb_highproc_2 RPCBPROC_CALLIT
493 %#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR
494 %#define rpcb_highproc_4 RPCBPROC_GETSTAT
495 %#define RPCBSTAT_HIGHPROC 13
496 %#define RPCBVERS_STAT 3
497 %#define RPCBVERS_4_STAT 2
498 %#define RPCBVERS_3_STAT 1
499 %#define RPCBVERS_2_STAT 0
501 %/* Link list of all the stats about getport and getaddr */
503 %struct rpcbs_addrlist {
509 % struct rpcbs_addrlist *next;
511 %typedef struct rpcbs_addrlist rpcbs_addrlist;
513 %/* Link list of all the stats about rmtcall */
515 %struct rpcbs_rmtcalllist {
523 % struct rpcbs_rmtcalllist *next;
525 %typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;
527 %typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
529 %typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
531 %typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
537 % rpcbs_addrlist_ptr addrinfo;
538 % rpcbs_rmtcalllist_ptr rmtinfo;
540 %typedef struct rpcb_stat rpcb_stat;
543 % * One rpcb_stat structure is returned for each version of rpcbind
547 %typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
553 %#endif /* ndef _KERNEL */