xref: /dragonfly/include/rpcsvc/yp.x (revision c8860c9a)
1 /* @(#)yp.x	2.1 88/08/01 4.0 RPCSRC */
2 
3 /*
4  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5  * unrestricted use provided that this legend is included on all tape
6  * media and as a part of the software program in whole or part.  Users
7  * may copy or modify Sun RPC without charge, but are not authorized
8  * to license or distribute it to anyone else except as part of a product or
9  * program developed by the user.
10  *
11  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12  * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
13  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14  *
15  * Sun RPC is provided with no support and without any obligation on the
16  * part of Sun Microsystems, Inc. to assist in its use, correction,
17  * modification or enhancement.
18  *
19  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21  * OR ANY PART THEREOF.
22  *
23  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24  * or profits or other special, indirect and consequential damages, even if
25  * Sun has been advised of the possibility of such damages.
26  *
27  * Sun Microsystems, Inc.
28  * 2550 Garcia Avenue
29  * Mountain View, California  94043
30  *
31  * $FreeBSD: src/include/rpcsvc/yp.x,v 1.12 1999/08/27 23:45:12 peter Exp $
32  */
33 
34 /*
35  * Protocol description file for the Yellow Pages Service
36  */
37 
38 const YPMAXRECORD = 1024;
39 const YPMAXDOMAIN = 64;
40 const YPMAXMAP = 64;
41 const YPMAXPEER = 64;
42 
43 
44 enum ypstat {
45 	YP_TRUE		=  1,
46 	YP_NOMORE	=  2,
47 	YP_FALSE	=  0,
48 	YP_NOMAP	= -1,
49 	YP_NODOM	= -2,
50 	YP_NOKEY	= -3,
51 	YP_BADOP	= -4,
52 	YP_BADDB	= -5,
53 	YP_YPERR	= -6,
54 	YP_BADARGS	= -7,
55 	YP_VERS		= -8
56 };
57 
58 
59 enum ypxfrstat {
60 	YPXFR_SUCC	=  1,
61 	YPXFR_AGE	=  2,
62 	YPXFR_NOMAP	= -1,
63 	YPXFR_NODOM	= -2,
64 	YPXFR_RSRC	= -3,
65 	YPXFR_RPC	= -4,
66 	YPXFR_MADDR	= -5,
67 	YPXFR_YPERR	= -6,
68 	YPXFR_BADARGS	= -7,
69 	YPXFR_DBM	= -8,
70 	YPXFR_FILE	= -9,
71 	YPXFR_SKEW	= -10,
72 	YPXFR_CLEAR	= -11,
73 	YPXFR_FORCE	= -12,
74 	YPXFR_XFRERR	= -13,
75 	YPXFR_REFUSED	= -14
76 };
77 
78 
79 typedef string domainname<YPMAXDOMAIN>;
80 typedef string mapname<YPMAXMAP>;
81 typedef string peername<YPMAXPEER>;
82 typedef opaque keydat<YPMAXRECORD>;
83 typedef opaque valdat<YPMAXRECORD>;
84 
85 
86 struct ypmap_parms {
87 	domainname domain;
88 	mapname map;
89 	unsigned int ordernum;
90 	peername peer;
91 };
92 
93 struct ypreq_key {
94 	domainname domain;
95 	mapname map;
96 	keydat key;
97 };
98 
99 struct ypreq_nokey {
100 	domainname domain;
101 	mapname map;
102 };
103 
104 struct ypreq_xfr {
105 	ypmap_parms map_parms;
106 	unsigned int transid;
107 	unsigned int prog;
108 	unsigned int port;
109 };
110 
111 
112 struct ypresp_val {
113 	ypstat stat;
114 	valdat val;
115 };
116 
117 struct ypresp_key_val {
118 	ypstat stat;
119 #ifdef STUPID_SUN_BUG /* These are backwards */
120 	keydat key;
121 	valdat val;
122 #else
123 	valdat val;
124 	keydat key;
125 #endif
126 };
127 
128 
129 struct ypresp_master {
130 	ypstat stat;
131 	peername peer;
132 };
133 
134 struct ypresp_order {
135 	ypstat stat;
136 	unsigned int ordernum;
137 };
138 
139 union ypresp_all switch (bool more) {
140 case TRUE:
141 	ypresp_key_val val;
142 case FALSE:
143 	void;
144 };
145 
146 struct ypresp_xfr {
147 	unsigned int transid;
148 	ypxfrstat xfrstat;
149 };
150 
151 struct ypmaplist {
152 	mapname map;
153 	ypmaplist *next;
154 };
155 
156 struct ypresp_maplist {
157 	ypstat stat;
158 	ypmaplist *maps;
159 };
160 
161 enum yppush_status {
162 	YPPUSH_SUCC	=  1,	/* Success */
163 	YPPUSH_AGE 	=  2,	/* Master's version not newer */
164 	YPPUSH_NOMAP	= -1,	/* Can't find server for map */
165 	YPPUSH_NODOM	= -2,	/* Domain not supported */
166 	YPPUSH_RSRC	= -3,	/* Local resource alloc failure */
167 	YPPUSH_RPC	= -4,	/* RPC failure talking to server */
168 	YPPUSH_MADDR 	= -5,	/* Can't get master address */
169 	YPPUSH_YPERR	= -6,	/* YP server/map db error */
170 	YPPUSH_BADARGS	= -7,	/* Request arguments bad */
171 	YPPUSH_DBM	= -8,	/* Local dbm operation failed */
172 	YPPUSH_FILE	= -9,	/* Local file I/O operation failed */
173 	YPPUSH_SKEW	= -10,	/* Map version skew during transfer */
174 	YPPUSH_CLEAR	= -11,	/* Can't send "Clear" req to local ypserv */
175 	YPPUSH_FORCE	= -12,	/* No local order number in map  use -f flag. */
176 	YPPUSH_XFRERR 	= -13,	/* ypxfr error */
177 	YPPUSH_REFUSED	= -14 	/* Transfer request refused by ypserv */
178 };
179 
180 struct yppushresp_xfr {
181 	unsigned transid;
182 	yppush_status status;
183 };
184 
185 /*
186  * Response structure and overall result status codes.  Success and failure
187  * represent two separate response message types.
188  */
189 
190 enum ypbind_resptype {
191 	YPBIND_SUCC_VAL = 1,
192 	YPBIND_FAIL_VAL = 2
193 };
194 
195 struct ypbind_binding {
196     opaque ypbind_binding_addr[4]; /* In network order */
197     opaque ypbind_binding_port[2]; /* In network order */
198 };
199 
200 union ypbind_resp switch (ypbind_resptype ypbind_status) {
201 case YPBIND_FAIL_VAL:
202         unsigned ypbind_error;
203 case YPBIND_SUCC_VAL:
204         ypbind_binding ypbind_bindinfo;
205 };
206 
207 /* Detailed failure reason codes for response field ypbind_error*/
208 
209 const YPBIND_ERR_ERR    = 1;	/* Internal error */
210 const YPBIND_ERR_NOSERV = 2;	/* No bound server for passed domain */
211 const YPBIND_ERR_RESC   = 3;	/* System resource allocation failure */
212 
213 
214 /*
215  * Request data structure for ypbind "Set domain" procedure.
216  */
217 struct ypbind_setdom {
218 	domainname ypsetdom_domain;
219 	ypbind_binding ypsetdom_binding;
220 	unsigned ypsetdom_vers;
221 };
222 
223 
224 /*
225  * NIS v1 support for backwards compatibility
226  */
227 enum ypreqtype {
228 	YPREQ_KEY = 1,
229 	YPREQ_NOKEY = 2,
230 	YPREQ_MAP_PARMS = 3
231 };
232 
233 enum ypresptype {
234 	YPRESP_VAL = 1,
235 	YPRESP_KEY_VAL = 2,
236 	YPRESP_MAP_PARMS = 3
237 };
238 
239 union yprequest switch (ypreqtype yp_reqtype) {
240 case YPREQ_KEY:
241 	ypreq_key yp_req_keytype;
242 case YPREQ_NOKEY:
243 	ypreq_nokey yp_req_nokeytype;
244 case YPREQ_MAP_PARMS:
245 	ypmap_parms yp_req_map_parmstype;
246 };
247 
248 union ypresponse switch (ypresptype yp_resptype) {
249 case YPRESP_VAL:
250 	ypresp_val yp_resp_valtype;
251 case YPRESP_KEY_VAL:
252 	ypresp_key_val yp_resp_key_valtype;
253 case YPRESP_MAP_PARMS:
254 	ypmap_parms yp_resp_map_parmstype;
255 };
256 
257 #if !defined(YPBIND_ONLY) && !defined(YPPUSH_ONLY)
258 /*
259  * YP access protocol
260  */
261 program YPPROG {
262 /*
263  * NIS v1 support for backwards compatibility
264  */
265 	version YPOLDVERS {
266 		void
267 		YPOLDPROC_NULL(void) = 0;
268 
269 		bool
270 		YPOLDPROC_DOMAIN(domainname) = 1;
271 
272 		bool
273 		YPOLDPROC_DOMAIN_NONACK(domainname) = 2;
274 
275 		ypresponse
276 		YPOLDPROC_MATCH(yprequest) = 3;
277 
278 		ypresponse
279 		YPOLDPROC_FIRST(yprequest) = 4;
280 
281 		ypresponse
282 		YPOLDPROC_NEXT(yprequest) = 5;
283 
284 		ypresponse
285 		YPOLDPROC_POLL(yprequest) = 6;
286 
287 		ypresponse
288 		YPOLDPROC_PUSH(yprequest) = 7;
289 
290 		ypresponse
291 		YPOLDPROC_PULL(yprequest) = 8;
292 
293 		ypresponse
294 		YPOLDPROC_GET(yprequest) = 9;
295 	} = 1;
296 
297 	version YPVERS {
298 		void
299 		YPPROC_NULL(void) = 0;
300 
301 		bool
302 		YPPROC_DOMAIN(domainname) = 1;
303 
304 		bool
305 		YPPROC_DOMAIN_NONACK(domainname) = 2;
306 
307 		ypresp_val
308 		YPPROC_MATCH(ypreq_key) = 3;
309 
310 		ypresp_key_val
311 #ifdef STUPID_SUN_BUG /* should be ypreq_nokey */
312 		YPPROC_FIRST(ypreq_key) = 4;
313 #else
314 		YPPROC_FIRST(ypreq_nokey) = 4;
315 #endif
316 		ypresp_key_val
317 		YPPROC_NEXT(ypreq_key) = 5;
318 
319 		ypresp_xfr
320 		YPPROC_XFR(ypreq_xfr) = 6;
321 
322 		void
323 		YPPROC_CLEAR(void) = 7;
324 
325 		ypresp_all
326 		YPPROC_ALL(ypreq_nokey) = 8;
327 
328 		ypresp_master
329 		YPPROC_MASTER(ypreq_nokey) = 9;
330 
331 		ypresp_order
332 		YPPROC_ORDER(ypreq_nokey) = 10;
333 
334 		ypresp_maplist
335 		YPPROC_MAPLIST(domainname) = 11;
336 	} = 2;
337 } = 100004;
338 #endif
339 #if !defined(YPSERV_ONLY) && !defined(YPBIND_ONLY)
340 /*
341  * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR
342  */
343 program YPPUSH_XFRRESPPROG {
344 	version YPPUSH_XFRRESPVERS {
345 		void
346 		YPPUSHPROC_NULL(void) = 0;
347 #ifdef STUPID_SUN_BUG /* argument and return value are backwards */
348 		yppushresp_xfr
349 		YPPUSHPROC_XFRRESP(void) = 1;
350 #else
351 		void
352 		YPPUSHPROC_XFRRESP(yppushresp_xfr) = 1;
353 #endif
354 	} = 1;
355 } = 0x40000000;	/* transient: could be anything up to 0x5fffffff */
356 #endif
357 #if !defined(YPSERV_ONLY) && !defined(YPPUSH_ONLY)
358 /*
359  * YP binding protocol
360  */
361 program YPBINDPROG {
362 	version YPBINDVERS {
363 		void
364 		YPBINDPROC_NULL(void) = 0;
365 
366 		ypbind_resp
367 		YPBINDPROC_DOMAIN(domainname) = 1;
368 
369 		void
370 		YPBINDPROC_SETDOM(ypbind_setdom) = 2;
371 	} = 2;
372 } = 100007;
373 
374 #endif
375