Skip to content

Commit

Permalink
Merge branch 'main' into time-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
archigup authored Jun 3, 2024
2 parents ee3a0a5 + 58d626a commit 902a078
Show file tree
Hide file tree
Showing 58 changed files with 317 additions and 299 deletions.
1 change: 1 addition & 0 deletions .github/.cSpellWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ utest
vect
Vect
VECT
Werror
Wunused
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_CLONE_SUBMODULES=ON \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG -DLIBRARY_LOG_LEVEL=LOG_DEBUG'
-DUNITTEST=1 \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Wsign-compare -Werror -DNDEBUG -DLIBRARY_LOG_LEVEL=LOG_DEBUG'
make -C build/ all
echo "::endgroup::"
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog for coreMQTT Client Library

## v2.2.0 (April 2024)

### Changes

- [#283](https://github.com/FreeRTOS/coreMQTT/pull/283) Fix build error with Werror=sign-compare is enabled.
- [#279](https://github.com/FreeRTOS/coreMQTT/pull/279) Add documentation about timer behavior when it overflows.
- [#275](https://github.com/FreeRTOS/coreMQTT/pull/275) Correct TransportRecv_t documentation.
- [#268](https://github.com/FreeRTOS/coreMQTT/pull/268) Typecast outgoing and incoming publish count to unsigned longs to match format specifier.
- [#255](https://github.com/FreeRTOS/coreMQTT/pull/255) Fix MQTT_Status_strerror to return correct error on NeedMoreBytes error.
- [#252](https://github.com/FreeRTOS/coreMQTT/pull/252) Fix sending empty strings in MQTT packets.
- [#258](https://github.com/FreeRTOS/coreMQTT/pull/258) Fix race condition in handleKeepAlive.
- [#250](https://github.com/FreeRTOS/coreMQTT/pull/250) Fix timeout calculation in sendVector function to account for overflow.
- [#249](https://github.com/FreeRTOS/coreMQTT/pull/249) Replace magic numbers with macros and add explaining comments.
- [#235](https://github.com/FreeRTOS/coreMQTT/pull/235) Fix to update the timestamp of the last packet received.

## v2.1.1 (November 2022)

### Changes
- [#230](https://github.com/FreeRTOS/coreMQTT/pull/230) Fix a broken link in MISRA.md.
- [#229](https://github.com/FreeRTOS/coreMQTT/pull/229) Fixed multiple Sub/Unsub request sending logic.

## v2.1.0 (October 2022)

### Changes
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ Example

- Actual_Username = “iotuser”, OS_Name = FreeRTOS, OS_Version = V10.4.3,
Hardware_Platform_Name = WinSim, MQTT_Library_Name = coremqtt,
MQTT_Library_version = 2.1.0. If username is not used, then “iotuser” can be
MQTT_Library_version = 2.2.0. If username is not used, then “iotuser” can be
removed.

```
/* Username string:
* iotuser?SDK=FreeRTOS&Version=v10.4.3&Platform=WinSim&MQTTLib=coremqtt@2.1.0
* iotuser?SDK=FreeRTOS&Version=v10.4.3&Platform=WinSim&MQTTLib=coremqtt@2.2.0
*/
#define OS_NAME "FreeRTOS"
#define OS_VERSION "V10.4.3"
#define HARDWARE_PLATFORM_NAME "WinSim"
#define MQTT_LIB "coremqtt@2.1.0"
#define MQTT_LIB "coremqtt@2.2.0"
#define USERNAME_STRING "iotuser?SDK=" OS_NAME "&Version=" OS_VERSION "&Platform=" HARDWARE_PLATFORM_NAME "&MQTTLib=" MQTT_LIB
#define USERNAME_STRING_LENGTH ( ( uint16_t ) ( sizeof( USERNAME_STRING ) - 1 ) )
Expand Down
2 changes: 1 addition & 1 deletion docs/doxygen/config.doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = coreMQTT
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v2.1.0
PROJECT_NUMBER = v2.2.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name : "coreMQTT"
version: "v2.1.0"
version: "v2.2.0"
description: |
"Client implementation of the MQTT 3.1.1 specification for embedded devices.\n"
license: "MIT"
6 changes: 2 additions & 4 deletions source/core_mqtt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* coreMQTT v2.1.0
* coreMQTT v2.2.0
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -35,8 +35,6 @@
/* Include config defaults header to get default values of configs. */
#include "core_mqtt_config_defaults.h"

#include "core_mqtt_default_logging.h"

#ifndef MQTT_PRE_SEND_HOOK

/**
Expand Down Expand Up @@ -2219,7 +2217,7 @@ static MQTTStatus_t sendConnectWithoutCopy( MQTTContext_t * pContext,
pWillInfo,
remainingLength );

assert( ( pIndex - connectPacketHeader ) <= sizeof( connectPacketHeader ) );
assert( ( ( size_t ) ( pIndex - connectPacketHeader ) ) <= sizeof( connectPacketHeader ) );

/* The header gets sent first. */
iterator->iov_base = connectPacketHeader;
Expand Down
4 changes: 1 addition & 3 deletions source/core_mqtt_serializer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* coreMQTT v2.1.0
* coreMQTT v2.2.0
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -34,8 +34,6 @@
/* Include config defaults header to get default values of configs. */
#include "core_mqtt_config_defaults.h"

#include "core_mqtt_default_logging.h"

/**
* @brief MQTT protocol version 3.1.1.
*/
Expand Down
4 changes: 1 addition & 3 deletions source/core_mqtt_state.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* coreMQTT v2.1.0
* coreMQTT v2.2.0
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -33,8 +33,6 @@
/* Include config defaults header to get default values of configs. */
#include "core_mqtt_config_defaults.h"

#include "core_mqtt_default_logging.h"

/*-----------------------------------------------------------*/

/**
Expand Down
10 changes: 9 additions & 1 deletion source/include/core_mqtt.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* coreMQTT v2.1.0
* coreMQTT v2.2.0
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -69,6 +69,14 @@ struct MQTTDeserializedInfo;
* @note The timer should be a monotonic timer. It just needs to provide an
* incrementing count of milliseconds elapsed since a given epoch.
*
* @note As the timer is supposed to be a millisecond timer returning a 32-bit
* value, it will overflow in just under 50 days. But it will not cause any issues
* in the library as the time function is only used for calculating durations for
* timeouts and keep alive periods. The difference in unsigned numbers is
* used where unsigned wrap around is defined. Unless the timeout is bigger than
* 100 days (50*2) where the numbers can wrap around more than once the code
* should work properly.
*
* @return The time elapsed in milliseconds.
*/
typedef uint32_t (* MQTTGetCurrentTimeFunc_t )( void );
Expand Down
82 changes: 81 additions & 1 deletion source/include/core_mqtt_config_defaults.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* coreMQTT v2.1.0
* coreMQTT v2.2.0
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -195,6 +195,86 @@
#error MQTT_SEND_RETRY_TIMEOUT_MS is deprecated. Instead use MQTT_SEND_TIMEOUT_MS.
#endif

/**
* @brief Macro that is called in the MQTT library for logging "Error" level
* messages.
*
* To enable error level logging in the MQTT library, this macro should be mapped to the
* application-specific logging implementation that supports error logging.
*
* @note This logging macro is called in the MQTT library with parameters wrapped in
* double parentheses to be ISO C89/C90 standard compliant. For a reference
* POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
* logging-stack in demos folder of the
* [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C).
*
* <b>Default value</b>: Error logging is turned off, and no code is generated for calls
* to the macro in the MQTT library on compilation.
*/
#ifndef LogError
#define LogError( message )
#endif

/**
* @brief Macro that is called in the MQTT library for logging "Warning" level
* messages.
*
* To enable warning level logging in the MQTT library, this macro should be mapped to the
* application-specific logging implementation that supports warning logging.
*
* @note This logging macro is called in the MQTT library with parameters wrapped in
* double parentheses to be ISO C89/C90 standard compliant. For a reference
* POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
* logging-stack in demos folder of the
* [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
*
* <b>Default value</b>: Warning logs are turned off, and no code is generated for calls
* to the macro in the MQTT library on compilation.
*/
#ifndef LogWarn
#define LogWarn( message )
#endif

/**
* @brief Macro that is called in the MQTT library for logging "Info" level
* messages.
*
* To enable info level logging in the MQTT library, this macro should be mapped to the
* application-specific logging implementation that supports info logging.
*
* @note This logging macro is called in the MQTT library with parameters wrapped in
* double parentheses to be ISO C89/C90 standard compliant. For a reference
* POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
* logging-stack in demos folder of the
* [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
*
* <b>Default value</b>: Info logging is turned off, and no code is generated for calls
* to the macro in the MQTT library on compilation.
*/
#ifndef LogInfo
#define LogInfo( message )
#endif

/**
* @brief Macro that is called in the MQTT library for logging "Debug" level
* messages.
*
* To enable debug level logging from MQTT library, this macro should be mapped to the
* application-specific logging implementation that supports debug logging.
*
* @note This logging macro is called in the MQTT library with parameters wrapped in
* double parentheses to be ISO C89/C90 standard compliant. For a reference
* POSIX implementation of the logging macros, refer to core_mqtt_config.h files, and the
* logging-stack in demos folder of the
* [AWS IoT Embedded C SDK repository](https://github.com/aws/aws-iot-device-sdk-embedded-C/).
*
* <b>Default value</b>: Debug logging is turned off, and no code is generated for calls
* to the macro in the MQTT library on compilation.
*/
#ifndef LogDebug
#define LogDebug( message )
#endif

/* *INDENT-OFF* */
#ifdef __cplusplus
}
Expand Down
132 changes: 0 additions & 132 deletions source/include/core_mqtt_default_logging.h

This file was deleted.

Loading

0 comments on commit 902a078

Please sign in to comment.