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) 116 #if (defined __SUNPRO_CC) || defined(__SUNPRO_C) 120 #define PACKED __attribute__ ((__packed__)) 122 #include <inttypes.h> 124 #include <arpa/inet.h> 125 #include <sys/socket.h> 126 #include <netinet/in.h> 129 #ifndef __LITTLE_ENDIAN 130 #define __LITTLE_ENDIAN 1234 133 #define __BIG_ENDIAN 4321 136 #ifdef SWITCH_BYTE_ORDER 137 #define __BYTE_ORDER SWITCH_BYTE_ORDER 139 #elif defined(__SVR4) && defined(__sun) && defined(_BIG_ENDIAN) 140 #define __BYTE_ORDER __BIG_ENDIAN 142 #elif defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN) 143 #define __BYTE_ORDER __BIG_ENDIAN 145 #define __BYTE_ORDER __LITTLE_ENDIAN 149 #if defined(SWITCH_CORE_DECLARE_STATIC) 150 #define SWITCH_DECLARE(type) type __stdcall 151 #define SWITCH_DECLARE_NONSTD(type) type __cdecl 152 #define SWITCH_DECLARE_DATA 153 #elif defined(FREESWITCHCORE_EXPORTS) 154 #define SWITCH_DECLARE(type) __declspec(dllexport) type __stdcall 155 #define SWITCH_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl 156 #define SWITCH_DECLARE_DATA __declspec(dllexport) 158 #define SWITCH_DECLARE(type) __declspec(dllimport) type __stdcall 159 #define SWITCH_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl 160 #define SWITCH_DECLARE_DATA __declspec(dllimport) 162 #if defined(SWITCH_MOD_DECLARE_STATIC) 163 #define SWITCH_MOD_DECLARE(type) type __stdcall 164 #define SWITCH_MOD_DECLARE_NONSTD(type) type __cdecl 165 #define SWITCH_MOD_DECLARE_DATA 166 #elif defined(MOD_EXPORTS) 167 #define SWITCH_MOD_DECLARE(type) __declspec(dllexport) type __stdcall 168 #define SWITCH_MOD_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl 169 #define SWITCH_MOD_DECLARE_DATA __declspec(dllexport) 171 #define SWITCH_MOD_DECLARE(type) __declspec(dllimport) type __stdcall 172 #define SWITCH_MOD_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl 173 #define SWITCH_MOD_DECLARE_DATA __declspec(dllimport) 175 #define SIGHUP SIGTERM 177 #define S_IRUSR _S_IREAD 180 #define S_IWUSR _S_IWRITE 182 #define SWITCH_THREAD_FUNC __stdcall 183 #define SWITCH_DECLARE_CLASS 186 #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(SWITCH_API_VISIBILITY) 187 #define SWITCH_DECLARE(type) __attribute__((visibility("default"))) type 188 #define SWITCH_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type 189 #define SWITCH_DECLARE_DATA __attribute__((visibility("default"))) 190 #define SWITCH_MOD_DECLARE(type) __attribute__((visibility("default"))) type 191 #define SWITCH_MOD_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type 192 #define SWITCH_MOD_DECLARE_DATA __attribute__((visibility("default"))) 193 #define SWITCH_DECLARE_CLASS __attribute__((visibility("default"))) 195 #define SWITCH_DECLARE(type) type 196 #define SWITCH_DECLARE_NONSTD(type) type 197 #define SWITCH_DECLARE_DATA 198 #define SWITCH_MOD_DECLARE(type) type 199 #define SWITCH_MOD_DECLARE_NONSTD(type) type 200 #define SWITCH_MOD_DECLARE_DATA 201 #define SWITCH_DECLARE_CLASS 203 #define SWITCH_THREAD_FUNC 205 #define SWITCH_DECLARE_CONSTRUCTOR SWITCH_DECLARE_DATA 207 #define DoxyDefine(x) x 209 #define DoxyDefine(x) 212 #define PRINTF_FUNCTION(fmtstr,vars) __attribute__((format(printf,fmtstr,vars))) 214 #define PRINTF_FUNCTION(fmtstr,vars) 228 #ifdef SWITCH_SSIZE_T 237 #define SWITCH_SSIZE_T_FMT "lld" 238 #define SWITCH_SIZE_T_FMT "lld" 241 #define SWITCH_SSIZE_T_FMT "d" 242 #define SWITCH_SIZE_T_FMT "d" 245 #define SWITCH_INT64_T_FMT "lld" 246 #define SWITCH_UINT64_T_FMT "llu" 249 #define TIME_T_FMT SWITCH_INT64_T_FMT 253 #ifndef SWITCH_SSIZE_T_FMT 254 #define SWITCH_SSIZE_T_FMT (sizeof (switch_ssize_t) == sizeof (long) ? "ld" : sizeof (switch_ssize_t) == sizeof (int) ? "d" : "lld") 257 #ifndef SWITCH_SIZE_T_FMT 258 #define SWITCH_SIZE_T_FMT (sizeof (switch_size_t) == sizeof (long) ? "lu" : sizeof (switch_size_t) == sizeof (int) ? "u" : "llu") 261 #ifndef SWITCH_INT64_T_FMT 262 #define SWITCH_INT64_T_FMT (sizeof (long) == 8 ? "ld" : "lld") 265 #ifndef SWITCH_UINT64_T_FMT 266 #define SWITCH_UINT64_T_FMT (sizeof (long) == 8 ? "lu" : "llu") 270 #if defined(__FreeBSD__) && SIZEOF_VOIDP == 4 271 #define TIME_T_FMT "d" 273 #if __USE_TIME_BITS64 274 #define TIME_T_FMT SWITCH_INT64_T_FMT 276 #define TIME_T_FMT "ld" 282 #if UINTPTR_MAX == 0xffffffffffffffff 288 #if defined(__sun__) && (defined(__x86_64) || defined(__arch64__)) 289 #define SWITCH_TIME_T_FMT SWITCH_SIZE_T_FMT 291 #define SWITCH_TIME_T_FMT SWITCH_INT64_T_FMT 302 #ifndef WIN32_LEAN_AND_MEAN 303 #define WIN32_LEAN_AND_MEAN 308 #define _WIN32_WINNT 0x0400 327 #include <winsock2.h> 329 #include <ws2tcpip.h> 341 #define TRUE (!FALSE) 343 #ifndef switch_assert 344 #ifdef PVS_STUDIO // Mute PVS FALSE ALARM 345 #define switch_assert(expr) do {if (!(expr)) {fprintf(stderr, "MEMERR\n"); abort();}} while (0) 347 #define switch_assert(expr) assert(expr) 357 #define _Printf_format_string_ 362 #define _Check_return_ 365 #define _In_bytecount_(x) 366 #define _Out_opt_bytecapcount_(x) 367 #define _Out_bytecapcount_(x) 371 #define _Out_z_cap_(x) 372 #define _Out_ptrdiff_cap_(x) 373 #define _Out_opt_ptrdiff_cap_(x) 374 #define _Post_count_(x) 376 #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 377 #define GCC_DIAG_STR(s) #s 378 #define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y) 379 # define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) 380 # define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x) 381 # if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 382 # define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \ 383 GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) 384 # define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop) 386 # define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) 387 # define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x)) 390 # define GCC_DIAG_OFF(x) 391 # define GCC_DIAG_ON(x) #define SWITCH_END_EXTERN_C
#define SWITCH_BEGIN_EXTERN_C