aboutsummaryrefslogtreecommitdiff
path: root/src/include/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/platform.h')
-rw-r--r--src/include/platform.h221
1 files changed, 221 insertions, 0 deletions
diff --git a/src/include/platform.h b/src/include/platform.h
new file mode 100644
index 000000000..07fbe0ee7
--- /dev/null
+++ b/src/include/platform.h
@@ -0,0 +1,221 @@
1/*
2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file include/platform.h
23 * @brief plaform specifics
24 *
25 * @author Nils Durner
26 *
27 * This file should never be included by installed
28 * header files (thos starting with "gnunet_").
29 */
30
31#ifndef PLATFORM_H
32#define PLATFORM_H
33
34#ifndef HAVE_USED_CONFIG_H
35#define HAVE_USED_CONFIG_H
36#if HAVE_CONFIG_H
37#include "gnunet_config.h"
38#endif
39#endif
40
41#ifdef WINDOWS
42#define BREAKPOINT asm("int $3;");
43#else
44#define BREAKPOINT
45#endif
46
47#ifdef HAVE_SYS_TYPES_H
48#include <sys/types.h>
49#endif
50
51#define ALLOW_EXTRA_CHECKS GNUNET_NO
52
53/**
54 * For strptime (glibc2 needs this).
55 */
56#ifndef _XOPEN_SOURCE
57#define _XOPEN_SOURCE
58#endif
59
60#ifndef _REENTRANT
61#define _REENTRANT
62#endif
63
64/* configuration options */
65
66#define VERBOSE_STATS 0
67
68#ifdef CYGWIN
69#include <sys/reent.h>
70#define _REENT_ONLY
71#endif
72
73#ifdef CYGWIN
74#undef _REENT_ONLY
75#endif
76
77#ifdef _MSC_VER
78#include <Winsock2.h>
79#else
80#ifndef MINGW
81#include <netdb.h>
82#include <sys/socket.h>
83#include <netinet/in.h>
84#include <arpa/inet.h>
85#include <netinet/tcp.h>
86#include <pwd.h>
87#include <sys/ioctl.h>
88#include <sys/wait.h>
89#include <grp.h>
90#else
91#include "winproc.h"
92#endif
93#endif
94
95#include <string.h>
96#include <stdio.h>
97#include <stdlib.h>
98#include <stdarg.h>
99#include <errno.h>
100#include <signal.h>
101#ifndef _MSC_VER
102#include <unistd.h> /* KLB_FIX */
103#endif
104#include <sys/stat.h>
105#include <sys/types.h>
106#ifndef _MSC_VER
107#include <dirent.h> /* KLB_FIX */
108#endif
109#include <fcntl.h>
110#include <math.h>
111#if HAVE_SYS_PARAM_H
112#include <sys/param.h>
113#endif
114#if TIME_WITH_SYS_TIME
115#include <sys/time.h>
116#include <time.h>
117#else
118#if HAVE_SYS_TIME_H
119#include <sys/time.h>
120#else
121#include <time.h>
122#endif
123#endif
124
125#ifdef SOMEBSD
126#include <net/if.h>
127#endif
128#ifdef GNUNET_freeBSD
129#include <semaphore.h>
130#endif
131#ifdef OSX
132#include <dlfcn.h>
133#include <semaphore.h>
134#include <net/if.h>
135#endif
136#ifdef LINUX
137#include <net/if.h>
138#endif
139#ifdef SOLARIS
140#include <sys/sockio.h>
141#include <sys/loadavg.h>
142#include <semaphore.h>
143#endif
144#ifdef CYGWIN
145#include <windows.h>
146#include <cygwin/if.h>
147#endif
148#if HAVE_IFADDRS_H
149#include <ifaddrs.h>
150#endif
151#include <errno.h>
152#include <limits.h>
153
154#if HAVE_CTYPE_H
155#include <ctype.h>
156#endif
157#if HAVE_SYS_RESOURCE_H
158#include <sys/resource.h>
159#endif
160
161#include "plibc.h"
162
163#include <pthread.h>
164#include <locale.h>
165#ifndef FRAMEWORK_BUILD
166#include "gettext.h"
167/**
168 * GNU gettext support macro.
169 */
170#define _(String) dgettext("gnunet",String)
171#define LIBEXTRACTOR_GETTEXT_DOMAIN "libextractor"
172#else
173#include "libintlemu.h"
174#define _(String) dgettext("org.gnunet.gnunet",String)
175#define LIBEXTRACTOR_GETTEXT_DOMAIN "org.gnunet.libextractor"
176#endif
177
178#ifdef CYGWIN
179#define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */
180#define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */
181#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
182#endif
183
184#ifndef MINGW
185#include <sys/mman.h>
186#endif
187
188#ifdef FREEBSD
189#define __BYTE_ORDER BYTE_ORDER
190#define __BIG_ENDIAN BIG_ENDIAN
191#endif
192
193#ifdef OSX
194#define socklen_t unsigned int
195#define __BYTE_ORDER BYTE_ORDER
196#define __BIG_ENDIAN BIG_ENDIAN
197 /* not available on OS X, override configure */
198#undef HAVE_STAT64
199#undef HAVE_MREMAP
200#endif
201
202
203#if !HAVE_ATOLL
204long long atoll (const char *nptr);
205#endif
206
207#if ENABLE_NLS
208#include "langinfo.h"
209#endif
210
211#ifndef O_LARGEFILE
212#define O_LARGEFILE 0
213#endif
214
215#if defined(__sparc__)
216#define MAKE_UNALIGNED(val) ({ __typeof__((val)) __tmp; memmove(&__tmp, &(val), sizeof((val))); __tmp; })
217#else
218#define MAKE_UNALIGNED(val) val
219#endif
220
221#endif