xref: /illumos-gate/usr/src/head/rpcsvc/yp_prot.h (revision 6e270ca8)
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 /*
23ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24ba3594baSGarrett D'Amore  *
257c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
30b4203d75SMarcel Telka /*	  All Rights Reserved	*/
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
347c478bd9Sstevel@tonic-gate  * under license from the Regents of the University of California.
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifndef	_RPCSVC_YP_PROT_H
387c478bd9Sstevel@tonic-gate #define	_RPCSVC_YP_PROT_H
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
417c478bd9Sstevel@tonic-gate #include <rpcsvc/ypclnt.h>
427c478bd9Sstevel@tonic-gate #include <ndbm.h>
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
457c478bd9Sstevel@tonic-gate extern "C" {
467c478bd9Sstevel@tonic-gate #endif
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * This file contains symbols and structures defining the rpc protocol
507c478bd9Sstevel@tonic-gate  * between the YP clients and the YP servers.  The servers are the YP
517c478bd9Sstevel@tonic-gate  * database servers, and the YP.
527c478bd9Sstevel@tonic-gate  */
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * The following procedures are supported by the protocol:
567c478bd9Sstevel@tonic-gate  *
577c478bd9Sstevel@tonic-gate  * YPPROC_NULL() returns () takes nothing, returns nothing.  This indicates
587c478bd9Sstevel@tonic-gate  * that the yp server is alive.
597c478bd9Sstevel@tonic-gate  *
607c478bd9Sstevel@tonic-gate  * YPPROC_DOMAIN (char *) returns (bool_t) TRUE.  Indicates that the
617c478bd9Sstevel@tonic-gate  * responding yp server does serve the named domain; FALSE indicates no
627c478bd9Sstevel@tonic-gate  * support.
637c478bd9Sstevel@tonic-gate  *
647c478bd9Sstevel@tonic-gate  * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the yp server does serve
657c478bd9Sstevel@tonic-gate  * the named domain, otherwise does not return.  Used in the broadcast case.
667c478bd9Sstevel@tonic-gate  *
677c478bd9Sstevel@tonic-gate  * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val).  Returns the
687c478bd9Sstevel@tonic-gate  * right-hand value for a passed left-hand key, within a named map and
697c478bd9Sstevel@tonic-gate  * domain.
707c478bd9Sstevel@tonic-gate  *
717c478bd9Sstevel@tonic-gate  * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
727c478bd9Sstevel@tonic-gate  * Returns the first key-value pair from a named domain and map.
737c478bd9Sstevel@tonic-gate  *
747c478bd9Sstevel@tonic-gate  * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val).  Returns
757c478bd9Sstevel@tonic-gate  * the key-value pair following a passed key-value pair within a named
767c478bd9Sstevel@tonic-gate  * domain and map.
777c478bd9Sstevel@tonic-gate  *
787c478bd9Sstevel@tonic-gate  * YPPROC_XFR (struct ypreq_xfr) returns nothing.  Indicates to a server that
797c478bd9Sstevel@tonic-gate  * a map should be updated.
807c478bd9Sstevel@tonic-gate  *
817c478bd9Sstevel@tonic-gate  * YPPROC_NEWXFR (struct ypreq_newxfr) returns nothing.  Indicates to a server
827c478bd9Sstevel@tonic-gate  * that a map should be updated. Uses protocol independent request struct.
837c478bd9Sstevel@tonic-gate  *
847c478bd9Sstevel@tonic-gate  * YPPROC_CLEAR	takes nothing, returns nothing.  Instructs a yp server to
857c478bd9Sstevel@tonic-gate  * close the current map, so that old versions of the disk file don't get
867c478bd9Sstevel@tonic-gate  * held open.
877c478bd9Sstevel@tonic-gate  *
887c478bd9Sstevel@tonic-gate  * YPPROC_ALL (struct ypreq_nokey), returns
897c478bd9Sstevel@tonic-gate  *	union switch (bool more) {
907c478bd9Sstevel@tonic-gate  *		TRUE:	(struct ypresp_key_val);
917c478bd9Sstevel@tonic-gate  *		FALSE:	(struct) {};
927c478bd9Sstevel@tonic-gate  *	}
937c478bd9Sstevel@tonic-gate  *
947c478bd9Sstevel@tonic-gate  * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
957c478bd9Sstevel@tonic-gate  *
967c478bd9Sstevel@tonic-gate  * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
977c478bd9Sstevel@tonic-gate  *
987c478bd9Sstevel@tonic-gate  * YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
997c478bd9Sstevel@tonic-gate  */
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /* 'bool' is a built-in type for g++ */
1027c478bd9Sstevel@tonic-gate #if !(defined(__cplusplus) && defined(_BOOL)) && !defined(__GNUG__)
1037c478bd9Sstevel@tonic-gate #ifndef BOOL_DEFINED
1047c478bd9Sstevel@tonic-gate typedef unsigned int bool;
1057c478bd9Sstevel@tonic-gate #define	BOOL_DEFINED
1067c478bd9Sstevel@tonic-gate #endif
1077c478bd9Sstevel@tonic-gate #endif
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate /* Program and version symbols, magic numbers */
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #define	YPPROG		((rpcprog_t)100004)
1127c478bd9Sstevel@tonic-gate #define	YPVERS		((rpcvers_t)2)
1137c478bd9Sstevel@tonic-gate #define	YPVERS_ORIG	((rpcvers_t)1)
1147c478bd9Sstevel@tonic-gate #define	YPMAXRECORD	((uint_t)1024)
1157c478bd9Sstevel@tonic-gate #define	YPMAXDOMAIN	((uint_t)256)
1167c478bd9Sstevel@tonic-gate #define	YPMAXMAP	((uint_t)64)
1177c478bd9Sstevel@tonic-gate #define	YPMAXPEER	((uint_t)256)
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /* byte size of a large yp packet */
1207c478bd9Sstevel@tonic-gate #define	YPMSGSZ		1600
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate struct ypmap_parms {
1237c478bd9Sstevel@tonic-gate 	char *domain;			/* Null string means not available */
1247c478bd9Sstevel@tonic-gate 	char *map;			/* Null string means not available */
1257c478bd9Sstevel@tonic-gate 	unsigned int ordernum;		/* 0 means not available */
1267c478bd9Sstevel@tonic-gate 	char *owner;			/* Null string means not available */
1277c478bd9Sstevel@tonic-gate };
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate /*
1307c478bd9Sstevel@tonic-gate  * Request parameter structures
1317c478bd9Sstevel@tonic-gate  */
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate struct ypreq_key {
1347c478bd9Sstevel@tonic-gate 	char *domain;
1357c478bd9Sstevel@tonic-gate 	char *map;
1367c478bd9Sstevel@tonic-gate 	datum keydat;
1377c478bd9Sstevel@tonic-gate };
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate struct ypreq_nokey {
1407c478bd9Sstevel@tonic-gate 	char *domain;
1417c478bd9Sstevel@tonic-gate 	char *map;
1427c478bd9Sstevel@tonic-gate };
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate struct ypreq_xfr {
1457c478bd9Sstevel@tonic-gate 	struct ypmap_parms map_parms;
1467c478bd9Sstevel@tonic-gate 	unsigned int transid;
1477c478bd9Sstevel@tonic-gate 	unsigned int proto;
1487c478bd9Sstevel@tonic-gate 	unsigned short port;
1497c478bd9Sstevel@tonic-gate };
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate struct ypreq_newxfr {
1527c478bd9Sstevel@tonic-gate 	struct ypmap_parms map_parms;
1537c478bd9Sstevel@tonic-gate 	unsigned int transid;
1547c478bd9Sstevel@tonic-gate 	unsigned int proto;
1557c478bd9Sstevel@tonic-gate 	char *name;
1567c478bd9Sstevel@tonic-gate };
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate #define	ypxfr_domain map_parms.domain
1597c478bd9Sstevel@tonic-gate #define	ypxfr_map map_parms.map
1607c478bd9Sstevel@tonic-gate #define	ypxfr_ordernum map_parms.ordernum
1617c478bd9Sstevel@tonic-gate #define	ypxfr_owner map_parms.owner
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate /*
1647c478bd9Sstevel@tonic-gate  * Response parameter structures
1657c478bd9Sstevel@tonic-gate  */
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate struct ypresp_val {
1687c478bd9Sstevel@tonic-gate 	unsigned int status;
1697c478bd9Sstevel@tonic-gate 	datum valdat;
1707c478bd9Sstevel@tonic-gate };
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate struct ypresp_key_val {
1737c478bd9Sstevel@tonic-gate 	unsigned int status;
1747c478bd9Sstevel@tonic-gate 	datum valdat;
1757c478bd9Sstevel@tonic-gate 	datum keydat;
1767c478bd9Sstevel@tonic-gate };
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate struct ypresp_master {
1797c478bd9Sstevel@tonic-gate 	unsigned int status;
1807c478bd9Sstevel@tonic-gate 	char *master;
1817c478bd9Sstevel@tonic-gate };
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate struct ypresp_order {
1847c478bd9Sstevel@tonic-gate 	unsigned int status;
1857c478bd9Sstevel@tonic-gate 	unsigned int ordernum;
1867c478bd9Sstevel@tonic-gate };
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate struct ypmaplist {
1897c478bd9Sstevel@tonic-gate 	char ypml_name[YPMAXMAP + 1];
1907c478bd9Sstevel@tonic-gate 	struct ypmaplist *ypml_next;
1917c478bd9Sstevel@tonic-gate };
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate struct ypresp_maplist {
1947c478bd9Sstevel@tonic-gate 	unsigned int status;
1957c478bd9Sstevel@tonic-gate 	struct ypmaplist *list;
1967c478bd9Sstevel@tonic-gate };
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate /*
1997c478bd9Sstevel@tonic-gate  * Procedure symbols.  YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
2007c478bd9Sstevel@tonic-gate  * must keep the same values (0, 1, and 2) that they had in the first version
2017c478bd9Sstevel@tonic-gate  * of the protocol.
2027c478bd9Sstevel@tonic-gate  */
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate #define	YPPROC_NULL	((rpcproc_t)0)
2057c478bd9Sstevel@tonic-gate #define	YPPROC_DOMAIN	((rpcproc_t)1)
2067c478bd9Sstevel@tonic-gate #define	YPPROC_DOMAIN_NONACK ((rpcproc_t)2)
2077c478bd9Sstevel@tonic-gate #define	YPPROC_MATCH	((rpcproc_t)3)
2087c478bd9Sstevel@tonic-gate #define	YPPROC_FIRST	((rpcproc_t)4)
2097c478bd9Sstevel@tonic-gate #define	YPPROC_NEXT	((rpcproc_t)5)
2107c478bd9Sstevel@tonic-gate #define	YPPROC_XFR	((rpcproc_t)6)
2117c478bd9Sstevel@tonic-gate #define	YPPROC_NEWXFR	((rpcproc_t)12)
2127c478bd9Sstevel@tonic-gate #define	YPPROC_CLEAR	((rpcproc_t)7)
2137c478bd9Sstevel@tonic-gate #define	YPPROC_ALL	((rpcproc_t)8)
2147c478bd9Sstevel@tonic-gate #define	YPPROC_MASTER	((rpcproc_t)9)
2157c478bd9Sstevel@tonic-gate #define	YPPROC_ORDER	((rpcproc_t)10)
2167c478bd9Sstevel@tonic-gate #define	YPPROC_MAPLIST	((rpcproc_t)11)
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate /* Return status values */
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate #define	YP_TRUE		(1)	/* General purpose success code */
2217c478bd9Sstevel@tonic-gate #define	YP_NOMORE	(2)	/* No more entries in map */
2227c478bd9Sstevel@tonic-gate #define	YP_FALSE	(0)	/* General purpose failure code */
2237c478bd9Sstevel@tonic-gate #define	YP_NOMAP	(-1)	/* No such map in domain */
2247c478bd9Sstevel@tonic-gate #define	YP_NODOM	(-2)	/* Domain not supported */
2257c478bd9Sstevel@tonic-gate #define	YP_NOKEY	(-3)	/* No such key in map */
2267c478bd9Sstevel@tonic-gate #define	YP_BADOP	(-4)	/* Invalid operation */
2277c478bd9Sstevel@tonic-gate #define	YP_BADDB	(-5)	/* Server data base is bad */
2287c478bd9Sstevel@tonic-gate #define	YP_YPERR	(-6)	/* YP server error */
2297c478bd9Sstevel@tonic-gate #define	YP_BADARGS	(-7)	/* Request arguments bad */
2307c478bd9Sstevel@tonic-gate #define	YP_VERS		(-8)	/* YP server vers. mismatch - server */
2317c478bd9Sstevel@tonic-gate 				/*   can't supply requested service. */
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate enum ypreqtype {YPREQ_KEY = 1, YPREQ_NOKEY = 2, YPREQ_MAP_PARMS = 3};
2347c478bd9Sstevel@tonic-gate struct yprequest {
2357c478bd9Sstevel@tonic-gate 	enum ypreqtype yp_reqtype;
2367c478bd9Sstevel@tonic-gate 	union {
2377c478bd9Sstevel@tonic-gate 		struct ypreq_key yp_req_keytype;
2387c478bd9Sstevel@tonic-gate 		struct ypreq_nokey yp_req_nokeytype;
2397c478bd9Sstevel@tonic-gate 		struct ypmap_parms yp_req_map_parmstype;
2407c478bd9Sstevel@tonic-gate 	}yp_reqbody;
2417c478bd9Sstevel@tonic-gate };
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate #define	YPMATCH_REQTYPE YPREQ_KEY
2447c478bd9Sstevel@tonic-gate #define	ypmatch_req_domain yp_reqbody.yp_req_keytype.domain
2457c478bd9Sstevel@tonic-gate #define	ypmatch_req_map yp_reqbody.yp_req_keytype.map
2467c478bd9Sstevel@tonic-gate #define	ypmatch_req_keydat yp_reqbody.yp_req_keytype.keydat
2477c478bd9Sstevel@tonic-gate #define	ypmatch_req_keyptr yp_reqbody.yp_req_keytype.keydat.dptr
2487c478bd9Sstevel@tonic-gate #define	ypmatch_req_keysize yp_reqbody.yp_req_keytype.keydat.dsize
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate #define	YPFIRST_REQTYPE YPREQ_NOKEY
2517c478bd9Sstevel@tonic-gate #define	ypfirst_req_domain yp_reqbody.yp_req_nokeytype.domain
2527c478bd9Sstevel@tonic-gate #define	ypfirst_req_map yp_reqbody.yp_req_nokeytype.map
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate #define	YPNEXT_REQTYPE YPREQ_KEY
2557c478bd9Sstevel@tonic-gate #define	ypnext_req_domain yp_reqbody.yp_req_keytype.domain
2567c478bd9Sstevel@tonic-gate #define	ypnext_req_map yp_reqbody.yp_req_keytype.map
2577c478bd9Sstevel@tonic-gate #define	ypnext_req_keydat yp_reqbody.yp_req_keytype.keydat
2587c478bd9Sstevel@tonic-gate #define	ypnext_req_keyptr yp_reqbody.yp_req_keytype.keydat.dptr
2597c478bd9Sstevel@tonic-gate #define	ypnext_req_keysize yp_reqbody.yp_req_keytype.keydat.dsize
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate #define	YPPUSH_REQTYPE YPREQ_NOKEY
2627c478bd9Sstevel@tonic-gate #define	yppush_req_domain yp_reqbody.yp_req_nokeytype.domain
2637c478bd9Sstevel@tonic-gate #define	yppush_req_map yp_reqbody.yp_req_nokeytype.map
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate #define	YPPULL_REQTYPE YPREQ_NOKEY
2667c478bd9Sstevel@tonic-gate #define	yppull_req_domain yp_reqbody.yp_req_nokeytype.domain
2677c478bd9Sstevel@tonic-gate #define	yppull_req_map yp_reqbody.yp_req_nokeytype.map
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate #define	YPPOLL_REQTYPE YPREQ_NOKEY
2707c478bd9Sstevel@tonic-gate #define	yppoll_req_domain yp_reqbody.yp_req_nokeytype.domain
2717c478bd9Sstevel@tonic-gate #define	yppoll_req_map yp_reqbody.yp_req_nokeytype.map
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate #define	YPGET_REQTYPE YPREQ_MAP_PARMS
2747c478bd9Sstevel@tonic-gate #define	ypget_req_domain yp_reqbody.yp_req_map_parmstype.domain
2757c478bd9Sstevel@tonic-gate #define	ypget_req_map yp_reqbody.yp_req_map_parmstype.map
2767c478bd9Sstevel@tonic-gate #define	ypget_req_ordernum yp_reqbody.yp_req_map_parmstype.ordernum
2777c478bd9Sstevel@tonic-gate #define	ypget_req_owner yp_reqbody.yp_req_map_parmstype.owner
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate enum ypresptype {YPRESP_VAL = 1, YPRESP_KEY_VAL = 2, YPRESP_MAP_PARMS = 3};
2807c478bd9Sstevel@tonic-gate struct ypresponse {
2817c478bd9Sstevel@tonic-gate 	enum ypresptype yp_resptype;
2827c478bd9Sstevel@tonic-gate 	union {
2837c478bd9Sstevel@tonic-gate 		struct ypresp_val yp_resp_valtype;
2847c478bd9Sstevel@tonic-gate 		struct ypresp_key_val yp_resp_key_valtype;
2857c478bd9Sstevel@tonic-gate 		struct ypmap_parms yp_resp_map_parmstype;
2867c478bd9Sstevel@tonic-gate 	} yp_respbody;
2877c478bd9Sstevel@tonic-gate };
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate #define	YPMATCH_RESPTYPE YPRESP_VAL
2907c478bd9Sstevel@tonic-gate #define	ypmatch_resp_status yp_respbody.yp_resp_valtype.status
2917c478bd9Sstevel@tonic-gate #define	ypmatch_resp_valdat yp_respbody.yp_resp_valtype.valdat
2927c478bd9Sstevel@tonic-gate #define	ypmatch_resp_valptr yp_respbody.yp_resp_valtype.valdat.dptr
2937c478bd9Sstevel@tonic-gate #define	ypmatch_resp_valsize yp_respbody.yp_resp_valtype.valdat.dsize
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate #define	YPFIRST_RESPTYPE YPRESP_KEY_VAL
2967c478bd9Sstevel@tonic-gate #define	ypfirst_resp_status yp_respbody.yp_resp_key_valtype.status
2977c478bd9Sstevel@tonic-gate #define	ypfirst_resp_keydat yp_respbody.yp_resp_key_valtype.keydat
2987c478bd9Sstevel@tonic-gate #define	ypfirst_resp_keyptr yp_respbody.yp_resp_key_valtype.keydat.dptr
2997c478bd9Sstevel@tonic-gate #define	ypfirst_resp_keysize yp_respbody.yp_resp_key_valtype.keydat.dsize
3007c478bd9Sstevel@tonic-gate #define	ypfirst_resp_valdat yp_respbody.yp_resp_key_valtype.valdat
3017c478bd9Sstevel@tonic-gate #define	ypfirst_resp_valptr yp_respbody.yp_resp_key_valtype.valdat.dptr
3027c478bd9Sstevel@tonic-gate #define	ypfirst_resp_valsize yp_respbody.yp_resp_key_valtype.valdat.dsize
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate #define	YPNEXT_RESPTYPE YPRESP_KEY_VAL
3057c478bd9Sstevel@tonic-gate #define	ypnext_resp_status yp_respbody.yp_resp_key_valtype.status
3067c478bd9Sstevel@tonic-gate #define	ypnext_resp_keydat yp_respbody.yp_resp_key_valtype.keydat
3077c478bd9Sstevel@tonic-gate #define	ypnext_resp_keyptr yp_respbody.yp_resp_key_valtype.keydat.dptr
3087c478bd9Sstevel@tonic-gate #define	ypnext_resp_keysize yp_respbody.yp_resp_key_valtype.keydat.dsize
3097c478bd9Sstevel@tonic-gate #define	ypnext_resp_valdat yp_respbody.yp_resp_key_valtype.valdat
3107c478bd9Sstevel@tonic-gate #define	ypnext_resp_valptr yp_respbody.yp_resp_key_valtype.valdat.dptr
3117c478bd9Sstevel@tonic-gate #define	ypnext_resp_valsize yp_respbody.yp_resp_key_valtype.valdat.dsize
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate #define	YPPOLL_RESPTYPE YPRESP_MAP_PARMS
3147c478bd9Sstevel@tonic-gate #define	yppoll_resp_domain yp_respbody.yp_resp_map_parmstype.domain
3157c478bd9Sstevel@tonic-gate #define	yppoll_resp_map yp_respbody.yp_resp_map_parmstype.map
3167c478bd9Sstevel@tonic-gate #define	yppoll_resp_ordernum yp_respbody.yp_resp_map_parmstype.ordernum
3177c478bd9Sstevel@tonic-gate #define	yppoll_resp_owner yp_respbody.yp_resp_map_parmstype.owner
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate extern bool _xdr_yprequest();
3217c478bd9Sstevel@tonic-gate extern bool _xdr_ypresponse();
3227c478bd9Sstevel@tonic-gate /*
3237c478bd9Sstevel@tonic-gate  *		Protocol between clients (ypxfr, only) and yppush
3247c478bd9Sstevel@tonic-gate  *		yppush speaks a protocol in the transient range, which
3257c478bd9Sstevel@tonic-gate  *		is supplied to ypxfr as a command-line parameter when it
3267c478bd9Sstevel@tonic-gate  *		is activated by ypserv.
3277c478bd9Sstevel@tonic-gate  */
3287c478bd9Sstevel@tonic-gate #define	YPPUSHVERS		((rpcvers_t)1)
3297c478bd9Sstevel@tonic-gate #define	YPPUSHVERS_ORIG		((rpcvers_t)1)
3307c478bd9Sstevel@tonic-gate 
3317c478bd9Sstevel@tonic-gate /* Procedure symbols */
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate #define	YPPUSHPROC_NULL		((rpcproc_t)0)
3347c478bd9Sstevel@tonic-gate #define	YPPUSHPROC_XFRRESP	((rpcproc_t)1)
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate struct yppushresp_xfr {
3377c478bd9Sstevel@tonic-gate 	unsigned int transid;
3387c478bd9Sstevel@tonic-gate 	unsigned int status;
3397c478bd9Sstevel@tonic-gate };
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate /* Status values for yppushresp_xfr.status */
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate #define	YPPUSH_SUCC	(1)	/* Success */
3447c478bd9Sstevel@tonic-gate #define	YPPUSH_AGE	(2)	/* Master's version not newer */
345*6e270ca8SMarcel Telka #define	YPPUSH_NOMAP	(-1)	/* Can't find server for map */
346*6e270ca8SMarcel Telka #define	YPPUSH_NODOM	(-2)	/* Domain not supported */
347*6e270ca8SMarcel Telka #define	YPPUSH_RSRC	(-3)	/* Local resouce alloc failure */
348*6e270ca8SMarcel Telka #define	YPPUSH_RPC	(-4)	/* RPC failure talking to server */
3497c478bd9Sstevel@tonic-gate #define	YPPUSH_MADDR	(-5)	/* Can't get master address */
350*6e270ca8SMarcel Telka #define	YPPUSH_YPERR	(-6)	/* YP server/map db error */
351*6e270ca8SMarcel Telka #define	YPPUSH_BADARGS	(-7)	/* Request arguments bad */
3527c478bd9Sstevel@tonic-gate #define	YPPUSH_DBM	(-8)	/* Local dbm operation failed */
3537c478bd9Sstevel@tonic-gate #define	YPPUSH_FILE	(-9)	/* Local file I/O operation failed */
3547c478bd9Sstevel@tonic-gate #define	YPPUSH_SKEW	(-10)	/* Map version skew during transfer */
3557c478bd9Sstevel@tonic-gate #define	YPPUSH_CLEAR	(-11)	/* Can't send "Clear" req to local */
3567c478bd9Sstevel@tonic-gate 				/*   ypserv */
3577c478bd9Sstevel@tonic-gate #define	YPPUSH_FORCE	(-12)	/* No local order number in map - */
3587c478bd9Sstevel@tonic-gate 				/*   use -f flag. */
3597c478bd9Sstevel@tonic-gate #define	YPPUSH_XFRERR	(-13)	/* ypxfr error */
3607c478bd9Sstevel@tonic-gate #define	YPPUSH_REFUSED	(-14)	/* Transfer request refused by ypserv */
3617c478bd9Sstevel@tonic-gate #define	YPPUSH_NOALIAS	(-15)	/* Alias not found for map or domain */
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate extern bool xdr_datum(XDR *, datum *);
3647c478bd9Sstevel@tonic-gate extern bool xdr_ypdomain_wrap_string(XDR *, char **);
3657c478bd9Sstevel@tonic-gate extern bool xdr_ypmap_wrap_string(XDR *, char **);
3667c478bd9Sstevel@tonic-gate extern bool xdr_ypreq_key(XDR *, struct ypreq_key *);
3677c478bd9Sstevel@tonic-gate extern bool xdr_ypreq_nokey(XDR *, struct ypreq_nokey *);
3687c478bd9Sstevel@tonic-gate extern bool xdr_ypreq_xfr(XDR *, struct ypreq_xfr *);
3697c478bd9Sstevel@tonic-gate extern bool xdr_ypreq_newxfr(XDR *, struct ypreq_newxfr *);
3707c478bd9Sstevel@tonic-gate extern bool xdr_ypresp_val(XDR *, struct ypresp_val *);
3717c478bd9Sstevel@tonic-gate extern bool xdr_ypresp_key_val(XDR *, struct ypresp_key_val *);
3727c478bd9Sstevel@tonic-gate extern bool xdr_ypmap_parms(XDR *, struct ypmap_parms *);
3737c478bd9Sstevel@tonic-gate extern bool xdr_ypowner_wrap_string(XDR *, char **);
3747c478bd9Sstevel@tonic-gate extern bool xdr_yppushresp_xfr(XDR *, struct yppushresp_xfr *);
3757c478bd9Sstevel@tonic-gate extern bool xdr_ypresp_order(XDR *, struct ypresp_order *);
3767c478bd9Sstevel@tonic-gate extern bool xdr_ypresp_master(XDR *, struct ypresp_master *);
3777c478bd9Sstevel@tonic-gate extern bool xdr_ypall(XDR *, struct ypall_callback *);
3787c478bd9Sstevel@tonic-gate extern bool xdr_ypresp_maplist(XDR *, struct ypresp_maplist *);
3797c478bd9Sstevel@tonic-gate 
3807c478bd9Sstevel@tonic-gate #ifdef __cplusplus
3817c478bd9Sstevel@tonic-gate }
3827c478bd9Sstevel@tonic-gate #endif
3837c478bd9Sstevel@tonic-gate 
3847c478bd9Sstevel@tonic-gate #endif	/* _RPCSVC_YP_PROT_H */
385