xref: /illumos-gate/usr/src/cmd/ypcmd/ypsym.h (revision 9c0752ac)
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
5*4a190493Ssdussud  * Common Development and Distribution License (the "License").
6*4a190493Ssdussud  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*4a190493Ssdussud  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
317c478bd9Sstevel@tonic-gate  * under license from the Regents of the University of California.
327c478bd9Sstevel@tonic-gate  */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef	__YPSYM_H
357c478bd9Sstevel@tonic-gate #define	__YPSYM_H
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
387c478bd9Sstevel@tonic-gate extern "C" {
397c478bd9Sstevel@tonic-gate #endif
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /*
42*4a190493Ssdussud  * This contains symbol and structure definitions for modules in the YP server
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #include <ndbm.h>			/* Pull this in first */
46*4a190493Ssdussud #define	DATUM
477c478bd9Sstevel@tonic-gate #include <stdio.h>
487c478bd9Sstevel@tonic-gate #include <errno.h>
497c478bd9Sstevel@tonic-gate #include <signal.h>
507c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
517c478bd9Sstevel@tonic-gate #include <dirent.h>
527c478bd9Sstevel@tonic-gate #include <sys/stat.h>
537c478bd9Sstevel@tonic-gate #include <sys/wait.h>
547c478bd9Sstevel@tonic-gate #include <rpcsvc/yp_prot.h>
557c478bd9Sstevel@tonic-gate #include "ypv1_prot.h"
567c478bd9Sstevel@tonic-gate #include <rpcsvc/ypclnt.h>
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate typedef void (*PFV)();
597c478bd9Sstevel@tonic-gate typedef int (*PFI)();
607c478bd9Sstevel@tonic-gate typedef unsigned int (*PFU)();
617c478bd9Sstevel@tonic-gate typedef long int (*PFLI)();
627c478bd9Sstevel@tonic-gate typedef unsigned long int (*PFULI)();
637c478bd9Sstevel@tonic-gate typedef short int (*PFSI)();
647c478bd9Sstevel@tonic-gate typedef unsigned short int (*PFUSI)();
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #ifndef TRUE
67*4a190493Ssdussud #define	TRUE 1
687c478bd9Sstevel@tonic-gate #endif
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #ifndef FALSE
71*4a190493Ssdussud #define	FALSE 0
727c478bd9Sstevel@tonic-gate #endif
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #ifdef NULL
757c478bd9Sstevel@tonic-gate #undef NULL
767c478bd9Sstevel@tonic-gate #endif
77*4a190493Ssdussud #define	NULL 0
787c478bd9Sstevel@tonic-gate 
79*4a190493Ssdussud /*
80*4a190493Ssdussud  * Size of lock hash table
81*4a190493Ssdussud  *
82*4a190493Ssdussud  * It's for a hash table, hence better if it is prime.
83*4a190493Ssdussud  * It's also the max number of maps and map locks, used
84*4a190493Ssdussud  * for initializing shared memory: need to be big enough
85*4a190493Ssdussud  * (until dynamic shared memory allocation is implemented ?).
86*4a190493Ssdussud  */
87*4a190493Ssdussud #define	MAXHASH 1009
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate /* Maximum length of a yp map name in the system v filesystem */
90*4a190493Ssdussud #define	MAXALIASLEN 8
917c478bd9Sstevel@tonic-gate 
92*4a190493Ssdussud #define	YPINTERTRY_TIME 10		/* Secs between tries for peer bind */
93*4a190493Ssdussud #define	YPTOTAL_TIME 30			/* Total secs until timeout */
94*4a190493Ssdussud #define	YPNOPORT ((unsigned short) 0)	/* Out-of-range port value */
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /* External refs to yp server data structures */
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate extern bool ypinitialization_done;
997c478bd9Sstevel@tonic-gate extern struct timeval ypintertry;
1007c478bd9Sstevel@tonic-gate extern struct timeval yptimeout;
1017c478bd9Sstevel@tonic-gate extern char myhostname[];
1027c478bd9Sstevel@tonic-gate extern bool silent;
1037c478bd9Sstevel@tonic-gate #ifdef MINUS_C_OPTION
1047c478bd9Sstevel@tonic-gate extern bool multiflag;
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /* External ref to logging func */
1087c478bd9Sstevel@tonic-gate extern void logprintf(char *format, ...);
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /* External refs for /var/yp/securenets support */
1117c478bd9Sstevel@tonic-gate extern void get_secure_nets(char *daemon_name);
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate /* External refs to yp server-only functions */
1147c478bd9Sstevel@tonic-gate extern bool ypcheck_map_existence(char *pname);
1157c478bd9Sstevel@tonic-gate extern bool ypget_map_master(char **owner, DBM *fdb);
1167c478bd9Sstevel@tonic-gate extern DBM *ypset_current_map(char *map, char *domain, uint_t *error);
1177c478bd9Sstevel@tonic-gate extern void ypclr_current_map(void);
1187c478bd9Sstevel@tonic-gate extern bool_t ypmkfilename(char *domain, char *map, char *path);
1197c478bd9Sstevel@tonic-gate extern int yplist_maps();
1207c478bd9Sstevel@tonic-gate extern bool yp_map_access(SVCXPRT *transp, uint_t *error, DBM *fdb);
1217c478bd9Sstevel@tonic-gate extern bool ypget_map_order(char *map, char *domain, uint_t *order);
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate extern bool ypcheck_domain();
1247c478bd9Sstevel@tonic-gate extern datum dbm_do_nextkey();
1257c478bd9Sstevel@tonic-gate extern void ypclr_current_map(void);
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate extern void ypdomain(SVCXPRT *transp, bool always_respond);
1287c478bd9Sstevel@tonic-gate extern void ypmatch(SVCXPRT *transp, struct svc_req *rqstp);
1297c478bd9Sstevel@tonic-gate extern void ypfirst(SVCXPRT *transp);
1307c478bd9Sstevel@tonic-gate extern void ypnext(SVCXPRT *transp);
1317c478bd9Sstevel@tonic-gate extern void ypxfr(SVCXPRT *transp, int prog);
1327c478bd9Sstevel@tonic-gate extern void ypall(SVCXPRT *transp);
1337c478bd9Sstevel@tonic-gate extern void ypmaster(SVCXPRT *transp);
1347c478bd9Sstevel@tonic-gate extern void yporder(SVCXPRT *transp);
1357c478bd9Sstevel@tonic-gate extern void ypmaplist(SVCXPRT *transp);
1367c478bd9Sstevel@tonic-gate extern void ypoldmatch(SVCXPRT *transp, struct svc_req *rqstp);
1377c478bd9Sstevel@tonic-gate extern void ypoldfirst(SVCXPRT *transp);
1387c478bd9Sstevel@tonic-gate extern void ypoldnext(SVCXPRT *transp);
1397c478bd9Sstevel@tonic-gate extern void ypoldpoll(SVCXPRT *transp);
1407c478bd9Sstevel@tonic-gate extern void ypoldpush(SVCXPRT *transp);
1417c478bd9Sstevel@tonic-gate extern void ypoldpull(SVCXPRT *transp);
1427c478bd9Sstevel@tonic-gate extern void ypoldget(SVCXPRT *transp);
1437c478bd9Sstevel@tonic-gate extern int yp_matchdns(DBM *, struct ypreq_key *, struct ypresp_val *);
1447c478bd9Sstevel@tonic-gate extern int yp_oldmatchdns(DBM *fdb,
145*4a190493Ssdussud 		    struct yprequest *req, struct ypresponse *resp);
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate extern bool _xdr_ypreqeust(XDR *xdrs, struct yprequest *ps);
1487c478bd9Sstevel@tonic-gate extern bool _xdr_ypresponse(XDR *xdrs, struct ypresponse *ps);
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate extern void setup_resolv(bool *fwding, int *child, CLIENT **client,
151*4a190493Ssdussud 		    char *tp_type, long prognum);
1527c478bd9Sstevel@tonic-gate extern int resolv_req(bool *fwding, CLIENT **client, int *pid,
153*4a190493Ssdussud 		    char *tp, SVCXPRT *xprt, struct ypreq_key *req,
154*4a190493Ssdussud 		    char *map);
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate /* definitions for reading files of lists */
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate struct listofnames
1607c478bd9Sstevel@tonic-gate {
1617c478bd9Sstevel@tonic-gate 	struct listofnames *nextname;
1627c478bd9Sstevel@tonic-gate 	char *name;
1637c478bd9Sstevel@tonic-gate };
1647c478bd9Sstevel@tonic-gate typedef struct listofnames listofnames;
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1677c478bd9Sstevel@tonic-gate }
1687c478bd9Sstevel@tonic-gate #endif
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate #endif	/* __YPSYM_H */
171