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