34 #ifndef SWITCH_PLATFORM_H
35 #define SWITCH_PLATFORM_H
38 #define SWITCH_USE_CLOCK_FUNCS
40 #if defined(WIN32) && defined(_MSC_VER)
44 #pragma warning (disable:810 869 981 279 1469 188)
47 #define SWITCH_VA_NONE "%s", ""
49 #define __SWITCH_FUNC__ __FUNCTION__
51 #define __SWITCH_FUNC__ (const char *)__func__
65 #pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610 4996)
66 #define SWITCH_HAVE_ODBC 1
68 # pragma comment(lib, "odbc32.lib")
70 #pragma include_alias(<libteletone.h>, <../../libs/libteletone/src/libteletone.h>)
71 #pragma include_alias(<libteletone_generate.h>, <../../libs/libteletone/src/libteletone_generate.h>)
72 #pragma include_alias(<libteletone_detect.h>, <../../libs/libteletone/src/libteletone_detect.h>)
73 #if (_MSC_VER >= 1400) // VC8+
74 #define switch_assert(expr) assert(expr);__analysis_assume( expr )
76 #if (_MSC_VER >= 1400) // VC8+
77 #ifndef _CRT_SECURE_NO_DEPRECATE
78 #define _CRT_SECURE_NO_DEPRECATE
80 #ifndef _CRT_NONSTDC_NO_DEPRECATE
81 #define _CRT_NONSTDC_NO_DEPRECATE
86 #define __FUNCTION__ ""
91 #define inline __inline
93 #if defined(_MSC_VER) && _MSC_VER >= 1900 && !defined(_STDINT)
96 #if !defined(_STDINT) && !defined(uint32_t)
97 typedef unsigned __int8 uint8_t;
98 typedef unsigned __int16 uint16_t;
99 typedef unsigned __int32 uint32_t;
100 typedef unsigned __int64 uint64_t;
101 typedef __int8 int8_t;
102 typedef __int16 int16_t;
103 typedef __int32 int32_t;
104 typedef __int64 int64_t;
105 typedef unsigned long in_addr_t;
112 #define strcasecmp(s1, s2) stricmp(s1, s2)
113 #define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
115 #define snprintf _snprintf
120 #if (defined __SUNPRO_CC) || defined(__SUNPRO_C)
124 #define PACKED __attribute__ ((__packed__))
126 #include <inttypes.h>
128 #include <arpa/inet.h>
129 #include <sys/socket.h>
130 #include <netinet/in.h>
133 #ifndef __LITTLE_ENDIAN
134 #define __LITTLE_ENDIAN 1234
137 #define __BIG_ENDIAN 4321
140 #ifdef SWITCH_BYTE_ORDER
141 #define __BYTE_ORDER SWITCH_BYTE_ORDER
143 #define __BYTE_ORDER __LITTLE_ENDIAN
147 #if defined(SWITCH_CORE_DECLARE_STATIC)
148 #define SWITCH_DECLARE(type) type __stdcall
149 #define SWITCH_DECLARE_NONSTD(type) type __cdecl
150 #define SWITCH_DECLARE_DATA
151 #elif defined(FREESWITCHCORE_EXPORTS)
152 #define SWITCH_DECLARE(type) __declspec(dllexport) type __stdcall
153 #define SWITCH_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
154 #define SWITCH_DECLARE_DATA __declspec(dllexport)
156 #define SWITCH_DECLARE(type) __declspec(dllimport) type __stdcall
157 #define SWITCH_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
158 #define SWITCH_DECLARE_DATA __declspec(dllimport)
160 #if defined(SWITCH_MOD_DECLARE_STATIC)
161 #define SWITCH_MOD_DECLARE(type) type __stdcall
162 #define SWITCH_MOD_DECLARE_NONSTD(type) type __cdecl
163 #define SWITCH_MOD_DECLARE_DATA
164 #elif defined(MOD_EXPORTS)
165 #define SWITCH_MOD_DECLARE(type) __declspec(dllexport) type __stdcall
166 #define SWITCH_MOD_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
167 #define SWITCH_MOD_DECLARE_DATA __declspec(dllexport)
169 #define SWITCH_MOD_DECLARE(type) __declspec(dllimport) type __stdcall
170 #define SWITCH_MOD_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
171 #define SWITCH_MOD_DECLARE_DATA __declspec(dllimport)
173 #define SIGHUP SIGTERM
175 #define S_IRUSR _S_IREAD
178 #define S_IWUSR _S_IWRITE
180 #define SWITCH_THREAD_FUNC __stdcall
181 #define SWITCH_DECLARE_CLASS
184 #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(SWITCH_API_VISIBILITY)
185 #define SWITCH_DECLARE(type) __attribute__((visibility("default"))) type
186 #define SWITCH_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
187 #define SWITCH_DECLARE_DATA __attribute__((visibility("default")))
188 #define SWITCH_MOD_DECLARE(type) __attribute__((visibility("default"))) type
189 #define SWITCH_MOD_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
190 #define SWITCH_MOD_DECLARE_DATA __attribute__((visibility("default")))
191 #define SWITCH_DECLARE_CLASS __attribute__((visibility("default")))
193 #define SWITCH_DECLARE(type) type
194 #define SWITCH_DECLARE_NONSTD(type) type
195 #define SWITCH_DECLARE_DATA
196 #define SWITCH_MOD_DECLARE(type) type
197 #define SWITCH_MOD_DECLARE_NONSTD(type) type
198 #define SWITCH_MOD_DECLARE_DATA
199 #define SWITCH_DECLARE_CLASS
201 #define SWITCH_THREAD_FUNC
203 #define SWITCH_DECLARE_CONSTRUCTOR SWITCH_DECLARE_DATA
205 #define DoxyDefine(x) x
207 #define DoxyDefine(x)
210 #define PRINTF_FUNCTION(fmtstr,vars) __attribute__((format(printf,fmtstr,vars)))
212 #define PRINTF_FUNCTION(fmtstr,vars)
226 #ifdef SWITCH_SSIZE_T
235 #define SWITCH_SSIZE_T_FMT "lld"
236 #define SWITCH_SIZE_T_FMT "lld"
239 #define SWITCH_SSIZE_T_FMT "d"
240 #define SWITCH_SIZE_T_FMT "d"
243 #define SWITCH_INT64_T_FMT "lld"
244 #define SWITCH_UINT64_T_FMT "llu"
247 #define TIME_T_FMT SWITCH_INT64_T_FMT
251 #ifndef SWITCH_SSIZE_T_FMT
252 #define SWITCH_SSIZE_T_FMT (sizeof (switch_ssize_t) == sizeof (long) ? "ld" : sizeof (switch_ssize_t) == sizeof (int) ? "d" : "lld")
255 #ifndef SWITCH_SIZE_T_FMT
256 #define SWITCH_SIZE_T_FMT (sizeof (switch_size_t) == sizeof (long) ? "lu" : sizeof (switch_size_t) == sizeof (int) ? "u" : "llu")
259 #ifndef SWITCH_INT64_T_FMT
260 #define SWITCH_INT64_T_FMT (sizeof (long) == 8 ? "ld" : "lld")
263 #ifndef SWITCH_UINT64_T_FMT
264 #define SWITCH_UINT64_T_FMT (sizeof (long) == 8 ? "lu" : "llu")
268 #if defined(__FreeBSD__) && SIZEOF_VOIDP == 4
269 #define TIME_T_FMT "d"
271 #define TIME_T_FMT "ld"
276 #if UINTPTR_MAX == 0xffffffffffffffff
282 #if defined(__sun__) && defined(__x86_64)
283 #define SWITCH_TIME_T_FMT SWITCH_SIZE_T_FMT
285 #define SWITCH_TIME_T_FMT SWITCH_INT64_T_FMT
296 #ifndef WIN32_LEAN_AND_MEAN
297 #define WIN32_LEAN_AND_MEAN
302 #define _WIN32_WINNT 0x0400
321 #include <winsock2.h>
323 #include <ws2tcpip.h>
335 #define TRUE (!FALSE)
337 #ifndef switch_assert
338 #define switch_assert(expr) assert(expr)
347 #define _Printf_format_string_
352 #define _Check_return_
355 #define _In_bytecount_(x)
356 #define _Out_opt_bytecapcount_(x)
357 #define _Out_bytecapcount_(x)
361 #define _Out_z_cap_(x)
362 #define _Out_ptrdiff_cap_(x)
363 #define _Out_opt_ptrdiff_cap_(x)
364 #define _Post_count_(x)
#define SWITCH_END_EXTERN_C
#define SWITCH_BEGIN_EXTERN_C