diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 16382c10..12909cf9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -80,6 +80,7 @@ elseif(UNIX) set(LIBS_SYSTEM compat pthread) elseif(CMAKE_SYSTEM_NAME MATCHES "QNX") set(LIBS_SYSTEM c) + add_definitions(-D_QNX_SOURCE -DGULLIVER) else() set(LIBS_SYSTEM c pthread) endif() diff --git a/src/MQTTPacket.h b/src/MQTTPacket.h index 04c217ef..74a6bfbd 100644 --- a/src/MQTTPacket.h +++ b/src/MQTTPacket.h @@ -28,7 +28,19 @@ #include "LinkedList.h" #include "Clients.h" + +#ifdef __cplusplus + #include +#else + #ifndef __bool_true_false_are_defined + #ifndef bool + typedef unsigned int bool; + #endif + #endif +#endif + typedef unsigned int bit; + typedef void* (*pf)(int, unsigned char, char*, size_t); #include "MQTTProperties.h" @@ -58,7 +70,13 @@ enum msgTypes #endif /** - * Bitfields for the MQTT header byte. + * + + + + + + fields for the MQTT header byte. */ typedef union { diff --git a/src/SHA1.c b/src/SHA1.c index 5c4c3496..5a241af0 100644 --- a/src/SHA1.c +++ b/src/SHA1.c @@ -16,6 +16,13 @@ #include "SHA1.h" +// In the source files using endian functions (like SHA1.c): +#ifdef QNX_OS +#include +#define be32toh(x) ENDIAN_BE32(x) +#define htobe32(x) ENDIAN_BE32(x) +#endif + #if !defined(OPENSSL) #if defined(_WIN32) #pragma comment(lib, "crypt32.lib") diff --git a/src/Thread.h b/src/Thread.h index bb249aee..3fbf2b93 100644 --- a/src/Thread.h +++ b/src/Thread.h @@ -46,6 +46,10 @@ #undef ETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT #else + #if defined(QNX_OS) + #include + #include + #endif #include #define thread_type pthread_t