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