[dns-sd] use new DNS TXT entry iterator (#700)
diff --git a/src/agent/advertising_proxy.cpp b/src/agent/advertising_proxy.cpp
index f3c6667..a91be7e 100644
--- a/src/agent/advertising_proxy.cpp
+++ b/src/agent/advertising_proxy.cpp
@@ -344,13 +344,19 @@
Mdns::Publisher::TxtList AdvertisingProxy::MakeTxtList(const otSrpServerService *aSrpService)
{
- otDnsTxtIterator iterator = OT_DNS_TXT_ITERATOR_INIT;
+ const uint8_t * txtData;
+ uint16_t txtDataLength = 0;
+ otDnsTxtEntryIterator iterator;
otDnsTxtEntry txtEntry;
Mdns::Publisher::TxtList txtList;
- while (otSrpServerServiceGetNextTxtEntry(aSrpService, &iterator, &txtEntry) == OT_ERROR_NONE)
+ txtData = otSrpServerServiceGetTxtData(aSrpService, &txtDataLength);
+
+ otDnsInitTxtEntryIterator(&iterator, txtData, txtDataLength);
+
+ while (otDnsGetNextTxtEntry(&iterator, &txtEntry) == OT_ERROR_NONE)
{
- txtList.emplace_back(txtEntry.mKey, txtEntry.mKeyLength, txtEntry.mValue, txtEntry.mValueLength);
+ txtList.emplace_back(txtEntry.mKey, txtEntry.mValue, txtEntry.mValueLength);
}
return txtList;