-
Notifications
You must be signed in to change notification settings - Fork 235
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
[mdsn] handling of txt record and boolean attributes #1987
Comments
Practically, I think it should work because an end device likely won't change the order of the TXT entries when it updates one or more entries. But conceptually, we can't guarantee that, though it's also okay that we treat two TXT blob as different values even when there are just order changes (we simply publish the same service for one more time).
It sounds okay to me. But if "Attribute present, with empty value (e.g., "PlugIns=" -- the server supports plugins, but none are presently installed)" is the only problem we are trying to solve, the simplest solution is probably add a boolean flag to // cc @superwhd |
+1 on this. For the code who uses |
Thanks guys. I agree that we need to update/enhance the Regarding the In all cases except for the
Since we already have |
Submitted first PR -> #1992 on this for enhancing |
All PRs address this are merged. We can close this. |
I have been looking into the
Mdns::Publisher
related toTXT
data record in published services.Per RFC 6763, section 6.4,
"If there is no '=' in a DNS-SD TXT record string, then it is a boolean attribute, simply identified as being present, with no value.".
We can also have:
"Attribute present, with empty value (e.g., "PlugIns=" -- the server supports plugins, but none are presently installed)"
But the
Publisher
API won't allow us to define/distinguish such entries since we use:And the
EncodeTxtData()
always inserts=
between key and value when constructing the data.In
AdvertisingProxy::MakeTxtList()
we construct array ofTxtEntry
usingotDnsTxtEntryIterator
andotDnsGetNextTxtEntry()
to parse the encoded TXT data.otDnsGetNextTxtEntry()
will indicate boolean attribute by settingmValue
inotDnsTxtEntry
toNULL
mValue
is non-null butmValueLength
is zero)."key="
format when advertising it on mDNS.One ides is to change the
Publisher
APIs to directly get the encoded TXT data instead of aTxtEntry
list.TxtEntry
array and back to encoded format)AvahiStringList
.@wgtdkp what do you think? do you see any issues with this?
The one thing I noticed in the code, is that we do
SortTxtList
and keep track of the sorted list inRegisteration
entries so that we can detect duplicate publish request. I think we can simplfit this and treat TXT data as data blob (seq of bytes) and compare the bytes directly (if there is a change to data blob, it is a change and need to updated/re-registered on mDNS).The text was updated successfully, but these errors were encountered: