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