xref: /titanic_52/usr/src/cmd/ypcmd/ypsym.h (revision 1cb6af97c6f66f456d4f726ef056e1ebc0f73305)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 /*
31  * Portions of this source code were derived from Berkeley 4.3 BSD
32  * under license from the Regents of the University of California.
33  */
34 
35 #ifndef	__YPSYM_H
36 #define	__YPSYM_H
37 
38 #pragma ident	"%Z%%M%	%I%	%E% SMI"
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  * This contains symbol and structure definitions for modules in the YP server
46  */
47 
48 #include <ndbm.h>			/* Pull this in first */
49 #define DATUM
50 #include <stdio.h>
51 #include <errno.h>
52 #include <signal.h>
53 #include <rpc/rpc.h>
54 #include <dirent.h>
55 #include <sys/stat.h>
56 #include <sys/wait.h>
57 #include <rpcsvc/yp_prot.h>
58 #include "ypv1_prot.h"
59 #include <rpcsvc/ypclnt.h>
60 
61 typedef void (*PFV)();
62 typedef int (*PFI)();
63 typedef unsigned int (*PFU)();
64 typedef long int (*PFLI)();
65 typedef unsigned long int (*PFULI)();
66 typedef short int (*PFSI)();
67 typedef unsigned short int (*PFUSI)();
68 
69 #ifndef TRUE
70 #define TRUE 1
71 #endif
72 
73 #ifndef FALSE
74 #define FALSE 0
75 #endif
76 
77 #ifdef NULL
78 #undef NULL
79 #endif
80 #define NULL 0
81 
82 /* Size of lock hash table */
83 #define MAXHASH 91
84 
85 /* Maximum length of a yp map name in the system v filesystem */
86 #define MAXALIASLEN 8
87 
88 #define YPINTERTRY_TIME 10		/* Secs between tries for peer bind */
89 #define YPTOTAL_TIME 30			/* Total secs until timeout */
90 #define YPNOPORT ((unsigned short) 0)	/* Out-of-range port value */
91 
92 /* External refs to yp server data structures */
93 
94 extern bool ypinitialization_done;
95 extern struct timeval ypintertry;
96 extern struct timeval yptimeout;
97 extern char myhostname[];
98 extern bool silent;
99 #ifdef MINUS_C_OPTION
100 extern bool multiflag;
101 #endif
102 
103 /* External ref to logging func */
104 extern void logprintf(char *format, ...);
105 
106 /* External refs for /var/yp/securenets support */
107 extern void get_secure_nets(char *daemon_name);
108 
109 /* External refs to yp server-only functions */
110 extern bool ypcheck_map_existence(char *pname);
111 extern bool ypget_map_master(char **owner, DBM *fdb);
112 extern DBM *ypset_current_map(char *map, char *domain, uint_t *error);
113 extern void ypclr_current_map(void);
114 extern bool_t ypmkfilename(char *domain, char *map, char *path);
115 extern int yplist_maps();
116 extern bool yp_map_access(SVCXPRT *transp, uint_t *error, DBM *fdb);
117 extern bool ypget_map_order(char *map, char *domain, uint_t *order);
118 
119 extern bool ypcheck_domain();
120 extern datum dbm_do_nextkey();
121 extern void ypclr_current_map(void);
122 
123 extern void ypdomain(SVCXPRT *transp, bool always_respond);
124 extern void ypmatch(SVCXPRT *transp, struct svc_req *rqstp);
125 extern void ypfirst(SVCXPRT *transp);
126 extern void ypnext(SVCXPRT *transp);
127 extern void ypxfr(SVCXPRT *transp, int prog);
128 extern void ypall(SVCXPRT *transp);
129 extern void ypmaster(SVCXPRT *transp);
130 extern void yporder(SVCXPRT *transp);
131 extern void ypmaplist(SVCXPRT *transp);
132 extern void ypoldmatch(SVCXPRT *transp, struct svc_req *rqstp);
133 extern void ypoldfirst(SVCXPRT *transp);
134 extern void ypoldnext(SVCXPRT *transp);
135 extern void ypoldpoll(SVCXPRT *transp);
136 extern void ypoldpush(SVCXPRT *transp);
137 extern void ypoldpull(SVCXPRT *transp);
138 extern void ypoldget(SVCXPRT *transp);
139 extern int yp_matchdns(DBM *, struct ypreq_key *, struct ypresp_val *);
140 extern int yp_oldmatchdns(DBM *fdb,
141 			  struct yprequest *req, struct ypresponse *resp);
142 
143 extern bool _xdr_ypreqeust(XDR *xdrs, struct yprequest *ps);
144 extern bool _xdr_ypresponse(XDR *xdrs, struct ypresponse *ps);
145 
146 extern void setup_resolv(bool *fwding, int *child, CLIENT **client,
147 			 char *tp_type, long prognum);
148 extern int resolv_req(bool *fwding, CLIENT **client, int *pid,
149 		      char *tp, SVCXPRT *xprt, struct ypreq_key *req,
150 		      char *map);
151 
152 
153 /* definitions for reading files of lists */
154 
155 struct listofnames
156 {
157 	struct listofnames *nextname;
158 	char *name;
159 };
160 typedef struct listofnames listofnames;
161 
162 /* XXX- NAME_MAX can't be defined in <limits.h> in a POSIX conformant system
163  *	(under conditions which apply to Sun systems). Removal of this define
164  *	caused yp to break (and only yp!). Hence, NAME_MAX is defined here
165  *	*exactly* as it was in <limits.h>. I suspect this may not be the
166  *	desired value. I suspect the desired value is either:
167  *		- the maxumum name length for any file system type, or
168  *		- should be _POSIX_NAME_MAX which is the minimum-maximum name
169  *		  length in a POSIX conformant system (which just happens to
170  *		  be 14), or
171  *		- should be gotten by pathconf() or fpathconf().
172  * XXX- I leave this to the owners of yp!
173  */
174 #define	NAME_MAX	14	/* s5 file system maximum name length */
175 
176 #ifdef	__cplusplus
177 }
178 #endif
179 
180 #endif	/* __YPSYM_H */
181