1 /* $Id: config.h,v 1.4 2004/03/08 16:57:27 rjs3 Exp $ 2 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in 13 * the documentation and/or other materials provided with the 14 * distribution. 15 * 16 * 3. The name "Carnegie Mellon University" must not be used to 17 * endorse or promote products derived from this software without 18 * prior written permission. For permission or any other legal 19 * details, please contact 20 * Office of Technology Transfer 21 * Carnegie Mellon University 22 * 5000 Forbes Avenue 23 * Pittsburgh, PA 15213-3890 24 * (412) 268-4387, fax: (412) 268-7395 25 * tech-transfer@andrew.cmu.edu 26 * 27 * 4. Redistributions of any form whatsoever must retain the following 28 * acknowledgment: 29 * "This product includes software developed by Computing Services 30 * at Carnegie Mellon University (http://www.cmu.edu/computing/)." 31 * 32 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 33 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 34 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 35 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 36 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 37 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 38 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 39 */ 40 41 #ifndef CONFIG_H 42 #define CONFIG_H 43 44 //#ifdef XSUS 45 //#include <windows.h> 46 //#endif 47 48 #include <string.h> 49 50 /* 51 * funky names for functions so we dont conflict with possible 52 * real ones in applications we load into 53 */ 54 55 #define htons 56 #define htonl 57 #define ntohl 58 #define ntohs 59 #define strdup xxx_sasl_strdup 60 #define strcasecmp xxx_sasl_strcasecmp 61 #define gethostname xxx_sasl_gethostname 62 #define inet_aton xxx_sasl_inetaton 63 64 /* Our package */ 65 #define PACKAGE "cyrus-sasl" 66 67 /* Our version */ 68 #define VERSION "2.0.4" 69 70 /* We only want minimal server functionality. Cripple the server functionality when necessary to get 71 * things to compile. 72 * 73 * Currently only cripples PLAIN. 74 */ 75 #define SASL_MINIMAL_SERVER 1 76 77 /* DB Type */ 78 #undef SASL_DB_TYPE 79 80 int strcasecmp(const char *s1,const char *s2); 81 int strncasecmp(const char *s1,const char *s2,int len); 82 83 int strcpy_truncate(char *dest,char *src,int len); 84 85 #define gethostname xxx_sasl_gethostname 86 int gethostname(char *dest,int destlen); 87 88 #define SASL_PATH_ENV_VAR "foo" 89 #define PLUGINDIR "make_me_a_function_to_get_that_info" 90 91 typedef unsigned char u_char; 92 typedef unsigned long u_long; 93 94 char *strdup(const char *str); 95 struct sockaddr_in { 96 u_char sin_len; 97 u_char sin_family; 98 unsigned short sin_port; 99 union { 100 unsigned long s_addr; 101 } sin_addr; 102 char sin_zero[8]; 103 }; 104 105 struct in_addr { 106 unsigned long s_addr; 107 }; 108 109 #ifndef HAVE_SOCKLEN_T 110 typedef unsigned int socklen_t; 111 #endif /* HAVE_SOCKLEN_T */ 112 113 #include "gai.h" 114 115 #ifndef NULL 116 #define NULL (0L) 117 #endif 118 119 #ifdef RUBBISH 120 int snprintf (char *str,size_t count,const char *fmt,...); 121 int snprintf (char *str,int count,const char *fmt,...); 122 #endif 123 124 extern char *optarg; 125 extern int optind; 126 extern int getopt( 127 int nargc, 128 char * const *nargv, 129 const char *ostr); 130 131 extern int getsubopt(char **optionp, const char * const *tokens, char **valuep); 132 extern char* getpass(const char *prompt); 133 134 /* ------------------------------------------------------------ */ 135 136 /* Things that are fetched via autoconf under Unix 137 */ 138 #define HAVE_MEMCPY 1 139 140 #define MAXHOSTNAMELEN 1024 141 142 /* ------------------------------------------------------------ */ 143 144 #define WITHOUT_NANA 145 #define L_DEFAULT_GUARD (0) 146 #define I_DEFAULT_GUARD (0) 147 #define I(foo) 148 #ifdef RUBBISH 149 //#define VL(foo) 150 #endif 151 #include <stdio.h> 152 #define XXVL(foo) printf foo; 153 #define VL(foo) 154 #define VLP(foo,bar) 155 156 #define __attribute__(foo) 157 158 #include <netinet/in.h> 159 160 #define getservbyname(X,Y) NULL 161 struct servent { 162 int s_port; 163 }; 164 165 struct sockaddr { 166 u_char sa_len; /* total length */ 167 u_char sa_family; /* address family */ 168 char sa_data[14]; /* address value */ 169 }; 170 #define SOCK_MAXADDRLEN 255 /* longest possible addresses */ 171 172 #ifndef HAVE_SOCKLEN_T 173 typedef unsigned int socklen_t; 174 #endif /* HAVE_SOCKLEN_T */ 175 176 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE 177 #define _SS_MAXSIZE 128 /* Implementation specific max size */ 178 #define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) 179 180 struct sockaddr_storage { 181 struct sockaddr ss_sa; 182 char __ss_pad2[_SS_PADSIZE]; 183 }; 184 #define ss_family ss_sa.sa_family 185 #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ 186 187 #define get_krb_err_txt(X) (krb_err_txt[(X)]) 188 189 /* 190 * Address families. 191 */ 192 #define AF_UNSPEC 0 /* unspecified */ 193 #define AF_UNIX 1 /* local to host (pipes, portals) */ 194 #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ 195 #define AF_IMPLINK 3 /* arpanet imp addresses */ 196 #define AF_PUP 4 /* pup protocols: e.g. BSP */ 197 #define AF_CHAOS 5 /* mit CHAOS protocols */ 198 #define AF_NS 6 /* XEROX NS protocols */ 199 #define AF_NBS 7 /* nbs protocols */ 200 #define AF_ECMA 8 /* european computer manufacturers */ 201 #define AF_DATAKIT 9 /* datakit protocols */ 202 #define AF_CCITT 10 /* CCITT protocols, X.25 etc */ 203 #define AF_SNA 11 /* IBM SNA */ 204 #define AF_DECnet 12 /* DECnet */ 205 #define AF_DLI 13 /* Direct data link interface */ 206 #define AF_LAT 14 /* LAT */ 207 #define AF_HYLINK 15 /* NSC Hyperchannel */ 208 #define AF_APPLETALK 16 /* Apple Talk */ 209 #define AF_NIT 17 /* Network Interface Tap */ 210 #define AF_802 18 /* IEEE 802.2, also ISO 8802 */ 211 #define AF_OSI 19 /* umbrella for all families used */ 212 #define AF_X25 20 /* CCITT X.25 in particular */ 213 #define AF_OSINET 21 /* AFI = 47, IDI = 4 */ 214 #define AF_GOSIP 22 /* U.S. Government OSI */ 215 #define AF_IPX 23 /* Novell Internet Protocol */ 216 #define AF_ROUTE 24 /* Internal Routing Protocol */ 217 #define AF_LINK 25 /* Link-layer interface */ 218 #define AF_INET6 26 /* Internet Protocol, Version 6 */ 219 #define AF_KEY 27 /* Security Association DB socket */ 220 221 #define AF_MAX 27 222 223 /* 224 * Protocol families, same as address families for now. 225 */ 226 #define PF_UNSPEC AF_UNSPEC 227 #define PF_UNIX AF_UNIX 228 #define PF_INET AF_INET 229 #define PF_IMPLINK AF_IMPLINK 230 #define PF_PUP AF_PUP 231 #define PF_CHAOS AF_CHAOS 232 #define PF_NS AF_NS 233 #define PF_NBS AF_NBS 234 #define PF_ECMA AF_ECMA 235 #define PF_DATAKIT AF_DATAKIT 236 #define PF_CCITT AF_CCITT 237 #define PF_SNA AF_SNA 238 #define PF_DECnet AF_DECnet 239 #define PF_DLI AF_DLI 240 #define PF_LAT AF_LAT 241 #define PF_HYLINK AF_HYLINK 242 #define PF_APPLETALK AF_APPLETALK 243 #define PF_NIT AF_NIT 244 #define PF_802 AF_802 245 #define PF_OSI AF_OSI 246 #define PF_X25 AF_X25 247 #define PF_OSINET AF_OSINET 248 #define PF_GOSIP AF_GOSIP 249 #define PF_IPX AF_IPX 250 #define PF_ROUTE AF_ROUTE 251 #define PF_LINK AF_LINK 252 #define PF_INET6 AF_INET6 253 #define PF_KEY AF_KEY 254 255 #define PF_MAX AF_MAX 256 257 #define SOCK_STREAM 1 258 #define SOCK_DGRAM 2 259 260 struct iovec { 261 char *iov_base; 262 long iov_len; 263 }; 264 265 #ifndef HAVE_GETADDRINFO 266 #define getaddrinfo sasl_getaddrinfo 267 #define freeaddrinfo sasl_freeaddrinfo 268 #define getnameinfo sasl_getnameinfo 269 #define gai_strerror sasl_gai_strerror 270 #include "gai.h" 271 #endif 272 273 #endif /* CONFIG_H */ 274