xref: /titanic_44/usr/src/head/rpcsvc/yp.x (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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  *	yp.x
24  *
25  *	Copyright (c) 1988-1992 Sun Microsystems Inc
26  *	All Rights Reserved.
27  */
28 
29 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Protocol description file for the Network Information Services
33  */
34 
35 const YPMAXRECORD = 1024;
36 const YPMAXDOMAIN = 256;
37 const YPMAXMAP = 64;
38 const YPMAXPEER = 64;
39 
40 
41 enum ypstat {
42 	YP_TRUE		=  1,
43 	YP_NOMORE	=  2,
44 	YP_FALSE	=  0,
45 	YP_NOMAP	= -1,
46 	YP_NODOM	= -2,
47 	YP_NOKEY	= -3,
48 	YP_BADOP	= -4,
49 	YP_BADDB	= -5,
50 	YP_YPERR	= -6,
51 	YP_BADARGS	= -7,
52 	YP_VERS		= -8
53 };
54 
55 
56 enum ypxfrstat {
57 	YPXFR_SUCC	=  1,
58 	YPXFR_AGE	=  2,
59 	YPXFR_NOMAP	= -1,
60 	YPXFR_NODOM	= -2,
61 	YPXFR_RSRC	= -3,
62 	YPXFR_RPC	= -4,
63 	YPXFR_MADDR	= -5,
64 	YPXFR_YPERR	= -6,
65 	YPXFR_BADARGS	= -7,
66 	YPXFR_DBM	= -8,
67 	YPXFR_FILE	= -9,
68 	YPXFR_SKEW	= -10,
69 	YPXFR_CLEAR	= -11,
70 	YPXFR_FORCE	= -12,
71 	YPXFR_XFRERR	= -13,
72 	YPXFR_REFUSED	= -14
73 };
74 
75 
76 typedef string domainname<YPMAXDOMAIN>;
77 typedef string mapname<YPMAXMAP>;
78 typedef string peername<YPMAXPEER>;
79 typedef opaque keydat<YPMAXRECORD>;
80 typedef opaque valdat<YPMAXRECORD>;
81 
82 
83 struct ypmap_parms {
84 	domainname domain;
85 	mapname map;
86 	unsigned int ordernum;
87 	peername peer;
88 };
89 
90 struct ypreq_key {
91 	domainname domain;
92 	mapname map;
93 	keydat key;
94 };
95 
96 struct ypreq_nokey {
97 	domainname domain;
98 	mapname map;
99 };
100 
101 struct ypreq_xfr {
102 	ypmap_parms map_parms;
103 	unsigned int transid;
104 	unsigned int prog;
105 	unsigned int port;
106 };
107 
108 
109 struct ypresp_val {
110 	ypstat stat;
111 	valdat val;
112 };
113 
114 struct ypresp_key_val {
115 	ypstat stat;
116 	valdat val;
117 	keydat key;
118 };
119 
120 
121 struct ypresp_master {
122 	ypstat stat;
123 	peername peer;
124 };
125 
126 struct ypresp_order {
127 	ypstat stat;
128 	unsigned int ordernum;
129 };
130 
131 union ypresp_all switch (bool more) {
132 case TRUE:
133 	ypresp_key_val val;
134 case FALSE:
135 	void;
136 };
137 
138 struct ypresp_xfr {
139 	unsigned int transid;
140 	ypxfrstat xfrstat;
141 };
142 
143 struct ypmaplist {
144 	mapname map;
145 	ypmaplist *next;
146 };
147 
148 struct ypresp_maplist {
149 	ypstat stat;
150 	ypmaplist *maps;
151 };
152 
153 enum yppush_status {
154 	YPPUSH_SUCC	=  1,	/* Success */
155 	YPPUSH_AGE 	=  2,	/* Master's version not newer */
156 	YPPUSH_NOMAP	= -1,	/* Can't find server for map */
157 	YPPUSH_NODOM	= -2,	/* Domain not supported */
158 	YPPUSH_RSRC	= -3,	/* Local resource alloc failure */
159 	YPPUSH_RPC	= -4,	/* RPC failure talking to server */
160 	YPPUSH_MADDR 	= -5,	/* Can't get master address */
161 	YPPUSH_YPERR	= -6,	/* NIS server/map db error */
162 	YPPUSH_BADARGS	= -7,	/* Request arguments bad */
163 	YPPUSH_DBM	= -8,	/* Local dbm operation failed */
164 	YPPUSH_FILE	= -9,	/* Local file I/O operation failed */
165 	YPPUSH_SKEW	= -10,	/* Map version skew during transfer */
166 	YPPUSH_CLEAR	= -11,	/* Can't send "Clear" req to local ypserv */
167 	YPPUSH_FORCE	= -12,	/* No local order number in map  use -f flag. */
168 	YPPUSH_XFRERR 	= -13,	/* ypxfr error */
169 	YPPUSH_REFUSED	= -14 	/* Transfer request refused by ypserv */
170 };
171 
172 struct yppushresp_xfr {
173 	unsigned transid;
174 	yppush_status status;
175 };
176 
177 /*
178  * Response structure and overall result status codes.  Success and failure
179  * represent two separate response message types.
180  */
181 
182 enum ypbind_resptype {
183 	YPBIND_SUCC_VAL = 1,
184 	YPBIND_FAIL_VAL = 2
185 };
186 
187 struct ypbind_binding {
188     opaque ypbind_binding_addr[4]; /* In network order */
189     opaque ypbind_binding_port[2]; /* In network order */
190 };
191 
192 union ypbind_resp switch (ypbind_resptype ypbind_status) {
193 case YPBIND_FAIL_VAL:
194         unsigned ypbind_error;
195 case YPBIND_SUCC_VAL:
196         ypbind_binding ypbind_bindinfo;
197 };
198 
199 /* Detailed failure reason codes for response field ypbind_error*/
200 
201 const YPBIND_ERR_ERR    = 1;	/* Internal error */
202 const YPBIND_ERR_NOSERV = 2;	/* No bound server for passed domain */
203 const YPBIND_ERR_RESC   = 3;	/* System resource allocation failure */
204 
205 
206 /*
207  * Request data structure for ypbind "Set domain" procedure.
208  */
209 struct ypbind_setdom {
210 	domainname ypsetdom_domain;
211 	ypbind_binding ypsetdom_binding;
212 	unsigned ypsetdom_vers;
213 };
214 
215 
216 /*
217  * NIS access protocol
218  */
219 program YPPROG {
220 	version YPVERS {
221 		void
222 		YPPROC_NULL(void) = 0;
223 
224 		bool
225 		YPPROC_DOMAIN(domainname) = 1;
226 
227 		bool
228 		YPPROC_DOMAIN_NONACK(domainname) = 2;
229 
230 		ypresp_val
231 		YPPROC_MATCH(ypreq_key) = 3;
232 
233 		ypresp_key_val
234 		YPPROC_FIRST(ypreq_key) = 4;
235 
236 		ypresp_key_val
237 		YPPROC_NEXT(ypreq_key) = 5;
238 
239 		ypresp_xfr
240 		YPPROC_XFR(ypreq_xfr) = 6;
241 
242 		void
243 		YPPROC_CLEAR(void) = 7;
244 
245 		ypresp_all
246 		YPPROC_ALL(ypreq_nokey) = 8;
247 
248 		ypresp_master
249 		YPPROC_MASTER(ypreq_nokey) = 9;
250 
251 		ypresp_order
252 		YPPROC_ORDER(ypreq_nokey) = 10;
253 
254 		ypresp_maplist
255 		YPPROC_MAPLIST(domainname) = 11;
256 	} = 2;
257 } = 100004;
258 
259 
260 /*
261  * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR
262  */
263 program YPPUSH_XFRRESPPROG {
264 	version YPPUSH_XFRRESPVERS {
265 		void
266 		YPPUSHPROC_NULL(void) = 0;
267 
268 		yppushresp_xfr
269 		YPPUSHPROC_XFRRESP(void) = 1;
270 	} = 1;
271 } = 0x40000000;	/* transient: could be anything up to 0x5fffffff */
272 
273 
274 /*
275  * NIS binding protocol
276  */
277 program YPBINDPROG {
278 	version YPBINDVERS {
279 		void
280 		YPBINDPROC_NULL(void) = 0;
281 
282 		ypbind_resp
283 		YPBINDPROC_DOMAIN(domainname) = 1;
284 
285 		void
286 		YPBINDPROC_SETDOM(ypbind_setdom) = 2;
287 	} = 2;
288 } = 100007;
289 
290 
291