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