Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dnssd-server] implement DNS-SD discovery proxy functionality in core #10050

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abtink
Copy link
Member

@abtink abtink commented Apr 19, 2024

This commit implements a generic discovery proxy in the DNS-SD server. It uses a set of newly added otPlatDnssd platform DNS-SD(mDNS) APIs to start or stop browsers, SRV/TXT resolvers, and IPv6/IPv4 address resolvers. These APIs closely match the native OpenThread mDNS implementation.

OpenThread DNS-SD's existing QueryCallback mechanism, enabling customized discovery proxy implementations, remains supported.

This commit includes a comprehensive unit test. This test validates the discovery proxy's behavior, covering: standard use cases, request timeout, s hared resolver/browser usage for multiple queries with the same name, filtering of invalid addresses, and various edge cases.

Copy link

size-report bot commented Apr 19, 2024

Size Report of OpenThread

Merging #10050 into main(3873c6f).

name branch text data bss total
ot-cli-ftd main 466528 856 66332 533716
#10050 466528 856 66332 533716
+/- 0 0 0 0
ot-ncp-ftd main 435396 760 61544 497700
#10050 435396 760 61544 497700
+/- 0 0 0 0
libopenthread-ftd.a main 235693 95 40278 276066
#10050 235693 95 40278 276066
+/- 0 0 0 0
libopenthread-cli-ftd.a main 57589 0 8075 65664
#10050 57589 0 8075 65664
+/- 0 0 0 0
libopenthread-ncp-ftd.a main 31863 0 5916 37779
#10050 31863 0 5916 37779
+/- 0 0 0 0
ot-cli-mtd main 364528 760 51204 416492
#10050 364528 760 51204 416492
+/- 0 0 0 0
ot-ncp-mtd main 347012 760 46432 394204
#10050 347012 760 46432 394204
+/- 0 0 0 0
libopenthread-mtd.a main 157904 0 25166 183070
#10050 157904 0 25166 183070
+/- 0 0 0 0
libopenthread-cli-mtd.a main 39812 0 8059 47871
#10050 39812 0 8059 47871
+/- 0 0 0 0
libopenthread-ncp-mtd.a main 24743 0 5916 30659
#10050 24743 0 5916 30659
+/- 0 0 0 0
ot-cli-ftd-br main 549872 864 131172 681908
#10050 549888 864 131172 681924
+/- +16 0 0 +16
libopenthread-ftd-br.a main 322994 100 105094 428188
#10050 323587 100 105094 428781
+/- +593 0 0 +593
libopenthread-cli-ftd-br.a main 71450 0 8099 79549
#10050 71450 0 8099 79549
+/- 0 0 0 0
ot-rcp main 62280 564 20604 83448
#10050 62280 564 20604 83448
+/- 0 0 0 0
libopenthread-rcp.a main 9542 0 5052 14594
#10050 9542 0 5052 14594
+/- 0 0 0 0
libopenthread-radio.a main 19042 0 214 19256
#10050 19042 0 214 19256
+/- 0 0 0 0

@abtink abtink force-pushed the disc-proxy-new branch 3 times, most recently from c09d867 to 8bf2e5e Compare April 20, 2024 16:26
@abtink abtink marked this pull request as ready for review April 21, 2024 21:09
@jwhui jwhui requested a review from Vyrastas May 23, 2024 14:36
Comment on lines 558 to 559
* Refer to `otPlatDnssdAddressResolver` for documentation of member fields and `otMdnsStartIp6Resolver()` or
* `otMdnsStartIp4Resolver()` for how they are used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otMdnsStartIp6Resolver --> otMdnsStartIp6AddressResolver
otMdnsStartIp4Resolver --> otMdnsStartIp4AddressResolver

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in new push. Thanks.

Comment on lines 423 to 426
typedef struct otPlatDnssdBrowseResult otPlatDnssdBrowseResult;
typedef struct otPlatDnssdSrvResult otPlatDnssdSrvResult;
typedef struct otPlatDnssdTxtResult otPlatDnssdTxtResult;
typedef struct otPlatDnssdAddressResult otPlatDnssdAddressResult;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation that you have for these below don't come through in Doxygen when they are typedef'd up here:

image

I assume you've done this for a reason... can the documentation comment for each also be put up here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the new push, I've re-arranged the type definitions and removed these.

These were intended as forward declarations so we can define the types in a more intuitive sequence. The challenge is that the Browser/Resolver types reference their corresponding Callback types, which in turn reference the Result type. We now define Result first, followed by Callback, and finally the Browser/Resolver structures.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for rearranging, everything comes through now 👍

@marius-preda
Copy link
Contributor

Hi @abtink, the name of the commit has changed to "[mle] allow appending pending timestamp TLV with zero seconds" I guess it was by mistake and you just did a rebase of the branch.

On the other hand, is there anything else missing to merge this PR? It looks like it has all the approvals.

This commit implements a generic discovery proxy in the DNS-SD server.
It uses a set of newly added `otPlatDnssd` platform DNS-SD(mDNS) APIs
to start or stop browsers, SRV/TXT resolvers, and IPv6/IPv4 address
resolvers. These APIs closely match the native OpenThread mDNS
implementation.

OpenThread DNS-SD's existing `QueryCallback` mechanism, enabling
customized discovery proxy implementations, remains supported.

This commit includes a comprehensive unit test. This test validates
the discovery proxy's behavior, covering: standard use cases, request
timeout, s hared resolver/browser usage for multiple queries with the
same name, filtering of invalid addresses, and various edge cases.
@abtink
Copy link
Member Author

abtink commented Jun 7, 2024

Hi @abtink, the name of the commit has changed to "[mle] allow appending pending timestamp TLV with zero seconds" I guess it was by mistake and you just did a rebase of the branch.

Thanks @marius-preda for noticing the commit message change. I am not sure how it happened. I just rebased it recently. It is interesting that it was changed to [mle] allow appending pending timestamp TLV with zero seconds (#10327) (which icnlude the (#10327) number which is auto-added by GitHub when a PR is merged. Seems like somehow git may have messed it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants