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