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