mirror of https://github.com/wolfSSL/wolfMQTT.git
Improve example headers and small sanitizer fixes
parent
b5cead7da6
commit
bcabbbfd12
|
|
@ -768,7 +768,6 @@ exit:
|
|||
|
||||
|
||||
/* so overall tests can pull in test function */
|
||||
#ifndef NO_MAIN_DRIVER
|
||||
#ifdef USE_WINDOWS_API
|
||||
#include <windows.h> /* for ctrl handler */
|
||||
|
||||
|
|
@ -796,7 +795,11 @@ exit:
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef NO_MAIN_DRIVER
|
||||
int awsiot_main(int argc, char** argv)
|
||||
#else
|
||||
int main(int argc, char** argv)
|
||||
#endif /* NO_MAIN_DRIVER */
|
||||
{
|
||||
int rc;
|
||||
#ifdef ENABLE_AWSIOT_EXAMPLE
|
||||
|
|
@ -849,5 +852,3 @@ exit:
|
|||
|
||||
return (rc == 0) ? 0 : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#endif /* NO_MAIN_DRIVER */
|
||||
|
|
|
|||
|
|
@ -22,10 +22,22 @@
|
|||
#ifndef WOLFMQTT_AWSIOT_H
|
||||
#define WOLFMQTT_AWSIOT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "examples/mqttexample.h"
|
||||
|
||||
|
||||
/* Exposed functions */
|
||||
int awsiot_test(MQTTCtx *mqttCtx);
|
||||
#ifdef NO_MAIN_DRIVER
|
||||
int awsiot_main(int argc, char** argv);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* WOLFMQTT_AWSIOT_H */
|
||||
|
|
|
|||
|
|
@ -22,10 +22,18 @@
|
|||
#ifndef WOLFMQTT_AZUREIOTHUB_H
|
||||
#define WOLFMQTT_AZUREIOTHUB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "examples/mqttexample.h"
|
||||
|
||||
|
||||
/* Exposed functions */
|
||||
int azureiothub_test(MQTTCtx *mqttCtx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFMQTT_AZUREIOTHUB_H */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,30 @@
|
|||
/* firmware.h
|
||||
*
|
||||
* Copyright (C) 2006-2023 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfMQTT.
|
||||
*
|
||||
* wolfMQTT is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfMQTT is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
#ifndef WOLFMQTT_FIRMWARE_H
|
||||
#define WOLFMQTT_FIRMWARE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FIRMWARE_TOPIC_NAME "wolfMQTT/example/firmware"
|
||||
#define FIRMWARE_MAX_BUFFER 2048
|
||||
|
|
@ -18,5 +42,8 @@ typedef struct _FirmwareHeader {
|
|||
word32 fwLen;
|
||||
} WOLFMQTT_PACK FirmwareHeader;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFMQTT_FIRMWARE_H */
|
||||
|
|
|
|||
|
|
@ -22,11 +22,18 @@
|
|||
#ifndef WOLFMQTT_MQTTCLIENT_H
|
||||
#define WOLFMQTT_MQTTCLIENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "examples/mqttexample.h"
|
||||
|
||||
|
||||
/* Exposed functions */
|
||||
int mqttclient_test(MQTTCtx *mqttCtx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFMQTT_MQTTCLIENT_H */
|
||||
|
|
|
|||
|
|
@ -711,7 +711,7 @@ static int NetRead_ex(void *context, byte* buf, int buf_len,
|
|||
int timeout_ms, byte peek)
|
||||
{
|
||||
SocketContext *sock = (SocketContext*)context;
|
||||
MQTTCtx* mqttCtx = sock->mqttCtx;
|
||||
MQTTCtx* mqttCtx;
|
||||
int rc = -1, timeout = 0;
|
||||
SOERROR_T so_error = 0;
|
||||
int bytes = 0;
|
||||
|
|
@ -722,8 +722,6 @@ static int NetRead_ex(void *context, byte* buf, int buf_len,
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
(void)mqttCtx;
|
||||
|
||||
if (context == NULL || buf == NULL || buf_len <= 0) {
|
||||
return MQTT_CODE_ERROR_BAD_ARG;
|
||||
}
|
||||
|
|
@ -735,6 +733,9 @@ static int NetRead_ex(void *context, byte* buf, int buf_len,
|
|||
flags |= MSG_PEEK;
|
||||
}
|
||||
|
||||
mqttCtx = sock->mqttCtx;
|
||||
(void)mqttCtx;
|
||||
|
||||
#ifndef WOLFMQTT_NO_TIMEOUT
|
||||
/* Setup timeout */
|
||||
setup_timeout(&tv, timeout_ms);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@
|
|||
#ifndef WOLFMQTT_PORT_H
|
||||
#define WOLFMQTT_PORT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* FreeRTOS TCP */
|
||||
#ifdef FREERTOS_TCP
|
||||
#include "FreeRTOS.h"
|
||||
|
|
@ -252,10 +256,15 @@
|
|||
#ifndef GET_SOCK_ERROR
|
||||
#define GET_SOCK_ERROR(f,s,o,e) \
|
||||
socklen_t len = sizeof(so_error); \
|
||||
getsockopt((f), (s), (o), &(e), &len)
|
||||
if (getsockopt((f), (s), (o), &(e), &len)) \
|
||||
rc = -1
|
||||
#endif
|
||||
#ifndef SOCK_EQ_ERROR
|
||||
#define SOCK_EQ_ERROR(e) (((e) == EWOULDBLOCK) || ((e) == EAGAIN))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFMQTT_PORT_H */
|
||||
|
|
|
|||
|
|
@ -22,9 +22,16 @@
|
|||
#ifndef WOLFMQTT_SIMPLE_H
|
||||
#define WOLFMQTT_SIMPLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Exposed functions */
|
||||
int mqttsimple_test(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFMQTT_SIMPLE_H */
|
||||
|
|
|
|||
|
|
@ -22,11 +22,18 @@
|
|||
#ifndef WOLFMQTT_MULTITHREAD_H
|
||||
#define WOLFMQTT_MULTITHREAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "examples/mqttexample.h"
|
||||
|
||||
|
||||
/* Exposed functions */
|
||||
int multithread_test(MQTTCtx *mqttCtx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFMQTT_MULTITHREAD_H */
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
#ifndef WOLFMQTT_SNCLIENT_H
|
||||
#define WOLFMQTT_SNCLIENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "examples/mqttexample.h"
|
||||
|
||||
|
||||
|
|
@ -30,5 +34,8 @@ int sn_test(MQTTCtx *mqttCtx);
|
|||
int sn_testQoSn1(MQTTCtx *mqttCtx);
|
||||
int sn_multithread_test(MQTTCtx *mqttCtx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFMQTT_SNCLIENT_H */
|
||||
|
|
|
|||
|
|
@ -22,11 +22,18 @@
|
|||
#ifndef WOLFMQTT_WIOT_H
|
||||
#define WOLFMQTT_WIOT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "examples/mqttexample.h"
|
||||
|
||||
|
||||
/* Exposed functions */
|
||||
int wiot_test(MQTTCtx *mqttCtx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFMQTT_WIOT_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue