# Multicast DNS

# Multicast DNS

This module includes APIs for Multicast DNS (mDNS).

## Summary

The mDNS APIs are available when the mDNS support `OPENTHREAD_CONFIG_MULTICAST_DNS_ENABLE` is enabled and the `OPENTHREAD_CONFIG_MULTICAST_DNS_PUBLIC_API_ENABLE` is also enabled.

| ### Enumerations ||
|---|---|
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5a58ef6be22b1763a8aec71dee58092f{ https://openthread.io/reference/group/api-mdns#group__api-mdns_1gga5a58ef6be22b1763a8aec71dee58092faa63b6e3d2680beaf9672a68b9ceb16ad, https://openthread.io/reference/group/api-mdns#group__api-mdns_1gga5a58ef6be22b1763a8aec71dee58092faa1787a2cfd970c2f4eabc1894820d019, https://openthread.io/reference/group/api-mdns#group__api-mdns_1gga5a58ef6be22b1763a8aec71dee58092fa46e5a507224047db8abd45d1044fb302, https://openthread.io/reference/group/api-mdns#group__api-mdns_1gga5a58ef6be22b1763a8aec71dee58092fa9ba5a60f8554f47e2cf955667675e13b }` | enumRepresents a host/service/key entry state. |

| ### Typedefs ||
|---|---|
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5eb9853793348369eea8b735dfebff8d` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-address-and-ttl` Represents a discovered host address and its TTL. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga3732415ad8df723a1b8dd177636ecf9d` | typedef `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga3b8b56615a8a4bfb1f618882be661e7f` Represents the callback function pointer type use to report an IPv6/IPv4 address resolve result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae63eeb32e9cae80c9d644f12eead203e` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-address-resolver` Represents an address resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga237bb2b6a6e893a4cfb32ccefdffd662` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-address-result` Represents address resolver result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga504aa0b81751d6a6186ceea7e4585b70` | typedef `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga478ff156be627d5ef35e6a512e0e4770` Represents the callback function pointer type used to report a browse result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga4d7cde7d0fb542f5d0e7446123aed6c4` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-browse-result` Represents a browse result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab20e6c4ed8712293c8cba1989287421c` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-browser` Represents a service browser. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gabb58fe808ba81abd7a529d2c7f48658c` | typedef `struct https://openthread.io/reference/struct/ot-mdns-cache-info` Represents additional information about a browser/resolver and its cached results. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga9e6261a1d7900e11f5d7d13fa7f823cb)(otInstance *aInstance, const char *aName, const char *aServiceType)` | typedef `void(*` Represents the callback function to report a detected name conflict after successful registration of an entry. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga1b61426aac1f158136f56303ceeeae8e` | typedef `enum https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5a58ef6be22b1763a8aec71dee58092f` Represents a host/service/key entry state. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga2e76933ab8bdc78033a2a2ff1a474ac5` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-host` Represents an mDNS host. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180` | typedef `struct https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180` Represents an mDNS entry iterator. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5b2c45847339df26fb5e8a2c8f9fa4fc` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-key` Represents an mDNS key record. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaed144d92ca425b986db7643ed8f9da21` | typedef `struct https://openthread.io/reference/struct/ot-mdns-local-host-address` Represents a local host IPv4 or IPv6 address entry. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga930ded138240f56428003da0d287fee1` | typedef `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga32409833ea4a869e150588038fd2e37e` Represents the callback function used to report a record querier result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaff8d1444c245bfc8d92835e02f9a9e10` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-record-querier` Represents a record querier. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaa19f5a8b6fd1382283109cf799270fad` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-record-result` Represents a record query result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga876a4ed458efa3d14450f5b08a60d442` | typedef `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga570e03d5bd480f76fc4c70f9c87c2bd5` Represents the callback function to report the outcome of a host, service, or key registration request. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga13aba019f785c27f3aa7833211720e33` | typedef `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6c475e668b2eceb746a2f17284ba0825` Represents a request ID (`uint32_t` value) for registering a host, a service, or a key service. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga59c635a33449b8cda1ebd8f487937b61` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-service` Represents an mDNS service. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga4d04fa3c1931be66eb186610b2c249bc` | typedef `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga1fb602e340f9b18bf93ad79d629eb7ef` Represents the callback function pointer type used to report an SRV resolve result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab45eef004b7e0a5b9e2661d62f841b5a` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-srv-resolver` Represents an SRV service resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga93694d94c1c47fe902ff034e1d3857e2` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-srv-result` Represents an SRV resolver result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga2e4e3fb6112994bf003babbf6652cf0e` | typedef `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gae5107bed5e99e9f7122411314755aad7` Represents the callback function pointer type used to report a TXT resolve result. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga108117ce7deff56bdc0835525605dc8b` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-txt-resolver` Represents a TXT service resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga17ebff48b0b2dbf7e6bffa1de2664bdc` | typedef `https://openthread.io/reference/struct/ot-plat-dnssd-txt-result` Represents a TXT resolver result. |

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga0fa7fec02d07a64bd59567c13a1cf50d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *` Allocates a new iterator. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga78828b46b65dc2a8bddda5dc5b4a9ce8(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator)` | `void` Frees a previously allocated iterator. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga02c4d38bece5b5ffe5df59ae851cc03d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether the auto-enable mode is enabled or disabled. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga1f4b63cc1ffcdde19f6ffefe5c445935(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const char *` Gets the local host name. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga02e23f79733209eb45e199f9d61228ac(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab20e6c4ed8712293c8cba1989287421c *aBrowser, https://openthread.io/reference/struct/ot-mdns-cache-info *aInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over browsers. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga080f84e4c9b6444a84c2beab0291fb02(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga2e76933ab8bdc78033a2a2ff1a474ac5 *aHost, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5a58ef6be22b1763a8aec71dee58092f *aState)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over registered host entries. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga8f84e9038917f80ba3d03dce6bba3e83(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae63eeb32e9cae80c9d644f12eead203e *aResolver, https://openthread.io/reference/struct/ot-mdns-cache-info *aInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over IPv4 address resolvers. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaa9fa66c7ea737d6102c5f0a532ab8ee6(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae63eeb32e9cae80c9d644f12eead203e *aResolver, https://openthread.io/reference/struct/ot-mdns-cache-info *aInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over IPv6 address resolvers. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga1e44876f34a4aa3efa1a6eaa4917f1a7(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5b2c45847339df26fb5e8a2c8f9fa4fc *aKey, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5a58ef6be22b1763a8aec71dee58092f *aState)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over registered key entries. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga9eba81f3b5f34ae52ca8dc0b4bb67c1d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/struct/ot-mdns-local-host-address *aAddress)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over the local host IPv6 and IPv4 addresses tracked by OpenThread mDNS module. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gace1188ff6187f96228ee250c8af54c1d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaff8d1444c245bfc8d92835e02f9a9e10 *aQuerier, https://openthread.io/reference/struct/ot-mdns-cache-info *aInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over record querier entries. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab480c01add6e56dfc8586be07ade82af(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga59c635a33449b8cda1ebd8f487937b61 *aService, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5a58ef6be22b1763a8aec71dee58092f *aState)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over registered service entries. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga392a1a7bf3ecd552ef28f8b059a527f2(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab45eef004b7e0a5b9e2661d62f841b5a *aResolver, https://openthread.io/reference/struct/ot-mdns-cache-info *aInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over SRV resolvers. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga3fc921cd91f06528ea3c7d41e9694a04(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga20045ba2e3717a5b1f6bd8082b189180 *aIterator, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga108117ce7deff56bdc0835525605dc8b *aResolver, https://openthread.io/reference/struct/ot-mdns-cache-info *aInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over TXT resolvers. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga488b472e8eb55d42e4539e70727f9b9e(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether the mDNS module is enabled. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga07a3eef1d52aedecc38b6034acf0da97(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether mDNS module is allowed to send "QU" questions requesting unicast response. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga562cf2663fe095239c2fdfb77d04d02a(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether verbose logging is enabled for the mDNS module. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga24a0c7d6d3506951f7d1f98a8d6276c6(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga2e76933ab8bdc78033a2a2ff1a474ac5 *aHost, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga13aba019f785c27f3aa7833211720e33 aRequestId, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga876a4ed458efa3d14450f5b08a60d442 aCallback)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Registers or updates a host on mDNS. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaeddceffd5132e5e7deebe91e1f9d963c(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5b2c45847339df26fb5e8a2c8f9fa4fc *aKey, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga13aba019f785c27f3aa7833211720e33 aRequestId, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga876a4ed458efa3d14450f5b08a60d442 aCallback)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Registers or updates a key record on mDNS module. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga553e5327284fe5f5baebc8d65e2c8448(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga59c635a33449b8cda1ebd8f487937b61 *aService, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga13aba019f785c27f3aa7833211720e33 aRequestId, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga876a4ed458efa3d14450f5b08a60d442 aCallback)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Registers or updates a service on mDNS. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gad9c5f46cb769b93d1fcd9d37a2a5e3c0(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnable)` | `void` Enables or disables the mDNS auto-enable mode. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaa01e5df396628f12490d6bae0318c9f7(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga9e6261a1d7900e11f5d7d13fa7f823cb aCallback)` | `void` Sets the post-registration conflict callback. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga129aa9fda4f4c35f0f2e4be0478fde7d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnable, uint32_t aInfraIfIndex)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Enables or disables the mDNS module. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaab918cb08298252ba8c74fee5cf0be07(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const char *aName)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets the local host name. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae1d8f5968a654d1a4e9aae98c13d5685(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aAllow)` | `void` Sets whether the mDNS module is allowed to send questions requesting unicast responses referred to as "QU" questions. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga84293fb4f7fb25a710f239cdf9e9fa44(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnable)` | `void` Enables or disables verbose logging for the mDNS module at run-time. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gac1fb5610093e93d53ea40ee7477b2668(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab20e6c4ed8712293c8cba1989287421c *aBrowser)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts a service browser. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga59cb92ea248098df25cd2f994366015b(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae63eeb32e9cae80c9d644f12eead203e *aResolver)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts an IPv4 address resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaa2faaa83b028eab4aa25dff87958097a(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae63eeb32e9cae80c9d644f12eead203e *aResolver)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts an IPv6 address resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga8147f581aeefba1fbc7968c465786e84(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaff8d1444c245bfc8d92835e02f9a9e10 *aQuerier)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts a record querier. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga8a1b24c6a6be56e24d395ec0f3fb2531(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab45eef004b7e0a5b9e2661d62f841b5a *aResolver)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts an SRV record resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga7d9436abe0afe4ebe160823a72c13867(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga108117ce7deff56bdc0835525605dc8b *aResolver)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts a TXT record resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga00a965cc88a7c9f92a330d78a7d66833(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab20e6c4ed8712293c8cba1989287421c *aBroswer)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Stops a service browser. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga69837783922dea985ecb7067a5c01052(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae63eeb32e9cae80c9d644f12eead203e *aResolver)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Stops an IPv4 address resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga35750a2b7fa69574e01b34e6c14fdb55(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae63eeb32e9cae80c9d644f12eead203e *aResolver)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Stops an IPv6 address resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gac6da899fd481a1f8bcf88a4827c8e786(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaff8d1444c245bfc8d92835e02f9a9e10 *aQuerier)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Stops a record querier. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga2654ff6435a8625459a0d3daa1d34405(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1gab45eef004b7e0a5b9e2661d62f841b5a *aResolver)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Stops an SRV record resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga061eb22928aa4006e85fdf04246ac7cb(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga108117ce7deff56bdc0835525605dc8b *aResolver)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Stops a TXT record resolver. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5ca39ccf73074f86bbc0602d4dd68a34(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga2e76933ab8bdc78033a2a2ff1a474ac5 *aHost)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Unregisters a host on mDNS. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae62ae19db2e22557e8556d7fcc34fe9d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5b2c45847339df26fb5e8a2c8f9fa4fc *aKey)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Unregisters a key record on mDNS. |
| `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga3f188595b17b2bd7f2b7032a91df9731(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga59c635a33449b8cda1ebd8f487937b61 *aService)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Unregisters a service on mDNS module. |

| ### Structs ||
|---|---|
| [otMdnsCacheInfo](https://openthread.io/reference/struct/ot-mdns-cache-info) | Represents additional information about a browser/resolver and its cached results. |
| [otMdnsLocalHostAddress](https://openthread.io/reference/struct/ot-mdns-local-host-address) | Represents a local host IPv4 or IPv6 address entry. |

## Enumerations

### otMdnsEntryState

```
 otMdnsEntryState
```
Represents a host/service/key entry state.

| Properties ||
|---|---|
| `OT_MDNS_ENTRY_STATE_CONFLICT` | Name conflict was detected. |
| `OT_MDNS_ENTRY_STATE_PROBING` | Probing to claim the name. |
| `OT_MDNS_ENTRY_STATE_REGISTERED` | Entry is successfully registered. |
| `OT_MDNS_ENTRY_STATE_REMOVING` | Entry is being removed (sending "goodbye" announcements). |

## Typedefs

### otMdnsAddressAndTtl

```
otPlatDnssdAddressAndTtl otMdnsAddressAndTtl
```
Represents a discovered host address and its TTL.

### otMdnsAddressCallback

```
otPlatDnssdAddressCallback otMdnsAddressCallback
```
Represents the callback function pointer type use to report an IPv6/IPv4 address resolve result.

### otMdnsAddressResolver

```
otPlatDnssdAddressResolver otMdnsAddressResolver
```
Represents an address resolver.

Refer to `https://openthread.io/reference/struct/ot-plat-dnssd-address-resolver` for documentation of member fields and `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaa2faaa83b028eab4aa25dff87958097a` or `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga59cb92ea248098df25cd2f994366015b` for how they are used.

### otMdnsAddressResult

```
otPlatDnssdAddressResult otMdnsAddressResult
```
Represents address resolver result.

### otMdnsBrowseCallback

```
otPlatDnssdBrowseCallback otMdnsBrowseCallback
```
Represents the callback function pointer type used to report a browse result.

### otMdnsBrowseResult

```
otPlatDnssdBrowseResult otMdnsBrowseResult
```
Represents a browse result.

### otMdnsBrowser

```
otPlatDnssdBrowser otMdnsBrowser
```
Represents a service browser.

Refer to `https://openthread.io/reference/struct/ot-plat-dnssd-browser` for documentation of member fields and `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gac1fb5610093e93d53ea40ee7477b2668` for how they are used.

### otMdnsCacheInfo

```
struct otMdnsCacheInfo otMdnsCacheInfo
```
Represents additional information about a browser/resolver and its cached results.

### otMdnsConflictCallback

```
void(* otMdnsConflictCallback)(otInstance *aInstance, const char *aName, const char *aServiceType)
```
Represents the callback function to report a detected name conflict after successful registration of an entry.

If a conflict is detected while registering an entry, it is reported through the provided `otMdnsRegisterCallback`. The `otMdnsConflictCallback` is used only when a name conflict is detected after an entry has been successfully registered.

A non-NULL `aServiceType` indicates that conflict is for a service entry. In this case `aName` specifies the service instance label (treated as as a single DNS label and can potentially include dot `.` character).

A NULL `aServiceType` indicates that conflict is for a host entry. In this case `Name` specifies the host name. It does not include the domain name.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aName` | The host name or the service instance label. | | `[in] aServiceType` | The service type (e.g., `_tst._udp`). | |

### otMdnsEntryState

```
enum otMdnsEntryState otMdnsEntryState
```
Represents a host/service/key entry state.

### otMdnsHost

```
otPlatDnssdHost otMdnsHost
```
Represents an mDNS host.

This type is used to register or unregister a host (`https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga24a0c7d6d3506951f7d1f98a8d6276c6` and `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5ca39ccf73074f86bbc0602d4dd68a34`).

See the description of each function for more details on how different fields are used in each case.

### otMdnsIterator

```
struct otMdnsIterator otMdnsIterator
```
Represents an mDNS entry iterator.

### otMdnsKey

```
otPlatDnssdKey otMdnsKey
```
Represents an mDNS key record.

See `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaeddceffd5132e5e7deebe91e1f9d963c`, `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae62ae19db2e22557e8556d7fcc34fe9d` for more details about fields in each case.

### otMdnsLocalHostAddress

```
struct otMdnsLocalHostAddress otMdnsLocalHostAddress
```
Represents a local host IPv4 or IPv6 address entry.

### otMdnsRecordCallback

```
otPlatDnssdRecordCallback otMdnsRecordCallback
```
Represents the callback function used to report a record querier result.

### otMdnsRecordQuerier

```
otPlatDnssdRecordQuerier otMdnsRecordQuerier
```
Represents a record querier.

### otMdnsRecordResult

```
otPlatDnssdRecordResult otMdnsRecordResult
```
Represents a record query result.

### otMdnsRegisterCallback

```
otPlatDnssdRegisterCallback otMdnsRegisterCallback
```
Represents the callback function to report the outcome of a host, service, or key registration request.

The outcome of a registration request is reported back by invoking this callback with one of the following `aError` inputs:


- `OT_ERROR_NONE` indicates registration was successful.
- `OT_ERROR_DUPLICATED` indicates a name conflict while probing, i.e., name is claimed by another mDNS responder.

<br />

See `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga24a0c7d6d3506951f7d1f98a8d6276c6`, `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga553e5327284fe5f5baebc8d65e2c8448`, and `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaeddceffd5132e5e7deebe91e1f9d963c` for more details about when the callback will be invoked.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aRequestId` | The request ID. | | `[in] aError` | Error indicating the outcome of request. | |

### otMdnsRequestId

```
otPlatDnssdRequestId otMdnsRequestId
```
Represents a request ID (`uint32_t` value) for registering a host, a service, or a key service.

### otMdnsService

```
otPlatDnssdService otMdnsService
```
Represents an mDNS service.

This type is used to register or unregister a service (`https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga553e5327284fe5f5baebc8d65e2c8448` and `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga3f188595b17b2bd7f2b7032a91df9731`).

See the description of each function for more details on how different fields are used in each case.

### otMdnsSrvCallback

```
otPlatDnssdSrvCallback otMdnsSrvCallback
```
Represents the callback function pointer type used to report an SRV resolve result.

### otMdnsSrvResolver

```
otPlatDnssdSrvResolver otMdnsSrvResolver
```
Represents an SRV service resolver.

Refer to `https://openthread.io/reference/struct/ot-plat-dnssd-srv-resolver` for documentation of member fields and `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga8a1b24c6a6be56e24d395ec0f3fb2531` for how they are used.

### otMdnsSrvResult

```
otPlatDnssdSrvResult otMdnsSrvResult
```
Represents an SRV resolver result.

### otMdnsTxtCallback

```
otPlatDnssdTxtCallback otMdnsTxtCallback
```
Represents the callback function pointer type used to report a TXT resolve result.

### otMdnsTxtResolver

```
otPlatDnssdTxtResolver otMdnsTxtResolver
```
Represents a TXT service resolver.

Refer to `https://openthread.io/reference/struct/ot-plat-dnssd-txt-resolver` for documentation of member fields and `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga7d9436abe0afe4ebe160823a72c13867` for how they are used.

### otMdnsTxtResult

```
otPlatDnssdTxtResult otMdnsTxtResult
```
Represents a TXT resolver result.

## Functions

### otMdnsAllocateIterator

```
otMdnsIterator * otMdnsAllocateIterator(
  otInstance *aInstance
)
```
Allocates a new iterator.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

An allocated iterator must be freed by the caller using `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga78828b46b65dc2a8bddda5dc5b4a9ce8`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | |
| **Returns** | A pointer to the allocated iterator, or `NULL` if it fails to allocate. |

### otMdnsFreeIterator

```
void otMdnsFreeIterator(
  otInstance *aInstance,
  otMdnsIterator *aIterator
)
```
Frees a previously allocated iterator.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | The iterator to free. | |

### otMdnsGetAutoEnableMode

```
bool otMdnsGetAutoEnableMode(
  otInstance *aInstance
)
```
Indicates whether the auto-enable mode is enabled or disabled.

Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | |
| Return Values | |---|---| | `TRUE` | The auto-enable mode is enabled. | | `FALSE` | The auto-enable mode is disabled. | |

### otMdnsGetLocalHostName

```
const char * otMdnsGetLocalHostName(
  otInstance *aInstance
)
```
Gets the local host name.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | |
| **Returns** | The local host name. |

### otMdnsGetNextBrowser

```
otError otMdnsGetNextBrowser(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsBrowser *aBrowser,
  otMdnsCacheInfo *aInfo
)
```
Iterates over browsers.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aBrowser` is populated with information about the next browser. The `mCallback` field is always set to `NULL` as there may be multiple active browsers with different callbacks. Other pointers within the `otMdnsBrowser` structure remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator. | | `[out] aBrowser` | Pointer to an `otMdnsBrowser` to return the information about the next browser. | | `[out] aInfo` | Pointer to an `https://openthread.io/reference/struct/ot-mdns-cache-info` to return additional information. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aBrowser`, `aInfo`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | `aIterator` is not valid. | |

### otMdnsGetNextHost

```
otError otMdnsGetNextHost(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsHost *aHost,
  otMdnsEntryState *aState
)
```
Iterates over registered host entries.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aHost` is populated with information about the next host. Pointers within the `otMdnsHost` structure (like `mName`) remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator. | | `[out] aHost` | Pointer to an `otMdnsHost` to return the information about the next host entry. | | `[out] aState` | Pointer to an `otMdnsEntryState` to return the entry state. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aHost`, `aState`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | `aIterator` is not valid. | |

### otMdnsGetNextIp4AddressResolver

```
otError otMdnsGetNextIp4AddressResolver(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsAddressResolver *aResolver,
  otMdnsCacheInfo *aInfo
)
```
Iterates over IPv4 address resolvers.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aResolver` is populated with information about the next resolver. The `mCallback` field is always set to `NULL` as there may be multiple active resolvers with different callbacks. Other pointers within the `otMdnsAddressResolver` structure remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator. | | `[out] aResolver` | Pointer to an `otMdnsAddressResolver` to return the information about the next resolver. | | `[out] aInfo` | Pointer to an `https://openthread.io/reference/struct/ot-mdns-cache-info` to return additional information. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aResolver`, `aInfo`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | `aIterator` is not valid. | |

### otMdnsGetNextIp6AddressResolver

```
otError otMdnsGetNextIp6AddressResolver(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsAddressResolver *aResolver,
  otMdnsCacheInfo *aInfo
)
```
Iterates over IPv6 address resolvers.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aResolver` is populated with information about the next resolver. The `mCallback` field is always set to `NULL` as there may be multiple active resolvers with different callbacks. Other pointers within the `otMdnsAddressResolver` structure remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator. | | `[out] aResolver` | Pointer to an `otMdnsAddressResolver` to return the information about the next resolver. | | `[out] aInfo` | Pointer to an `https://openthread.io/reference/struct/ot-mdns-cache-info` to return additional information. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aResolver`, `aInfo`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | `aIterator` is not valid. | |

### otMdnsGetNextKey

```
otError otMdnsGetNextKey(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsKey *aKey,
  otMdnsEntryState *aState
)
```
Iterates over registered key entries.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aKey` is populated with information about the next key. Pointers within the `otMdnsKey` structure (like `mName`) remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator to use. | | `[out] aKey` | Pointer to an `otMdnsKey` to return the information about the next key entry. | | `[out] aState` | Pointer to an `otMdnsEntryState` to return the entry state. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aKey`, `aState`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | Iterator is not valid. | |

### otMdnsGetNextLocalHostAddress

```
otError otMdnsGetNextLocalHostAddress(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsLocalHostAddress *aAddress
)
```
Iterates over the local host IPv6 and IPv4 addresses tracked by OpenThread mDNS module.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

The platform layer is responsible for monitoring and reporting all host IPv4 and IPv6 addresses to the OpenThread mDNS module, which then tracks the full address list (see `https://openthread.io/reference/group/plat-mdns#group__plat-mdns_1ga2205f9ddba9c1ea84315960229143f9d`). This function allows iteration through this tracked list, primarily intended for information and debugging purposes.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[out] aIterator` | Pointer to the iterator to use. | | `[out] aAddress` | Pointer to an `https://openthread.io/reference/struct/ot-mdns-local-host-address` to output the next address entry. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | The `aAddress`, and `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARGS` | Iterator is not valid. | |

### otMdnsGetNextRecordQuerier

```
otError otMdnsGetNextRecordQuerier(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsRecordQuerier *aQuerier,
  otMdnsCacheInfo *aInfo
)
```
Iterates over record querier entries.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aQuerier` is populated with information about the next querier . The `mCallback` field is always set to `NULL` as there may be multiple active querier with different callbacks. Other pointers within the `otMdnsRecordQuerier` structure remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator. | | `[out] aQuerier` | Pointer to an `otMdnsRecordQuerier` to return the information about the next one. | | `[out] aInfo` | Pointer to an `https://openthread.io/reference/struct/ot-mdns-cache-info` to return additional information. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aQuerier`, `aInfo`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | `aIterator` is not valid. | |

### otMdnsGetNextService

```
otError otMdnsGetNextService(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsService *aService,
  otMdnsEntryState *aState
)
```
Iterates over registered service entries.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aService` is populated with information about the next service . Pointers within the `otMdnsService` structure (like `mServiceType`, `mSubTypeLabels`) remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator to use. | | `[out] aService` | Pointer to an `otMdnsService` to return the information about the next service entry. | | `[out] aState` | Pointer to an `otMdnsEntryState` to return the entry state. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aService`, `aState`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | `aIterator` is not valid. | |

### otMdnsGetNextSrvResolver

```
otError otMdnsGetNextSrvResolver(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsSrvResolver *aResolver,
  otMdnsCacheInfo *aInfo
)
```
Iterates over SRV resolvers.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aResolver` is populated with information about the next resolver. The `mCallback` field is always set to `NULL` as there may be multiple active resolvers with different callbacks. Other pointers within the `otMdnsSrvResolver` structure remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator. | | `[out] aResolver` | Pointer to an `otMdnsSrvResolver` to return the information about the next resolver. | | `[out] aInfo` | Pointer to an `https://openthread.io/reference/struct/ot-mdns-cache-info` to return additional information. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aResolver`, `aInfo`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | `aIterator` is not valid. | |

### otMdnsGetNextTxtResolver

```
otError otMdnsGetNextTxtResolver(
  otInstance *aInstance,
  otMdnsIterator *aIterator,
  otMdnsTxtResolver *aResolver,
  otMdnsCacheInfo *aInfo
)
```
Iterates over TXT resolvers.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_ENTRY_ITERATION_API_ENABLE`.

On success, `aResolver` is populated with information about the next resolver. The `mCallback` field is always set to `NULL` as there may be multiple active resolvers with different callbacks. Other pointers within the `otMdnsTxtResolver` structure remain valid until the next call to any OpenThread stack's public or platform API/callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aIterator` | Pointer to the iterator. | | `[out] aResolver` | Pointer to an `otMdnsTxtResolver` to return the information about the next resolver. | | `[out] aInfo` | Pointer to an `https://openthread.io/reference/struct/ot-mdns-cache-info` to return additional information. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aResolver`, `aInfo`, \& `aIterator` are updated successfully. | | `OT_ERROR_NOT_FOUND` | Reached the end of the list. | | `OT_ERROR_INVALID_ARG` | `aIterator` is not valid. | |

### otMdnsIsEnabled

```
bool otMdnsIsEnabled(
  otInstance *aInstance
)
```
Indicates whether the mDNS module is enabled.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | |
| Return Values | |---|---| | `TRUE` | The mDNS module is enabled | | `FALSE` | The mDNS module is disabled. | |

### otMdnsIsQuestionUnicastAllowed

```
bool otMdnsIsQuestionUnicastAllowed(
  otInstance *aInstance
)
```
Indicates whether mDNS module is allowed to send "QU" questions requesting unicast response.

<br />

| Details ||
|---|---|
| Return Values | |---|---| | `TRUE` | The mDNS module is allowed to send "QU" questions. | | `FALSE` | The mDNS module is not allowed to send "QU" questions. | |

### otMdnsIsVerboseLoggingEnabled

```
bool otMdnsIsVerboseLoggingEnabled(
  otInstance *aInstance
)
```
Indicates whether verbose logging is enabled for the mDNS module.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_VERBOSE_LOGGING_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| Return Values | |---|---| | `TRUE` | If verbose logging is enabled. | | `FALSE` | If verbose logging is disabled. | |

### otMdnsRegisterHost

```
otError otMdnsRegisterHost(
  otInstance *aInstance,
  const otMdnsHost *aHost,
  otMdnsRequestId aRequestId,
  otMdnsRegisterCallback aCallback
)
```
Registers or updates a host on mDNS.

The fields in `aHost` follow these rules:


- The `mHostName` field specifies the host name to register (e.g., "myhost"). MUST NOT contain the domain name.
- The `mAddresses` is array of IPv6 addresses to register with the host. `mAddressesLength` provides the number of entries in `mAddresses` array.
- The `mAddresses` array can be empty with zero `mAddressesLength`. In this case, mDNS will treat it as if host is unregistered and stops advertising any addresses for this the host name.
- The `mTtl` specifies the TTL if non-zero. If zero, the mDNS core will choose the default TTL of 120 seconds.
- Other fields in `aHost` structure are ignored in an `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga24a0c7d6d3506951f7d1f98a8d6276c6` call.

<br />

This function can be called again for the same `mHostName` to update a previously registered host entry, for example, to change the list of addresses of the host. In this case, the mDNS module will send "goodbye" announcements for any previously registered and now removed addresses and announce any newly added addresses.

The outcome of the registration request is reported back by invoking the provided `aCallback` with `aRequestId` as its input and one of the following `aError` inputs:


- `OT_ERROR_NONE` indicates registration was successful.
- `OT_ERROR_DULICATED` indicates a name conflict while probing, i.e., name is claimed by another mDNS responder.

<br />

For caller convenience, the OpenThread mDNS module guarantees that the callback will be invoked after this function returns, even in cases of immediate registration success. The `aCallback` can be `NULL` if caller does not want to be notified of the outcome.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aHost` | Information about the host to register. | | `[in] aRequestId` | The ID associated with this request. | | `[in] aCallback` | The callback function pointer to report the outcome (can be NULL if not needed). | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully started registration. `aCallback` will report the outcome. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | The name in `aHost` is invalid. | |

### otMdnsRegisterKey

```
otError otMdnsRegisterKey(
  otInstance *aInstance,
  const otMdnsKey *aKey,
  otMdnsRequestId aRequestId,
  otMdnsRegisterCallback aCallback
)
```
Registers or updates a key record on mDNS module.

The fields in `aKey` follow these rules:


- If the key is associated with a host entry, the `mName` field specifies the host name and the `mServiceType` MUST be NULL.
- If the key is associated with a service entry, the `mName` filed specifies the service instance label (always treated as a single label) and the `mServiceType` filed specifies the service type (e.g., "_tst._udp"). In this case the DNS name for key record is `.`.
- The `mKeyData` field contains the key record's data with `mKeyDataLength` as its length in byes.
- The `mTtl` specifies the TTL if non-zero. If zero, the mDNS module will use the default TTL of 120 seconds.
- Other fields in `aKey` structure are ignored in an `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gaeddceffd5132e5e7deebe91e1f9d963c` call.

<br />

This function can be called again for the same name to updated a previously registered key entry, for example, to change the key data or TTL.

Regarding the invocation of the `aCallback`, this function behaves in the same way as described in `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga24a0c7d6d3506951f7d1f98a8d6276c6`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aKey` | Information about the key record to register. | | `[in] aRequestId` | The ID associated with this request. | | `[in] aCallback` | The callback function pointer to report the outcome (can be NULL if not needed). | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully started registration. `aCallback` will report the outcome. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aKey` is not valid. | |

### otMdnsRegisterService

```
otError otMdnsRegisterService(
  otInstance *aInstance,
  const otMdnsService *aService,
  otMdnsRequestId aRequestId,
  otMdnsRegisterCallback aCallback
)
```
Registers or updates a service on mDNS.

The fields in `aService` follow these rules:


- The `mServiceInstance` specifies the service instance label. It is treated as a single DNS name label. It may contain dot `.` character which is allowed in a service instance label.
- The `mServiceType` specifies the service type (e.g., "_tst._udp"). It is treated as multiple dot `.` separated labels. It MUST NOT contain the domain name.
- The `mHostName` field specifies the host name of the service if it is not NULL. Otherwise, if it is NULL, it indicates that this service is for the local host (this device itself).
- The `mSubTypeLabels` is an array of strings representing sub-types associated with the service. Each array entry is a sub-type label. The `mSubTypeLabels can be NULL if there is no sub-type. Otherwise, the array length is specified by`mSubTypeLabelsLength`.`
- `The`mTxtData`and`mTxtDataLength`specify the encoded TXT data. The`mTxtData`can be NULL or`mTxtDataLength` can be zero to specify an empty TXT data. In this case mDNS module will use a single zero byte`\[ 0 \]\` as the TXT data.
- The `mPort`, `mWeight`, and `mPriority` specify the service's parameters as specified in DNS SRV record.
- The `mTtl` specifies the TTL if non-zero. If zero, the mDNS module will use the default TTL of 120 seconds.
- Other fields in `aService` structure are ignored in an `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga553e5327284fe5f5baebc8d65e2c8448` call.

<br />

This function can be called again for the same `mServiceInstance` and `mServiceType` to update a previously registered service entry, for example, to change the sub-types list, or update any parameter such as port, weight, priority, TTL, or host name. The mDNS module will send announcements for any changed info, e.g., will send "goodbye" announcements for any removed sub-types and announce any newly added sub-types.

Regarding the invocation of the `aCallback`, this function behaves in the same way as described in `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga24a0c7d6d3506951f7d1f98a8d6276c6`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aService` | Information about the service to register. | | `[in] aRequestId` | The ID associated with this request. | | `[in] aCallback` | The callback function pointer to report the outcome (can be NULL if not needed). | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully started registration. `aCallback` will report the outcome. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aService` (instance, service type, sub-types, or host) is not valid. | |

### otMdnsSetAutoEnableMode

```
void otMdnsSetAutoEnableMode(
  otInstance *aInstance,
  bool aEnable
)
```
Enables or disables the mDNS auto-enable mode.

Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE`.

When this mode is enabled, the mDNS module uses the same infrastructure network interface as the Border Routing manager. The mDNS module is then automatically enabled or disabled based on the operational state of that interface (see `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gac8da634c6f717dcd2070ae0ecb5ea9c9` and `https://openthread.io/reference/group/plat-infra-if#group__plat-infra-if_1ga972ec6661c5c3f2d917dbb55a954f622`).

It is recommended to use the auto-enable mode on Border Routers. The default state of this mode at initialization is controlled by the `OPENTHREAD_CONFIG_MULTICAST_DNS_AUTO_ENABLE_ON_INFRA_IF` configuration.

The auto-enable mode can be disabled by a call to `otMdnsSetAutoEnableMode(false)` or by an explicit call to `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga129aa9fda4f4c35f0f2e4be0478fde7d`. Deactivating the auto-enable mode with `otMdnsSetAutoEnableMode(false)` will not change the current operational state of the mDNS module (e.g., if it is currently enabled, it remains enabled).

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aEnable` | A boolean to enable or disable the auto-enable mode. | |

### otMdnsSetConflictCallback

```
void otMdnsSetConflictCallback(
  otInstance *aInstance,
  otMdnsConflictCallback aCallback
)
```
Sets the post-registration conflict callback.

If a conflict is detected while registering an entry, it is reported through the provided `otMdnsRegisterCallback`. The `otMdnsConflictCallback` is used only when a name conflict is detected after an entry has been successfully registered.

`aCallback` can be set to `NULL` if not needed. Subsequent calls will replace any previously set callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aCallback` | The conflict callback. | |

### otMdnsSetEnabled

```
otError otMdnsSetEnabled(
  otInstance *aInstance,
  bool aEnable,
  uint32_t aInfraIfIndex
)
```
Enables or disables the mDNS module.

The mDNS module should be enabled before registration any host, service, or key entries. Disabling mDNS will immediately stop all operations and any communication (multicast or unicast tx) and remove any previously registered entries without sending any "goodbye" announcements or invoking their callback. Once disabled, all currently active browsers and resolvers are stopped.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aEnable` | Boolean to indicate whether to enable (on `TRUE`) or disable (on `FALSE`). | | `[in] aInfraIfIndex` | The network interface index for mDNS operation. Value is ignored when disabling | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Enabled or disabled the mDNS module successfully. | | `OT_ERROR_FAILED` | Failed to enable/disable mDNS. | |

### otMdnsSetLocalHostName

```
otError otMdnsSetLocalHostName(
  otInstance *aInstance,
  const char *aName
)
```
Sets the local host name.

The local host name can be set only when the mDNS module is disabled. If not set the mDNS module itself will auto-generate the local host name.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aName` | The local host name to use, can be to `NULL` to allow the mDNS module to choose the name. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | The local host name was successfully set. | | `OT_ERROR_INVALID_STATE` | mDNS module is already enabled. | |

### otMdnsSetQuestionUnicastAllowed

```
void otMdnsSetQuestionUnicastAllowed(
  otInstance *aInstance,
  bool aAllow
)
```
Sets whether the mDNS module is allowed to send questions requesting unicast responses referred to as "QU" questions.

The "QU" questions request unicast responses, in contrast to "QM" questions which request multicast responses.

When allowed, the first probe will be sent as a "QU" question. This API can be used to address platform limitation where platform socket cannot accept unicast response received on mDNS port (due to it being already bound).

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aAllow` | Indicates whether or not to allow "QU" questions. | |

### otMdnsSetVerboseLoggingEnabled

```
void otMdnsSetVerboseLoggingEnabled(
  otInstance *aInstance,
  bool aEnable
)
```
Enables or disables verbose logging for the mDNS module at run-time.

Requires `OPENTHREAD_CONFIG_MULTICAST_DNS_VERBOSE_LOGGING_ENABLE`.

The initial state of verbose logging (enabled or disabled at startup) is determined by the configuration `OPENTHREAD_CONFIG_MULTICAST_DEFAULT_DNS_VERBOSE_LOGGING_STATE`.

When enabled, the mDNS module emits verbose logs for every sent or received mDNS message, including the header and all question and resource records. These logs are generated regardless of the current log level configured on the device.

This feature can generate a large volume of logs, so its use is recommended only during development, integration, or debugging.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aEnable` | TRUE to enable verbose logging, FALSE to disable. | |

### otMdnsStartBrowser

```
otError otMdnsStartBrowser(
  otInstance *aInstance,
  const otMdnsBrowser *aBrowser
)
```
Starts a service browser.

Initiates a continuous search for the specified `mServiceType` in `aBrowser`. For sub-type services, use `mSubTypeLabel` to define the sub-type, for base services, set `mSubTypeLabel` to NULL.

Discovered services are reported through the `mCallback` function in `aBrowser`. Services that have been removed are reported with a TTL value of zero. The callback may be invoked immediately with cached information (if available) and potentially before this function returns. When cached results are used, the reported TTL value will reflect the original TTL from the last received response.

Multiple browsers can be started for the same service, provided they use different callback functions.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aBrowser` | The browser to be started. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Browser started successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_ALREADY` | An identical browser (same service and callback) is already active. | | `OT_ERROR_INVALID_ARGS` | A name in `aBrowser` is invalid, or the callback is `NULL`. | |

### otMdnsStartIp4AddressResolver

```
otError otMdnsStartIp4AddressResolver(
  otInstance *aInstance,
  const otMdnsAddressResolver *aResolver
)
```
Starts an IPv4 address resolver.

Initiates a continuous IPv4 address resolver for the specified host name in `aResolver`.

Discovered addresses are reported through the `mCallback` function in `aResolver`. The IPv4 addresses are represented using the IPv4-mapped IPv6 address format in `mAddresses` array. The callback is invoked whenever addresses are added or removed, providing an updated list. If all addresses are removed, the callback is invoked with an empty list (`mAddresses` will be NULL, and `mAddressesLength` will be zero).

The callback may be invoked immediately with cached information (if available) and potentially before this function returns. When cached result is used, the reported TTL values will reflect the original TTL from the last received response.

Multiple resolvers can be started for the same host name, provided they use different callback functions.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResolver` | The resolver to be started. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Resolver started successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_ALREADY` | An identical resolver (same host and callback) is already active. | | `OT_ERROR_INVALID_ARGS` | A name in `aResolver` is invalid, or the callback is `NULL`. | |

### otMdnsStartIp6AddressResolver

```
otError otMdnsStartIp6AddressResolver(
  otInstance *aInstance,
  const otMdnsAddressResolver *aResolver
)
```
Starts an IPv6 address resolver.

Initiates a continuous IPv6 address resolver for the specified host name in `aResolver`.

Discovered addresses are reported through the `mCallback` function in `aResolver`. The callback is invoked whenever addresses are added or removed, providing an updated list. If all addresses are removed, the callback is invoked with an empty list (`mAddresses` will be NULL, and `mAddressesLength` will be zero).

The callback may be invoked immediately with cached information (if available) and potentially before this function returns. When cached result is used, the reported TTL values will reflect the original TTL from the last received response.

Multiple resolvers can be started for the same host name, provided they use different callback functions.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResolver` | The resolver to be started. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Resolver started successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_ALREADY` | An identical resolver (same host and callback) is already active. | | `OT_ERROR_INVALID_ARGS` | A name in `aResolver` is invalid, or the callback is `NULL`. | |

### otMdnsStartRecordQuerier

```
otError otMdnsStartRecordQuerier(
  otInstance *aInstance,
  const otMdnsRecordQuerier *aQuerier
)
```
Starts a record querier.

Initiates a continuous query for a given `mRecordType` as specified in `aQuerier`. The queried name is specified by the combination of `mFirstLabel` and `mNextLabels` (optional rest of the labels) in `aQuerier`. The `mFirstLabel` MUST be non-NULL but `mNextLabels` can be `NULL` if there are no other labels. The `mNextLabels` MUST NOT include the domain name. The reason for a separate first label is to allow it to include a dot `.` character (as allowed for service instance labels).

Discovered results are reported through the `mCallback` function in `aQuerier`, providing the record data bytes (RDATA). For NS, CNAME, SOA, PTR, MX, RP, AFSDB, RT, PX, SRV, KX, DNAME, and NSEC record types, the RDATA format contains one or more DNS names (which may use DNS name compression). For the above list, the reported record data bytes via `mCallback` will be decompressed to contain the full DNS name(s). For all other record types, the record data bytes are provided exactly as they appear in the received mDNS response. This aligns the implementation with RFC 6762 (section 18.14) regarding the use of name compression.

A removed record data is indicated with a TTL value of zero. The callback may be invoked immediately with cached information (if available) and potentially before this function returns. When cached results are used, the reported TTL value will reflect the original TTL from the last received response.

Multiple querier instances can be started for the same name, provided they use different callback functions.

The record querier MUST not be used for record types PTR, SRV, TXT, A, and AAAA. Otherwise, `OT_ERROR_INVALID_ARGS` will be returned. For these, browsers/resolvers can be used. This design is intentional to enable the implementation of an "opportunistic cache mechanism", where, depending on currently active service browsers/resolvers, the mDNS implementation will also monitor and cache related records (e.g., when a service is resolved, the address records associated with its host name are cached even if there is no active address resolver for this hostname).

The `aQuerier` and all its contained information (strings) are only valid during this call. The platform MUST save a copy of the information if it wants to retain the information after returning from this function.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aQuerier` | The record querier to be started. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Record `aQuerier` started successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_ALREADY` | An identical querier (same name, record type, and callback) is already active. | | `OT_ERROR_INVALID_ARGS` | The `mRecordType` in `aQuerier` is invalid (MUST use browser/resolvers), or a name in `aQuerier` is invalid, or the callback is `NULL`. | |

### otMdnsStartSrvResolver

```
otError otMdnsStartSrvResolver(
  otInstance *aInstance,
  const otMdnsSrvResolver *aResolver
)
```
Starts an SRV record resolver.

Initiates a continuous SRV record resolver for the specified service in `aResolver`.

Discovered information is reported through the `mCallback` function in `aResolver`. When the service is removed it is reported with a TTL value of zero. In this case, `mHostName` may be NULL and other result fields (such as `mPort`) should be ignored.

The callback may be invoked immediately with cached information (if available) and potentially before this function returns. When cached result is used, the reported TTL value will reflect the original TTL from the last received response.

Multiple resolvers can be started for the same service, provided they use different callback functions.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResolver` | The resolver to be started. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Resolver started successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_ALREADY` | An identical resolver (same service and callback) is already active. | | `OT_ERROR_INVALID_ARGS` | A name in `aResolver` is invalid, or the callback is `NULL`. | |

### otMdnsStartTxtResolver

```
otError otMdnsStartTxtResolver(
  otInstance *aInstance,
  const otMdnsTxtResolver *aResolver
)
```
Starts a TXT record resolver.

Initiates a continuous TXT record resolver for the specified service in `aResolver`.

Discovered information is reported through the `mCallback` function in `aResolver`. When the TXT record is removed it is reported with a TTL value of zero. In this case, `mTxtData` may be NULL, and other result fields (such as `mTxtDataLength`) should be ignored.

The callback may be invoked immediately with cached information (if available) and potentially before this function returns. When cached result is used, the reported TTL value will reflect the original TTL from the last received response.

Multiple resolvers can be started for the same service, provided they use different callback functions.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResolver` | The resolver to be started. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Resolver started successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_ALREADY` | An identical resolver (same service and callback) is already active. | | `OT_ERROR_INVALID_ARGS` | A name in `aResolver` is invalid, or the callback is `NULL`. | |

### otMdnsStopBrowser

```
otError otMdnsStopBrowser(
  otInstance *aInstance,
  const otMdnsBrowser *aBroswer
)
```
Stops a service browser.

No action is performed if no matching browser with the same service and callback is currently active.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aBrowser` | The browser to stop. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Browser stopped successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aBrowser` is invalid, or the callback is `NULL`. | |

### otMdnsStopIp4AddressResolver

```
otError otMdnsStopIp4AddressResolver(
  otInstance *aInstance,
  const otMdnsAddressResolver *aResolver
)
```
Stops an IPv4 address resolver.

No action is performed if no matching resolver with the same host name and callback is currently active.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResolver` | The resolver to stop. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Resolver stopped successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aResolver` is invalid, or the callback is `NULL`. | |

### otMdnsStopIp6AddressResolver

```
otError otMdnsStopIp6AddressResolver(
  otInstance *aInstance,
  const otMdnsAddressResolver *aResolver
)
```
Stops an IPv6 address resolver.

No action is performed if no matching resolver with the same host name and callback is currently active.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResolver` | The resolver to stop. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Resolver stopped successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aResolver` is invalid, or the callback is `NULL`. | |

### otMdnsStopRecordQuerier

```
otError otMdnsStopRecordQuerier(
  otInstance *aInstance,
  const otMdnsRecordQuerier *aQuerier
)
```
Stops a record querier.

No action is performed if no matching querier with the same name and callback is currently active.

The `aQuerier` and all its contained information (strings) are only valid during this call. The platform MUST save a copy of the information if it wants to retain the information after returning from this function.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aQuerier` | The record querier to be stopped. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Querier stopped successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | The `mRecordType` in `aQuerier` is invalid (MUST use browser/resolvers), or a name in `aQuerier` is invalid, or the callback is `NULL`. | |

### otMdnsStopSrvResolver

```
otError otMdnsStopSrvResolver(
  otInstance *aInstance,
  const otMdnsSrvResolver *aResolver
)
```
Stops an SRV record resolver.

No action is performed if no matching resolver with the same service and callback is currently active.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResolver` | The resolver to stop. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Resolver stopped successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aResolver` is invalid, or the callback is `NULL`. | |

### otMdnsStopTxtResolver

```
otError otMdnsStopTxtResolver(
  otInstance *aInstance,
  const otMdnsTxtResolver *aResolver
)
```
Stops a TXT record resolver.

No action is performed if no matching resolver with the same service and callback is currently active.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResolver` | The resolver to stop. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Resolver stopped successfully. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aResolver` is invalid, or the callback is `NULL`. | |

### otMdnsUnregisterHost

```
otError otMdnsUnregisterHost(
  otInstance *aInstance,
  const otMdnsHost *aHost
)
```
Unregisters a host on mDNS.

The fields in `aHost` follow these rules:


- The `mHostName` field specifies the host name to unregister (e.g., "myhost"). MUST NOT contain the domain name.
- Other fields in `aHost` structure are ignored in an `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga5ca39ccf73074f86bbc0602d4dd68a34` call.

<br />

If there is no previously registered host with the same name, no action is performed.

If there is a previously registered host with the same name, the mDNS module will send "goodbye" announcement for all previously advertised address records.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aHost` | Information about the host to unregister. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully unregistered host. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | The name in `aHost` is invalid. | |

### otMdnsUnregisterKey

```
otError otMdnsUnregisterKey(
  otInstance *aInstance,
  const otMdnsKey *aKey
)
```
Unregisters a key record on mDNS.

The fields in `aKey` follow these rules:


- If the key is associated with a host entry, the `mName` field specifies the host name and the `mServiceType` MUST be NULL.
- If the key is associated with a service entry, the `mName` filed specifies the service instance label (always treated as a single label) and the `mServiceType` filed specifies the service type (e.g., "_tst._udp"). In this case the DNS name for key record is `.`.
- Other fields in `aKey` structure are ignored in an `https://openthread.io/reference/group/api-mdns#group__api-mdns_1gae62ae19db2e22557e8556d7fcc34fe9d` call.

<br />

If there is no previously registered key with the same name, no action is performed.

If there is a previously registered key with the same name, the mDNS module will send "goodbye" announcements for the key record.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aKey` | Information about the key to unregister. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully unregistered key | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aKey` is not valid. | |

### otMdnsUnregisterService

```
otError otMdnsUnregisterService(
  otInstance *aInstance,
  const otMdnsService *aService
)
```
Unregisters a service on mDNS module.

The fields in `aService` follow these rules:


- The `mServiceInstance` specifies the service instance label. It is treated as a single DNS name label. It may contain dot `.` character which is allowed in a service instance label.
- The `mServiceType` specifies the service type (e.g., "_tst._udp"). It is treated as multiple dot `.` separated labels. It MUST NOT contain the domain name.
- Other fields in `aService` structure are ignored in an `https://openthread.io/reference/group/api-mdns#group__api-mdns_1ga3f188595b17b2bd7f2b7032a91df9731` call.

<br />

If there is no previously registered service with the same name, no action is performed.

If there is a previously registered service with the same name, the mDNS module will send "goodbye" announcements for all related records.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aService` | Information about the service to unregister. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully unregistered service. | | `OT_ERROR_INVALID_STATE` | mDNS module is not enabled. | | `OT_ERROR_INVALID_ARGS` | A name in `aService` (instance or service type) is not valid. | |

## Resources

OpenThread API Reference topics originate from the source code, available
on [GitHub](https://github.com/openthread/openthread/tree/main/include/openthread).
For more information, or to contribute to our documentation, refer to
[Resources](https://openthread.io/resources).