# DNS-SD (mDNS)

# DNS-SD (mDNS)

This module includes the platform abstraction for DNS-SD (e.g., mDNS) on the infrastructure network.

## Summary

The DNS-SD platform APIs are used only when `OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE` is enabled.

| ### Enumerations ||
|---|---|
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga48effe37eb07fe3bdeb6cd4680994873{ https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gga48effe37eb07fe3bdeb6cd4680994873aa002dbbc5f1123de59f108383955fbfd, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gga48effe37eb07fe3bdeb6cd4680994873ae89c460f5bf64bf0160d1498c9b0d9a4 }` | enumRepresents the state of the DNS-SD platform. |

| ### Typedefs ||
|---|---|
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga9389dc1ceb68fcf65cea8ba748f3ea06` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-address-and-ttl` Represents a discovered host address and its TTL. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga3b8b56615a8a4bfb1f618882be661e7f)(otInstance *aInstance, const otPlatDnssdAddressResult *aResult)` | typedef `void(*` Represents the callback function use to report a IPv6/IPv4 address resolve result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gae66098c537a20aadca78a4f43b0b0831` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-address-resolver` Represents an address resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaef7eec31b4228d2c05651aab462a9bf3` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-address-result` Represents address resolver result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga478ff156be627d5ef35e6a512e0e4770)(otInstance *aInstance, const otPlatDnssdBrowseResult *aResult)` | typedef `void(*` Represents the callback function used to report a browse result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga65cb1d8f70611e36dad083ef8482e522` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-browse-result` Represents a browse result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaed4360b05e7185e2adebfe822405514e` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-browser` Represents a service browser. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gab910b80d0b22573b85575f1b686b74c5` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-host` Represents a DNS-SD host. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaa155bc4d4d549600d5d2a3d1accdcc64` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-key` Represents a DNS-SD key record. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga32409833ea4a869e150588038fd2e37e)(otInstance *aInstance, const otPlatDnssdRecordResult *aResult)` | typedef `void(*` Represents the callback function used to report a record querier result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga1d71c1e91cc239bd72447fa2df11a346` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-record-querier` Represents a record querier. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gab1254cf1ee068522ff83690ed04adb90` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-record-result` Represents a record query result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga570e03d5bd480f76fc4c70f9c87c2bd5)(otInstance *aInstance, otPlatDnssdRequestId aRequestId, otError aError)` | typedef `void(*` Represents the callback function used when registering/unregistering a host or service. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6c475e668b2eceb746a2f17284ba0825` | typedef `uint32_t` Represents a request ID for registering/unregistering a service or host. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad00471e6ef963e824c7312e4b27b28fa` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-service` Represents a DNS-SD service. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga1fb602e340f9b18bf93ad79d629eb7ef)(otInstance *aInstance, const otPlatDnssdSrvResult *aResult)` | typedef `void(*` Represents the callback function used to report an SRV resolve result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gab1ce27ce0f3adb4e4cabbd849c1ec3a9` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-srv-resolver` Represents an SRV service resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga3ecdd1615f700d37b0453c88d0d61699` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-srv-result` Represents an SRV resolver result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gabe530ed2e266971fa150a9d871528d95` | typedef `enum https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga48effe37eb07fe3bdeb6cd4680994873` Represents the state of the DNS-SD platform. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gae5107bed5e99e9f7122411314755aad7)(otInstance *aInstance, const otPlatDnssdTxtResult *aResult)` | typedef `void(*` Represents the callback function used to report a TXT resolve result. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga7dff99bd870e38f79218a039db7542dc` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-txt-resolver` Represents a TXT service resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga5a19a9e01c7d869f3527b8fd58a7e791` | typedef `struct https://openthread.io/reference/struct/ot-plat-dnssd-txt-result` Represents a TXT resolver result. |

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad962040403c7fc0bc9fad247eed2fc28(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga48effe37eb07fe3bdeb6cd4680994873` Gets the current state of the DNS-SD module. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga8ec148f41f14746b2e61a4b77d50236f(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-host *aHost, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6c475e668b2eceb746a2f17284ba0825 aRequestId, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga570e03d5bd480f76fc4c70f9c87c2bd5 aCallback)` | `void` Registers or updates a host on the infrastructure network's DNS-SD module. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaf1f534e92391539679c1114805f7cfcf(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-key *aKey, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6c475e668b2eceb746a2f17284ba0825 aRequestId, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga570e03d5bd480f76fc4c70f9c87c2bd5 aCallback)` | `void` Registers or updates a key record on the infrastructure network's DNS-SD module. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga15b25fe94dfee3a78e38184fe1f22389(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-service *aService, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6c475e668b2eceb746a2f17284ba0825 aRequestId, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga570e03d5bd480f76fc4c70f9c87c2bd5 aCallback)` | `void` Registers or updates a service on the infrastructure network's DNS-SD module. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gac6e3a623452c80a1767baa8128274d1d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-browser *aBrowser)` | `void` Starts a service browser. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga51cca8cbc75657f2d01e575996e42a05(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-address-resolver *aResolver)` | `void` Starts an IPv4 address resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga5a52283b0f2c2df5ee154f9ff7dfaad5(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-address-resolver *aResolver)` | `void` Starts an IPv6 address resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga88768c91ceb4de994ef747606bcc7ccf(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-record-querier *aQuerier)` | `void` Starts a record querier. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gadf46b0fa0eab094e54dba7a9b86a1c1b(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-srv-resolver *aResolver)` | `void` Starts an SRV record resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga1300703724b983afcc59ed8ea93c979b(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-txt-resolver *aResolver)` | `void` Starts a TXT record resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gae5c64f4fde7d62134d48c81fc214b4ce(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Callback to notify state changes of the DNS-SD platform. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gacc21fbd85192c72e816f41a3426bf6de(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-browser *aBrowser)` | `void` Stops a service browser. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga5399ad235adc78ff646d761a3d1b2ad8(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-address-resolver *aResolver)` | `void` Stops an IPv4 address resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaef1253fae0e6f8a571fe42a5627163ce(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-address-resolver *aResolver)` | `void` Stops an IPv6 address resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga72b840fb842c5bcf0bc07ba71ea7c8b3(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-record-querier *aQuerier)` | `void` Stops a record querier. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gacb8967877f3726ffde2071cf315ac649(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-srv-resolver *aResolver)` | `void` Stops an SRV record resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga5b68252057122bee77fce5ccc7486915(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-txt-resolver *aResolver)` | `void` Stops a TXT record resolver. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6f374039a6f5059870a8670392b5e843(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-host *aHost, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6c475e668b2eceb746a2f17284ba0825 aRequestId, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga570e03d5bd480f76fc4c70f9c87c2bd5 aCallback)` | `void` Unregisters a host on the infrastructure network's DNS-SD module. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaef09d752d81a9004b3e80637389262ee(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-key *aKey, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6c475e668b2eceb746a2f17284ba0825 aRequestId, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga570e03d5bd480f76fc4c70f9c87c2bd5 aCallback)` | `void` Unregisters a key record on the infrastructure network's DNS-SD module. |
| `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad706b2209bf8324dc98b87a59789de5c(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-plat-dnssd-service *aService, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6c475e668b2eceb746a2f17284ba0825 aRequestId, https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga570e03d5bd480f76fc4c70f9c87c2bd5 aCallback)` | `void` Unregisters a service on the infrastructure network's DNS-SD module. |

| ### Structs ||
|---|---|
| [otPlatDnssdAddressAndTtl](https://openthread.io/reference/struct/ot-plat-dnssd-address-and-ttl) | Represents a discovered host address and its TTL. |
| [otPlatDnssdAddressResolver](https://openthread.io/reference/struct/ot-plat-dnssd-address-resolver) | Represents an address resolver. |
| [otPlatDnssdAddressResult](https://openthread.io/reference/struct/ot-plat-dnssd-address-result) | Represents address resolver result. |
| [otPlatDnssdBrowseResult](https://openthread.io/reference/struct/ot-plat-dnssd-browse-result) | Represents a browse result. |
| [otPlatDnssdBrowser](https://openthread.io/reference/struct/ot-plat-dnssd-browser) | Represents a service browser. |
| [otPlatDnssdHost](https://openthread.io/reference/struct/ot-plat-dnssd-host) | Represents a DNS-SD host. |
| [otPlatDnssdKey](https://openthread.io/reference/struct/ot-plat-dnssd-key) | Represents a DNS-SD key record. |
| [otPlatDnssdRecordQuerier](https://openthread.io/reference/struct/ot-plat-dnssd-record-querier) | Represents a record querier. |
| [otPlatDnssdRecordResult](https://openthread.io/reference/struct/ot-plat-dnssd-record-result) | Represents a record query result. |
| [otPlatDnssdService](https://openthread.io/reference/struct/ot-plat-dnssd-service) | Represents a DNS-SD service. |
| [otPlatDnssdSrvResolver](https://openthread.io/reference/struct/ot-plat-dnssd-srv-resolver) | Represents an SRV service resolver. |
| [otPlatDnssdSrvResult](https://openthread.io/reference/struct/ot-plat-dnssd-srv-result) | Represents an SRV resolver result. |
| [otPlatDnssdTxtResolver](https://openthread.io/reference/struct/ot-plat-dnssd-txt-resolver) | Represents a TXT service resolver. |
| [otPlatDnssdTxtResult](https://openthread.io/reference/struct/ot-plat-dnssd-txt-result) | Represents a TXT resolver result. |

## Enumerations

### otPlatDnssdState

```
 otPlatDnssdState
```
Represents the state of the DNS-SD platform.

| Properties ||
|---|---|
| `OT_PLAT_DNSSD_READY` | Running and ready to register service or host. |
| `OT_PLAT_DNSSD_STOPPED` | Stopped and unable to register any service or host, or start any browser/resolver. |

## Typedefs

### otPlatDnssdAddressAndTtl

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

### otPlatDnssdAddressCallback

```
void(* otPlatDnssdAddressCallback)(otInstance *aInstance, const otPlatDnssdAddressResult *aResult)
```
Represents the callback function use to report a IPv6/IPv4 address resolve result.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResult` | The address resolve result. | |

### otPlatDnssdAddressResolver

```
struct otPlatDnssdAddressResolver otPlatDnssdAddressResolver
```
Represents an address resolver.

### otPlatDnssdAddressResult

```
struct otPlatDnssdAddressResult otPlatDnssdAddressResult
```
Represents address resolver result.

### otPlatDnssdBrowseCallback

```
void(* otPlatDnssdBrowseCallback)(otInstance *aInstance, const otPlatDnssdBrowseResult *aResult)
```
Represents the callback function used to report a browse result.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResult` | The browse result. | |

### otPlatDnssdBrowseResult

```
struct otPlatDnssdBrowseResult otPlatDnssdBrowseResult
```
Represents a browse result.

### otPlatDnssdBrowser

```
struct otPlatDnssdBrowser otPlatDnssdBrowser
```
Represents a service browser.

### otPlatDnssdHost

```
struct otPlatDnssdHost otPlatDnssdHost
```
Represents a DNS-SD host.

See `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga8ec148f41f14746b2e61a4b77d50236f`, `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6f374039a6f5059870a8670392b5e843` for more details about fields in each case.

### otPlatDnssdKey

```
struct otPlatDnssdKey otPlatDnssdKey
```
Represents a DNS-SD key record.

See `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaf1f534e92391539679c1114805f7cfcf`, `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaef09d752d81a9004b3e80637389262ee` for more details about fields in each case.

### otPlatDnssdRecordCallback

```
void(* otPlatDnssdRecordCallback)(otInstance *aInstance, const otPlatDnssdRecordResult *aResult)
```
Represents the callback function used to report a record querier result.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResult` | The record querier result. | |

### otPlatDnssdRecordQuerier

```
struct otPlatDnssdRecordQuerier otPlatDnssdRecordQuerier
```
Represents a record querier.

### otPlatDnssdRecordResult

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

### otPlatDnssdRegisterCallback

```
void(* otPlatDnssdRegisterCallback)(otInstance *aInstance, otPlatDnssdRequestId aRequestId, otError aError)
```
Represents the callback function used when registering/unregistering a host or service.

See `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga15b25fe94dfee3a78e38184fe1f22389`, `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad706b2209bf8324dc98b87a59789de5c`, `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga8ec148f41f14746b2e61a4b77d50236f`, and `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6f374039a6f5059870a8670392b5e843` for more details about when to invoke the callback and the `aError` values that can be returned in each case.

<br />

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

### otPlatDnssdRequestId

```
uint32_t otPlatDnssdRequestId
```
Represents a request ID for registering/unregistering a service or host.

### otPlatDnssdService

```
struct otPlatDnssdService otPlatDnssdService
```
Represents a DNS-SD service.

See `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga15b25fe94dfee3a78e38184fe1f22389`, `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad706b2209bf8324dc98b87a59789de5c` for more details about fields in each case.

### otPlatDnssdSrvCallback

```
void(* otPlatDnssdSrvCallback)(otInstance *aInstance, const otPlatDnssdSrvResult *aResult)
```
Represents the callback function used to report an SRV resolve result.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResult` | The SRV resolve result. | |

### otPlatDnssdSrvResolver

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

### otPlatDnssdSrvResult

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

### otPlatDnssdState

```
enum otPlatDnssdState otPlatDnssdState
```
Represents the state of the DNS-SD platform.

### otPlatDnssdTxtCallback

```
void(* otPlatDnssdTxtCallback)(otInstance *aInstance, const otPlatDnssdTxtResult *aResult)
```
Represents the callback function used to report a TXT resolve result.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aResult` | The TXT resolve result. | |

### otPlatDnssdTxtResolver

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

### otPlatDnssdTxtResult

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

## Functions

### otPlatDnssdGetState

```
otPlatDnssdState otPlatDnssdGetState(
  otInstance *aInstance
)
```
Gets the current state of the DNS-SD module.

The platform MUST notify the OpenThread stack whenever its state gets changed by invoking `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gae5c64f4fde7d62134d48c81fc214b4ce`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | |
| **Returns** | The current state of the DNS-SD module. |

### otPlatDnssdRegisterHost

```
void otPlatDnssdRegisterHost(
  otInstance *aInstance,
  const otPlatDnssdHost *aHost,
  otPlatDnssdRequestId aRequestId,
  otPlatDnssdRegisterCallback aCallback
)
```
Registers or updates a host on the infrastructure network's DNS-SD module.

The `aHost` and all its contained information (strings and arrays) 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.

The fields in `aHost` follow these rules:


- The `mHostName` field specifies the host name to register. It is never NULL.
- The `mAddresses` field is an array of IPv6 addresses to register with the host. `mAddressesLength` field provides the number of entries in `mAddresses` array. The platform implementation MUST not filter or remove any of addresses in the list. The OpenThread stack will already ensure that the given addresses are externally reachable. For example, when registering host from an SRP registration, link-local or mesh-local addresses associated with the host which are intended for use within Thread mesh are not included in `mAddresses` array passed to this API. The `mAddresses` array can be empty with zero `mAddressesLength`. In such a case, the platform MUST stop advertising any addresses for this host name on the infrastructure DNS-SD.
- The `mTtl` field specifies the TTL if non-zero. If zero, the platform can choose the TTL to use.
- The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this request. If zero, the platform implementation can decided the interface.

<br />

Regarding the invocation of the `aCallback` and the reuse of the `aRequestId`, this function follows the same rules as described in `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga15b25fe94dfee3a78e38184fe1f22389`.

The OpenThread stack will not register the same host (with no changes) that was registered successfully earlier. Therefore, the platform implementation does not need to check for duplicate/same host and can assume that calls to this function are either registering a new entry or changing some parameter in a previously registered item. As a result, these changes always need to be synced on the infrastructure DNS-SD module.

<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 (may be NULL if no callback needed). | |

### otPlatDnssdRegisterKey

```
void otPlatDnssdRegisterKey(
  otInstance *aInstance,
  const otPlatDnssdKey *aKey,
  otPlatDnssdRequestId aRequestId,
  otPlatDnssdRegisterCallback aCallback
)
```
Registers or updates a key record on the infrastructure network's DNS-SD module.

The `aKey` and all its contained information (strings and arrays) 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.

The fields in `aKey` follow these rules:


- If the key is associated with a host, `mName` field specifies the host name and `mServiceType` will be NULL.
- If the key is associated with a service, `mName` field specifies the service instance label and `mServiceType` field specifies the service type. In this case the DNS name for key record is `{mName}.{mServiceTye}`.
- The `mKeyData` field contains the key record's data with `mKeyDataLength` as its length in byes. It is never NULL.
- The `mClass` fields specifies the resource record class to use when registering key record.
- The `mTtl` field specifies the TTL if non-zero. If zero, the platform can choose the TTL to use.
- The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this request. If zero, the platform implementation can decided the interface.

<br />

Regarding the invocation of the `aCallback` and the reuse of the `aRequestId`, this function follows the same rules as described in `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga15b25fe94dfee3a78e38184fe1f22389`.

The OpenThread stack will not register the same key (with no changes) that was registered successfully earlier. Therefore, the platform implementation does not need to check for duplicate/same name and can assume that calls to this function are either registering a new key or changing the key data in a previously registered one. As a result, these changes always need to be synced on the infrastructure DNS-SD module.

<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 (may be NULL if no callback needed). | |

### otPlatDnssdRegisterService

```
void otPlatDnssdRegisterService(
  otInstance *aInstance,
  const otPlatDnssdService *aService,
  otPlatDnssdRequestId aRequestId,
  otPlatDnssdRegisterCallback aCallback
)
```
Registers or updates a service on the infrastructure network's DNS-SD module.

The `aService` and all its contained information (strings and buffers) 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.

The fields in `aService` follow these rules:


- The `mServiceInstance` and `mServiceType` fields specify the service instance label and service type name, respectively. They are never NULL.
- 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 device itself and leaves the host name selection to DNS-SD platform.
- The `mSubTypeLabels` is an array of strings representing sub-types associated with the service. It can be NULL if there are no sub-types. Otherwise, the array length is specified by `mSubTypeLabelsLength`.
- The `mTxtData` and `mTxtDataLength` fields specify the encoded TXT data.
- The `mPort`, `mWeight`, and `mPriority` fields specify the service's parameters (as specified in DNS SRV record).
- The `mTtl` field specifies the TTL if non-zero. If zero, the platform can choose the TTL to use.
- The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this request. If zero, the platform implementation can decided the interface.

<br />

When the `mHostName` field in `aService` is not NULL (indicating that this registration is on behalf of another host), the OpenThread stack will ensure that `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga8ec148f41f14746b2e61a4b77d50236f` is also called for the same host before any service registration requests for the same host.

Once the registration request is finished, either successfully or failed, the platform reports the outcome by invoking the `aCallback` and passing the same `aRequestId` in the callback. The `aCallback` function pointer can be NULL, which indicates that the OpenThread stack does not need to be notified of the outcome of the request. If the outcome is determined, the platform implementation may invoke the `aCallback` before returning from this function. The OpenThread stack will ensure to handle such a situation.

On success, the `aCallback` MUST be called (if non-NULL) with `OT_ERROR_NONE` as the `aError` input parameter. If the registration causes a name conflict on DNS-SD domain (the service instance name is already claimed by another host), the `OT_ERROR_DUPLICATED` error MUST be used. The platform implementation can use other `OT_ERROR` types for other types of errors.

The platform implementation MUST not assume that the `aRequestId` used in subsequent requests will be different. OpenThread may reuse the same request ID again for a different request.

The OpenThread stack will not register the same service (with no changes) that was registered successfully earlier. Therefore, the platform implementation does not need to check for duplicate/same service and can assume that calls to this function are either registering a new entry or changing some parameter in a previously registered item. As a result, these changes always need to be synced on the infrastructure DNS-SD module.

The OpenThread stack does not require the platform implementation to always invoke the `aCallback` function. The OpenThread stack has its own mechanism to time out an aged request with no response. This relaxes the requirement for platform implementations.

<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 (may be NULL if no callback needed). | |

### otPlatDnssdStartBrowser

```
void otPlatDnssdStartBrowser(
  otInstance *aInstance,
  const otPlatDnssdBrowser *aBrowser
)
```
Starts a service browser.

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

Discovered services should be 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 should reflect the original TTL from the last received response.

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

The `aBrowser` 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] aBrowser` | The browser to be started. | |

### otPlatDnssdStartIp4AddressResolver

```
void otPlatDnssdStartIp4AddressResolver(
  otInstance *aInstance,
  const otPlatDnssdAddressResolver *aResolver
)
```
Starts an IPv4 address resolver.

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

Discovered addresses should be reported through the `mCallback` function in `aResolver`. The IPv4 addresses are represented using the IPv4-mapped IPv6 address format in `mAddresses` array. The callback should be invoked whenever addresses are added or removed, providing an updated list. If all addresses are removed, the callback should be invoked with an empty list (`mAddressesLength` set to 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.

The `aResolver` 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] aResolver` | The resolver to be started. | |

### otPlatDnssdStartIp6AddressResolver

```
void otPlatDnssdStartIp6AddressResolver(
  otInstance *aInstance,
  const otPlatDnssdAddressResolver *aResolver
)
```
Starts an IPv6 address resolver.

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

Discovered addresses should be reported through the `mCallback` function in `aResolver`. The callback should be invoked whenever addresses are added or removed, providing an updated list. If all addresses are removed, the callback should be invoked with an empty list (`mAddressesLength` set to 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 should 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.

The `aResolver` 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] aResolver` | The resolver to be started. | |

### otPlatDnssdStartRecordQuerier

```
void otPlatDnssdStartRecordQuerier(
  otInstance *aInstance,
  const otPlatDnssdRecordQuerier *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` is always non-NULL but `mNextLabels` can be `NULL` if there are no other labels. The `mNextLabels does 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 should be reported through the `mCallback` function in `aQuerier`, providing the raw record data bytes. 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 should 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.

OpenThread will only use a record querier for types other than PTR, SRV, TXT, A, and AAAA. For those, specific browsers or resolvers are used. The platform implementation, therefore, can choose to restrict its implementation.

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. | |

### otPlatDnssdStartSrvResolver

```
void otPlatDnssdStartSrvResolver(
  otInstance *aInstance,
  const otPlatDnssdSrvResolver *aResolver
)
```
Starts an SRV record resolver.

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

Discovered information should be 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`) will be ignored by the OpenThread stack.

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 should reflect the original TTL from the last received response.

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

The `aResolver` 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] aResolver` | The resolver to be started. | |

### otPlatDnssdStartTxtResolver

```
void otPlatDnssdStartTxtResolver(
  otInstance *aInstance,
  const otPlatDnssdTxtResolver *aResolver
)
```
Starts a TXT record resolver.

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

Discovered information should be 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`) will be ignored by the OpenThread stack.

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 should reflect the original TTL from the last received response.

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

The `aResolver` 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] aResolver` | The resolver to be started. | |

### otPlatDnssdStateHandleStateChange

```
void otPlatDnssdStateHandleStateChange(
  otInstance *aInstance
)
```
Callback to notify state changes of the DNS-SD platform.

The OpenThread stack will call `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad962040403c7fc0bc9fad247eed2fc28` (from this callback or later) to get the new state. The platform MUST therefore ensure that the returned state from `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad962040403c7fc0bc9fad247eed2fc28` is updated before calling this.

When the platform signals a state change to `OT_PLAT_DNSSD_STOPPED` using this callback, all active browsers and resolvers are considered to be stopped, and any previously registered host, service, key entries as removed.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | |

### otPlatDnssdStopBrowser

```
void otPlatDnssdStopBrowser(
  otInstance *aInstance,
  const otPlatDnssdBrowser *aBrowser
)
```
Stops a service browser.

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

The `aBrowser` 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] aBrowser` | The browser to stop. | |

### otPlatDnssdStopIp4AddressResolver

```
void otPlatDnssdStopIp4AddressResolver(
  otInstance *aInstance,
  const otPlatDnssdAddressResolver *aResolver
)
```
Stops an IPv4 address resolver.

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

The `aResolver` 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] aResolver` | The resolver to stop. | |

### otPlatDnssdStopIp6AddressResolver

```
void otPlatDnssdStopIp6AddressResolver(
  otInstance *aInstance,
  const otPlatDnssdAddressResolver *aResolver
)
```
Stops an IPv6 address resolver.

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

The `aResolver` 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] aResolver` | The resolver to stop. | |

### otPlatDnssdStopRecordQuerier

```
void otPlatDnssdStopRecordQuerier(
  otInstance *aInstance,
  const otPlatDnssdRecordQuerier *aQuerier
)
```
Stops a record querier.

No action is performed if no matching querier with the same name, record type 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. | |

### otPlatDnssdStopSrvResolver

```
void otPlatDnssdStopSrvResolver(
  otInstance *aInstance,
  const otPlatDnssdSrvResolver *aResolver
)
```
Stops an SRV record resolver.

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

The `aResolver` 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] aResolver` | The resolver to stop. | |

### otPlatDnssdStopTxtResolver

```
void otPlatDnssdStopTxtResolver(
  otInstance *aInstance,
  const otPlatDnssdTxtResolver *aResolver
)
```
Stops a TXT record resolver.

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

The `aResolver` 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] aResolver` | The resolver to stop. | |

### otPlatDnssdUnregisterHost

```
void otPlatDnssdUnregisterHost(
  otInstance *aInstance,
  const otPlatDnssdHost *aHost,
  otPlatDnssdRequestId aRequestId,
  otPlatDnssdRegisterCallback aCallback
)
```
Unregisters a host on the infrastructure network's DNS-SD module.

The `aHost` and all its contained information (strings and arrays) 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.

The fields in `aHost` follow these rules:


- The `mHostName` field specifies the host name to unregister. It is never NULL.
- The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this request. If zero, the platform implementation can decided the interface.
- The rest of the fields in `aHost` structure MUST be ignored in `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga6f374039a6f5059870a8670392b5e843` call and may be set to zero by the OpenThread stack.

<br />

Regarding the invocation of the `aCallback` and the reuse of the `aRequestId`, this function follows the same rules as described in `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga15b25fe94dfee3a78e38184fe1f22389`.

The OpenThread stack may request the unregistration of a host that was not previously registered, and the platform implementation MUST handle this case. In such a case, the platform can use either `OT_ERROR_NOT_FOUND` to indicate that there was no such registration, or `OT_ERROR_NONE` when invoking the `aCallback` function. OpenThread stack will handle either case correctly.

When unregistering a host, the OpenThread stack will also unregister any previously registered services associated with the same host (by calling `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad706b2209bf8324dc98b87a59789de5c`). However, the platform implementation MAY assume that unregistering a host also unregisters all its associated services.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aHost` | Information about the host to unregister. | | `[in] aRequestId` | The ID associated with this request. | | `[in] aCallback` | The callback function pointer to report the outcome (may be NULL if no callback needed). | |

### otPlatDnssdUnregisterKey

```
void otPlatDnssdUnregisterKey(
  otInstance *aInstance,
  const otPlatDnssdKey *aKey,
  otPlatDnssdRequestId aRequestId,
  otPlatDnssdRegisterCallback aCallback
)
```
Unregisters a key record on the infrastructure network's DNS-SD module.

The `aKey` and all its contained information (strings and arrays) 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.

The fields in `aKey` follow these rules:


- If the key is associated with a host, `mName` field specifies the host name and `mServiceType` will be NULL.
- If the key is associated with a service, `mName` field specifies the service instance label and `mServiceType` field specifies the service type. In this case the DNS name for key record is `{mName}.{mServiceTye}`.
- The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this request. If zero, the platform implementation can decided the interface.
- The rest of the fields in `aKey` structure MUST be ignored in `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gaef09d752d81a9004b3e80637389262ee` call and may be set to zero by the OpenThread stack.

<br />

Regarding the invocation of the `aCallback` and the reuse of the `aRequestId`, this function follows the same rules as described in `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga15b25fe94dfee3a78e38184fe1f22389`.

The OpenThread stack may request the unregistration of a key that was not previously registered, and the platform implementation MUST handle this case. In such a case, the platform can use either `OT_ERROR_NOT_FOUND` to indicate that there was no such registration, or `OT_ERROR_NONE` when invoking the `aCallback` function. the OpenThread stack will handle either case correctly.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aKey` | Information about the key to unregister. | | `[in] aRequestId` | The ID associated with this request. | | `[in] aCallback` | The callback function pointer to report the outcome (may be NULL if no callback needed). | |

### otPlatDnssdUnregisterService

```
void otPlatDnssdUnregisterService(
  otInstance *aInstance,
  const otPlatDnssdService *aService,
  otPlatDnssdRequestId aRequestId,
  otPlatDnssdRegisterCallback aCallback
)
```
Unregisters a service on the infrastructure network's DNS-SD module.

The `aService` and all its contained information (strings and buffers) 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.

The fields in `aService` follow these rules:


- The `mServiceInstance` and `mServiceType` fields specify the service instance label and service type name, respectively. They are never NULL.
- 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 device itself and leaves the host name selection to DNS-SD platform.
- The `mInfraIfIndex` field, if non-zero, specifies the infrastructure network interface index to use for this request. If zero, the platform implementation can decided the interface.
- The rest of the fields in `aService` structure MUST be ignored in `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1gad706b2209bf8324dc98b87a59789de5c` call and may be set to zero by the OpenThread stack.

<br />

Regarding the invocation of the `aCallback` and the reuse of the `aRequestId`, this function follows the same rules as described in `https://openthread.io/reference/group/plat-dns-sd#group__plat-dns-sd_1ga15b25fe94dfee3a78e38184fe1f22389`.

The OpenThread stack may request the unregistration of a service that was not previously registered, and the platform implementation MUST handle this case. In such a case, the platform can use either `OT_ERROR_NOT_FOUND` to indicate that there was no such registration, or `OT_ERROR_NONE` when invoking the `aCallback` function. The OpenThread stack will handle either case correctly.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aService` | Information about the service to unregister. | | `[in] aRequestId` | The ID associated with this request. | | `[in] aCallback` | The callback function pointer to report the outcome (may be NULL if no callback needed). | |

## 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).