Граф коммитов

129 Коммитов

Автор SHA1 Сообщение Дата
Ewerton Scaboro da Silva cdb3a7c5ec Complete updating RPC to take one topic only 2023-12-01 15:02:31 -08:00
Ewerton Scaboro da Silva 5655b7c322 Change RPC commands to take just one topic format, support cmdPhase 2023-11-29 22:59:31 -08:00
Ewerton Scaboro da Silva aa60e8118a
Make content type optional for RPC requests & responses (#2696)
* Make content type optional in az_mqtt5_rpc_server_hfsm

* Do not append content type if is AZ_SPAN_EMPTY in command response (server)

* Allow sending command request with empty content type

* Address CR comments

* Add documentation in unit test function
2023-11-27 17:25:43 -08:00
Raul Leclair 6a61b8fbe7
paho async improvements (#2694) 2023-11-22 14:03:35 -08:00
Raul Leclair ff95e34ad3
Telemetry codec (#2686)
* Telemetry codec (no tests)

* addressing comments, updating service_group_id, adding UTs

* Addressing comments
2023-11-20 14:41:47 -08:00
Ewerton Scaboro da Silva c24e59a793
Expose command_name and service_id, do not fail if command respose has empty body (#2685)
* Expose command_name and service_id, do not fail if command respose has empty body

* Fix unit test to expect null payloads
2023-11-15 00:41:49 +00:00
Raul Leclair 389d8d15e8
Improvements to RPC parser and get topic functions (#2674)
* get_*_topic function improvement

* *_codec_parse_received_topic improvement

* Addressing comments

* style fix

* Addressing comments

* Addressing comments 2

* Addressing comments 3
2023-11-10 12:09:24 -08:00
Raul Leclair 0cd0fd7810
RPC Codec Update (#2671)
* Reworking codec

* Rename of .h rpc client and server hfsm file

* Quick fix

* Addressing comments

* Quick fix

* Addressing comments 2

* Addressing comments 3
2023-11-02 11:33:04 -07:00
Valerie Avva Lim 908ef5274b
[RPC Server] fix segfault on incoming publish with missing properties (#2668)
* fix segfault on incoming publish with missing properties

* fix inbound error messages so they route to the policy collection
2023-10-30 15:44:09 -07:00
Raul Leclair cbaaae4299
Adding client certificate count (#2662)
* Adding client certificate count

* Initializing client_certificates empty
2023-10-12 18:37:12 +00:00
Raul Leclair 6cc11b5600
Reworking MQTT 5 Properties and integrating paho to RPC samples and code (#2651)
* Paho sample rpc

* Adding multiple RPC paho sample

* Unit test memory fix, adding safeguards to RPC HFSMs

* Cleaning up paho at end of rpc sample

* Addressing comments

* style

* Integrating callback change
2023-10-10 17:22:33 -07:00
Ewerton Scaboro da Silva 8051862c3b
Add context to az_mqtt5_connection_callback + additional fixes (#2657)
* Add context to rpc mqtt callback + addtl fixes

* Fix unit tests and remove unnecessary include

* Fix test_az_mqtt5_rpc_client_hfsm.c

* Fix test_az_mqtt5_rpc_server_hfsm.c

* Fix code documentation
2023-10-09 14:09:59 -07:00
Valerie Avva Lim 1c96a69b2d
[RPC] Policy & Codec Rename (#2643)
* rename rpc codec files to have codec in name

* rename rpc policy files to not have policy in the name

* first round of renames

* more codec naming updates

* remove uints where not needed

* style
2023-09-22 16:19:14 -07:00
Valerie Avva Lim 8ccc3ac5d6
RPC Custom Topics & Server + Client Sample supporting multiple commands (#2638)
* base files for client sample/hfsm

* filled in basic client hfsm implementation and sample. Sending command flow mostly functional, receiving command flow still needs property parsing. Initial command also not being sent yet

* switch to using az_context instead of timer in application, add common rpc.h file, parse mqtt5 properties on command response and validation

* add rpc_client_start and invoke errors

* updates from UML review

* add unsubscribe support for mqtt and rpc client

* move handling responses to the root state since it's the same in all

* handle unsubscribe req from any state

* cleanup

* cleanup

* style

* enable multiple rpc clients

* addressing first round of PR comments

* remove handle by superstate

* pass server executor id on command invocation

* remove parsing failure bool and have parse response return az_result instead of rsp struct

* move status check to shared codec

* move sending inbound event that rpc client can receive commands from entry event on Ready to transitions to Ready

* remove pointer to az_span for creating the subscription topic

* naming & comments

* use _az_hfsm_send_event to keep events within that rpc client instance

* rename hfsm to policy to more clearly separate the difference between the rpc_client and the rpc_client_policy

* rename long running operations to begin instead of request

* change pending commands from being dynamically allocated to being statically allocated

* update correlation id log

* style

* move all incoming pub recv processing to Ready

* move puback handling and pub mid tracking to the hfsm instead of the application. Adds new limitation of only 1 outstanding pub at a time until the puback is received

* doxygen

* style

* add base unit tests for rpc_client

* addressing PR comments

* add base unit test for rpc_client_policy

* add timeout to publishing

* more unit tests

* more unit tests

* updates from feature/v2

* more unit tests

* ensure free of properties

* cleanup

* style

* cleanup

* cleanup

* split rpc server into policy and main codec struct

* merge in mqtt init changes

* add rpc server unit tests and make topics actually customizable

* test custom properties

* style

* cleanup tests

* more server unit tests

* separate server into codec and add more unit tests

* style

* doxygen

* address PR comments

* add sample for handling multiple commands with server and client on same device

* add client to sample and add support for one client handling multiple commands under the same subscription

* address PR comments

* addressing PR comments

* style

* changes needed to work with server updates

* doxygen fix

* PR comment & spelling

* test updates

* updates to naming and no more requirements of some fields

* take recommendations from other PR feedback

* style

* cleanup

* feedback from other PRs

* parity with client sample

* ensure properties get free'd every time in server hfsm

* move common rpc code to rpc.c instead of all being inline in rpc.h

* cleanup

* style

* build fix

* build fix

* build fix

* add unit tests for get topic from format & fix bugs in it

* style

* fix correlation id memory error on back pubacks

* addressing PR comments

* addressing PR comments

* make loop changes to client & server sample

* refactor topic generation to use functions & remove the need for formats to include the null terminator

* optimize topic generation

* add details about client command expiration

* style

* use platform mutex and sleep in samples

* use platform timer in samples

* pr comments

* style

* fixes from merging from feature/v2

* align multiple sample to use same cert/broker setup as other samples

* style

* add null terminator to response topics and move timer within mutex

* PR comments

* fix build error

* style
2023-09-21 20:27:08 +00:00
Raul Leclair b831befbc6
Paho Async Implementation (#2635)
* Adding Paho

* Adding test job for Paho Async MQTT

* Build fixes

* Build fix 2

* Adding unsubscribe + puback rc (cred: vaavva)

* Adding unsuback test

* Adding unsubscribe to paho

* Addressing comments

* Quick fix

* Addressing comments

* Fixing build

* Changing property create function naming
2023-09-19 13:44:31 -07:00
Valerie Avva Lim 67ba2a655b
RPC Client MQTT5 HFSM & Sample (#2628)
* base files for client sample/hfsm

* filled in basic client hfsm implementation and sample. Sending command flow mostly functional, receiving command flow still needs property parsing. Initial command also not being sent yet

* switch to using az_context instead of timer in application, add common rpc.h file, parse mqtt5 properties on command response and validation

* add rpc_client_start and invoke errors

* updates from UML review

* add unsubscribe support for mqtt and rpc client

* move handling responses to the root state since it's the same in all

* handle unsubscribe req from any state

* cleanup

* cleanup

* style

* enable multiple rpc clients

* addressing first round of PR comments

* remove handle by superstate

* pass server executor id on command invocation

* remove parsing failure bool and have parse response return az_result instead of rsp struct

* move status check to shared codec

* move sending inbound event that rpc client can receive commands from entry event on Ready to transitions to Ready

* remove pointer to az_span for creating the subscription topic

* naming & comments

* use _az_hfsm_send_event to keep events within that rpc client instance

* rename hfsm to policy to more clearly separate the difference between the rpc_client and the rpc_client_policy

* rename long running operations to begin instead of request

* change pending commands from being dynamically allocated to being statically allocated

* update correlation id log

* style

* move all incoming pub recv processing to Ready

* move puback handling and pub mid tracking to the hfsm instead of the application. Adds new limitation of only 1 outstanding pub at a time until the puback is received

* doxygen

* style

* add base unit tests for rpc_client

* addressing PR comments

* add base unit test for rpc_client_policy

* add timeout to publishing

* more unit tests

* more unit tests

* updates from feature/v2

* more unit tests

* ensure free of properties

* cleanup

* style

* cleanup

* cleanup

* merge in mqtt init changes

* style

* cleanup tests

* addressing PR comments

* style

* changes needed to work with server updates

* doxygen fix

* PR comment & spelling

* style

* feedback from other PRs

* address pr comments

* address PR comments

* move QOS definitions to az_mqtt5

* doxygen
2023-09-12 10:56:45 -07:00
Valerie Avva Lim e4dfba5e8f
RPC Server Split for Codec & unit tests (#2634)
* separate server into codec and add more unit tests

* style

* doxygen

* address PR comments

* address PR comments
2023-09-08 13:45:36 -07:00
Raul Leclair d0e45a23d3
Adding MQTT implementation specific client handle to MQTT initializer (#2632)
* Adding mqtt implementation specific init argument

* edit

* Ensuring app and az mqtt point to same mosq struct

* Addressing comments
2023-09-05 18:51:34 +00:00
Raul Leclair cdcb738695
Adding MQTT5 property initializers (#2631)
* Adding initializers to MQTT5

* Doxygen change

* Addressing comments
2023-08-31 21:56:43 +00:00
Raul Leclair 238a001414
Addressing comments for properties v5 (#2619)
* Addressing comments

* Removing destroy call.

* Addressing comments

* Addressing comments pt2

* Changing rpc sample property allocation

* Addressing API review comments

* Integrating new changes

* Fixing memory leak

* Memory Leak 2

* Add more logging and publish test failure logs when ctest fails

* Make ctest extra verbose

* Stack Fix

---------

Co-authored-by: Daniel Jurek <djurek@microsoft.com>
2023-08-17 17:14:02 -07:00
Valerie Avva Lim 73f6268af0
RPC Server Address comments (#2623)
* add rpc_server hfsm

* add mosquitto rpc server sample

* cleanup

* make sample easier to modify with personal values

* basic running instructions

* Changing naming to mqtt5

* Add publish v5 with properties plus naming changes

* Excluding files lacking coverage

* rename files

* update naming to mqtt5

* use new mqtt5 properties functions

* memory fix

* some clean-up and validation

* remove out_id needing to be a pointer

* switch property bag to be allocated for the lifetime of the rpc server

* split rpc server data from options

* add timeout

* add timeout

* create new data type for sending command to application for execution

* update naming with mqtt5 property changes

* add proper error response formatting, add notification to application for ignored commands because of current command processing, and send cancellation notification to application on timeout

* cleanup

* move execution timer to application and add subscribe timeout to hfsm

* update property bag to not be a pointer and add comments

* update property bag to not be a pointer and add comments

* add comments

* style

* style

* fix mosquitto memory leak

* support multiple rpc server instances

* first pass WIP at adding json serializer

* move content type handling to application

* cleanup

* fix json parser logging

* eof newlines

* remove usage of az_platform functions in the sample

* sample wording

* remove pending command from rpc server policy so it can handle multiple commands and transfer the ownership of knowing whether a command is being executed to the application

* update idle state a bit

* renaming from feedback

* Update README.md

* doc update

* style

* build fixes

* build fixes

* doxygen fixes

* add basic test as a start for code coverage checks

* address PR comments from previous PR

* naming for json parser

* style

* remove connected boolean from sample

* simplify states for rpc server and add fixes for multiple rpc server instances of different subscriptions

* add puml diagram for rpc server

* add puml and start of readme

* remove duplicate json parser files

* cleanup

* add link to state diagram

* style

* slice request topic to size so we can properly compare it

* fix test

* address PR comments

* address PR comments

* style and build fix

---------

Co-authored-by: RLeclair <raulleclair@microsoft.com>
2023-08-16 11:07:12 -07:00
Valerie Avva Lim 697d3beb32
RPC Server MQTT5 HFSM & Sample (#2621)
* add rpc_server hfsm

* add mosquitto rpc server sample

* cleanup

* make sample easier to modify with personal values

* basic running instructions

* Changing naming to mqtt5

* Add publish v5 with properties plus naming changes

* Excluding files lacking coverage

* rename files

* update naming to mqtt5

* use new mqtt5 properties functions

* memory fix

* some clean-up and validation

* remove out_id needing to be a pointer

* switch property bag to be allocated for the lifetime of the rpc server

* split rpc server data from options

* add timeout

* add timeout

* create new data type for sending command to application for execution

* update naming with mqtt5 property changes

* add proper error response formatting, add notification to application for ignored commands because of current command processing, and send cancellation notification to application on timeout

* cleanup

* move execution timer to application and add subscribe timeout to hfsm

* update property bag to not be a pointer and add comments

* update property bag to not be a pointer and add comments

* add comments

* style

* style

* fix mosquitto memory leak

* support multiple rpc server instances

* first pass WIP at adding json serializer

* move content type handling to application

* cleanup

* fix json parser logging

* eof newlines

* remove usage of az_platform functions in the sample

* sample wording

* renaming from feedback

* Update README.md

* doc update

* style

* build fixes

* build fixes

* doxygen fixes

* add basic test as a start for code coverage checks

---------

Co-authored-by: RLeclair <raulleclair@microsoft.com>
2023-08-11 16:45:20 -07:00
Raul Leclair 5336993143
Adding MQTTv5 Properties (Publish) (#2613)
* Changing naming to mqtt5

* Add publish v5 with properties plus naming changes

* Excluding files lacking coverage

* Adding property bag empty + addr. coments pt 1

* Addressing comments pt 2
2023-07-26 17:55:41 -07:00
Raul Leclair fd0c31cec2
Adding mqtt connection with unit tests, subclient (#2591)
* Adding mqtt connection with unit tests, subclient

* Adding extra coverage, addressing comments

* Adding more test coverage

* More test coverage

* Adjusting code coverage threshold
2023-06-28 14:47:19 -07:00
Raul Leclair afac5030ea
Adding MQTT container to test pipeline (#2585) 2023-06-23 09:35:05 -07:00
Raul Leclair 00a12e3d43
Adding az_mqtt and integration tests (#2567)
* Adding az_mqtt and integration tests

* Build fix

* Apple build fix

* Addressing comments + build

* Addressing comments 2

* Removing context from az_nomqtt

* minor fix

* Adding missing docs

* Clarification on mosquitto
2023-05-24 10:08:09 -07:00
Raul Leclair 7bef7cda79
Adding event policy, HFSM, and policy pipeline (#2557)
* Adding event policy, HFSM, and pipeline.

* Undoing small change

* Adding CODEOWNERS edit

* UTs and comment addressing

* Minor formatting correction

* Fixing macOS and Windows build
2023-05-10 16:49:29 -07:00
Raul Leclair 037766994f
Adding posix mutex and timers and x509 cred header (#2537)
* Platform expansion, mutex and timer

* Adding x509 cred

* CODEOWNERS edit

* Removing az_credentials_x509 for now

* removing user from codeowners

* Addressing comments p1

* Renaming

* Formatting revision

* Adding linux check in az_posix

* CODEOWNERS update

* Adding pthreads to VS2022 yml

* Adding pthreads to vcpkg default

* Cmake edit

* Undoing yaml changes

* Fix for builds, and address ret val comment

* lint correction

* Fixing MacOS build, adding more documentation

* CMake edit for Mac

* Disabling mutex and timer IT for macos

* Minor fix

* Quick fix

* Fixing doxygen

* Naming corrections

* formatting corrections
2023-05-02 11:41:09 -07:00
Ahson Khan c317e45896
Rename push ignore deprecations and pop warnings macro from AZ_ to _az_ to indicate they are for internal use only. (#2474)
* Rename push ignore deprecations and pop warnings macro from AZ_ to _az_ to indicate they are for internal use only.

* Update paho_iot_pnp_with_provisioning_sample.c

* Update test_az_iot_provisioning_client_register_get_request_payload.c

* Update clang format to avoid unwanted indentation with statement macros
2023-01-10 16:51:30 -08:00
Cristian Pop e8f105e711
Azure IoT Provisioning Client Receiving Custom Allocation Payloads (#2443)
Porting feature from feature/iot_certificate_management: Azure IoT Provisioning Client Receiving Custom Allocation Payloads.
2022-12-12 17:42:43 +00:00
Dane Walton 54f7bf322e
Update ADU device props to GA fields (#2437) 2022-12-01 17:20:55 -05:00
Dane Walton bc4c1ee28c
Add Azure Device Update code to main (#2375)
Co-authored-by: Victor Vazquez <vhvb1989@gmail.com>
Co-authored-by: Ewerton Scaboro da Silva <ewertons@microsoft.com>
Co-authored-by: Valerie Avva Lim <54871851+vaavva@users.noreply.github.com>
2022-11-11 15:40:11 -05:00
Ahson Khan c770dd2f04
Update az_json_string_unescape to accept az_span as destination to improve usability of API. (#2412)
* Update az_json_string_unescape to accept az_span as destination to improve usability of API.

* Clang formatting.
2022-11-09 19:06:38 -08:00
Anton Kolesnyk 94b5847e5e
Fix minimum log buffer size calculation (#2372) 2022-10-27 17:54:30 -07:00
Dane Walton f9bfb8f76e
add base64 url encoder (#2329) 2022-09-14 12:19:26 -05:00
Ahson Khan e88c6b0422
Add null terminator for char* based json string unescape, and precondition on input length (#2303)
* Add null terminator for char* based json string unescape, and precondition on input length

* Add remark comment about precondition and null terimination

* Update doc comment typo

* Remove the test cases about insufficient space.

* Fix clang formatting.

* Add null terminator tests.

* Test that the null terminator is there at the end.

* Fix build errors.
2022-08-09 18:59:33 -07:00
George Arama 89cc5c13f6
Unescape json string (in , out of plac#2290)
* first pass

* A few small updates

* revert cmakesettings, and some file format

* fix char conv

* remove static

* pointerize

* test

* disable

* fix tests

* free

* lint

* the cmake of glory

* remove wrapper API

* remove build folder

* clang

* PR comments

* remark

* argh

* PR comments

* PR comments

* Test updates from PR

* added unit test for missing

* some more PR comments
2022-07-29 11:49:57 -07:00
George Arama 935cb92bdb
Unescape (#2287)
* first pass

* A few small updates

* revert cmakesettings, and some file format

* fix char conv

* remove static

* pointerize

* test

* disable

* fix tests

* free

* lint

* the cmake of glory

* remove wrapper API

* remove build folder

* clang

* PR comments

* remark

* argh
2022-07-28 14:53:19 -07:00
Charlie Barto 3e18d44ebb
Activate address sanitizer in CI, on Linux and Windows (#2219)
* Actually use the COMCKA_LIB variable that we set in the top level CMakeLists.txt

* rename global_compile_options.txt to .cmake

This results in better colorization in editors, and is less suprising.

* add ADDRESS_SANITIZER option

* add asan to CI, use

* use - instead of / for sanitize=address, so things work with other compilers

* make the canary compiler-specific.

* make an imported target for cmocka if it's too old to have a real imported target.

* link asan when using gcc

* make only the static analysis lie compiler specific.

* use target_link_libraries and target_include_directories instead of set_property

This is required to properly expand build type keywords.

* Revert "use target_link_libraries and target_include_directories instead of set_property"

This reverts commit f10143e03b.

* Revert "make an imported target for cmocka if it's too old to have a real imported target."

This reverts commit fd708295b8.

* just do target detection, don't try and make an imported target

the imported target doesn't work because it has build type keywords.

* supress "asan needs debug mode for good error reporting.

* ignore the linker warning about better debug info too.

* Remove the canary

* Add asan to a debug linux build.

* whitespace

* whitespace mk2

* update readme to mention asan

* asan option description nits

* add some explenation of the changes to linker warnings

* add note about compiler warning as well.
2022-07-05 15:32:22 -07:00
Mollie Munoz d353a56010
Add 400+ error tests for twin topic reported-properties response (#2164) 2022-03-31 18:48:22 -07:00
Mollie Munoz 28dfc63769
Remove failure if version not present in the reported properties response (#2162)
* Version will be present from IoT Hub, but absent from IoT Edge.
2022-03-29 13:36:27 -07:00
ewertons 285b7ce156
Revert the user agent property name from dct to DeviceClientType (#2152)
* Revert the user agent property name from dct to DeviceClientType

Azure IoT Hub parses the user agent information using the property
name DeviceClientType, so the client must send it with that name
otherwise the user agent string is not properly stored on Azure.
A change in the property name to "dct" can only be done after the hub is
also updated to support that name/alias.

* Fix clang format for dct to DeviceClientType change
2022-03-17 15:00:39 -07:00
Ahson Khan 36a7257760
Add total bytes written public field to the JSON writer, by moving it from internal. (#2102)
* Add total bytes written public field to the JSON writer, by moving it
from internal.

* Add doc comments to internal json writer fields.

* Fix typo in comment, close bracket.
2022-02-08 17:34:01 -08:00
Dane Walton cca74f2da8
fix custom iot user agent (#2027) 2021-11-30 10:16:16 -08:00
Anton Kolesnyk 5ad7985d50
Telemetry options constructor and component name size constraint (#1976) 2021-11-03 19:26:25 -07:00
Anton Kolesnyk 994916db1c
HTTP request telemetry improvements (#1968)
* HTTP request telemetry improvements

* Changelog improvements

* Fix warning

* Correct braces

* Remove extra arg

* Fix unit test, plus inline constant

* Empty Component Name triggers precondition failure

* Use constants

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-11-02 15:21:40 -07:00
Anton Kolesnyk 7b237f2105
get_http_status_code() helper function (#1961)
* az_http_response_get_status_code()

* Add unit test

* Update unit test

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-10-26 11:46:30 -07:00
Ahson Khan 4c881ccf0f
Add unit test to make sure internal state of json writer is set (#1907)
correctly.
2021-09-09 00:10:47 +00:00
John Spaith 84bfe57b50
Merge feature/iot_pnp branch into main (#1891)
Enables 1st class IoT Plug and Play functionality into embedded SDK.
2021-09-02 19:42:26 -07:00
John Spaith 4c7466ea26
Create az_iot_provisioning_client_get_request_payload API (#1871) 2021-08-31 14:26:07 -07:00