1
0
mirror of https://github.com/FreeRTOS/coreMQTT synced 2025-06-04 19:14:18 +08:00

392 Commits

Author SHA1 Message Date
jasonpcarroll
e7ca765d8f
Fixes to timeout of sendMessageVector and refactor of sendBuffer for consistency (#224)
* Fixes to timeout of sendMessageVector and refactor of sendBuffer for consistency.

* Update size table.

* Fixing some small MISRA related issues

* Formatting fix

* Minor fixes for CBMC.

* Updated logical flow to break instead.

* Revert "Updated logical flow to break instead."

This reverts commit 0ac1c6a61876fe2ee049ce400b46b43b7a3a69e9.

* Updated unit tests for coverage.

* Fix MQTT_Publish Proof

* Fix proofs for connect/sub/unsub API functions

* New timing scheme.

* Update config defaults to reflect new timing change.

* Fix doxygen. Fix formatting. Fix memory table.

* Doxygen fixes.

* Fix CBMC proofs

* Added License identifier back.

* Swapped from warning to error for Visual Studio.

Co-authored-by: Jason Carroll <czjaso@amazon.com>
Co-authored-by: Soren Ptak <skptak@amazon.com>
Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
2022-10-13 12:03:07 -07:00
Aniruddha Kanhere
dafa7c89e6
Add SPDX identifier to source files (#226)
* Add SPDX identifier to source files

* Add license information to CBMC stub

* Fix spellcheck and the formatting
2022-10-11 18:56:37 -07:00
jasonpcarroll
cd0315cfe1
Add MQTTNeedMoreBytes to Receive and Process Loop documentation. (#225) 2022-10-11 17:01:50 -07:00
Aniruddha Kanhere
10d85cb9f9
Modify a check to make sure that keep alive is sent even when data is in the buffer (#223)
* Modify check to send keep alive when no data is received

* Modify control flow to process keepalive.

* Fix formatting and increase coverage

* Remove unused mocked functions

* Update log messages
2022-09-29 16:01:39 -07:00
Aniruddha Kanhere
25b496854b
Remove restriction on LWT payload being zero (#221)
* Update the changelog

* Remove payload non-zero restriction
Ref: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718031

* Update changelog

* Fix 10.4 violation

* FRemove unused files

* Update memory table

* Add assert to check invalid conditions

* Update the assertion to be correct

* Fix last CBMC proof by making sure all pointers are allocated properly
2022-09-22 10:34:17 -07:00
Aniruddha Kanhere
afc726a52c
Update the changelog (#220) 2022-09-21 17:46:30 -07:00
Aniruddha Kanhere
167b092ed4
Fix MISRA violations (#219)
* Update the timout check in the send function

* Fix direction of check

* Allow processing of data in the buffer

* Fix formatting and unit-tests

* Update comment to clarify control flow

* Fix Disconnect CBMC proof and update size table

* Fix formatting and CBMC proofs

* Fix last CBMC proof

* Fix broken unit tests and add branch coverage

* Fix MISRA violations and add coverity readme

* Uncrustify

* Update coverity version number in the readme
2022-09-21 17:04:35 -07:00
Aniruddha Kanhere
b04c65f3c1
Fix bugs in receiveSingleIteration and optimize sendMessageVector (#218)
* Update the timout check in the send function

* Fix direction of check

* Allow processing of data in the buffer

* Fix formatting and unit-tests

* Update comment to clarify control flow

* Fix Disconnect CBMC proof and update size table

* Fix formatting and CBMC proofs

* Fix last CBMC proof

* Fix broken unit tests and add branch coverage
2022-09-21 15:26:58 -07:00
Aniruddha Kanhere
522d9cb244
Fix dependencies (#216) 2022-09-19 17:03:26 -07:00
Aniruddha Kanhere
e5643a3e37
Update version numbers and .md files for release (#215)
* Update version number to 2.0.0

* Update changelog, readme and remaining version numbers
2022-09-19 16:31:54 -07:00
Aniruddha Kanhere
ee13cbdb27
Bring in changes from dev branch to main (#214)
* Update ci.yml (#197)

* Update ci.yml

* Add main branch in the CI YAML

* Add cancel callback API (#196)

* Add cancel callback command

* Update the function name

* Fix formatting

* Update memory estimates

* Add State to MQTT_ProcessLoop so that it can be called in a non-blocking manner (#198)

* Add stateful process-loop function

* Add extra checks; fix bugs and add description of functions

* Add index based stateful processloop

* Clean up

* Renamed functions to make them more coherent with their function

* Remove unused function declarations

* Fixed failing CI checks from previous commits except unit-test

* Fixed spell check and updated size-table

* Fix CBMC proofs

* Empty-Commit to trigger CBMC proofs

* Fix loop unwinding values in the Makefile

* Add upper bound on the buffer size of MQTT

* Increase minimum limit on buffer size to >0

* Add upper bound on the size of the buffer as well

* CBMC: Add memmove stub to accelerate coverage

The commit adds a stub for memmove accelerate CBMC coverage
calculation.  Without this stub, coverage for `MQTT_ProcessLoop` and
`MQTT_ReceiveLoop` fails to converge (gets stuck generating the SAT
formula for the memmove in `receiveSingleIteration`).  This stub
checks that src and dst are nonnull pointers and havocs dst.

* Fix formatting

Co-authored-by: Aniruddha Kanhere <ubuntu@ip-172-31-25-12.us-west-2.compute.internal>
Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>

* Remove the use of common buffer (#199)

* Make publish use internal buffers

* Fix comment about packet ID

* Try a different approach for ping and disconnect

* Use writev and flush in conjuction with send

* Update the publish method to use vectors

* Add vectored IO to all functions

* Fix formatting

* Reduce complexity score

* Fix spell check and complexity score

* Fix breaking build

* Add doxygen comments

* Fix doxygen part 2

* Doxygen fix part 3

* Fix doxygen part 4

* Fix some checks

* Fix memory tables

* Fix some small errors

* Fix compiler warnings and breaking CI checks from previous commit

* Fix spell check and doxygen

* Fix a couple of CBMC proofs

* Fix ping and publish proofs

* Update the function name

* Fix more CBMC proofs

* Fix MQTT Connect proof

* Add unwinding loops

* Fix last CBMC proof

* Fix formatting

* Update the Subscribe and Unsubscribe functions

* Fix formatting and doxygen checks

* Fix broken CBMC proofs

* Fix memory statistic table

* Revert changes from serializer source

* update comments to clarify write requirements

* Add a note for write function pointer

* Fix spell check

* Update changelog (#202)

* Update MQTT logging so that log levels of the library do not leak (#205)

* Replace publish state arrays with pointers
Added an MQTT_InIt function for QoS > 0 publishes
Fixed functions which were dealing with state arrays

* Fix CI checks and clean up

* Fix CBMC proofs

* Fix sub and unsub CBMC proofs

* Fix remaining proofs

* Fix remaining CI checks

* Fix spell check

* Minor typo fix (#209)

* Update core_mqtt.h (#208)

* Update core_mqtt.h

* Update core_mqtt.h

Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>

* Update documentation and Doxygen comments in the source (#206)

* Update comments of the MQTT_InIt function

* Updating documentation of more of functions

* Fix formatting and spell check

* Update core_mqtt.h

* Add hooks to the source code (#200)

* Add mutex hooks

* Clean up of code

* Add doxygen comments and fix spell check

* Fix LogError call

* Fix formatting and memory table

* Fix dereference failure

* Update the hook names

* Fix broken builds

* Update the macros and variables

* Reword the briefs of hooks and uncrustify

* Fir formatting

* Protect get packet ID

* Fix formatting

* Fix Unit tests (#212)

* Fix Unit tests

* Update unit tests after new changes

* Fix more UT

* add dummy calls to the transport

* fix build error

* Remove usused variables

* Remove unsused variables

* Remove usused variables

* Unsued parameter

* Fix ut failure

* Fix uninitialized unit test variables

* Fix ut expectation

* Fix unit-tests

* Fix unit test uninitialized variable

* increase unit test coverage

* increase unit test coverage

* Fix unit test build

* State coverage 100%

* Serializer 100% coverage

* 100% UT coverage

* Fix formatting

* Fix size table

* Address PR comments

Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>

* Remove unnecessary ternaries (#211)

Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>

* Fix misra deviations  (#213)

* MISRA compliance update 1

* Fix MISRA errors

* Zero MISRA violations; 13 suppressed

* Fix CI checks

* Update MISRA.md

* Remove deviations

* Fix MISRA.md file

* Fix bug - wasn't incrementing vector length properly.

* Remove unwanted files

* Update comment to clarify the control flow of UT

* Remove 'dev' branch from the CI checks

* Update horrid threshold = 10

Co-authored-by: Aniruddha Kanhere <ubuntu@ip-172-31-25-12.us-west-2.compute.internal>
Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
Co-authored-by: jasonpcarroll <23126711+jasonpcarroll@users.noreply.github.com>
Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
Co-authored-by: Archit Gupta <71798289+archigup@users.noreply.github.com>
2022-09-19 14:14:55 -07:00
Soren Ptak
ec3380e5f1
Updating copyright year to match coreHTTP (#210) 2022-09-09 14:23:30 -07:00
Paul Bartell
dbef3da99b
Update github apt repository signing key id (#207)
C99B11DEB97541F0 -> 23F3D4EA75716059
2022-09-08 17:42:00 -07:00
Xin Lin
a2dddd65f6
Add SBOM Generation in release.yml (#195) 2022-07-28 11:04:06 -07:00
Angelo Nakos
7ec05d4d7e Update README to include a section on CBMC 2022-07-15 10:56:02 -07:00
Angelo Nakos
ac8a4ed967 Remove starter-kit and Litani submodules 2022-07-15 10:56:02 -07:00
Angelo Nakos
dc45d0c9cb Update files related to CBMC starter kit 2022-07-15 10:56:02 -07:00
Angelo Nakos
257695d218 Change SPDX identifier in CBMC proof Makefile from Apache-2.0 to MIT-0 2022-07-15 10:56:02 -07:00
Adam Scislowicz
c92e5ff606
generate PINGREQ packets on idle input or output. (#191)
* generate PINREQ packets on idle input or output.

* changes addressing Paul's feedback.

* changes to reflect feedback from Paul and Cobus.

* further changes after discussions with Paul.

* address issues raised by static analysis and formatting.

* update documentation and unit tests.

* use if else to clarify.

* remove stale variable.

* fix logical error.

* increment MQTT_TIMER_CALLS_PER_ITERATION by 1.

* add lastpackettxtime to the lexicon.

* use a different uncrustify config and add rx to the lexicon.

* update unit test to acheive coverage and correct memory size expectations and default tieout settings.

* cover case where keep alive interval is greater than the tx timeout.

* use correct units.

* dont pre-set waitingForPingResp to true, we want handleKeepAlive to trigger that.

* expect success on the new subtest.

* add additional test cases to cover two new branches.

* remove unused variable.

* MISRA compliance change.

* try to make both MISRA and uncrustify happy.

* try different version of uncrustify.

* Set PACKET_RX_TIMEOUT_MS to 30000U to match comment

Co-authored-by: Paul Bartell <pbartell@amazon.com>
2022-07-07 11:11:44 -07:00
Adam Scislowicz
34c3272260
add Dockerfile and requirements.txt, used by the Dockerfile in settin… (#192)
* add Dockerfile and requirements.txt, used by the Dockerfile in setting up python dependencies. This container allows building and running of the tests and coverage report generation.

* update REDME to include docker based instructions.
2022-06-13 09:44:40 -07:00
Archit Gupta
b313f0bdbb
Remove config header include in coreMQTT headers (#189)
core_mqtt.h and other coreMQTT headers pull in core_mqtt_config.h and core_mqtt_config_defaults.h.
core_mqtt_config_defaults.h defines empty logging macros. This means every application that uses coreMQTT needs to be careful to set up the logging stack before including core_mqtt.h or they may mysteriously not have logging output.

The logging setup should be in each compilation object, not set up in headers. This moves the inclusion of default logging macros from the headers to the library c files.

This fixes the issue with the logging macros for customers who do not set the logging macros in their core_mqtt_config.h. However, those who do enable logging for coreMQTT will still have their coreMQTT logging setup in all their c files using coreMQTT.
2022-03-18 15:24:01 -07:00
Archit Gupta
76eb955b8c
Fix typo (#188) 2022-01-07 13:56:18 -08:00
Archit Gupta
424ebd3f82
Clear all fields of MQTTPubAckInfo_t when invalidating (#187) 2022-01-07 12:51:57 -08:00
Archit Gupta
2b43f3a849
Fix release workflow doxygen generation (#186) 2021-12-22 17:02:00 -08:00
Archit Gupta
ff8f4b006b
Add automated doxygen deployment (#184)
Adds the automated doxygen action to a new on-each-commit workflow and the release workflow. Also removes the unused memory_statics.yml and makes the workflow file names consistent between repos.
2021-12-16 17:53:51 -08:00
Mark Tuttle
d79fbaccd2
Loop invariant update (#181)
* Advance litani submodule for CBMC proofs

* Advance templates submodule for CBMC proofs

Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
2021-12-06 17:43:31 -07:00
Muneeb Ahmed
785f2f2117
Update version to 1.2.0 (#179) v1.2.0 2021-11-11 12:17:38 -08:00
Felipe R. Monteiro
702c4bbe38 Keep assumptions in validity functions
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
2021-10-27 16:15:12 -04:00
Felipe R. Monteiro
495b7d74a8 Removes memcpy stub from CBMC proofs
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
2021-10-27 16:15:12 -04:00
Felipe R. Monteiro
dfdcae137c Updates .gitignore to ignore IDE setting folders
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
2021-10-27 16:15:12 -04:00
Felipe R. Monteiro
4795e1b592 Removes all instances of mallocCanFail from CBMC proofs
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
2021-10-27 16:15:12 -04:00
Mark R. Tuttle
441244bd20 Advance template submodule for cbmc proofs to latest version 2021-10-15 10:16:48 -04:00
Mark R. Tuttle
158af97bd0 Advance litani submodule for cbmc proofs to latest version 2021-10-15 10:16:48 -04:00
johnrhen
0f244d4454
Fix inconsistent log levels (#175)
* Change logging level on CONNACK from 'Info' to 'Debug' to reflect CONNECT

* Changed Debug logging to Error logging where MQTTBadResponse is set

* Fix formatting

* Update source/core_mqtt_serializer.c

Co-authored-by: Archit Gupta <71798289+archigup@users.noreply.github.com>

* Change LogInfo to LogDebug on line 958 to mirror line 970

* Fix comments with inconsistent byte indexes

Co-authored-by: Hendrickson <johnrhen@88665a3d649f.ant.amazon.com>
Co-authored-by: Archit Gupta <71798289+archigup@users.noreply.github.com>
2021-09-30 09:49:54 -07:00
Joey Degges
c42daa1b82
Handle all enum values in switches (#174)
Non-functional change to handle all enum values for MQTTPublishState_t
and MQTTQoS_t in switch statements. This allows users to compile with
-Werror=switch-enum.
2021-09-24 19:01:13 -04:00
Muneeb Ahmed
33031789a1
Rename master references to main (#173) 2021-09-09 15:57:32 -07:00
Muneeb Ahmed
73eee0bd11
Update Doxygen to version 1.9.2 (#148) 2021-08-24 12:10:36 -07:00
Ronak Fofaliya
a1bbbf9a23
Updated aws-templates-for-cbmc-proofs submodule (#170) 2021-08-19 10:25:02 -07:00
Ronak Fofaliya
e2dcacfc02
testing expensive proofs (#169) 2021-07-23 12:15:06 -07:00
Muneeb Ahmed
51c8067bff
Update version and add C++ guards (#168)
* Update version numbers

* Update CHANGELOG.md

* Add guards for C++ linkage

* Link to Memory estimates markdown from README

* Make possible to override CMake C Standard for tests
v1.1.2
2021-07-22 16:49:59 -07:00
Archit Aggarwal
a108af5297
Remove debug log that can be problematic for non-blocking transport implementations (#167)
The debug-level log that is printed on not receiving any data from the network (when the first byte of an MQTT packet is attempted for reading) can be problematic when the transport interface TransportInterfaceRecv_t function is implemented in non-blocking behavior.

The problem it will cause is overwhelming logging of the message when MQTT_ProcessLoop API is called with a non-zero timeout (or the API is called multiple times with zero timeout but within a loop until some data is achieved). Due to over-logging of this message, the DEBUG logging level configured build of the coreMQTT library will be non-valuable.

This PR removes the problematic log statement.
2021-07-16 16:28:30 -07:00
Kareem Khazem
8786f32290
Upgrade proof tool submodules (#165)
This commit advances Litani to release 1.10.0, and the starter kit to
the tip-of-tree. This brings the following improvements:

- Profiling
    - Litani measures the memory usage of the CBMC safety checking and
      coverage checking jobs
    - The dashboard includes box-and-whisker diagrams for memory use per
      proof
    - The dashboard includes a graph of how many parallel jobs are
      running over the whole run, making it easy to choose a CI machine
      with enough parallelism
    - It is now possible to designate particular proofs as "EXPENSIVE";
      Litani runs expensive proofs serially, ensuring that they do not
      over-consume resources like RAM.

- UI improvements
    - Each pipeline page includes a table of contents
    - Each pipeline page includes a dependency graph of the pipeline
    - Each job on the pipeline page has a hyperlink to that job
    - The terminal output is now less noisy
2021-07-15 10:55:16 -07:00
Oscar Michael Abrina
76295c92f7
Update broken links (#166) 2021-07-14 13:56:09 -07:00
Muneeb Ahmed
d39236e732
Add check for 0 packet ID for subacks (#159)
* Add check for 0 packet ID for subacks

* Sort lexicon.txt
2021-07-07 20:11:00 -07:00
Muneeb Ahmed
a7818cbee3
Fix description of CBMC in README (#164) 2021-07-07 13:24:21 -07:00
Muneeb Ahmed
6b222a7c51
Fix keep alive interval check (#163)
* Fix keep alive checking interval

* Update default ping response timeout to a more reasonable value

* Update changelog

* Update doc for MQTT_PINGRESP_TIMEOUT_MS
2021-07-01 10:13:11 -07:00
Nicholas Rodgers
f756d9833a
Update litani and starter kit submodules (#158)
Update litani to version 1.6.0 and starter kit to tip of tree
2021-03-30 11:12:36 -07:00
Archit Aggarwal
6b1336f662
Update release job to support deleting duplicate tag and release (#156)
* Update release job to support deleting existing tag and release

* Update conditional for tag-commit job

* Update default value to be a string

* Update parameter description

* Fix typo

* Fix whitespace
2021-03-03 15:11:09 -08:00
Muneeb Ahmed
b6c4ae8b27
Change http links to https (#155) 2021-03-02 12:25:58 -08:00
Archit Aggarwal
ffb68182ab
Update URL to memory estimates in README (#154) v1.1.1 2021-02-28 10:36:41 -08:00