2018-05-02 10:39:36 +02:00
|
|
|
#ifndef CONFIG_H
|
2019-06-04 10:02:58 +02:00
|
|
|
#define CONFIG_H
|
2014-05-08 00:27:00 +02:00
|
|
|
/* ============================================================
|
2018-09-20 17:12:00 +02:00
|
|
|
* Platform options
|
|
|
|
|
* ============================================================ */
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
# define __DARWIN_C_SOURCE
|
2020-10-30 15:34:32 +01:00
|
|
|
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__SYMBIAN32__)
|
2018-09-20 17:12:00 +02:00
|
|
|
# define _XOPEN_SOURCE 700
|
|
|
|
|
# define __BSD_VISIBLE 1
|
|
|
|
|
# define HAVE_NETINET_IN_H
|
2020-10-30 15:34:32 +01:00
|
|
|
#elif defined(__QNX__)
|
|
|
|
|
# define _XOPEN_SOURCE 600
|
|
|
|
|
# define __BSD_VISIBLE 1
|
|
|
|
|
# define HAVE_NETINET_IN_H
|
2018-09-20 17:12:00 +02:00
|
|
|
#else
|
|
|
|
|
# define _XOPEN_SOURCE 700
|
|
|
|
|
# define _DEFAULT_SOURCE 1
|
|
|
|
|
# define _POSIX_C_SOURCE 200809L
|
|
|
|
|
#endif
|
2014-05-08 00:27:00 +02:00
|
|
|
|
2019-07-25 22:08:00 +02:00
|
|
|
|
|
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
|
# define _GNU_SOURCE
|
|
|
|
|
#endif
|
2014-05-08 00:27:00 +02:00
|
|
|
|
2019-02-26 18:11:29 +01:00
|
|
|
#define OPENSSL_LOAD_CONF
|
|
|
|
|
|
2014-05-08 00:27:00 +02:00
|
|
|
/* ============================================================
|
|
|
|
|
* Compatibility defines
|
|
|
|
|
* ============================================================ */
|
2016-03-17 22:24:50 +01:00
|
|
|
#if defined(_MSC_VER) && _MSC_VER < 1900
|
|
|
|
|
# define snprintf sprintf_s
|
2017-02-20 22:20:00 +01:00
|
|
|
# define EPROTO ECONNABORTED
|
2021-04-18 21:23:25 +02:00
|
|
|
# ifndef ECONNABORTED
|
|
|
|
|
# define ECONNABORTED WSAECONNABORTED
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef ENOTCONN
|
|
|
|
|
# define ENOTCONN WSAENOTCONN
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef ECONNREFUSED
|
|
|
|
|
# define ECONNREFUSED WSAECONNREFUSED
|
|
|
|
|
# endif
|
2016-03-17 22:24:50 +01:00
|
|
|
#endif
|
|
|
|
|
|
2014-05-08 00:27:00 +02:00
|
|
|
#ifdef WIN32
|
2014-10-26 22:17:08 +01:00
|
|
|
# ifndef strcasecmp
|
|
|
|
|
# define strcasecmp strcmpi
|
|
|
|
|
# endif
|
2018-08-16 12:16:16 +02:00
|
|
|
# define strtok_r strtok_s
|
|
|
|
|
# define strerror_r(e, b, l) strerror_s(b, l, e)
|
2014-05-08 00:27:00 +02:00
|
|
|
#endif
|
2014-09-17 23:58:46 +02:00
|
|
|
|
|
|
|
|
|
2020-09-23 17:13:29 +02:00
|
|
|
#define uthash_malloc(sz) mosquitto_malloc(sz)
|
|
|
|
|
#define uthash_free(ptr,sz) mosquitto_free(ptr)
|
2014-09-17 23:58:46 +02:00
|
|
|
|
2018-12-09 14:40:38 +01:00
|
|
|
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
# include <openssl/opensslconf.h>
|
|
|
|
|
# if defined(WITH_TLS_PSK) && !defined(OPENSSL_NO_PSK)
|
|
|
|
|
# define FINAL_WITH_TLS_PSK
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-02-27 11:53:36 +01:00
|
|
|
|
|
|
|
|
#ifdef __COVERITY__
|
|
|
|
|
# include <stdint.h>
|
|
|
|
|
/* These are "wrong", but we don't use them so it doesn't matter */
|
|
|
|
|
# define _Float32 uint32_t
|
|
|
|
|
# define _Float32x uint32_t
|
|
|
|
|
# define _Float64 uint64_t
|
|
|
|
|
# define _Float64x uint64_t
|
|
|
|
|
# define _Float128 uint64_t
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-03-13 15:11:50 +01:00
|
|
|
#define UNUSED(A) (void)(A)
|
|
|
|
|
|
2019-06-06 15:04:14 +02:00
|
|
|
/* Android Bionic libpthread implementation doesn't have pthread_cancel */
|
2021-09-29 14:45:01 +02:00
|
|
|
#if !defined(ANDROID) && !defined(WIN32)
|
2019-06-06 15:04:14 +02:00
|
|
|
# define HAVE_PTHREAD_CANCEL
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-11-25 17:57:33 +01:00
|
|
|
#ifdef WITH_CJSON
|
2020-12-04 23:15:19 +01:00
|
|
|
# include <cjson/cJSON.h>
|
2020-11-25 17:57:33 +01:00
|
|
|
# define CJSON_VERSION_FULL (CJSON_VERSION_MAJOR*1000000+CJSON_VERSION_MINOR*1000+CJSON_VERSION_PATCH)
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-09-10 00:55:33 +02:00
|
|
|
#define WS_IS_LWS 1
|
|
|
|
|
#define WS_IS_WSLAY 2
|
|
|
|
|
|
2018-05-02 10:39:36 +02:00
|
|
|
#endif
|