1/* config.h--SASL configuration for win32
2 * Ryan Troll
3 */
4/*
5 * Copyright (c) 1998-2004 Carnegie Mellon University.  All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in
16 *    the documentation and/or other materials provided with the
17 *    distribution.
18 *
19 * 3. The name "Carnegie Mellon University" must not be used to
20 *    endorse or promote products derived from this software without
21 *    prior written permission. For permission or any other legal
22 *    details, please contact
23 *      Office of Technology Transfer
24 *      Carnegie Mellon University
25 *      5000 Forbes Avenue
26 *      Pittsburgh, PA  15213-3890
27 *      (412) 268-4387, fax: (412) 268-7395
28 *      tech-transfer@andrew.cmu.edu
29 *
30 * 4. Redistributions of any form whatsoever must retain the following
31 *    acknowledgment:
32 *    "This product includes software developed by Computing Services
33 *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
34 *
35 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
36 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
38 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
39 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
40 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
41 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
42 */
43
44#ifndef CONFIG_H
45#define CONFIG_H
46
47#include <stddef.h>
48
49/* winsock2 includes windows.h.
50   Note that we can't include both winsock.h and winsock2.h as
51   they conflict */
52#include <winsock2.h>
53
54/* Our package */
55#define PACKAGE "cyrus-sasl"
56
57/* Our version */
58#define VERSION "2.1.22"
59
60/* Visual Studio supports prototypes */
61#define PROTOTYPES     1
62
63#ifndef HAVE_CADDR_T
64#ifndef	caddr_t
65typedef unsigned char   *caddr_t;
66#define HAVE_CADDR_T	1
67#endif
68#endif
69
70#ifndef _INTPTR_T_DEFINED
71
72#ifdef  _WIN64
73typedef __int64             intptr_t;
74#else
75typedef int		    intptr_t;
76#endif
77
78#endif
79
80/* Registry key that contains the locations of the plugins */
81#define SASL_ROOT_KEY "SOFTWARE\\Carnegie Mellon\\Project Cyrus\\SASL Library"
82#define SASL_KEY_V1 SASL_ROOT_KEY "\\Available Plugins"
83#define SASL_PATH_SUBKEY "SearchPath"
84
85/* : This should probably be replaced with a call to a function
86   : that gets the proper value from Registry */
87#define SASL_DB_PATH "c:\\CMU\\sasldb2"
88
89/* what db package are we using? */
90/* #undef SASL_GDBM */
91/* #undef SASL_NDBM */
92#define SASL_BERKELEYDB 1
93
94/* which mechs can we link staticly? */
95#define STATIC_ANONYMOUS 1
96#define STATIC_CRAMMD5 1
97#define STATIC_DIGESTMD5 1
98#define STATIC_GSSAPIV2 1
99/* #undef STATIC_KERBEROS4 */
100#define STATIC_LOGIN 1
101/* #undef STATIC_MYSQL */
102#define STATIC_OTP 1
103#define STATIC_PLAIN 1
104#define STATIC_SASLDB 1
105#define STATIC_SRP 1
106
107/* ------------------------------------------------------------ */
108
109/* Things that are fetched via autoconf under Unix
110 */
111#define HAVE_MEMCPY 1
112
113#define SASL_PATH_ENV_VAR "SASL_PATH"
114#define PLUGINDIR "C:\\CMU\\bin\\sasl2"
115
116/* Windows calls these functions something else
117 */
118#define strcasecmp   stricmp
119#define snprintf    _snprintf
120#define strncasecmp  strnicmp
121
122#define MAXHOSTNAMELEN 1024
123
124/* ------------------------------------------------------------ */
125
126#define WITHOUT_NANA
127#define L_DEFAULT_GUARD (0)
128#define I_DEFAULT_GUARD (0)
129#define I(foo)
130#define VL(foo)  printf foo;
131#define VLP(foo,bar)
132
133/* we're not gcc */
134#define __attribute__(foo)
135
136/* : Same as in tpipv6.h */
137#ifndef HAVE_SOCKLEN_T
138typedef int socklen_t;
139#endif /* HAVE_SOCKLEN_T */
140
141/* If we expect to run on XP and later, we have IPv6 support natively */
142#if TARGET_WIN_SYSTEM >= 51
143#if !defined(_WIN32_WINNT)
144/* This forces the inclusion of OS supported functions, with no fallback */
145#define _WIN32_WINNT	0x0510
146#endif
147#endif
148
149#if defined(_MSC_VER) && (_MSC_VER >= 1300)
150/* The following two defines will prevent our own definitions below */
151#define HAVE_GETADDRINFO
152#define HAVE_GETNAMEINFO
153#define HAVE_STRUCT_SOCKADDR_STORAGE
154/* Unless _WIN32_WINNT > 0x0500, Ws2tcpip.h will try to find OS provided
155   getaddrinfo at runtime. It will fallback to Microsoft emulation,
156   if not found */
157#include <Ws2tcpip.h>
158#endif
159
160#if !defined(HAVE_STRUCT_SOCKADDR_STORAGE) && !defined(_SS_MAXSIZE)
161#define	_SS_MAXSIZE	128	/* Implementation specific max size */
162#define	_SS_PADSIZE	(_SS_MAXSIZE - sizeof (struct sockaddr))
163
164struct sockaddr_storage {
165	struct	sockaddr ss_sa;
166	char		__ss_pad2[_SS_PADSIZE];
167};
168# define ss_family ss_sa.sa_family
169#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
170
171#ifndef AF_INET6
172/* Define it to something that should never appear */
173#define	AF_INET6	AF_MAX
174#endif
175
176#ifndef HAVE_GETADDRINFO
177#define	getaddrinfo	sasl_getaddrinfo
178#define	freeaddrinfo	sasl_freeaddrinfo
179#define	gai_strerror	sasl_gai_strerror
180#endif
181
182#ifndef HAVE_GETNAMEINFO
183#define	getnameinfo	sasl_getnameinfo
184#endif
185
186#if !defined(HAVE_GETNAMEINFO) || !defined(HAVE_GETADDRINFO)
187#include "gai.h"
188#endif
189
190#ifndef AI_NUMERICHOST   /* support glibc 2.0.x */
191#define AI_NUMERICHOST  4
192#define NI_NUMERICHOST  2
193#define NI_NAMEREQD     4
194#define NI_NUMERICSERV  8
195#endif
196
197#include <time.h>
198
199typedef int ssize_t;
200
201#define HIER_DELIMITER '\\'
202
203#ifndef sleep
204#define sleep(seconds)		plug_sleep(seconds)
205unsigned int plug_sleep(unsigned int seconds);
206#endif
207
208#endif /* CONFIG_H */
209