1
0
mirror of https://github.com/FreeRTOS/coreMQTT synced 2025-06-28 14:30:37 +08:00

446 Commits

Author SHA1 Message Date
Archit Gupta
42d843f40e
Remove formatting bot workflow (#320) 2025-05-09 14:05:05 -07:00
Archit Gupta
a34c0e8705 Initialize variables coverity can't track 2025-05-01 09:07:34 -07:00
Archit Gupta
45a03ac41b Remove unused assignments 2025-05-01 09:07:34 -07:00
Archit Gupta
3489f0f18b Silence coverity false-positives 2025-05-01 09:07:34 -07:00
Archit Gupta
06e63e09b7 Simplify loop for coverity
With dereferencing pNameIndex at each use, Coverity is unable to
determine that the loop terminates.
2025-05-01 09:07:34 -07:00
Archit Gupta
083e7fc767 Remove Dockerfile 2025-05-01 09:07:34 -07:00
Archit Gupta
d8e6240778 Fix formatting check 2025-05-01 09:07:34 -07:00
diopoex
c5715e3d1f
Express the need of a non-blocking TransportRecv_t (#318)
Express the need of a non-blocking TransportRecv_t #317

Description
-----------
- changed documentation to express the need of a non-blocking
TransportRecv_t
- mentioned that a non-blocking implementation is highly recommended in
porting.dox and in the transportinterface
- did go more into detail in TransportRecv_t what the effects of a
blocking recv implementation are

Test Steps
-----------
only changed documentation

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] I have tested my changes. No regression in existing tests.
- [ ] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
#317 
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Paul Höhn <paulh@MacBook-Air-von-Paul.local>
Co-authored-by: DakshitBabbar <100972343+DakshitBabbar@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: DakshitBabbar <dakshitbabbar.iitd@gmail.com>
2025-04-07 18:39:38 +05:30
Dakshit Babbar
8ec72d6ef7
Add CBMC Proofs for the new APIs (#315)
Description
-----------
This PR:
Adds CBMC proofs for the new APIs added for publish retransmits in #308 

Test Steps
-----------
Proofs run without any errors or warnings

Checklist:
----------
- [x] I have tested my changes. No regression in existing tests.
- [x] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
<!-- If any, please provide issue ID. -->
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: DakshitBabbar <dakshba@amazon.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2025-03-05 16:49:34 +05:30
Dakshit Babbar
86a5750bb3
Changes for passing the Coverity Static Analysis (#314)
<!--- Title -->

Description
-----------
<!--- Describe your changes in detail. -->
Make required changes for passing the Coverity Static Analysis. Unit
tests are modified for the changes made.

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [x] I have tested my changes. No regression in existing tests.
- [x] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
<!-- If any, please provide issue ID. -->
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: DakshitBabbar <ubuntu@ip-172-31-24-168.ap-south-1.compute.internal>
Co-authored-by: Dakshit Babbar <dakshba@amazon.com>
2025-02-24 14:55:47 +05:30
ActoryOu
8dfeccb02a
Follow Security Guide to update release.yml (#313)
Follow Security Guide to update release.yml
2024-11-05 15:24:46 +08:00
Dakshit Babbar
f1827d8b46
Enabling Unclean Session Publish Re-Transmits (#308)
<!--- Title -->

Description
-----------
<!--- Describe your changes in detail. -->
This PR enables the coreMQTT library to resend unacked publishes on an
unclean session connection.

Following is a brief summary of changes:
1. Add a new API `MQTT_InitRetransmits` that will initialise the context
to handle publish retransmits on an unclean session connection
2. Add signatures of callback function pointers that users will define
in order to:
     a. copy and store outgoing publishes
b. retrieve copied publish on an unclean session connection to resend
     c. clear a copied publish when a `PUBACK`/`PUBREC` is received
     d. clear all copied publishes on a clean session connection
3. Update the API's to check if callback's are defined and implement
resend publishes as required.

Following are the specifics of the changes:
1. Add 3 new MQTTStatus_t values: MQTTPublishStoreFailed,
MQTTPublishRetrieveFailed and MQTTPublishClearAllFailed
2. Update `MQTTContext_t` to hold the callback function pointers
        a. `MQTTRetransmitStorePacket storeFunction`
        b. `MQTTRetransmitRetrievePacket retrieveFunction`
        c. `MQTTRetransmitClearPacket clearFunction`
        d. `MQTTRetransmitClearAllPackets clearAllFunction`
3. Update the `MQTT_Status_strerror` function to handle the new
`MQTTStatus_t` values
4. Add a new API function `MQTT_InitRetransmits` that will initialise
the new callback functions in the `MQTTContext_t`
5. Add this API to the core_mqtt.h file to make it available to users
6. Modify `MQTT_Publish`
a. copy the outgoing publish packet in form of an array of
`TransportOutVector_t` if the callback if defined
        b. if copy fails then bubble up  corresponding error status code
7. Modify `MQTT_ReceiveLoop`
a. on receiving a `PUBACK`/`PUBREC` clear the copy of that particular
publish after the state of the publish record has been successfully
updated, if the callback if defined
8. Modify `MQTT_Connect`
a. on a clean session clear all the copies of publishes stored if the
callback is defined
b. if clear all fails then bubble up corresponding error status code
c. on an unclean session get the packetID of the unacked publishes and
retrieve the copies of those if the callback is defined
d. if retrieve fails then bubble up corresponding error status code

Approaches Taken
---------------
- To let user know about the changes we have made we will add them to a
changelog and have a minor version bump
- To be in line with the zero copy principle in our library we chose to
provide and retrieve the publish packets for storing and resending in
form of an array of `TransportOutVector_t`
- Code is written in a way that on receiving a `PUBACK`/`PUBREC` the
copy will be cleared after the state of the publish record is changed so
that if state update fails the copy won't be cleared. Otherwise if the
state does not change and the copy is cleared then when a connection is
made with an unclean session there will be a retrieve fail as the system
is in an inconsistent state.
- We are storing the copies of the publishes with the Duplicate flag set
this is because on retrieving the packet we will get it in the form of a
`TransportOutVector_t` that holds the data in a `const` pointer which
cannot be changed after retrieving.

Pending Tasks
---------------
- [ ] Changelog
- [ ] Minor version bump
- [x] Doxygen example for the new API
- [x] Better API Names
- [x] Unit Test Updates
- [x] CBMC Proof

---------

Co-authored-by: Dakshit Babbar <dakshba@amazon.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
2024-10-24 18:43:49 -07:00
Dakshit Babbar
86fc7d15e3
MQTT Connection Status Thread Safety (#305)
<!--- Title -->

Description
-----------
<!--- Describe your changes in detail. -->
Following is a brief summary of changes:
1. Check the connected flag before doing any send operation on the
connection
2. Make all the APIs that do send operations, thread safe
3. Update the connected flag within MQTT_Disconnect regardless of the
return status of the send operation

Following are the specifics of the changes:
1. Add 3 new MQTTStatus_t values: MQTTStatusConnected,
MQTTStatusNotConnected and MQTTStatusDisconnectPending
2. Added 1 new MQTTConnectionStatus_t value: MQTTDisconnectPending
3. Update the MQTT_Status_strerror function to handle the new
MQTTStatus_t values
4. Add a new API function MQTT_CheckConnectStatus() that will check the
value of the context→connectStatus flag safely.
5. Add this API to the core_mqtt.h file to make it available to users
6. Check the connected flag before doing any Send operation (following
API's are updated)
        a. sendPublishAcks
        b. MQTT_Connect
        c. MQTT_Subscribe
        d. MQTT_Publish
        e. MQTT_Ping
        f. MQTT_Unsubscribe
        g. MQTT_Disconnect
7. Use the MQTT_PRE_STATE_UPDATE_HOOK() and
MQTT_POST_STATE_UPDATE_HOOK() to make the send APIs thread safe
8. The connect status is set to MQTTDisconnectPending whenever a
transport send or receive function returns a negative error code
9. `const` keyword for the the MQTTStatus_t is removed in the input
parameters for the receive functions as we need to update the connection
status when the receive function returns a negative error code

Relevant Explanations
---------------
- MQTT_PRE_SEND_HOOK(): The Pre and Post Send hook Macros are not
required now, as the sending logic will be within the pre and post state
update hook itself. (because we cannot allow other threads to change the
connection state of the application until a send operation is complete).
- I have split the handleSessionResumption function. The part of that
function which was handling the clean session has been added within the
mutex calls in the [MQTT_Connect
API](https://github.com/FreeRTOS/coreMQTT/pull/305/files#diff-2534a3c0229ae9af3801f2a5c6a24eeef2cd0a686671f0371a11d2718ba4fdd6R2828)
and the unclean session part is handled by this new function that is
[called outside the mutex
calls](https://github.com/FreeRTOS/coreMQTT/pull/305/files#diff-2534a3c0229ae9af3801f2a5c6a24eeef2cd0a686671f0371a11d2718ba4fdd6R2866).

Pending Tasks
---------------
- [ ] Doxygen example for the new API
- [x] Unit Test Updates
- [x] CBMC Proof

---------

Co-authored-by: Dakshit Babbar <dakshba@amazon.com>
Co-authored-by: GitHub Action <action@github.com>
2024-09-27 09:30:00 +05:30
Michael Tautschnig
6a3ec09eda
Adjust proof tooling to support CBMC v6 (#304)
Description
-----------
With CBMC v6, unwinding assertions are enabled by default, and object
bits no longer need to be set at compile time. Update various build
rules to use the latest template as provided with CBMC starter kit.

Test Steps
-----------
Tested in CI.

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] I have tested my changes. No regression in existing tests.
- n/a I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-09-25 09:22:26 -07:00
Dakshit Babbar
afe000c688
Update code to resolve lcov issues and mocks failing on Mac (#307)
<!--- Title -->

Description
-----------
<!--- Describe your changes in detail. -->
**Issue1:** 
Mocked function calls jump to real implementation instead of mocks on
mac
**Solution:**
Convert the symbols of the mocked implementation from weak to strong

**Issue2:**
lcov generating wrong coverage reports on mac
**Solution:**
Rectifying network buffer size to be of the appropriate value otherwise
memset clears out more memory spaces than required which leads to
reseting the line coverage counters.

**Issue3:**
log statements being taken as branches
**Solution:**
Removing the ternary operation to figure out if there is a '/' in front
of the file name or not. This can be done as this feature is just for
debugging purposes.

**Issue4:**
Some tests failing randomly on mac
**Solution:**
Initialise variables at places where necessary 

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Dakshit Babbar <dakshba@amazon.com>
2024-09-17 09:38:23 +05:30
Dakshit Babbar
c0c05f9fd4
Add the updates to Cmake files to build unit tests on Mac (#306)
<!--- Title -->

Description
-----------
<!--- Describe your changes in detail. -->
Updated the coverage.cmake and create_test.cmake files to build the unit
tests on Mac
Updated the README file to include the correct Cmake command for the
users to use to build the unit tests

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [x] I have tested my changes. No regression in existing tests.
- [x] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
<!-- If any, please provide issue ID. -->
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Dakshit Babbar <dakshba@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
2024-09-10 13:55:31 +05:30
Gaurav-Aggarwal-AWS
e7322e88a8
Update the mqtt.tag file location (#303)
Description
-----------
The `mqtt.tag` was generated at `coreMQTT/docs/doxygen/output/mqtt.tag`.
The
[doxygen-generation](https://github.com/FreeRTOS/CI-CD-Github-Actions/tree/main/doxygen-generation)
GH action deploys the content of `coreMQTT/docs/doxygen/output/html` and
as a result, the `mqtt.tag` was not getting deployed.

This change updates the location of `mqtt.tag` to
`coreMQTT/docs/doxygen/output/html/mqtt.tag` to ensure that it gets
deployed by the doxygen-generation GH action.

Test Steps
-----------
Generated the doxygen documentation locally. 

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [x] I have tested my changes. No regression in existing tests.
- [NA] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
NA.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2024-08-05 22:35:09 +05:30
Archit Gupta
4c24d173f9
Fix loop iteration for checking subscription QoS (#302) 2024-07-30 13:17:06 +05:30
Michael Tautschnig
cbdf3d20af
Use CBMC version 5.95.1 (#289)
Description
-----------
The upcoming CBMC version 6 release includes changes that may affect
existing proofs. This PR will make sure that coreMQTT PRs are not
negatively impacted by this release. After releasing CBMC version 6 we
will issue a follow-up PR that will return coreMQTT to using CBMC's
latest release, and will include any changes to proofs that may be
necessary to support the new version.

Test Steps
-----------
Tested in CI (no changes in behaviour at this point)

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] I have tested my changes. No regression in existing tests.
- [ ] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
n/a

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

Co-authored-by: Tony Josi <tonyjosi@amazon.com>
Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
2024-07-19 16:09:07 -07:00
chinglee-iot
4f11b8cafd
Update LTS 202406.01 information (#299)
* Update LTS 202406.01 information in README.md
2024-07-16 20:18:36 +08:00
chinglee-iot
44b013b393
[v2.3.1] Update changelog, version numbers and .md files for release (#298)
* Update the CHANGELOG.md to include v2.3.1 information
* Update version number to "v2.3.1+" in main branch in public header file macro, manifest.yml and config.doxyfile.
2024-07-12 12:48:45 +08:00
chinglee-iot
9b993a6981
Update release action for version number (#297)
<!--- Title -->

Description
-----------
* Update the release action for version number include the following
files
  - docs/doxygen/config.doxyfile - PROJECT_NUMBER
  - manifest.yml file - version
  - source file - version header
  - core_mqtt.h - version number
* Add version number check in "Create ZIP and verify package for release
asset" steps. Including the following
  - docs/doxygen/config.doxyfile - PROJECT_NUMBER
  - manifest.yml file - version
  - source file - version header
  - core_mqtt.h - version number
* Update all the version number to "v2.3.0+" and "\<DEVELOPMENT
BRANCH\>"

Test Steps
-----------
Using release action to create release should update the following
* source/include/core_mqtt.h version number
* source files header version number
* doxygen version number
* manifest.yml number
* SBOM file

Tested in personal fork without problem :
https://github.com/FreshDevGo/coreMQTT/actions/runs/9885707328/job/27304218049

Test with wrong source file version number :
https://github.com/FreshDevGo/coreMQTT/actions/runs/9885727002/job/27304274003
Test with wrong manifest.yml version number :
https://github.com/FreshDevGo/coreMQTT/actions/runs/9885726029/job/27304270303
Test with wrong doxygen version number :
https://github.com/FreshDevGo/coreMQTT/actions/runs/9885723302/job/27304269170
Test with wrong version number macro in core_mqtt.h :
https://github.com/FreshDevGo/coreMQTT/actions/runs/9885724835/job/27304268841

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [x] I have tested my changes. No regression in existing tests.
- [ ] ~~I have modified and/or added unit-tests to cover the code
changes in this Pull Request.~~

Related Issue
-----------
<!-- If any, please provide issue ID. -->
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-07-11 18:50:40 +05:30
chinglee-iot
8b3abb7036
Update LTS 202406 information (#295)
* Update LTS 202406 information
2024-07-02 09:15:29 +08:00
chinglee-iot
a2459c6317
[V2.3.0] Update changelog, version numbers and .md files for release (#291)
* Update changelog for version v2.3.0
* Update version tag in .md files and manifest files
* Update version tag in source files
2024-06-07 17:18:53 +08:00
Archit Gupta
e40e9a32d6 Fix time comparison overflow 2024-06-04 22:46:15 +00:00
Tony Josi
58d626a258
[V2.2.0] Update changelog, version numbers and .md files for release (#285)
<!--- Title -->

Description
-----------
This PR update changelog, version numbers and .md (doxygen, size table)
files for release

Test Steps
-----------
<!-- Describe the steps to reproduce. -->

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] I have tested my changes. No regression in existing tests.
- [ ] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
<!-- If any, please provide issue ID. -->
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-05-03 09:30:23 +05:30
Tony Josi
a607ca2e25
Fix build error with Werror=sign-compare is enabled (#283)
<!--- Title -->

Description
-----------
This PR fixes a build issue when `Werror=sign-compare` is enabled while
building the library.

Test Steps
-----------
<!-- Describe the steps to reproduce. -->

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [x] I have tested my changes. No regression in existing tests.
- ~[ ] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.~

Related Issue
-----------
#282 

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-04-25 14:57:49 +05:30
Aniruddha Kanhere
ce8bb2a976
Add note about timer behavior (#279)
Description
-----------
This PR adds a note about the user provided timer behavior when it
overflows.

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [NA] I have tested my changes. No regression in existing tests.
- [NA] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
https://github.com/FreeRTOS/coreMQTT/issues/277

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------
2024-04-11 13:40:06 -07:00
Aniruddha Kanhere
9a3edb6b67
Update CMakeList to optionally build UT/Coverity; Update coverity configuration (#276)
Update Coverity configuration to meet the latest coverity standard.
Updated CMakelist to only build Coverity if required instead of building
the CMock based unit tests as well.

<!--- Title -->

Description
-----------
<!--- Describe your changes in detail. -->

Test Steps
-----------
<!-- Describe the steps to reproduce. -->

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [x] I have tested my changes. No regression in existing tests.
- [x] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
<!-- If any, please provide issue ID. -->
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
2024-02-22 14:18:16 -08:00
Kody Stribrny
7b68936daf
Correct TransportRecv_t documentation (#275)
Description
-----------
Corrections highlight the non-blocking
expectations of the TransportRecv method.

Test Steps
-----------
No manual steps taken. I'm going to let the doxygen CI verify this.

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ X ] I have tested my changes. No regression in existing tests.
  - Testing with CI
- [ X ] I have modified and/or added unit-tests to cover the code
changes in this Pull Request.
  - Not applicable

Related Issue
-----------
https://github.com/FreeRTOS/coreMQTT/issues/261

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-02-08 15:45:07 -08:00
Archit Gupta
b9dfc361f2 Combine config default headers
The loggging defaults were split out since they are not namespaced to
coreMQTT, and they previously leaked to all files including a coreMQTT
header. Splitting them allowed the logging defaults to only be pulled
into coreMQTT source files. Now that no header files use the config
headers, and thus all coreMQTT config only affects coreMQTT source
files, the split is no longer needed.
2024-02-01 14:44:28 -08:00
Archit Gupta
05522148da Remove config include from header
core_mqtt_serializer.h included the user coreMQTT config, which spills
the config header's contents into all consumers of coreMQTT's headers.
Macros from the config are no longer used in the the API, so this is
also no longer used for anything, so can be removed.
2024-02-01 14:44:28 -08:00
Archit Gupta
e122ce15e4 Fix CBMC config including NetworkContext definition
The NetworkContext struct should be defined in each c file, not in the
config h file. The API uses it as an opaque type.
2024-02-01 14:44:28 -08:00
Archit Gupta
873a27a268 Fix unit tests defining NetworkContext in config
The NetworkContext struct should be defined in each c file, not in the
config h file. The API uses it as an opaque type.

CMock needs a workaround for it's c files though, as it does not support
opaque types.
2024-02-01 14:44:28 -08:00
Soren Ptak
238350a844
Update word list (#273)
* Add new common words to the cSpellWordList.txt
2024-01-09 09:23:13 -08:00
bradleysmith23
ac5b9e4dcd
add typecast for Logging (#268)
<!--- Title -->

Description
-----------
<!--- Describe your changes in detail. -->
Typecast outgoing and incomingpublish count to unsigned longs to match
format specifier.
Test Steps
-----------
<!-- Describe the steps to reproduce. -->
core OTA demo had a build error due to format specifier used when
logging with coreMQTT. Adding these typecasts fixes the build error.
Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [X] I have tested my changes. No regression in existing tests.
- [ ] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
<!-- If any, please provide issue ID. -->
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2023-11-21 14:55:30 -08:00
Soren Ptak
87bb497e0d
Apply formatting bot fix (#263)
<!--- Title -->

Description
-----------
<!--- Describe your changes in detail. -->

Test Steps
-----------
<!-- Describe the steps to reproduce. -->

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] I have tested my changes. No regression in existing tests.
- [ ] I have modified and/or added unit-tests to cover the code changes
in this Pull Request.

Related Issue
-----------
<!-- If any, please provide issue ID. -->
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2023-10-05 09:38:52 -07:00
Soren Ptak
03290fe027
CI-CD Updates (#260)
* Use new version of CI-CD Actions,  checkout@v3 instead of checkout@v2 on all jobs
* Use cSpell spell check, and use ubuntu-20.04 for formatting check
* Add in bot formatting action
2023-09-05 14:31:36 -07:00
saidrhs
9bfc62459a
Fix race condition in handleKeepAlive (#258)
The code for handleKeepAlive() (which is invoked as part of MQTT_ProcessLoop()) does not invoke the STATE_UPDATE_HOOK macros, but still reads from pContext->lastPacketTxTime. Therefore, this causes a RW race condition which is picked up by ThreadAnalyzer. With a sufficiently meddlesome scheduler, the value of lastPacketTxTime could be different for each time it is checked inside of handleKeepAlive() , causing unreliable behavior in the transmission of KeepAlive packets.
2023-08-23 17:50:12 -07:00
Kareem Khazem
000a574c0e
Change proof_ci runner to 64-core (#247)
Co-authored-by: Paul Bartell <pbartell@amazon.com>
Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
2023-06-26 15:24:25 -07:00
Aniruddha Kanhere
c5a1efe3ca
Fix MQTT_Status_strerror to return correct error on NeedMoreBytes error (#255)
* Fix timeout calculation to account for overflow

* Add unit tests to check for overflow

* Update timeout value in UT

* Fix formatting

* Update core_mqtt_utest.c

* Add one more unit test to check for one corner case

* Make unit-test more robust

* Fix MQTT_Status_strerror to return correct error on NeedMoreBytes error.
2023-06-26 14:10:23 -07:00
Archit Gupta
0df6f495e7
Fix sending empty strings in MQTT packets (#252)
The assert that checks that non-zero lengths have non-NULL pointers currently also inadvertently checks that zero lengths have NULL pointers.
2023-05-26 10:43:50 -07:00
Aniruddha Kanhere
b0acf49c6c
Fix timeout calculation in sendVector function to account for overflow (#250)
* Fix timeout calculation to account for overflow

* Add unit tests to check for overflow

* Update timeout value in UT

* Fix formatting

* Update core_mqtt_utest.c

* Add one more unit test to check for one corner case

* Make unit-test more robust
2023-05-08 11:44:44 -07:00
Aniruddha Kanhere
19412aa6b3
Replace magic numbers with macros and add explaining comments (#249)
* Replaced magic numbers with macros and added comments

* Fix spell check and build check

* Fix formatting

* Remove macros which are only used once

* Fix formatting and build check
2023-04-06 13:11:20 -07:00
Kareem Khazem
143a15eb11 Add CBMC-running GitHub Action;
This commit adds a GitHub Action that runs the CBMC proofs in this
repository upon pushes and pull requests
2023-03-03 22:22:22 +00:00
Aniruddha Kanhere
c5cd410331
Add pull request template (#242) 2023-02-20 13:16:49 -08:00
Kody Stribrny
b4b5fa6737
Upgrade doxygen to 1.9.6 (#239)
Doxygen 1.9.5 can report false positives
around function parameters. 1.9.6 does not
have this bug.
2023-01-03 12:23:38 -08:00
Kyunghwan Kwon
d7a478aa9f
Fix: update the lastPacketRxTime field when packets are received
Co-authored-by: Paul Bartell <paul.bartell@gmail.com>
2022-12-15 14:12:00 -08:00
Aniruddha Kanhere
19d198c8cb
Update Doxygen to use latest ubuntu version and updated config file. (#234)
* Initialise variables in test before use

* Init variables in serializer tests

* Update uncrustify runner OS version

* Update doxygen config and doxygen used to latest

* Update brief and remove unused return description

* Update python version for latest ubuntu image
2022-11-23 22:18:34 +05:30
Aniruddha Kanhere
13d80aada8
Initialize variables in unit-test before use (#232)
* Initialise variables in test before use

* Init variables in serializer tests

* Update uncrustify runner OS version
2022-11-22 09:58:37 +05:30