xref: /titanic_51/usr/src/uts/common/rpc/pmap_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) 1984,1989 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate % */
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate %/* from pmap_prot.x */
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
29*7c478bd9Sstevel@tonic-gate %
30*7c478bd9Sstevel@tonic-gate %#pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate %
32*7c478bd9Sstevel@tonic-gate %#ifndef _KERNEL
33*7c478bd9Sstevel@tonic-gate %
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * Port Mapper Protocol Specification (in RPC Language)
38*7c478bd9Sstevel@tonic-gate  * derived from RFC 1057
39*7c478bd9Sstevel@tonic-gate  */
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate %/*
42*7c478bd9Sstevel@tonic-gate % * Protocol for the local binder service, or pmap.
43*7c478bd9Sstevel@tonic-gate % *
44*7c478bd9Sstevel@tonic-gate % * Copyright (C) 1984, Sun Microsystems, Inc.
45*7c478bd9Sstevel@tonic-gate % *
46*7c478bd9Sstevel@tonic-gate % * The following procedures are supported by the protocol:
47*7c478bd9Sstevel@tonic-gate % *
48*7c478bd9Sstevel@tonic-gate % * PMAPPROC_NULL() returns ()
49*7c478bd9Sstevel@tonic-gate % * 	takes nothing, returns nothing
50*7c478bd9Sstevel@tonic-gate % *
51*7c478bd9Sstevel@tonic-gate % * PMAPPROC_SET(struct pmap) returns (bool_t)
52*7c478bd9Sstevel@tonic-gate % * 	TRUE is success, FALSE is failure.  Registers the tuple
53*7c478bd9Sstevel@tonic-gate % *	[prog, vers, prot, port].
54*7c478bd9Sstevel@tonic-gate % *
55*7c478bd9Sstevel@tonic-gate % * PMAPPROC_UNSET(struct pmap) returns (bool_t)
56*7c478bd9Sstevel@tonic-gate % *	TRUE is success, FALSE is failure.  Un-registers pair
57*7c478bd9Sstevel@tonic-gate % *	[prog, vers].  prot and port are ignored.
58*7c478bd9Sstevel@tonic-gate % *
59*7c478bd9Sstevel@tonic-gate % * PMAPPROC_GETPORT(struct pmap) returns (rpcport_t).
60*7c478bd9Sstevel@tonic-gate % *	0 is failure.  Otherwise returns the port number where the pair
61*7c478bd9Sstevel@tonic-gate % *	[prog, vers] is registered.  It may lie!
62*7c478bd9Sstevel@tonic-gate % *
63*7c478bd9Sstevel@tonic-gate % * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr)
64*7c478bd9Sstevel@tonic-gate % *
65*7c478bd9Sstevel@tonic-gate % * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
66*7c478bd9Sstevel@tonic-gate % * 	RETURNS (port, string<>);
67*7c478bd9Sstevel@tonic-gate % * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc,
68*7c478bd9Sstevel@tonic-gate % *						encapsulatedargs);
69*7c478bd9Sstevel@tonic-gate % * 	Calls the procedure on the local machine.  If it is not registered,
70*7c478bd9Sstevel@tonic-gate % *	this procedure is quite; ie it does not return error information!!!
71*7c478bd9Sstevel@tonic-gate % *	This procedure only is supported on rpc/udp and calls via
72*7c478bd9Sstevel@tonic-gate % *	rpc/udp.  This routine only passes null authentication parameters.
73*7c478bd9Sstevel@tonic-gate % *	This file has no interface to xdr routines for PMAPPROC_CALLIT.
74*7c478bd9Sstevel@tonic-gate % *
75*7c478bd9Sstevel@tonic-gate % * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
76*7c478bd9Sstevel@tonic-gate % */
77*7c478bd9Sstevel@tonic-gate %
78*7c478bd9Sstevel@tonic-gate const PMAPPORT = 111;	/* portmapper port number */
79*7c478bd9Sstevel@tonic-gate %
80*7c478bd9Sstevel@tonic-gate %
81*7c478bd9Sstevel@tonic-gate %/*
82*7c478bd9Sstevel@tonic-gate % * A mapping of (program, version, protocol) to port number
83*7c478bd9Sstevel@tonic-gate % */
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate struct pmap {
86*7c478bd9Sstevel@tonic-gate 	rpcprog_t pm_prog;
87*7c478bd9Sstevel@tonic-gate 	rpcvers_t pm_vers;
88*7c478bd9Sstevel@tonic-gate 	rpcprot_t pm_prot;
89*7c478bd9Sstevel@tonic-gate 	rpcport_t pm_port;
90*7c478bd9Sstevel@tonic-gate };
91*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
92*7c478bd9Sstevel@tonic-gate %
93*7c478bd9Sstevel@tonic-gate %typedef pmap PMAP;
94*7c478bd9Sstevel@tonic-gate %
95*7c478bd9Sstevel@tonic-gate #endif
96*7c478bd9Sstevel@tonic-gate %
97*7c478bd9Sstevel@tonic-gate %/*
98*7c478bd9Sstevel@tonic-gate % * Supported values for the "prot" field
99*7c478bd9Sstevel@tonic-gate % */
100*7c478bd9Sstevel@tonic-gate %
101*7c478bd9Sstevel@tonic-gate const PMAP_IPPROTO_TCP = 6;	/* protocol number for TCP/IP */
102*7c478bd9Sstevel@tonic-gate const PMAP_IPPROTO_UDP = 17;	/* protocol number for UDP/IP */
103*7c478bd9Sstevel@tonic-gate %
104*7c478bd9Sstevel@tonic-gate %
105*7c478bd9Sstevel@tonic-gate %/*
106*7c478bd9Sstevel@tonic-gate % * A list of mappings
107*7c478bd9Sstevel@tonic-gate % *
108*7c478bd9Sstevel@tonic-gate % * Below are two definitions for the pmaplist structure.  This is done because
109*7c478bd9Sstevel@tonic-gate % * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a
110*7c478bd9Sstevel@tonic-gate % * struct pmaplist * that rpcgen would produce.  One version of the pmaplist
111*7c478bd9Sstevel@tonic-gate % * structure (actually called pm__list) is used with rpcgen, and the other is
112*7c478bd9Sstevel@tonic-gate % * defined only in the header file for compatibility with the specified
113*7c478bd9Sstevel@tonic-gate % * interface.
114*7c478bd9Sstevel@tonic-gate % */
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate struct pm__list {
117*7c478bd9Sstevel@tonic-gate 	pmap pml_map;
118*7c478bd9Sstevel@tonic-gate 	struct pm__list *pml_next;
119*7c478bd9Sstevel@tonic-gate };
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate typedef pm__list *pmaplist_ptr;		/* results of PMAPPROC_DUMP */
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
124*7c478bd9Sstevel@tonic-gate %
125*7c478bd9Sstevel@tonic-gate %struct pmaplist {
126*7c478bd9Sstevel@tonic-gate %	PMAP pml_map;
127*7c478bd9Sstevel@tonic-gate %	struct pmaplist *pml_next;
128*7c478bd9Sstevel@tonic-gate %};
129*7c478bd9Sstevel@tonic-gate %
130*7c478bd9Sstevel@tonic-gate %typedef struct pmaplist pmaplist;
131*7c478bd9Sstevel@tonic-gate %typedef struct pmaplist PMAPLIST;
132*7c478bd9Sstevel@tonic-gate %
133*7c478bd9Sstevel@tonic-gate %#ifdef __cplusplus
134*7c478bd9Sstevel@tonic-gate %extern "C" {
135*7c478bd9Sstevel@tonic-gate %#endif
136*7c478bd9Sstevel@tonic-gate %#ifdef __STDC__
137*7c478bd9Sstevel@tonic-gate %extern  bool_t xdr_pmaplist(XDR *, pmaplist**);
138*7c478bd9Sstevel@tonic-gate %#else /* K&R C */
139*7c478bd9Sstevel@tonic-gate %bool_t xdr_pmaplist();
140*7c478bd9Sstevel@tonic-gate %#endif
141*7c478bd9Sstevel@tonic-gate %#ifdef	__cplusplus
142*7c478bd9Sstevel@tonic-gate %}
143*7c478bd9Sstevel@tonic-gate %#endif
144*7c478bd9Sstevel@tonic-gate %
145*7c478bd9Sstevel@tonic-gate #endif
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate %
148*7c478bd9Sstevel@tonic-gate %/*
149*7c478bd9Sstevel@tonic-gate % * Arguments to callit
150*7c478bd9Sstevel@tonic-gate % */
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate struct rmtcallargs {
153*7c478bd9Sstevel@tonic-gate 	rpcprog_t prog;
154*7c478bd9Sstevel@tonic-gate 	rpcvers_t vers;
155*7c478bd9Sstevel@tonic-gate 	rpcproc_t proc;
156*7c478bd9Sstevel@tonic-gate 	opaque args<>;
157*7c478bd9Sstevel@tonic-gate };
158*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
159*7c478bd9Sstevel@tonic-gate %
160*7c478bd9Sstevel@tonic-gate %/*
161*7c478bd9Sstevel@tonic-gate % * Client-side only representation of rmtcallargs structure.
162*7c478bd9Sstevel@tonic-gate % *
163*7c478bd9Sstevel@tonic-gate % * The routine that XDRs the rmtcallargs structure must deal with the
164*7c478bd9Sstevel@tonic-gate % * opaque arguments in the "args" structure.  xdr_rmtcall_args() needs to be
165*7c478bd9Sstevel@tonic-gate % * passed the XDR routine that knows the args' structure.  This routine
166*7c478bd9Sstevel@tonic-gate % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
167*7c478bd9Sstevel@tonic-gate % * the application being called knows the args structure already.  So we use a
168*7c478bd9Sstevel@tonic-gate % * different "XDR" structure on the client side, p_rmtcallargs, which includes
169*7c478bd9Sstevel@tonic-gate % * the args' XDR routine.
170*7c478bd9Sstevel@tonic-gate % */
171*7c478bd9Sstevel@tonic-gate %struct p_rmtcallargs {
172*7c478bd9Sstevel@tonic-gate %	rpcprog_t prog;
173*7c478bd9Sstevel@tonic-gate %	rpcvers_t vers;
174*7c478bd9Sstevel@tonic-gate %	rpcproc_t proc;
175*7c478bd9Sstevel@tonic-gate %	struct {
176*7c478bd9Sstevel@tonic-gate %		u_int args_len;
177*7c478bd9Sstevel@tonic-gate %		char *args_val;
178*7c478bd9Sstevel@tonic-gate %	} args;
179*7c478bd9Sstevel@tonic-gate %	xdrproc_t	xdr_args;	/* encodes args */
180*7c478bd9Sstevel@tonic-gate %};
181*7c478bd9Sstevel@tonic-gate %
182*7c478bd9Sstevel@tonic-gate #endif	/* def RPC_HDR */
183*7c478bd9Sstevel@tonic-gate %
184*7c478bd9Sstevel@tonic-gate %
185*7c478bd9Sstevel@tonic-gate %/*
186*7c478bd9Sstevel@tonic-gate % * Results of callit
187*7c478bd9Sstevel@tonic-gate % */
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate struct rmtcallres {
190*7c478bd9Sstevel@tonic-gate 	rpcport_t port;
191*7c478bd9Sstevel@tonic-gate 	opaque res<>;
192*7c478bd9Sstevel@tonic-gate };
193*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
194*7c478bd9Sstevel@tonic-gate %
195*7c478bd9Sstevel@tonic-gate %/*
196*7c478bd9Sstevel@tonic-gate % * Client-side only representation of rmtcallres structure.
197*7c478bd9Sstevel@tonic-gate % */
198*7c478bd9Sstevel@tonic-gate %struct p_rmtcallres {
199*7c478bd9Sstevel@tonic-gate %	rpcport_t port;
200*7c478bd9Sstevel@tonic-gate %	struct {
201*7c478bd9Sstevel@tonic-gate %		u_int res_len;
202*7c478bd9Sstevel@tonic-gate %		char *res_val;
203*7c478bd9Sstevel@tonic-gate %	} res;
204*7c478bd9Sstevel@tonic-gate %	xdrproc_t	xdr_res;	/* decodes res */
205*7c478bd9Sstevel@tonic-gate %};
206*7c478bd9Sstevel@tonic-gate %
207*7c478bd9Sstevel@tonic-gate #endif	/* def RPC_HDR */
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate /*
210*7c478bd9Sstevel@tonic-gate  * Port mapper procedures
211*7c478bd9Sstevel@tonic-gate  */
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate program PMAPPROG {
214*7c478bd9Sstevel@tonic-gate    version PMAPVERS {
215*7c478bd9Sstevel@tonic-gate 	void
216*7c478bd9Sstevel@tonic-gate 	PMAPPROC_NULL(void)	= 0;
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate 	bool
219*7c478bd9Sstevel@tonic-gate 	PMAPPROC_SET(pmap)	= 1;
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate 	bool
222*7c478bd9Sstevel@tonic-gate 	PMAPPROC_UNSET(pmap)	= 2;
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate 	rpcport_t
225*7c478bd9Sstevel@tonic-gate 	PMAPPROC_GETPORT(pmap)	= 3;
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate 	pmaplist_ptr
228*7c478bd9Sstevel@tonic-gate 	PMAPPROC_DUMP(void)	= 4;
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate 	rmtcallres
231*7c478bd9Sstevel@tonic-gate 	PMAPPROC_CALLIT(rmtcallargs)  = 5;
232*7c478bd9Sstevel@tonic-gate    } = 2;
233*7c478bd9Sstevel@tonic-gate } = 100000;
234*7c478bd9Sstevel@tonic-gate %
235*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
236*7c478bd9Sstevel@tonic-gate %#define	PMAPVERS_PROTO		((rpcvers_t)2)
237*7c478bd9Sstevel@tonic-gate %#define	PMAPVERS_ORIG		((rpcvers_t)1)
238*7c478bd9Sstevel@tonic-gate %
239*7c478bd9Sstevel@tonic-gate %#else		/* ndef _KERNEL */
240*7c478bd9Sstevel@tonic-gate %
241*7c478bd9Sstevel@tonic-gate %#include <rpc/pmap_rmt.h>
242*7c478bd9Sstevel@tonic-gate %
243*7c478bd9Sstevel@tonic-gate %#ifdef __cplusplus
244*7c478bd9Sstevel@tonic-gate %extern "C" {
245*7c478bd9Sstevel@tonic-gate %#endif
246*7c478bd9Sstevel@tonic-gate %
247*7c478bd9Sstevel@tonic-gate %#define	PMAPPORT 111
248*7c478bd9Sstevel@tonic-gate %
249*7c478bd9Sstevel@tonic-gate %struct pmap {
250*7c478bd9Sstevel@tonic-gate %	rpcprog_t pm_prog;
251*7c478bd9Sstevel@tonic-gate %	rpcvers_t pm_vers;
252*7c478bd9Sstevel@tonic-gate %	rpcprot_t pm_prot;
253*7c478bd9Sstevel@tonic-gate %	rpcport_t pm_port;
254*7c478bd9Sstevel@tonic-gate %};
255*7c478bd9Sstevel@tonic-gate %typedef struct pmap PMAP;
256*7c478bd9Sstevel@tonic-gate %#ifdef __STDC__
257*7c478bd9Sstevel@tonic-gate %extern bool_t xdr_pmap (XDR *, struct pmap *);
258*7c478bd9Sstevel@tonic-gate %#else
259*7c478bd9Sstevel@tonic-gate %extern bool_t xdr_pmap ();
260*7c478bd9Sstevel@tonic-gate %#endif
261*7c478bd9Sstevel@tonic-gate %
262*7c478bd9Sstevel@tonic-gate %struct pmaplist {
263*7c478bd9Sstevel@tonic-gate %	struct pmap pml_map;
264*7c478bd9Sstevel@tonic-gate %	struct pmaplist *pml_next;
265*7c478bd9Sstevel@tonic-gate %};
266*7c478bd9Sstevel@tonic-gate %typedef struct pmaplist PMAPLIST;
267*7c478bd9Sstevel@tonic-gate %typedef struct pmaplist *pmaplist_ptr;
268*7c478bd9Sstevel@tonic-gate %
269*7c478bd9Sstevel@tonic-gate %
270*7c478bd9Sstevel@tonic-gate %#ifdef __cplusplus
271*7c478bd9Sstevel@tonic-gate %}
272*7c478bd9Sstevel@tonic-gate %#endif
273*7c478bd9Sstevel@tonic-gate %
274*7c478bd9Sstevel@tonic-gate %#endif		/* ndef _KERNEL */
275*7c478bd9Sstevel@tonic-gate #endif
276*7c478bd9Sstevel@tonic-gate 
277