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