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