mirror of
https://github.com/espressif/openthread.git
synced 2026-07-09 13:50:28 +00:00
3ffe8516f7
This commit updates DNS client to add `otDnsServiceMode` to the `otDnsQueryConfig`. This new config property determines which records to query and allow the API user to control the behavior during service resolution: We can query for SRV record only or TXT record only, or query for both SRV and TXT records in the same message, or in parallel in different messages, or an "optimized" mode where client will first try to query for both records together in the same message but if server responds with an error, it then retries using two parallel separate queries. This gives flexibility and control to the API user. It also helps address situations where the server (DNS resolver) may not accept queries with more than one questions. To support this new feature, this commit updates and enhances the internal design of the `Dns::Client`. A new mechanism is added to allow multiple `Query` instances to be associated with each other under a main `Query` and responses for the related queries are saved until all are received and validated before finalizing the main `Query` and invoking the callback and allowing caller to retrieve the info. This commit also adds a detailed unit test `test_dns_client` which covers DNS client browse and service resolution validating behavior under all service modes. In order to test `Client` functionality, this commit also adds a `TestMode` in `Dns::ServiceDiscovery::Server` allowing us to change server behavior, e.g., reject messages with more than one question in query.