aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/compat.h
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-08 02:19:02 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-08 02:19:02 +0000
commita40fa4713e3ea9ad330dadc9613b289998a45b18 (patch)
tree9fcdb078aedbfd2aba55d94e0cafc5df2f02a7cf /include/asterisk/compat.h
parent79b38ffbe93fcdc51a6df4a3bfda59af7875e133 (diff)
first set of Cygwin portability stuff (issue #4678)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6547 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/compat.h')
-rwxr-xr-xinclude/asterisk/compat.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h
new file mode 100755
index 000000000..8d40ab34b
--- /dev/null
+++ b/include/asterisk/compat.h
@@ -0,0 +1,107 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * General Definitions for Asterisk top level program
+ *
+ * Copyright (C) 1999-2005, Mark Spencer
+ *
+ * Mark Spencer <markster@digium.com>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#ifndef _COMPAT_H
+#define _COMPAT_H
+
+#ifdef SOLARIS
+#define __BEGIN_DECLS
+#define __END_DECLS
+
+#ifndef __P
+#define __P(p) p
+#endif
+
+#include <alloca.h>
+#include <strings.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <netinet/in.h>
+
+#ifndef BYTE_ORDER
+#define LITTLE_ENDIAN 1234
+#define BIG_ENDIAN 4321
+
+#ifdef __sparc__
+#define BYTE_ORDER BIG_ENDIAN
+#else
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+#endif
+
+#ifndef __BYTE_ORDER
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#define __BIG_ENDIAN BIG_ENDIAN
+#define __BYTE_ORDER BYTE_ORDER
+#endif
+
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
+typedef unsigned char u_int8_t;
+typedef unsigned short u_int16_t;
+typedef unsigned int u_int32_t;
+#endif
+
+char* strsep(char** str, const char* delims);
+int setenv(const char *name, const char *value, int overwrite);
+int unsetenv(const char *name);
+#endif /* SOLARIS */
+
+#ifdef __CYGWIN__
+#define _WIN32_WINNT 0x0500
+#include <windows.h>
+#include <w32api/ws2tcpip.h>
+#endif /* __CYGWIN__ */
+
+#define HAVE_VASPRINTF
+#define HAVE_STRTOQ
+
+#ifdef __linux__
+#define HAVE_STRCASESTR
+#define HAVE_STRNDUP
+#define HAVE_STRNLEN
+#endif
+
+#ifdef SOLARIS
+#undef HAVE_VASPRINTF
+#undef HAVE_STRTOQ
+#endif
+
+#ifdef __CYGWIN__
+#undef HAVE_STRTOQ
+typedef unsigned long long uint64_t;
+#endif
+
+#ifndef HAVE_STRCASESTR
+char *strcasestr(const char *, const char *);
+#endif
+
+#ifndef HAVE_STRNDUP
+char *strndup(const char *, size_t);
+#endif
+
+#ifndef HAVE_STRNLEN
+size_t strnlen(const char *, size_t);
+#endif
+
+#ifndef HAVE_VASPRINTF
+int vasprintf(char **strp, const char *fmt, va_list ap);
+#endif
+
+#ifndef HAVE_STRTOQ
+uint64_t strtoq(const char *nptr, char **endptr, int base);
+#endif
+
+#endif