1%/*
2% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3% * unrestricted use provided that this legend is included on all tape
4% * media and as a part of the software program in whole or part.  Users
5% * may copy or modify Sun RPC without charge, but are not authorized
6% * to license or distribute it to anyone else except as part of a product or
7% * program developed by the user.
8% *
9% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12% *
13% * Sun RPC is provided with no support and without any obligation on the
14% * part of Sun Microsystems, Inc. to assist in its use, correction,
15% * modification or enhancement.
16% *
17% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19% * OR ANY PART THEREOF.
20% *
21% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22% * or profits or other special, indirect and consequential damages, even if
23% * Sun has been advised of the possibility of such damages.
24% *
25% * Sun Microsystems, Inc.
26% * 2550 Garcia Avenue
27% * Mountain View, California  94043
28% */
29%/*
30% * Copyright (c) 1984,1989 by Sun Microsystems, Inc.
31% */
32
33%/* from pmap_prot.x */
34
35#ifdef RPC_HDR
36%
37%#ifndef _KERNEL
38%
39#endif
40
41/*
42 * Port Mapper Protocol Specification (in RPC Language)
43 * derived from RFC 1057
44 */
45
46%/*
47% * Protocol for the local binder service, or pmap.
48% *
49% * Copyright (C) 1984, Sun Microsystems, Inc.
50% *
51% * The following procedures are supported by the protocol:
52% *
53% * PMAPPROC_NULL() returns ()
54% * 	takes nothing, returns nothing
55% *
56% * PMAPPROC_SET(struct pmap) returns (bool_t)
57% * 	TRUE is success, FALSE is failure.  Registers the tuple
58% *	[prog, vers, prot, port].
59% *
60% * PMAPPROC_UNSET(struct pmap) returns (bool_t)
61% *	TRUE is success, FALSE is failure.  Un-registers pair
62% *	[prog, vers].  prot and port are ignored.
63% *
64% * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
65% *	0 is failure.  Otherwise returns the port number where the pair
66% *	[prog, vers] is registered.  It may lie!
67% *
68% * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr)
69% *
70% * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
71% * 	RETURNS (port, string<>);
72% * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc,
73% *						encapsulatedargs);
74% * 	Calls the procedure on the local machine.  If it is not registered,
75% *	this procedure is quite; ie it does not return error information!!!
76% *	This procedure only is supported on rpc/udp and calls via
77% *	rpc/udp.  This routine only passes null authentication parameters.
78% *	This file has no interface to xdr routines for PMAPPROC_CALLIT.
79% *
80% * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
81% */
82%
83const PMAPPORT = 111;	/* portmapper port number */
84%
85%
86%/*
87% * A mapping of (program, version, protocol) to port number
88% */
89
90struct pmap {
91	unsigned long pm_prog;
92	unsigned long pm_vers;
93	unsigned long pm_prot;
94	unsigned long pm_port;
95};
96#ifdef RPC_HDR
97%
98%typedef pmap PMAP;
99%
100#endif
101%
102%/*
103% * Supported values for the "prot" field
104% */
105%
106const PMAP_IPPROTO_TCP = 6;	/* protocol number for TCP/IP */
107const PMAP_IPPROTO_UDP = 17;	/* protocol number for UDP/IP */
108%
109%
110%/*
111% * A list of mappings
112% *
113% * Below are two definitions for the pmaplist structure.  This is done because
114% * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a
115% * struct pmaplist * that rpcgen would produce.  One version of the pmaplist
116% * structure (actually called pm__list) is used with rpcgen, and the other is
117% * defined only in the header file for compatibility with the specified
118% * interface.
119% */
120
121struct pm__list {
122	pmap pml_map;
123	struct pm__list *pml_next;
124};
125
126typedef pm__list *pmaplist_ptr;		/* results of PMAPPROC_DUMP */
127
128#ifdef RPC_HDR
129%
130%typedef struct pm__list pmaplist;
131%typedef struct pm__list PMAPLIST;
132%
133%#ifndef __cplusplus
134%struct pmaplist {
135%	PMAP pml_map;
136%	struct pmaplist *pml_next;
137%};
138%#endif
139%
140%#ifdef __cplusplus
141%extern "C" {
142%#endif
143%extern  bool_t xdr_pmaplist(XDR *, pmaplist**);
144%#ifdef	__cplusplus
145%}
146%#endif
147%
148#endif
149
150%
151%/*
152% * Arguments to callit
153% */
154
155struct rmtcallargs {
156	unsigned long prog;
157	unsigned long vers;
158	unsigned long proc;
159	opaque args<>;
160};
161#ifdef RPC_HDR
162%
163%/*
164% * Client-side only representation of rmtcallargs structure.
165% *
166% * The routine that XDRs the rmtcallargs structure must deal with the
167% * opaque arguments in the "args" structure.  xdr_rmtcall_args() needs to be
168% * passed the XDR routine that knows the args' structure.  This routine
169% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
170% * the application being called knows the args structure already.  So we use a
171% * different "XDR" structure on the client side, p_rmtcallargs, which includes
172% * the args' XDR routine.
173% */
174%struct p_rmtcallargs {
175%	u_long prog;
176%	u_long vers;
177%	u_long proc;
178%	struct {
179%		u_int args_len;
180%		char *args_val;
181%	} args;
182%	xdrproc_t	xdr_args;	/* encodes args */
183%};
184%
185#endif	/* def RPC_HDR */
186%
187%
188%/*
189% * Results of callit
190% */
191
192struct rmtcallres {
193	unsigned long port;
194	opaque res<>;
195};
196#ifdef RPC_HDR
197%
198%/*
199% * Client-side only representation of rmtcallres structure.
200% */
201%struct p_rmtcallres {
202%	u_long port;
203%	struct {
204%		u_int res_len;
205%		char *res_val;
206%	} res;
207%	xdrproc_t	xdr_res;	/* decodes res */
208%};
209%
210#endif	/* def RPC_HDR */
211
212/*
213 * Port mapper procedures
214 */
215
216program PMAPPROG {
217   version PMAPVERS {
218	void
219	PMAPPROC_NULL(void)	= 0;
220
221	bool
222	PMAPPROC_SET(pmap)	= 1;
223
224	bool
225	PMAPPROC_UNSET(pmap)	= 2;
226
227	unsigned long
228	PMAPPROC_GETPORT(pmap)	= 3;
229
230	pmaplist_ptr
231	PMAPPROC_DUMP(void)	= 4;
232
233	rmtcallres
234	PMAPPROC_CALLIT(rmtcallargs)  = 5;
235   } = 2;
236} = 100000;
237%
238#ifdef RPC_HDR
239%#define PMAPVERS_PROTO		((u_long)2)
240%#define PMAPVERS_ORIG		((u_long)1)
241%
242%#else		/* ndef _KERNEL */
243%
244%#include <rpc/pmap_rmt.h>
245%
246%#ifdef __cplusplus
247%extern "C" {
248%#endif
249%
250%#define	PMAPPORT 111
251%
252%struct pmap {
253%	long unsigned pm_prog;
254%	long unsigned pm_vers;
255%	long unsigned pm_prot;
256%	long unsigned pm_port;
257%};
258%typedef struct pmap PMAP;
259%extern bool_t xdr_pmap (XDR *, struct pmap *);
260%
261%struct pmaplist {
262%	struct pmap pml_map;
263%	struct pmaplist *pml_next;
264%};
265%typedef struct pmaplist PMAPLIST;
266%typedef struct pmaplist *pmaplist_ptr;
267%
268%
269%#ifdef __cplusplus
270%}
271%#endif
272%
273%#endif		/* ndef _KERNEL */
274#endif
275
276