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

[mdns] update TxtEntry to handle boolean attribute #1992

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

abtink
Copy link
Member

@abtink abtink commented Sep 4, 2023

This commit updates TxtEntry, EncodeTxtData(), and DecodeTxtData() to support boolean attributes, which are encoded as key string without the = character. It also ensures that EncodeTxtData() will generate valid TXT data (containing a single zero byte) when given an empty TxtList. Additionally, this commit updates AdvertisingProxy::MakeTxtList() to use DecodeTxtData(), and adds a test to validate the encoder and decoder behavior.

Copy link
Member

@wgtdkp wgtdkp left a comment

Choose a reason for hiding this comment

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

Thanks @abtink! Looks great!

Copy link
Contributor

@superwhd superwhd left a comment

Choose a reason for hiding this comment

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

LGTM 👍

src/mdns/mdns.cpp Outdated Show resolved Hide resolved
tests/mdns/main.cpp Outdated Show resolved Hide resolved
tests/mdns/main.cpp Outdated Show resolved Hide resolved
@abtink abtink force-pushed the mdns/handle-bool-attr-txt-record branch from 81c26c6 to 5cf09ee Compare September 5, 2023 18:10
This commit updates `TxtEntry`, `EncodeTxtData()`, and `DecodeTxtData()`
to support boolean attributes, which are encoded as `key` string
without the `=` character. It also ensures that `EncodeTxtData()`
will generate valid TXT data (containing a single zero byte) when
given an empty `TxtList`. Additionally, this commit updates
`AdvertisingProxy::MakeTxtList()` to use `DecodeTxtData()`, and adds
a test to validate the encoder and decoder behavior.
@jwhui jwhui merged commit 186b001 into openthread:main Sep 6, 2023
31 checks passed
@jwhui jwhui changed the title [mdns] update 'TxtEntry' to handle boolean attribute [mdns] update TxtEntry to handle boolean attribute Sep 6, 2023
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.

4 participants