pmap_prot.x revision 256281
1207753Smm%/*
2207753Smm% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3207753Smm% * unrestricted use provided that this legend is included on all tape
4207753Smm% * media and as a part of the software program in whole or part.  Users
5207753Smm% * may copy or modify Sun RPC without charge, but are not authorized
6207753Smm% * to license or distribute it to anyone else except as part of a product or
7207753Smm% * program developed by the user.
8207753Smm% *
9207753Smm% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10207753Smm% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11207753Smm% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12207753Smm% *
13207753Smm% * Sun RPC is provided with no support and without any obligation on the
14207753Smm% * part of Sun Microsystems, Inc. to assist in its use, correction,
15207753Smm% * modification or enhancement.
16207753Smm% *
17207753Smm% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18207753Smm% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19207753Smm% * OR ANY PART THEREOF.
20207753Smm% *
21207753Smm% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22207753Smm% * or profits or other special, indirect and consequential damages, even if
23274261Sdelphij% * Sun has been advised of the possibility of such damages.
24207753Smm% *
25207753Smm% * Sun Microsystems, Inc.
26207753Smm% * 2550 Garcia Avenue
27207753Smm% * Mountain View, California  94043
28207753Smm% */
29207753Smm%/*
30207753Smm% * Copyright (c) 1984,1989 by Sun Microsystems, Inc.
31207753Smm% */
32207753Smm
33207753Smm%/* from pmap_prot.x */
34207753Smm
35207753Smm#ifdef RPC_HDR
36207753Smm%
37207753Smm%#pragma ident	"@(#)pmap_prot.x	1.6	94/04/29 SMI"
38207753Smm%#include <sys/cdefs.h>
39207753Smm%__FBSDID("$FreeBSD: stable/10/include/rpcsvc/pmap_prot.x 114629 2003-05-04 02:51:42Z obrien $");
40207753Smm%
41207753Smm%#ifndef _KERNEL
42207753Smm%
43207753Smm#endif
44207753Smm
45207753Smm/*
46207753Smm * Port Mapper Protocol Specification (in RPC Language)
47207753Smm * derived from RFC 1057
48207753Smm */
49207753Smm
50207753Smm%/*
51207753Smm% * Protocol for the local binder service, or pmap.
52207753Smm% *
53207753Smm% * Copyright (C) 1984, Sun Microsystems, Inc.
54207753Smm% *
55207753Smm% * The following procedures are supported by the protocol:
56207753Smm% *
57207753Smm% * PMAPPROC_NULL() returns ()
58207753Smm% * 	takes nothing, returns nothing
59207753Smm% *
60207753Smm% * PMAPPROC_SET(struct pmap) returns (bool_t)
61207753Smm% * 	TRUE is success, FALSE is failure.  Registers the tuple
62207753Smm% *	[prog, vers, prot, port].
63207753Smm% *
64207753Smm% * PMAPPROC_UNSET(struct pmap) returns (bool_t)
65207753Smm% *	TRUE is success, FALSE is failure.  Un-registers pair
66207753Smm% *	[prog, vers].  prot and port are ignored.
67207753Smm% *
68207753Smm% * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
69207753Smm% *	0 is failure.  Otherwise returns the port number where the pair
70207753Smm% *	[prog, vers] is registered.  It may lie!
71207753Smm% *
72207753Smm% * PMAPPROC_DUMP() RETURNS (struct pmaplist_ptr)
73207753Smm% *
74207753Smm% * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
75207753Smm% * 	RETURNS (port, string<>);
76207753Smm% * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc,
77207753Smm% *						encapsulatedargs);
78207753Smm% * 	Calls the procedure on the local machine.  If it is not registered,
79207753Smm% *	this procedure is quite; ie it does not return error information!!!
80207753Smm% *	This procedure only is supported on rpc/udp and calls via
81207753Smm% *	rpc/udp.  This routine only passes null authentication parameters.
82207753Smm% *	This file has no interface to xdr routines for PMAPPROC_CALLIT.
83% *
84% * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
85% */
86%
87const PMAPPORT = 111;	/* portmapper port number */
88%
89%
90%/*
91% * A mapping of (program, version, protocol) to port number
92% */
93
94struct pmap {
95	unsigned long pm_prog;
96	unsigned long pm_vers;
97	unsigned long pm_prot;
98	unsigned long pm_port;
99};
100#ifdef RPC_HDR
101%
102%typedef pmap PMAP;
103%
104#endif
105%
106%/*
107% * Supported values for the "prot" field
108% */
109%
110const PMAP_IPPROTO_TCP = 6;	/* protocol number for TCP/IP */
111const PMAP_IPPROTO_UDP = 17;	/* protocol number for UDP/IP */
112%
113%
114%/*
115% * A list of mappings
116% *
117% * Below are two definitions for the pmaplist structure.  This is done because
118% * xdr_pmaplist() is specified to take a struct pmaplist **, rather than a
119% * struct pmaplist * that rpcgen would produce.  One version of the pmaplist
120% * structure (actually called pm__list) is used with rpcgen, and the other is
121% * defined only in the header file for compatibility with the specified
122% * interface.
123% */
124
125struct pm__list {
126	pmap pml_map;
127	struct pm__list *pml_next;
128};
129
130typedef pm__list *pmaplist_ptr;		/* results of PMAPPROC_DUMP */
131
132#ifdef RPC_HDR
133%
134%typedef struct pm__list pmaplist;
135%typedef struct pm__list PMAPLIST;
136%
137%#ifndef __cplusplus
138%struct pmaplist {
139%	PMAP pml_map;
140%	struct pmaplist *pml_next;
141%};
142%#endif
143%
144%#ifdef __cplusplus
145%extern "C" {
146%#endif
147%extern  bool_t xdr_pmaplist(XDR *, pmaplist**);
148%#ifdef	__cplusplus
149%}
150%#endif
151%
152#endif
153
154%
155%/*
156% * Arguments to callit
157% */
158
159struct rmtcallargs {
160	unsigned long prog;
161	unsigned long vers;
162	unsigned long proc;
163	opaque args<>;
164};
165#ifdef RPC_HDR
166%
167%/*
168% * Client-side only representation of rmtcallargs structure.
169% *
170% * The routine that XDRs the rmtcallargs structure must deal with the
171% * opaque arguments in the "args" structure.  xdr_rmtcall_args() needs to be
172% * passed the XDR routine that knows the args' structure.  This routine
173% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
174% * the application being called knows the args structure already.  So we use a
175% * different "XDR" structure on the client side, p_rmtcallargs, which includes
176% * the args' XDR routine.
177% */
178%struct p_rmtcallargs {
179%	u_long prog;
180%	u_long vers;
181%	u_long proc;
182%	struct {
183%		u_int args_len;
184%		char *args_val;
185%	} args;
186%	xdrproc_t	xdr_args;	/* encodes args */
187%};
188%
189#endif	/* def RPC_HDR */
190%
191%
192%/*
193% * Results of callit
194% */
195
196struct rmtcallres {
197	unsigned long port;
198	opaque res<>;
199};
200#ifdef RPC_HDR
201%
202%/*
203% * Client-side only representation of rmtcallres structure.
204% */
205%struct p_rmtcallres {
206%	u_long port;
207%	struct {
208%		u_int res_len;
209%		char *res_val;
210%	} res;
211%	xdrproc_t	xdr_res;	/* decodes res */
212%};
213%
214#endif	/* def RPC_HDR */
215
216/*
217 * Port mapper procedures
218 */
219
220program PMAPPROG {
221   version PMAPVERS {
222	void
223	PMAPPROC_NULL(void)	= 0;
224
225	bool
226	PMAPPROC_SET(pmap)	= 1;
227
228	bool
229	PMAPPROC_UNSET(pmap)	= 2;
230
231	unsigned long
232	PMAPPROC_GETPORT(pmap)	= 3;
233
234	pmaplist_ptr
235	PMAPPROC_DUMP(void)	= 4;
236
237	rmtcallres
238	PMAPPROC_CALLIT(rmtcallargs)  = 5;
239   } = 2;
240} = 100000;
241%
242#ifdef RPC_HDR
243%#define PMAPVERS_PROTO		((u_long)2)
244%#define PMAPVERS_ORIG		((u_long)1)
245%
246%#else		/* ndef _KERNEL */
247%
248%#include <rpc/pmap_rmt.h>
249%
250%#ifdef __cplusplus
251%extern "C" {
252%#endif
253%
254%#define	PMAPPORT 111
255%
256%struct pmap {
257%	long unsigned pm_prog;
258%	long unsigned pm_vers;
259%	long unsigned pm_prot;
260%	long unsigned pm_port;
261%};
262%typedef struct pmap PMAP;
263%extern bool_t xdr_pmap (XDR *, struct pmap *);
264%
265%struct pmaplist {
266%	struct pmap pml_map;
267%	struct pmaplist *pml_next;
268%};
269%typedef struct pmaplist PMAPLIST;
270%typedef struct pmaplist *pmaplist_ptr;
271%
272%
273%#ifdef __cplusplus
274%}
275%#endif
276%
277%#endif		/* ndef _KERNEL */
278#endif
279
280