diff --git a/MQTTPacket/src/MQTTConnect.h b/MQTTPacket/src/MQTTConnect.h index 98c2c164..2c83b5b3 100644 --- a/MQTTPacket/src/MQTTConnect.h +++ b/MQTTPacket/src/MQTTConnect.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2017 IBM Corp. + * Copyright (c) 2014, 2019 IBM Corp. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -37,6 +37,13 @@ enum connack_return_codes #define DLLExport #endif +#if defined(__linux__) +#include +#if __BYTE_ORDER == __BIG_ENDIAN + #define REVERSED 1 +#endif +#endif + typedef union { diff --git a/MQTTPacket/src/MQTTPacket.h b/MQTTPacket/src/MQTTPacket.h index 0ee46231..ea4346a0 100644 --- a/MQTTPacket/src/MQTTPacket.h +++ b/MQTTPacket/src/MQTTPacket.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 IBM Corp. + * Copyright (c) 2014, 2019 IBM Corp. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -13,6 +13,7 @@ * Contributors: * Ian Craggs - initial API and implementation and/or initial documentation * Xiang Rong - 442039 Add makefile to Embedded C client + * Ian Craggs - big endian Linux reversed definition *******************************************************************************/ #ifndef MQTTPACKET_H_ @@ -33,6 +34,14 @@ extern "C" { #define DLLExport #endif +#if defined(__linux__) +#include +#if __BYTE_ORDER == __BIG_ENDIAN + #define REVERSED 1 +#endif +#endif + + enum errors { MQTTPACKET_BUFFER_TOO_SHORT = -2,