2 % * Copyright (c) 2009, Sun Microsystems, Inc.
3 % * All rights reserved.
5 % * Redistribution and use in source and binary forms, with or without
6 % * modification, are permitted provided that the following conditions are met:
7 % * - Redistributions of source code must retain the above copyright notice,
8 % * this list of conditions and the following disclaimer.
9 % * - Redistributions in binary form must reproduce the above copyright notice,
10 % * this list of conditions and the following disclaimer in the documentation
11 % * and/or other materials provided with the distribution.
12 % * - Neither the name of Sun Microsystems, Inc. nor the names of its
13 % * contributors may be used to endorse or promote products derived
14 % * from this software without specific prior written permission.
16 % * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 % * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 % * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 % * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 % * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 % * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 % * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 % * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 % * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 % * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 % * POSSIBILITY OF SUCH DAMAGE.
29 % * Copyright (c) 1988 by Sun Microsystems, Inc.
32 %/* from rpcb_prot.x */
42 * rpcbind protocol, versions 3 and 4, in RPC Language
46 % * The following procedures are supported by the protocol in version 3:
48 % * RPCBPROC_NULL() returns ()
49 % * takes nothing, returns nothing
51 % * RPCBPROC_SET(rpcb) returns (bool_t)
52 % * TRUE is success, FALSE is failure. Registers the tuple
53 % * [prog, vers, address, owner, netid].
54 % * Finds out owner and netid information on its own.
56 % * RPCBPROC_UNSET(rpcb) returns (bool_t)
57 % * TRUE is success, FALSE is failure. Un-registers tuple
58 % * [prog, vers, netid]. addresses is ignored.
59 % * If netid is NULL, unregister all.
61 % * RPCBPROC_GETADDR(rpcb) returns (string).
62 % * 0 is failure. Otherwise returns the universal address where the
63 % * triple [prog, vers, netid] is registered. Ignore address and owner.
65 % * RPCBPROC_DUMP() RETURNS (rpcblist_ptr)
66 % * used to dump the entire rpcbind maps
68 % * RPCBPROC_CALLIT(rpcb_rmtcallargs)
69 % * RETURNS (rpcb_rmtcallres);
70 % * Calls the procedure on the remote machine. If it is not registered,
71 % * this procedure is quiet; i.e. it does not return error information!!!
72 % * This routine only passes null authentication parameters.
73 % * It has no interface to xdr routines for RPCBPROC_CALLIT.
75 % * RPCBPROC_GETTIME() returns (int).
76 % * Gets the remote machines time
78 % * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)
79 % * Returns the netbuf address from universal address.
81 % * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)
82 % * Returns the universal address from netbuf address.
84 % * END OF RPCBIND VERSION 3 PROCEDURES
87 % * Except for RPCBPROC_CALLIT, the procedures above are carried over to
88 % * rpcbind version 4. Those below are added or modified for version 4.
89 % * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER
90 % * AS RPCBPROC_CALLIT.
92 % * RPCBPROC_BCAST(rpcb_rmtcallargs)
93 % * RETURNS (rpcb_rmtcallres);
94 % * Calls the procedure on the remote machine. If it is not registered,
95 % * this procedure IS quiet; i.e. it DOES NOT return error information!!!
96 % * This routine should be used for broadcasting and nothing else.
98 % * RPCBPROC_GETVERSADDR(rpcb) returns (string).
99 % * 0 is failure. Otherwise returns the universal address where the
100 % * triple [prog, vers, netid] is registered. Ignore address and owner.
101 % * Same as RPCBPROC_GETADDR except that if the given version number
102 % * is not available, the address is not returned.
104 % * RPCBPROC_INDIRECT(rpcb_rmtcallargs)
105 % * RETURNS (rpcb_rmtcallres);
106 % * Calls the procedure on the remote machine. If it is not registered,
107 % * this procedure is NOT quiet; i.e. it DOES return error information!!!
108 % * as any normal application would expect.
110 % * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).
111 % * Same as RPCBPROC_GETADDR except that it returns a list of all the
112 % * addresses registered for the combination (prog, vers) (for all
115 % * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)
116 % * Returns the statistics about the kind of requests received by rpcbind.
120 % * A mapping of (program, version, network ID) to address
123 rpcprog_t r_prog; /* program number */
124 rpcvers_t r_vers; /* version number */
125 string r_netid<>; /* network id */
126 string r_addr<>; /* universal address */
127 string r_owner<>; /* owner of this service */
136 % * A list of mappings
138 % * Below are two definitions for the rpcblist structure. This is done because
139 % * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a
140 % * struct rpcblist * that rpcgen would produce. One version of the rpcblist
141 % * structure (actually called rp__list) is used with rpcgen, and the other is
142 % * defined only in the header file for compatibility with the specified
148 struct rp__list *rpcb_next;
151 typedef rp__list *rpcblist_ptr; /* results of RPCBPROC_DUMP */
155 %typedef struct rp__list rpcblist;
156 %typedef struct rp__list RPCBLIST;
161 % struct rpcblist *rpcb_next;
168 %extern bool_t xdr_rpcblist(XDR *, rpcblist**);
177 % * Arguments of remote calls
179 struct rpcb_rmtcallargs {
180 rpcprog_t prog; /* program number */
181 rpcvers_t vers; /* version number */
182 rpcproc_t proc; /* procedure number */
183 opaque args<>; /* argument */
188 % * Client-side only representation of rpcb_rmtcallargs structure.
190 % * The routine that XDRs the rpcb_rmtcallargs structure must deal with the
191 % * opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to
192 % * be passed the XDR routine that knows the args' structure. This routine
193 % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
194 % * the application being called already knows the args structure. So we use a
195 % * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which
196 % * includes the args' XDR routine.
198 %struct r_rpcb_rmtcallargs {
206 % xdrproc_t xdr_args; /* encodes args */
209 #endif /* def RPC_HDR */
212 % * Results of the remote call
214 struct rpcb_rmtcallres {
215 string addr<>; /* remote universal address */
216 opaque results<>; /* result */
221 % * Client-side only representation of rpcb_rmtcallres structure.
223 %struct r_rpcb_rmtcallres {
226 % u_int32_t results_len;
229 % xdrproc_t xdr_res; /* decodes results */
234 % * rpcb_entry contains a merged address of a service on a particular
235 % * transport, plus associated netconfig information. A list of rpcb_entrys
236 % * is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used
237 % * in r_nc_* fields.
240 string r_maddr<>; /* merged address of service */
241 string r_nc_netid<>; /* netid field */
242 unsigned int r_nc_semantics; /* semantics of transport */
243 string r_nc_protofmly<>; /* protocol family */
244 string r_nc_proto<>; /* protocol name */
248 % * A list of addresses supported by a service.
250 struct rpcb_entry_list {
251 rpcb_entry rpcb_entry_map;
252 struct rpcb_entry_list *rpcb_entry_next;
255 typedef rpcb_entry_list *rpcb_entry_list_ptr;
259 % * rpcbind statistics
262 const rpcb_highproc_2 = RPCBPROC_CALLIT;
263 const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR;
264 const rpcb_highproc_4 = RPCBPROC_GETSTAT;
266 const RPCBSTAT_HIGHPROC = 13; /* # of procs in rpcbind V4 plus one */
267 const RPCBVERS_STAT = 3; /* provide only for rpcbind V2, V3 and V4 */
268 const RPCBVERS_4_STAT = 2;
269 const RPCBVERS_3_STAT = 1;
270 const RPCBVERS_2_STAT = 0;
272 %/* Link list of all the stats about getport and getaddr */
273 struct rpcbs_addrlist {
279 struct rpcbs_addrlist *next;
282 %/* Link list of all the stats about rmtcall */
283 struct rpcbs_rmtcalllist {
289 int indirect; /* whether callit or indirect */
291 struct rpcbs_rmtcalllist *next;
294 typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
295 typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
296 typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
302 rpcbs_addrlist_ptr addrinfo;
303 rpcbs_rmtcalllist_ptr rmtinfo;
307 % * One rpcb_stat structure is returned for each version of rpcbind
311 typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
316 % * We don't define netbuf in RPCL, since it would contain structure member
317 % * names that would conflict with the definition of struct netbuf in
318 % * <tiuser.h>. Instead we merely declare the XDR routine xdr_netbuf() here,
319 % * and implement it ourselves in rpc/rpcb_prot.c.
322 %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
324 %#else /* __STDC__ */
325 %extern bool_t xdr_netbuf(XDR *, struct netbuf *);
328 #endif /* def RPC_HDR */
336 RPCBPROC_SET(rpcb) = 1;
339 RPCBPROC_UNSET(rpcb) = 2;
342 RPCBPROC_GETADDR(rpcb) = 3;
345 RPCBPROC_DUMP(void) = 4;
348 RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;
351 RPCBPROC_GETTIME(void) = 6;
354 RPCBPROC_UADDR2TADDR(string) = 7;
357 RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
362 RPCBPROC_SET(rpcb) = 1;
365 RPCBPROC_UNSET(rpcb) = 2;
368 RPCBPROC_GETADDR(rpcb) = 3;
371 RPCBPROC_DUMP(void) = 4;
374 * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT;
375 * the new name is intended to indicate that this
376 * procedure should be used for broadcast RPC, and
377 * RPCBPROC_INDIRECT should be used for indirect calls.
380 RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT;
383 RPCBPROC_GETTIME(void) = 6;
386 RPCBPROC_UADDR2TADDR(string) = 7;
389 RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
392 RPCBPROC_GETVERSADDR(rpcb) = 9;
395 RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10;
398 RPCBPROC_GETADDRLIST(rpcb) = 11;
401 RPCBPROC_GETSTAT(void) = 12;
406 %#define RPCBVERS_3 RPCBVERS
407 %#define RPCBVERS_4 RPCBVERS4
409 %#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock"
411 %#else /* ndef _KERNEL */
417 % * A mapping of (program, version, network ID) to address
420 % rpcprog_t r_prog; /* program number */
421 % rpcvers_t r_vers; /* version number */
422 % char *r_netid; /* network id */
423 % char *r_addr; /* universal address */
424 % char *r_owner; /* owner of the mapping */
426 %typedef struct rpcb RPCB;
429 % * A list of mappings
433 % struct rpcblist *rpcb_next;
435 %typedef struct rpcblist RPCBLIST;
436 %typedef struct rpcblist *rpcblist_ptr;
439 % * Remote calls arguments
441 %struct rpcb_rmtcallargs {
442 % rpcprog_t prog; /* program number */
443 % rpcvers_t vers; /* version number */
444 % rpcproc_t proc; /* procedure number */
445 % u_int32_t arglen; /* arg len */
446 % caddr_t args_ptr; /* argument */
447 % xdrproc_t xdr_args; /* XDR routine for argument */
449 %typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;
452 % * Remote calls results
454 %struct rpcb_rmtcallres {
455 % char *addr_ptr; /* remote universal address */
456 % u_int32_t resultslen; /* results length */
457 % caddr_t results_ptr; /* results */
458 % xdrproc_t xdr_results; /* XDR routine for result */
460 %typedef struct rpcb_rmtcallres rpcb_rmtcallres;
465 % unsigned int r_nc_semantics;
466 % char *r_nc_protofmly;
469 %typedef struct rpcb_entry rpcb_entry;
472 % * A list of addresses supported by a service.
475 %struct rpcb_entry_list {
476 % rpcb_entry rpcb_entry_map;
477 % struct rpcb_entry_list *rpcb_entry_next;
479 %typedef struct rpcb_entry_list rpcb_entry_list;
481 %typedef rpcb_entry_list *rpcb_entry_list_ptr;
484 % * rpcbind statistics
487 %#define rpcb_highproc_2 RPCBPROC_CALLIT
488 %#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR
489 %#define rpcb_highproc_4 RPCBPROC_GETSTAT
490 %#define RPCBSTAT_HIGHPROC 13
491 %#define RPCBVERS_STAT 3
492 %#define RPCBVERS_4_STAT 2
493 %#define RPCBVERS_3_STAT 1
494 %#define RPCBVERS_2_STAT 0
496 %/* Link list of all the stats about getport and getaddr */
498 %struct rpcbs_addrlist {
504 % struct rpcbs_addrlist *next;
506 %typedef struct rpcbs_addrlist rpcbs_addrlist;
508 %/* Link list of all the stats about rmtcall */
510 %struct rpcbs_rmtcalllist {
518 % struct rpcbs_rmtcalllist *next;
520 %typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;
522 %typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
524 %typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
526 %typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
532 % rpcbs_addrlist_ptr addrinfo;
533 % rpcbs_rmtcalllist_ptr rmtinfo;
535 %typedef struct rpcb_stat rpcb_stat;
538 % * One rpcb_stat structure is returned for each version of rpcbind
542 %typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
548 %#endif /* ndef _KERNEL */