1
0
mirror of https://github.com/FreeRTOS/coreMQTT synced 2025-06-03 18:49:26 +08:00

216 Commits

Author SHA1 Message Date
Archit Aggarwal
09fbf71a3f
Enable CBMC proof builds (#16) 2020-08-31 16:23:26 -07:00
Archit Aggarwal
3ab7316bad
Add build instructions to root README (#14) 2020-08-31 16:07:38 -07:00
Muneeb Ahmed
54b54e78ad
Add define guards and change spellings (#15)
* Add checks for definition of false and true

* Prefer American spellings for optimize and acknowledgment
2020-08-31 14:51:21 -07:00
Muneeb Ahmed
b6bf2005ca
Fix bug that may sometimes disable keep alive (#7)
* Reset the waitingForPingResp flag in every MQTT_Connect
2020-08-31 12:45:46 -07:00
Nathan Glimsdale
163eea9cf6
Ci/update doxygen check (#13)
* Update the doxygen check.

* New method to check doxygen output
2020-08-31 10:27:50 -07:00
Archit Aggarwal
e83fadcfc7
Rename MQTT files, and Relocate CBMC and unit-test files (#12)
* Relocate CBMC to test/cbmc and unit test files to test/unit-test

* Rename all library and test files to use "core_" prefix
2020-08-31 10:02:38 -07:00
Archit Aggarwal
9cf0130428
Remove integration tests folder (#11) 2020-08-28 15:13:13 -07:00
Archit Aggarwal
52ffc3af7f
Enable Cmake builds (#8)
* Update CMake infrastructure for repository to be self-sufficient for building targets
* Update GitHub CI workflow to only use build infrastructure of the repository
2020-08-28 14:47:22 -07:00
Nathan Glimsdale
9471935683
Clarify Doxygen Test (#10)
* Clarify doxygen test by separating commands.

* Add clarifying comment.
2020-08-28 14:25:55 -07:00
Nathan Glimsdale
b4e86d103c
Doxygen CI job. (#9) 2020-08-28 11:29:47 -07:00
Nathan Glimsdale
f238a29b9f
Setup CI Actions (#5)
* Setup Unit Test Action
* Add complexity
2020-08-27 17:33:18 -07:00
Archit Aggarwal
e5a761608c
Enable doxygen build (#4)
Update file path in config.doxygen file to enable doxygen build
2020-08-27 16:42:57 -07:00
Archit Aggarwal
f2581e5da5
Re-structure files (#3)
* Relocate library, test and doc files

* Add transport interface from C-SDK

* Update file path in mqttFilePaths.cmake
2020-08-27 16:29:26 -07:00
Muneeb Ahmed
c18ed99e7d Fix MISRA 8.13 violations from earlier commit (#1164)
* Fix MISRA 8.13 violations in mqtt by using a const qualifier wherever TransportRecv_t is used.
2020-08-27 10:22:00 -07:00
Archit Aggarwal
e1d26dbcdd Fix integration test from change in MQTT_Publish behavior (#1170)
* Fix resend unacked Publish tests

* Add assertion on return value of MQTT_PublishToResend on the packet ID validity

* Hygiene improvement to use resumePersistentSession in PUBLISH resend tests
2020-08-27 09:53:26 -07:00
leegeth
35300aa029 Unit tests compiler warning fixes (#1171) 2020-08-27 09:11:53 -07:00
leegeth
b50a1888d5 MISRA fixes for openssl transport implementation (#1157) 2020-08-26 18:25:03 -07:00
Archit Aggarwal
876cceeb9d Mqtt/add config template (#1160) 2020-08-26 18:22:06 -07:00
Archit Aggarwal
a1c6b729b4 Fix build issues in MQTT integration tests file (#1166) 2020-08-26 14:18:16 -07:00
Archit Aggarwal
ff330f7ffc Fix config include path conflict for MQTT demos (#1165)
* Separate out variables for lightweight and managed MQTT sources

* Update all MQTT demos' CMakeLists.txt to build MQTT sources along with their demo binaries

* Update CMakeLists.txt of unit and integration tests for updates to mqttFilePaths.cmake
2020-08-26 12:42:13 -07:00
SarenaAWS
5634426244 Doxygen templates and instructions for writing docs for a new library (#1150)
* Add doxygen templates and instructions for writing docs for a new library.
* Make some fixes to the MQTT library doxygen.
2020-08-25 23:23:35 -07:00
SarenaAWS
ef2a080052 Doxygen for MQTT API Only (#1149)
* MQTT API doxygen documentation and supporting files.

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
2020-08-24 15:53:59 -07:00
Archit Aggarwal
4fb7f3c24f Add 3 test cases for full branch coverage of MatchTopic (#1156) 2020-08-24 15:02:00 -07:00
Muneeb Ahmed
0884ff0f4d Clear old records for clean sessions (#1148)
* Clear state records when a CONNACK's session present flag is false

Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
2020-08-24 13:33:45 -07:00
Muneeb Ahmed
ff63b3342e Add code examples for new and state API functions (#1146)
* Add code examples for MQTT_PublishToResend, MQTT_MatchTopic, and MQTT_GetSubAckStatusCodes

Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
2020-08-24 12:57:34 -07:00
Archit Aggarwal
814e73948b Add #error statements for CLIENT_CERT_PATH and CLIENT_PRIVATE_KEY_PATH macros (#1155) 2020-08-24 11:56:25 -07:00
Muneeb Ahmed
05b141658a Change state status code and increase coverage (#1140)
* Change a status code in MQTT_UpdateStateAck to MQTTBadParameter when a record is not found

* Add some unit tests to increase code coverage
2020-08-21 16:31:56 -07:00
Archit Aggarwal
afc448615c Fix flaky behavior of LWT test (#1147) 2020-08-20 17:25:04 -07:00
Archit Aggarwal
9614fd8b9d [PR from CLI tool] Add MQTT demo for connection sharing with subscription manager (#1098) 2020-08-20 15:53:17 -07:00
Archit Aggarwal
b8b79b783d Proof for MQTT_MatchTopic API (#1137) 2020-08-20 13:06:20 -07:00
Muneeb Ahmed
8741986353 Add doxygen code examples for mqtt_lightweight.h (#1135)
* Add doxygen code examples for mqtt_lightweight.h

* Comment fixes in mqtt.h

Co-authored-by: SarenaAWS <6563840+sarenameas@users.noreply.github.com>
2020-08-18 16:57:16 -07:00
Archit Aggarwal
2799ee65da [PR from CLI tool]
Add utility for MQTT topic filter and topic matching to library (#1119)

* Add topic matching utility to MQTT API

* Add thorough unit tests for topic matching utility

* Fix failing ExactMatch unit test

* Add topic matching parameter names to mqtt/lexicon.txt

* Fixes caught in code review

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>

* Remove problematic assert in matchWildcardsSpecialCases and make hygiene parameter re-ordering changes

* Add another param name to mqtt/lexicon.txt

* Update topic matching to support corner case of matching topic filter ending with "/#" with topic name ending with "/"

* Remove duplicate word entry in mqtt/lexicon.txt

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>

* Fix bugs in topic matching algorithm that allowed matching when wildcards are not preceding with '/'

* Slight style change for improved readability to matchWildcards function

* Re-add param names to mqtt/lexicon.txt that were removed in merge conflict resolution

* Rename private function for better expressivity

* Revert "Rename private function for better expressivity"

This reverts commit fe22642a4d723342dbb4c37f2df28c7aea9df0ca.

* Hygiene changes for better readability

* Add more cases to unit tests

* Hygiene changes for invoking matchEndWildcardsSpecialCases function

* More hygiene refactors from review comments

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>

* Separate Match and no-match test case sets for # willdcard

* Remove extraneous param docstring for private function

* Add note to MatchTopic API about assumption and behavior of function

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
2020-08-18 15:38:02 -07:00
Archit Aggarwal
aa36fb1082 Fix MQTT_GetSubAckStatusCodes API, and add CBMC proof for it (#1132)
* Add CBMC proof for MQTT_GetSubAckStatusCodes function
* Fix parameter type in API signature found by CBMC proof
2020-08-18 15:21:30 -07:00
SarenaAWS
c772b2214f Fix doxygen warnings in MQTT Library documentation (#1122)
Ignore private functions in mqtt_state.h and .c
2020-08-18 12:24:01 -07:00
Archit Aggarwal
959515328b Hygiene changes in MQTT demos and tests (#1128)
* Upgrade MQTT integration test to use mutual auth, and update its build setup to use CMake cache variables for credentials

* Fix build warning from logging

* Remove references to test.mosquitto.org from demos
2020-08-18 11:21:58 -07:00
Muneeb Ahmed
86dad4faaf Add doxygen code examples for mqtt.h (#1123)
* Add code examples for mqtt.h
2020-08-14 10:44:45 -07:00
Oscar Michael Abrina
d31e39dd5e Download certs into demos/certificates with an option to disable downloading (#1126)
* Add option to turn off downloading of certificates and create demos/certificates directory

* Remove Mosquitto certificate from list of certs to download

* Address PR comments

* Add CMake command line options to use for configuring demos

* Update README.md to contain extra flag for ROOT_CA_CERT_PATH

* Set prefix to PWD if any path flags are relative
2020-08-14 09:39:39 -07:00
SarenaAWS
250d32d0a7 Add cbmc pointer primitive check flag and mqtt_lightweight.c small refactor (#1120)
* Update proof templates, add proof flag --pointer-primitive-check

* Fix overflow in MQTT_SerializeSubscribe, MQTT_SerializeUnsubscribe, MQTT_SerializePublish, and MQTT_SerializePublishHeader.

Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
2020-08-14 08:05:02 -07:00
Muneeb Ahmed
504d919814 Add macro for ping response timeout (#1113)
* Add macro to initialize ping response timeout

* Remove pingRespTimeoutMs field from MQTT context

* Add macro to demo configs

* Remove unused MQTT_MAX_QUEUED_PUBLISH_MESSAGES macro
2020-08-13 16:08:32 -07:00
Archit Aggarwal
997cc0e819 [PR from CLI tool] Add new MQTT API for obtaining SUBACK codes (#1108)
* Add new API in lightweight MQTT for extracting payload from SUBACK packet

* Add parameter names of new API to lexicon.txt

* Minor updates

* Update readSubackStatus in lightweight file to use named constants

* Address hygiene comments from review

* Move new API for SUBACK decoding from lightweight to managed layer

* Make minor changes suggested in review comments

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>

* Rename API for customer usability and update doc

* Remove new QoS and SUBACK failure macros from lightweight API; Add a new enum for SUBACK status in managed API

* Fix CI build issues

* Adding another word to lexicon.txt for spell check

* Address MISRA violation of type promotion in subtraction logic

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>

Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
2020-08-12 18:34:55 -07:00
Archit Aggarwal
93dd4aee17 Fix build warnings from logging pointers in MQTT library (#1109) 2020-08-12 14:31:42 -07:00
Archit Aggarwal
1bdc9b7762 Address unused parameter and unused variable warnings (#1117) 2020-08-12 14:27:06 -07:00
Muneeb Ahmed
36a27e6d9b Add doxygen comments, remove unused fields (#1112)
* Add doxygen comments to structs and enums in mqtt.h

* Remove unused publish count parameters in MQTTContext_t
2020-08-11 11:46:24 -07:00
Archit Aggarwal
bed0ba61dd Minor hygiene updates for logging (#1096)
* Log stripped out filename as metadata instead of function name for ISO C adherence
* Make ERROR_LOG as default logging verbosity for MQTT unit tests
2020-08-07 11:39:55 -07:00
Muneeb Ahmed
26a2990384 Return suback when server refuses subscription (#1089)
* Return suback when server refuses subscription

* Add new deserialized struct parameter to callback

* Continue process loop if server refused
2020-08-07 10:53:27 -07:00
Muneeb Ahmed
9fff9d9030 Improve format specifiers in logs (#1097)
* Remove C99 %hhu format specifier

* Add unsigned long to %lu format specifiers

* Log stringified status codes instead of integers
2020-08-07 10:33:37 -07:00
Archit Aggarwal
a26a769fb4 Fix logging call in MQTT, Make hygiene improvement in logging stack (#1095)
* Fix issues with logging across files

* Fix format specifier causing warning
2020-08-04 11:14:39 -07:00
SarenaAWS
c43f4d85f9 CBMC Proofs for MQTT and Some HTTPClient_Send proof updates (#1079)
* Add MQTT proofs:

MQTT_Connect
MQTT_Disconnect Proof
MQTT_Publish
MQTT_Subscribe harness
MQTT_Unsubscribe
MQTT_ReceiveLoop proof

* Add some clarification comments.
2020-08-01 21:17:39 -07:00
Archit Aggarwal
624cab81f5 Integ tests/mqtt retain flag (#1086)
Add integration test for verifying that the MQTT library supports the "retained" PUBLISH message feature
2020-07-31 11:46:18 -07:00
Archit Aggarwal
12337f8c1d Integ tests/more cases of mqtt restore session (#1083)
Add integration tests for:
1) Resending unacked PUBLISH packets (Qos 1 and QoS 2)
2) Receiving duplicate PUBLISH packets (QoS 1 and QoS 2) from the broker in restored session
2020-07-29 10:02:02 -07:00