xref: /onnv-gate/usr/src/cmd/ypcmd/ypsym.h (revision 2189:bbaf8c7f3afd)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*2189Ssdussud  * Common Development and Distribution License (the "License").
6*2189Ssdussud  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*2189Ssdussud  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
270Sstevel@tonic-gate /*	  All Rights Reserved  	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
310Sstevel@tonic-gate  * under license from the Regents of the University of California.
320Sstevel@tonic-gate  */
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #ifndef	__YPSYM_H
350Sstevel@tonic-gate #define	__YPSYM_H
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #ifdef	__cplusplus
400Sstevel@tonic-gate extern "C" {
410Sstevel@tonic-gate #endif
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /*
44*2189Ssdussud  * This contains symbol and structure definitions for modules in the YP server
450Sstevel@tonic-gate  */
460Sstevel@tonic-gate 
470Sstevel@tonic-gate #include <ndbm.h>			/* Pull this in first */
48*2189Ssdussud #define	DATUM
490Sstevel@tonic-gate #include <stdio.h>
500Sstevel@tonic-gate #include <errno.h>
510Sstevel@tonic-gate #include <signal.h>
520Sstevel@tonic-gate #include <rpc/rpc.h>
530Sstevel@tonic-gate #include <dirent.h>
540Sstevel@tonic-gate #include <sys/stat.h>
550Sstevel@tonic-gate #include <sys/wait.h>
560Sstevel@tonic-gate #include <rpcsvc/yp_prot.h>
570Sstevel@tonic-gate #include "ypv1_prot.h"
580Sstevel@tonic-gate #include <rpcsvc/ypclnt.h>
590Sstevel@tonic-gate 
600Sstevel@tonic-gate typedef void (*PFV)();
610Sstevel@tonic-gate typedef int (*PFI)();
620Sstevel@tonic-gate typedef unsigned int (*PFU)();
630Sstevel@tonic-gate typedef long int (*PFLI)();
640Sstevel@tonic-gate typedef unsigned long int (*PFULI)();
650Sstevel@tonic-gate typedef short int (*PFSI)();
660Sstevel@tonic-gate typedef unsigned short int (*PFUSI)();
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #ifndef TRUE
69*2189Ssdussud #define	TRUE 1
700Sstevel@tonic-gate #endif
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #ifndef FALSE
73*2189Ssdussud #define	FALSE 0
740Sstevel@tonic-gate #endif
750Sstevel@tonic-gate 
760Sstevel@tonic-gate #ifdef NULL
770Sstevel@tonic-gate #undef NULL
780Sstevel@tonic-gate #endif
79*2189Ssdussud #define	NULL 0
800Sstevel@tonic-gate 
81*2189Ssdussud /*
82*2189Ssdussud  * Size of lock hash table
83*2189Ssdussud  *
84*2189Ssdussud  * It's for a hash table, hence better if it is prime.
85*2189Ssdussud  * It's also the max number of maps and map locks, used
86*2189Ssdussud  * for initializing shared memory: need to be big enough
87*2189Ssdussud  * (until dynamic shared memory allocation is implemented ?).
88*2189Ssdussud  */
89*2189Ssdussud #define	MAXHASH 1009
900Sstevel@tonic-gate 
910Sstevel@tonic-gate /* Maximum length of a yp map name in the system v filesystem */
92*2189Ssdussud #define	MAXALIASLEN 8
930Sstevel@tonic-gate 
94*2189Ssdussud #define	YPINTERTRY_TIME 10		/* Secs between tries for peer bind */
95*2189Ssdussud #define	YPTOTAL_TIME 30			/* Total secs until timeout */
96*2189Ssdussud #define	YPNOPORT ((unsigned short) 0)	/* Out-of-range port value */
970Sstevel@tonic-gate 
980Sstevel@tonic-gate /* External refs to yp server data structures */
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate extern bool ypinitialization_done;
1010Sstevel@tonic-gate extern struct timeval ypintertry;
1020Sstevel@tonic-gate extern struct timeval yptimeout;
1030Sstevel@tonic-gate extern char myhostname[];
1040Sstevel@tonic-gate extern bool silent;
1050Sstevel@tonic-gate #ifdef MINUS_C_OPTION
1060Sstevel@tonic-gate extern bool multiflag;
1070Sstevel@tonic-gate #endif
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate /* External ref to logging func */
1100Sstevel@tonic-gate extern void logprintf(char *format, ...);
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate /* External refs for /var/yp/securenets support */
1130Sstevel@tonic-gate extern void get_secure_nets(char *daemon_name);
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate /* External refs to yp server-only functions */
1160Sstevel@tonic-gate extern bool ypcheck_map_existence(char *pname);
1170Sstevel@tonic-gate extern bool ypget_map_master(char **owner, DBM *fdb);
1180Sstevel@tonic-gate extern DBM *ypset_current_map(char *map, char *domain, uint_t *error);
1190Sstevel@tonic-gate extern void ypclr_current_map(void);
1200Sstevel@tonic-gate extern bool_t ypmkfilename(char *domain, char *map, char *path);
1210Sstevel@tonic-gate extern int yplist_maps();
1220Sstevel@tonic-gate extern bool yp_map_access(SVCXPRT *transp, uint_t *error, DBM *fdb);
1230Sstevel@tonic-gate extern bool ypget_map_order(char *map, char *domain, uint_t *order);
1240Sstevel@tonic-gate 
1250Sstevel@tonic-gate extern bool ypcheck_domain();
1260Sstevel@tonic-gate extern datum dbm_do_nextkey();
1270Sstevel@tonic-gate extern void ypclr_current_map(void);
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate extern void ypdomain(SVCXPRT *transp, bool always_respond);
1300Sstevel@tonic-gate extern void ypmatch(SVCXPRT *transp, struct svc_req *rqstp);
1310Sstevel@tonic-gate extern void ypfirst(SVCXPRT *transp);
1320Sstevel@tonic-gate extern void ypnext(SVCXPRT *transp);
1330Sstevel@tonic-gate extern void ypxfr(SVCXPRT *transp, int prog);
1340Sstevel@tonic-gate extern void ypall(SVCXPRT *transp);
1350Sstevel@tonic-gate extern void ypmaster(SVCXPRT *transp);
1360Sstevel@tonic-gate extern void yporder(SVCXPRT *transp);
1370Sstevel@tonic-gate extern void ypmaplist(SVCXPRT *transp);
1380Sstevel@tonic-gate extern void ypoldmatch(SVCXPRT *transp, struct svc_req *rqstp);
1390Sstevel@tonic-gate extern void ypoldfirst(SVCXPRT *transp);
1400Sstevel@tonic-gate extern void ypoldnext(SVCXPRT *transp);
1410Sstevel@tonic-gate extern void ypoldpoll(SVCXPRT *transp);
1420Sstevel@tonic-gate extern void ypoldpush(SVCXPRT *transp);
1430Sstevel@tonic-gate extern void ypoldpull(SVCXPRT *transp);
1440Sstevel@tonic-gate extern void ypoldget(SVCXPRT *transp);
1450Sstevel@tonic-gate extern int yp_matchdns(DBM *, struct ypreq_key *, struct ypresp_val *);
1460Sstevel@tonic-gate extern int yp_oldmatchdns(DBM *fdb,
147*2189Ssdussud 		    struct yprequest *req, struct ypresponse *resp);
1480Sstevel@tonic-gate 
1490Sstevel@tonic-gate extern bool _xdr_ypreqeust(XDR *xdrs, struct yprequest *ps);
1500Sstevel@tonic-gate extern bool _xdr_ypresponse(XDR *xdrs, struct ypresponse *ps);
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate extern void setup_resolv(bool *fwding, int *child, CLIENT **client,
153*2189Ssdussud 		    char *tp_type, long prognum);
1540Sstevel@tonic-gate extern int resolv_req(bool *fwding, CLIENT **client, int *pid,
155*2189Ssdussud 		    char *tp, SVCXPRT *xprt, struct ypreq_key *req,
156*2189Ssdussud 		    char *map);
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate 
1590Sstevel@tonic-gate /* definitions for reading files of lists */
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate struct listofnames
1620Sstevel@tonic-gate {
1630Sstevel@tonic-gate 	struct listofnames *nextname;
1640Sstevel@tonic-gate 	char *name;
1650Sstevel@tonic-gate };
1660Sstevel@tonic-gate typedef struct listofnames listofnames;
1670Sstevel@tonic-gate 
168*2189Ssdussud /*
169*2189Ssdussud  * XXX- NAME_MAX can't be defined in <limits.h> in a POSIX conformant system
1700Sstevel@tonic-gate  *	(under conditions which apply to Sun systems). Removal of this define
1710Sstevel@tonic-gate  *	caused yp to break (and only yp!). Hence, NAME_MAX is defined here
1720Sstevel@tonic-gate  *	*exactly* as it was in <limits.h>. I suspect this may not be the
1730Sstevel@tonic-gate  *	desired value. I suspect the desired value is either:
1740Sstevel@tonic-gate  *		- the maxumum name length for any file system type, or
1750Sstevel@tonic-gate  *		- should be _POSIX_NAME_MAX which is the minimum-maximum name
1760Sstevel@tonic-gate  *		  length in a POSIX conformant system (which just happens to
1770Sstevel@tonic-gate  *		  be 14), or
1780Sstevel@tonic-gate  *		- should be gotten by pathconf() or fpathconf().
1790Sstevel@tonic-gate  * XXX- I leave this to the owners of yp!
1800Sstevel@tonic-gate  */
1810Sstevel@tonic-gate #define	NAME_MAX	14	/* s5 file system maximum name length */
1820Sstevel@tonic-gate 
1830Sstevel@tonic-gate #ifdef	__cplusplus
1840Sstevel@tonic-gate }
1850Sstevel@tonic-gate #endif
1860Sstevel@tonic-gate 
1870Sstevel@tonic-gate #endif	/* __YPSYM_H */
188