Adds DAHDI support alongside Zaptel. DAHDI usage favored, but all Zap stuff should...
[asterisk-bristuff.git] / include / asterisk / compat.h
blob2c131527d13ed560d6307373d152510279309b87
1 /*
2 * Asterisk -- A telephony toolkit for Linux.
3 *
4 * Copyright (C) 1999-2006, Digium, Inc.
6 * Mark Spencer <markster@digium.com>
8 * This program is free software, distributed under the terms of
9 * the GNU General Public License
12 /*! \file
13 * \brief General Definitions for Asterisk top level program
16 #ifndef _COMPAT_H
17 #define _COMPAT_H
19 #include "asterisk/autoconfig.h"
20 #include <inttypes.h>
21 #include <sys/types.h>
22 #include <stdarg.h>
24 #if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
25 int asprintf(char **str, const char *fmt, ...);
26 #endif
28 #ifndef HAVE_GETLOADAVG
29 int getloadavg(double *list, int nelem);
30 #endif
32 #ifndef HAVE_SETENV
33 int setenv(const char *name, const char *value, int overwrite);
34 #endif
36 #ifndef HAVE_STRCASESTR
37 char *strcasestr(const char *, const char *);
38 #endif
40 #if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC)
41 char *strndup(const char *, size_t);
42 #endif
44 #ifndef HAVE_STRNLEN
45 size_t strnlen(const char *, size_t);
46 #endif
48 #ifndef HAVE_STRSEP
49 char* strsep(char** str, const char* delims);
50 #endif
52 #ifndef HAVE_STRTOQ
53 uint64_t strtoq(const char *nptr, char **endptr, int base);
54 #endif
56 #ifndef HAVE_UNSETENV
57 int unsetenv(const char *name);
58 #endif
60 #if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC)
61 int vasprintf(char **strp, const char *fmt, va_list ap);
62 #endif
64 #ifndef HAVE_STRLCAT
65 size_t strlcat(char *dst, const char *src, size_t siz);
66 #endif
68 #ifndef HAVE_STRLCPY
69 size_t strlcpy(char *dst, const char *src, size_t siz);
70 #endif
72 #ifdef SOLARIS
73 #define __BEGIN_DECLS
74 #define __END_DECLS
76 #ifndef __P
77 #define __P(p) p
78 #endif
80 #include <alloca.h>
81 #include <strings.h>
82 #include <string.h>
83 #include <pthread.h>
84 #include <sys/stat.h>
85 #include <signal.h>
86 #include <netinet/in.h>
87 #include <sys/loadavg.h>
88 #include <dat/dat_platform_specific.h>
90 #ifndef BYTE_ORDER
91 #define LITTLE_ENDIAN 1234
92 #define BIG_ENDIAN 4321
94 #ifdef __sparc__
95 #define BYTE_ORDER BIG_ENDIAN
96 #else
97 #define BYTE_ORDER LITTLE_ENDIAN
98 #endif
99 #endif
101 #ifndef __BYTE_ORDER
102 #define __LITTLE_ENDIAN LITTLE_ENDIAN
103 #define __BIG_ENDIAN BIG_ENDIAN
104 #define __BYTE_ORDER BYTE_ORDER
105 #endif
107 #ifndef __BIT_TYPES_DEFINED__
108 #define __BIT_TYPES_DEFINED__
109 typedef unsigned char u_int8_t;
110 typedef unsigned short u_int16_t;
111 typedef unsigned int u_int32_t;
112 #endif
114 #endif /* SOLARIS */
116 #ifdef __CYGWIN__
117 #define _WIN32_WINNT 0x0500
118 #ifndef INET_ADDRSTRLEN
119 #define INET_ADDRSTRLEN 16
120 #endif
121 #ifndef INET6_ADDRSTRLEN
122 #define INET6_ADDRSTRLEN 46
123 #endif
124 #endif /* __CYGWIN__ */
126 #ifdef __CYGWIN__
127 typedef unsigned long long uint64_t;
128 #endif
130 #endif