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