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