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 #pragma ident "%Z%%M% %I% %E% SMI" 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 /* 44 * This contains symbol and structure definitions for modules in the YP server 45 */ 46 47 #include <ndbm.h> /* Pull this in first */ 48 #define DATUM 49 #include <stdio.h> 50 #include <errno.h> 51 #include <signal.h> 52 #include <rpc/rpc.h> 53 #include <dirent.h> 54 #include <sys/stat.h> 55 #include <sys/wait.h> 56 #include <rpcsvc/yp_prot.h> 57 #include "ypv1_prot.h" 58 #include <rpcsvc/ypclnt.h> 59 60 typedef void (*PFV)(); 61 typedef int (*PFI)(); 62 typedef unsigned int (*PFU)(); 63 typedef long int (*PFLI)(); 64 typedef unsigned long int (*PFULI)(); 65 typedef short int (*PFSI)(); 66 typedef unsigned short int (*PFUSI)(); 67 68 #ifndef TRUE 69 #define TRUE 1 70 #endif 71 72 #ifndef FALSE 73 #define FALSE 0 74 #endif 75 76 #ifdef NULL 77 #undef NULL 78 #endif 79 #define NULL 0 80 81 /* 82 * Size of lock hash table 83 * 84 * It's for a hash table, hence better if it is prime. 85 * It's also the max number of maps and map locks, used 86 * for initializing shared memory: need to be big enough 87 * (until dynamic shared memory allocation is implemented ?). 88 */ 89 #define MAXHASH 1009 90 91 /* Maximum length of a yp map name in the system v filesystem */ 92 #define MAXALIASLEN 8 93 94 #define YPINTERTRY_TIME 10 /* Secs between tries for peer bind */ 95 #define YPTOTAL_TIME 30 /* Total secs until timeout */ 96 #define YPNOPORT ((unsigned short) 0) /* Out-of-range port value */ 97 98 /* External refs to yp server data structures */ 99 100 extern bool ypinitialization_done; 101 extern struct timeval ypintertry; 102 extern struct timeval yptimeout; 103 extern char myhostname[]; 104 extern bool silent; 105 #ifdef MINUS_C_OPTION 106 extern bool multiflag; 107 #endif 108 109 /* External ref to logging func */ 110 extern void logprintf(char *format, ...); 111 112 /* External refs for /var/yp/securenets support */ 113 extern void get_secure_nets(char *daemon_name); 114 115 /* External refs to yp server-only functions */ 116 extern bool ypcheck_map_existence(char *pname); 117 extern bool ypget_map_master(char **owner, DBM *fdb); 118 extern DBM *ypset_current_map(char *map, char *domain, uint_t *error); 119 extern void ypclr_current_map(void); 120 extern bool_t ypmkfilename(char *domain, char *map, char *path); 121 extern int yplist_maps(); 122 extern bool yp_map_access(SVCXPRT *transp, uint_t *error, DBM *fdb); 123 extern bool ypget_map_order(char *map, char *domain, uint_t *order); 124 125 extern bool ypcheck_domain(); 126 extern datum dbm_do_nextkey(); 127 extern void ypclr_current_map(void); 128 129 extern void ypdomain(SVCXPRT *transp, bool always_respond); 130 extern void ypmatch(SVCXPRT *transp, struct svc_req *rqstp); 131 extern void ypfirst(SVCXPRT *transp); 132 extern void ypnext(SVCXPRT *transp); 133 extern void ypxfr(SVCXPRT *transp, int prog); 134 extern void ypall(SVCXPRT *transp); 135 extern void ypmaster(SVCXPRT *transp); 136 extern void yporder(SVCXPRT *transp); 137 extern void ypmaplist(SVCXPRT *transp); 138 extern void ypoldmatch(SVCXPRT *transp, struct svc_req *rqstp); 139 extern void ypoldfirst(SVCXPRT *transp); 140 extern void ypoldnext(SVCXPRT *transp); 141 extern void ypoldpoll(SVCXPRT *transp); 142 extern void ypoldpush(SVCXPRT *transp); 143 extern void ypoldpull(SVCXPRT *transp); 144 extern void ypoldget(SVCXPRT *transp); 145 extern int yp_matchdns(DBM *, struct ypreq_key *, struct ypresp_val *); 146 extern int yp_oldmatchdns(DBM *fdb, 147 struct yprequest *req, struct ypresponse *resp); 148 149 extern bool _xdr_ypreqeust(XDR *xdrs, struct yprequest *ps); 150 extern bool _xdr_ypresponse(XDR *xdrs, struct ypresponse *ps); 151 152 extern void setup_resolv(bool *fwding, int *child, CLIENT **client, 153 char *tp_type, long prognum); 154 extern int resolv_req(bool *fwding, CLIENT **client, int *pid, 155 char *tp, SVCXPRT *xprt, struct ypreq_key *req, 156 char *map); 157 158 159 /* definitions for reading files of lists */ 160 161 struct listofnames 162 { 163 struct listofnames *nextname; 164 char *name; 165 }; 166 typedef struct listofnames listofnames; 167 168 /* 169 * XXX- NAME_MAX can't be defined in <limits.h> in a POSIX conformant system 170 * (under conditions which apply to Sun systems). Removal of this define 171 * caused yp to break (and only yp!). Hence, NAME_MAX is defined here 172 * *exactly* as it was in <limits.h>. I suspect this may not be the 173 * desired value. I suspect the desired value is either: 174 * - the maxumum name length for any file system type, or 175 * - should be _POSIX_NAME_MAX which is the minimum-maximum name 176 * length in a POSIX conformant system (which just happens to 177 * be 14), or 178 * - should be gotten by pathconf() or fpathconf(). 179 * XXX- I leave this to the owners of yp! 180 */ 181 #define NAME_MAX 14 /* s5 file system maximum name length */ 182 183 #ifdef __cplusplus 184 } 185 #endif 186 187 #endif /* __YPSYM_H */ 188