* Add code examples for MQTT_PublishToResend, MQTT_MatchTopic, and MQTT_GetSubAckStatusCodes
Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
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>
* 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
* 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
* 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>
* 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>
Add integration tests for MQTT session restoration when
1) Unacked PUBREL packets are resent by the client
2) Duplicate PUBREL packets are sent by broker
* Move assert on bug in the transport rx/tx to after checking for a negative returned. This is done to avoid overflow on the signed to unsigned conversion.
* Delete check for the sendPacket return not equal to the total amount to send. sendPacket() returns only the full amount to send OR a negative return code.
* Check for a payload length of zero for a publish. When the payload length is zero, then the payload buffer is allowed to be NULL. Added unit tests for this case.
Updated missed pFixedBuffer variable name changes.
Add periods in logs where missing.
Add docs to the user callbacks.
Add unit tests where coverage is missing.
Address missing MISRA flags.
* Add code for unittest
* Fix lexicon.txt
Fix topicfilterlength in lexicon.txt in MQTT to be all lowercase.
* update run targets
* Fix check status
Co-authored-by: SarenaAWS <6563840+sarenameas@users.noreply.github.com>
Add lexicon.txt to demos, platform, libraries/standard/http, libraries/standard/json, and libraries/standard/mqtt.
Fix spelling mistakes where they were found.
Update script to ignore the third_party folder.
Add README.md on how to create a new lexicon.txt.
* Get all unit tests to pass
* Update integration tests to common transport interface
* Update OpenSSL send and recv to poll
* Update OpenSSL send and recv
* Update plaintext demo to use common transport interface and removal of warnings
* Get mutual auth demo to compile but not returning successfully
* Remove usage of poll in OpenSSL transport send/recv
* Update based on latest changes to OpenSSL transport recv
* Make certs directory if not exist
* Add reconnection logic to mqtt basic tls demo
* Add reconnection logic to lightweight demo and update transport interface
* Make all demos consistent with each other
* Update CBMC proofs to follow suit
* Remove unnecessary includes
* Add missing time.h include to mqtt_demo_plaintext
* Remove unnecessary cast for network context buffer
Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
* Address PR comments
* Refactor Clock_GetTimeMs into clock_posix.c
* Fix accidental replace
* Remove accidentally pushed certificate
* Remove time.h include from mqtt plaintext demo
* Update demos/mqtt/mqtt_demo_lightweight/mqtt_demo_lightweight.c
Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
* Update demos/mqtt/mqtt_demo_mutual_auth/mqtt_demo_mutual_auth.c
Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
* Update demos/mqtt/mqtt_demo_mutual_auth/mqtt_demo_mutual_auth.c
Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
* Update demos/mqtt/mqtt_demo_mutual_auth/mqtt_demo_mutual_auth.c
Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
* Address PR comments
* Address PR comments
* Fix error in fixing merge conflict
* Fix redefinition of NetworkContext_t in mqtt_config.h
* Fix PUBREC comment in demos/mqtt/mqtt_demo_basic_tls/mqtt_demo_basic_tls.c
Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
* Fix PUBREC comment in demos/mqtt/mqtt_demo_basic_tls/mqtt_demo_basic_tls.c
Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
* Address PR comments
* Address PR comments
* Remove test assert for packet type != MQTT_PACKET_TYPE_PINGRESP
* Add back handling of MQTT_PACKET_TYPE_PINGRESP
* Add MQTT_PACKET_TYPE_PINGRESP log for mqtt system test
* Address PR comments
* Update library name of transport_posix
* Address PR comments and add reconnect logic changes
* Update comment in demos
* Remove accidentally pushed cert
* Update demos
* Add missing closing parenthesis
Co-authored-by: Muneeb Ahmed <54290492+muneebahmed10@users.noreply.github.com>
* Add parameter check for will message payload length in MQTT_GetConnectPacketSize()
* Add documentation about the necessity of MQTT_GetConnectPacketSize()
* Add missing private static function documentation for consistency
* Add documentation about starting over the packet ID at 1.
* Add more parameter checks to MQTT_SerializeConnect()
* Add unit tests for changes.
* Disable logging in the HTTP Client unit tests.