xref: /illumos-gate/usr/src/head/rpcsvc/yp.x (revision e13f9236)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  *	yp.x
247c478bd9Sstevel@tonic-gate  *
257c478bd9Sstevel@tonic-gate  *	Copyright (c) 1988-1992 Sun Microsystems Inc
267c478bd9Sstevel@tonic-gate  *	All Rights Reserved.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * Protocol description file for the Network Information Services
317c478bd9Sstevel@tonic-gate  */
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate const YPMAXRECORD = 1024;
347c478bd9Sstevel@tonic-gate const YPMAXDOMAIN = 256;
357c478bd9Sstevel@tonic-gate const YPMAXMAP = 64;
367c478bd9Sstevel@tonic-gate const YPMAXPEER = 64;
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate enum ypstat {
407c478bd9Sstevel@tonic-gate 	YP_TRUE		=  1,
417c478bd9Sstevel@tonic-gate 	YP_NOMORE	=  2,
427c478bd9Sstevel@tonic-gate 	YP_FALSE	=  0,
437c478bd9Sstevel@tonic-gate 	YP_NOMAP	= -1,
447c478bd9Sstevel@tonic-gate 	YP_NODOM	= -2,
457c478bd9Sstevel@tonic-gate 	YP_NOKEY	= -3,
467c478bd9Sstevel@tonic-gate 	YP_BADOP	= -4,
477c478bd9Sstevel@tonic-gate 	YP_BADDB	= -5,
487c478bd9Sstevel@tonic-gate 	YP_YPERR	= -6,
497c478bd9Sstevel@tonic-gate 	YP_BADARGS	= -7,
507c478bd9Sstevel@tonic-gate 	YP_VERS		= -8
517c478bd9Sstevel@tonic-gate };
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate enum ypxfrstat {
557c478bd9Sstevel@tonic-gate 	YPXFR_SUCC	=  1,
567c478bd9Sstevel@tonic-gate 	YPXFR_AGE	=  2,
577c478bd9Sstevel@tonic-gate 	YPXFR_NOMAP	= -1,
587c478bd9Sstevel@tonic-gate 	YPXFR_NODOM	= -2,
597c478bd9Sstevel@tonic-gate 	YPXFR_RSRC	= -3,
607c478bd9Sstevel@tonic-gate 	YPXFR_RPC	= -4,
617c478bd9Sstevel@tonic-gate 	YPXFR_MADDR	= -5,
627c478bd9Sstevel@tonic-gate 	YPXFR_YPERR	= -6,
637c478bd9Sstevel@tonic-gate 	YPXFR_BADARGS	= -7,
647c478bd9Sstevel@tonic-gate 	YPXFR_DBM	= -8,
657c478bd9Sstevel@tonic-gate 	YPXFR_FILE	= -9,
667c478bd9Sstevel@tonic-gate 	YPXFR_SKEW	= -10,
677c478bd9Sstevel@tonic-gate 	YPXFR_CLEAR	= -11,
687c478bd9Sstevel@tonic-gate 	YPXFR_FORCE	= -12,
697c478bd9Sstevel@tonic-gate 	YPXFR_XFRERR	= -13,
707c478bd9Sstevel@tonic-gate 	YPXFR_REFUSED	= -14
717c478bd9Sstevel@tonic-gate };
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate typedef string domainname<YPMAXDOMAIN>;
757c478bd9Sstevel@tonic-gate typedef string mapname<YPMAXMAP>;
767c478bd9Sstevel@tonic-gate typedef string peername<YPMAXPEER>;
777c478bd9Sstevel@tonic-gate typedef opaque keydat<YPMAXRECORD>;
787c478bd9Sstevel@tonic-gate typedef opaque valdat<YPMAXRECORD>;
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate struct ypmap_parms {
82*e13f9236SToomas Soome 	domainname domain;
837c478bd9Sstevel@tonic-gate 	mapname map;
847c478bd9Sstevel@tonic-gate 	unsigned int ordernum;
857c478bd9Sstevel@tonic-gate 	peername peer;
867c478bd9Sstevel@tonic-gate };
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate struct ypreq_key {
897c478bd9Sstevel@tonic-gate 	domainname domain;
907c478bd9Sstevel@tonic-gate 	mapname map;
917c478bd9Sstevel@tonic-gate 	keydat key;
927c478bd9Sstevel@tonic-gate };
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate struct ypreq_nokey {
95*e13f9236SToomas Soome 	domainname domain;
967c478bd9Sstevel@tonic-gate 	mapname map;
977c478bd9Sstevel@tonic-gate };
98*e13f9236SToomas Soome 
997c478bd9Sstevel@tonic-gate struct ypreq_xfr {
1007c478bd9Sstevel@tonic-gate 	ypmap_parms map_parms;
1017c478bd9Sstevel@tonic-gate 	unsigned int transid;
1027c478bd9Sstevel@tonic-gate 	unsigned int prog;
1037c478bd9Sstevel@tonic-gate 	unsigned int port;
1047c478bd9Sstevel@tonic-gate };
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate struct ypresp_val {
1087c478bd9Sstevel@tonic-gate 	ypstat stat;
1097c478bd9Sstevel@tonic-gate 	valdat val;
1107c478bd9Sstevel@tonic-gate };
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate struct ypresp_key_val {
1137c478bd9Sstevel@tonic-gate 	ypstat stat;
1147c478bd9Sstevel@tonic-gate 	valdat val;
1157c478bd9Sstevel@tonic-gate 	keydat key;
1167c478bd9Sstevel@tonic-gate };
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate struct ypresp_master {
120*e13f9236SToomas Soome 	ypstat stat;
1217c478bd9Sstevel@tonic-gate 	peername peer;
1227c478bd9Sstevel@tonic-gate };
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate struct ypresp_order {
1257c478bd9Sstevel@tonic-gate 	ypstat stat;
1267c478bd9Sstevel@tonic-gate 	unsigned int ordernum;
1277c478bd9Sstevel@tonic-gate };
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate union ypresp_all switch (bool more) {
1307c478bd9Sstevel@tonic-gate case TRUE:
1317c478bd9Sstevel@tonic-gate 	ypresp_key_val val;
1327c478bd9Sstevel@tonic-gate case FALSE:
1337c478bd9Sstevel@tonic-gate 	void;
1347c478bd9Sstevel@tonic-gate };
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate struct ypresp_xfr {
1377c478bd9Sstevel@tonic-gate 	unsigned int transid;
1387c478bd9Sstevel@tonic-gate 	ypxfrstat xfrstat;
1397c478bd9Sstevel@tonic-gate };
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate struct ypmaplist {
1427c478bd9Sstevel@tonic-gate 	mapname map;
1437c478bd9Sstevel@tonic-gate 	ypmaplist *next;
1447c478bd9Sstevel@tonic-gate };
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate struct ypresp_maplist {
1477c478bd9Sstevel@tonic-gate 	ypstat stat;
1487c478bd9Sstevel@tonic-gate 	ypmaplist *maps;
1497c478bd9Sstevel@tonic-gate };
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate enum yppush_status {
1527c478bd9Sstevel@tonic-gate 	YPPUSH_SUCC	=  1,	/* Success */
1537c478bd9Sstevel@tonic-gate 	YPPUSH_AGE 	=  2,	/* Master's version not newer */
1547c478bd9Sstevel@tonic-gate 	YPPUSH_NOMAP	= -1,	/* Can't find server for map */
1557c478bd9Sstevel@tonic-gate 	YPPUSH_NODOM	= -2,	/* Domain not supported */
1567c478bd9Sstevel@tonic-gate 	YPPUSH_RSRC	= -3,	/* Local resource alloc failure */
1577c478bd9Sstevel@tonic-gate 	YPPUSH_RPC	= -4,	/* RPC failure talking to server */
1587c478bd9Sstevel@tonic-gate 	YPPUSH_MADDR 	= -5,	/* Can't get master address */
1597c478bd9Sstevel@tonic-gate 	YPPUSH_YPERR	= -6,	/* NIS server/map db error */
1607c478bd9Sstevel@tonic-gate 	YPPUSH_BADARGS	= -7,	/* Request arguments bad */
1617c478bd9Sstevel@tonic-gate 	YPPUSH_DBM	= -8,	/* Local dbm operation failed */
1627c478bd9Sstevel@tonic-gate 	YPPUSH_FILE	= -9,	/* Local file I/O operation failed */
1637c478bd9Sstevel@tonic-gate 	YPPUSH_SKEW	= -10,	/* Map version skew during transfer */
1647c478bd9Sstevel@tonic-gate 	YPPUSH_CLEAR	= -11,	/* Can't send "Clear" req to local ypserv */
1657c478bd9Sstevel@tonic-gate 	YPPUSH_FORCE	= -12,	/* No local order number in map  use -f flag. */
1667c478bd9Sstevel@tonic-gate 	YPPUSH_XFRERR 	= -13,	/* ypxfr error */
1677c478bd9Sstevel@tonic-gate 	YPPUSH_REFUSED	= -14 	/* Transfer request refused by ypserv */
1687c478bd9Sstevel@tonic-gate };
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate struct yppushresp_xfr {
1717c478bd9Sstevel@tonic-gate 	unsigned transid;
1727c478bd9Sstevel@tonic-gate 	yppush_status status;
1737c478bd9Sstevel@tonic-gate };
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate /*
1767c478bd9Sstevel@tonic-gate  * Response structure and overall result status codes.  Success and failure
1777c478bd9Sstevel@tonic-gate  * represent two separate response message types.
1787c478bd9Sstevel@tonic-gate  */
179*e13f9236SToomas Soome 
1807c478bd9Sstevel@tonic-gate enum ypbind_resptype {
181*e13f9236SToomas Soome 	YPBIND_SUCC_VAL = 1,
1827c478bd9Sstevel@tonic-gate 	YPBIND_FAIL_VAL = 2
1837c478bd9Sstevel@tonic-gate };
184*e13f9236SToomas Soome 
1857c478bd9Sstevel@tonic-gate struct ypbind_binding {
1867c478bd9Sstevel@tonic-gate     opaque ypbind_binding_addr[4]; /* In network order */
1877c478bd9Sstevel@tonic-gate     opaque ypbind_binding_port[2]; /* In network order */
188*e13f9236SToomas Soome };
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate union ypbind_resp switch (ypbind_resptype ypbind_status) {
1917c478bd9Sstevel@tonic-gate case YPBIND_FAIL_VAL:
1927c478bd9Sstevel@tonic-gate         unsigned ypbind_error;
1937c478bd9Sstevel@tonic-gate case YPBIND_SUCC_VAL:
1947c478bd9Sstevel@tonic-gate         ypbind_binding ypbind_bindinfo;
195*e13f9236SToomas Soome };
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate /* Detailed failure reason codes for response field ypbind_error*/
198*e13f9236SToomas Soome 
1997c478bd9Sstevel@tonic-gate const YPBIND_ERR_ERR    = 1;	/* Internal error */
2007c478bd9Sstevel@tonic-gate const YPBIND_ERR_NOSERV = 2;	/* No bound server for passed domain */
2017c478bd9Sstevel@tonic-gate const YPBIND_ERR_RESC   = 3;	/* System resource allocation failure */
202*e13f9236SToomas Soome 
203*e13f9236SToomas Soome 
2047c478bd9Sstevel@tonic-gate /*
2057c478bd9Sstevel@tonic-gate  * Request data structure for ypbind "Set domain" procedure.
2067c478bd9Sstevel@tonic-gate  */
2077c478bd9Sstevel@tonic-gate struct ypbind_setdom {
2087c478bd9Sstevel@tonic-gate 	domainname ypsetdom_domain;
2097c478bd9Sstevel@tonic-gate 	ypbind_binding ypsetdom_binding;
2107c478bd9Sstevel@tonic-gate 	unsigned ypsetdom_vers;
2117c478bd9Sstevel@tonic-gate };
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate 
2147c478bd9Sstevel@tonic-gate /*
2157c478bd9Sstevel@tonic-gate  * NIS access protocol
2167c478bd9Sstevel@tonic-gate  */
2177c478bd9Sstevel@tonic-gate program YPPROG {
2187c478bd9Sstevel@tonic-gate 	version YPVERS {
219*e13f9236SToomas Soome 		void
2207c478bd9Sstevel@tonic-gate 		YPPROC_NULL(void) = 0;
2217c478bd9Sstevel@tonic-gate 
222*e13f9236SToomas Soome 		bool
223*e13f9236SToomas Soome 		YPPROC_DOMAIN(domainname) = 1;
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate 		bool
2267c478bd9Sstevel@tonic-gate 		YPPROC_DOMAIN_NONACK(domainname) = 2;
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate 		ypresp_val
2297c478bd9Sstevel@tonic-gate 		YPPROC_MATCH(ypreq_key) = 3;
2307c478bd9Sstevel@tonic-gate 
231*e13f9236SToomas Soome 		ypresp_key_val
2327c478bd9Sstevel@tonic-gate 		YPPROC_FIRST(ypreq_key) = 4;
2337c478bd9Sstevel@tonic-gate 
234*e13f9236SToomas Soome 		ypresp_key_val
2357c478bd9Sstevel@tonic-gate 		YPPROC_NEXT(ypreq_key) = 5;
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate 		ypresp_xfr
2387c478bd9Sstevel@tonic-gate 		YPPROC_XFR(ypreq_xfr) = 6;
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate 		void
2417c478bd9Sstevel@tonic-gate 		YPPROC_CLEAR(void) = 7;
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate 		ypresp_all
2447c478bd9Sstevel@tonic-gate 		YPPROC_ALL(ypreq_nokey) = 8;
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate 		ypresp_master
2477c478bd9Sstevel@tonic-gate 		YPPROC_MASTER(ypreq_nokey) = 9;
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate 		ypresp_order
2507c478bd9Sstevel@tonic-gate 		YPPROC_ORDER(ypreq_nokey) = 10;
2517c478bd9Sstevel@tonic-gate 
252*e13f9236SToomas Soome 		ypresp_maplist
2537c478bd9Sstevel@tonic-gate 		YPPROC_MAPLIST(domainname) = 11;
2547c478bd9Sstevel@tonic-gate 	} = 2;
2557c478bd9Sstevel@tonic-gate } = 100004;
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate /*
2597c478bd9Sstevel@tonic-gate  * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR
2607c478bd9Sstevel@tonic-gate  */
2617c478bd9Sstevel@tonic-gate program YPPUSH_XFRRESPPROG {
2627c478bd9Sstevel@tonic-gate 	version YPPUSH_XFRRESPVERS {
2637c478bd9Sstevel@tonic-gate 		void
2647c478bd9Sstevel@tonic-gate 		YPPUSHPROC_NULL(void) = 0;
2657c478bd9Sstevel@tonic-gate 
266*e13f9236SToomas Soome 		yppushresp_xfr
2677c478bd9Sstevel@tonic-gate 		YPPUSHPROC_XFRRESP(void) = 1;
2687c478bd9Sstevel@tonic-gate 	} = 1;
2697c478bd9Sstevel@tonic-gate } = 0x40000000;	/* transient: could be anything up to 0x5fffffff */
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate /*
2737c478bd9Sstevel@tonic-gate  * NIS binding protocol
2747c478bd9Sstevel@tonic-gate  */
2757c478bd9Sstevel@tonic-gate program YPBINDPROG {
2767c478bd9Sstevel@tonic-gate 	version YPBINDVERS {
2777c478bd9Sstevel@tonic-gate 		void
2787c478bd9Sstevel@tonic-gate 		YPBINDPROC_NULL(void) = 0;
279*e13f9236SToomas Soome 
2807c478bd9Sstevel@tonic-gate 		ypbind_resp
2817c478bd9Sstevel@tonic-gate 		YPBINDPROC_DOMAIN(domainname) = 1;
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate 		void
2847c478bd9Sstevel@tonic-gate 		YPBINDPROC_SETDOM(ypbind_setdom) = 2;
2857c478bd9Sstevel@tonic-gate 	} = 2;
2867c478bd9Sstevel@tonic-gate } = 100007;
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate 
289