# SRP

This module includes functions that control SRP client behavior.

## Summary

This module includes functions of the Service Registration Protocol.

This module includes functions for SRP client buffers and service pool.

Functions in this module are only available when feature OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_ENABLE is enabled.

| ### Enumerations ||
|---|---|
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga4282c995a78d63a59e930f4a67f07e41{ https://openthread.io/reference/group/api-srp#group__api-srp_1gga4282c995a78d63a59e930f4a67f07e41aea96ccf5599bd8897c87ebcf7157be64, https://openthread.io/reference/group/api-srp#group__api-srp_1gga4282c995a78d63a59e930f4a67f07e41a70e8b301b3d24324cb007512c4a0715c, https://openthread.io/reference/group/api-srp#group__api-srp_1gga4282c995a78d63a59e930f4a67f07e41a575dd4924d46b0f82a93760846def7a8, https://openthread.io/reference/group/api-srp#group__api-srp_1gga4282c995a78d63a59e930f4a67f07e41ab058e263966f407223d76b8846fc75f8, https://openthread.io/reference/group/api-srp#group__api-srp_1gga4282c995a78d63a59e930f4a67f07e41ab7d6d9181b5cdcd9f440788be3db10c3, https://openthread.io/reference/group/api-srp#group__api-srp_1gga4282c995a78d63a59e930f4a67f07e41a00bcc9135d70553c98846b71ff1d25a4, https://openthread.io/reference/group/api-srp#group__api-srp_1gga4282c995a78d63a59e930f4a67f07e41ad6f143fe4e7a9e38d34b8a587ab686d7, https://openthread.io/reference/group/api-srp#group__api-srp_1gga4282c995a78d63a59e930f4a67f07e41a93df2521eb58089bf3fadb81d51be0ba }` | enumSpecifies an SRP client item (service or host info) state. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gab9bd7767a555687de78052e458e64ee7{ https://openthread.io/reference/group/api-srp#group__api-srp_1ggab9bd7767a555687de78052e458e64ee7ac984ecd53ed71e0b626c1d1718229539 = 0, https://openthread.io/reference/group/api-srp#group__api-srp_1ggab9bd7767a555687de78052e458e64ee7ae3fc416d1e4d051d71d9c4df47157e4c = 1, https://openthread.io/reference/group/api-srp#group__api-srp_1ggab9bd7767a555687de78052e458e64ee7a5f522d215b05556b67ba7716e1df4ff1 = 2 }` | enumRepresents the address mode used by the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga7165fd138cfec6fb0398c6a1a0834ab6{ https://openthread.io/reference/group/api-srp#group__api-srp_1gga7165fd138cfec6fb0398c6a1a0834ab6a4ea78ea1dd21b24b5fbb84a379175ca1 = 0, https://openthread.io/reference/group/api-srp#group__api-srp_1gga7165fd138cfec6fb0398c6a1a0834ab6ae717cfa841a2a8b17852164e56fe0011 = 1, https://openthread.io/reference/group/api-srp#group__api-srp_1gga7165fd138cfec6fb0398c6a1a0834ab6acec7f119355ddeb9933f449636706988 = 2 }` | enumRepresents the state of the SRP server. |

| ### Typedefs ||
|---|---|
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gae09954870745515d7fa13e31da8c547c)(const otSockAddr *aServerSockAddr, void *aContext)` | typedef `void(*` Pointer type defines the callback used by SRP client to notify user when it is auto-started or stopped. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga59bcca7fc50b032432859005175cfc4e` | typedef `struct https://openthread.io/reference/struct/ot-srp-client-buffers-service-entry` Represents a SRP client service pool entry. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gafe9e9dd2f5d4a2f4fff60cd0e0f82afc)(otError aError, const otSrpClientHostInfo *aHostInfo, const otSrpClientService *aServices, const otSrpClientService *aRemovedServices, void *aContext)` | typedef `void(*` Pointer type defines the callback used by SRP client to notify user of changes/events/errors. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga619866958f45ab09750a49f2f22a6d0a` | typedef `struct https://openthread.io/reference/struct/ot-srp-client-counters` Represents the SRP client counters. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gab247cc74c4ede822dc840ed9637e0f77` | typedef `struct https://openthread.io/reference/struct/ot-srp-client-host-info` Represents an SRP client host info. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga311388e94f5e412b68f1f8e5c7609391` | typedef `struct https://openthread.io/reference/struct/ot-srp-client-service` Represents an SRP client service. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga53cc44bc1a09e5cca84bdd0af2bb57d3` | typedef `enum https://openthread.io/reference/group/api-srp#group__api-srp_1gab9bd7767a555687de78052e458e64ee7` Represents the address mode used by the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93` | typedef `struct https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93` This opaque type represents a SRP service host. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6d46c482b8f18fdf08685a3bbf59b94e` | typedef `struct https://openthread.io/reference/struct/ot-srp-server-lease-config` Includes SRP server LEASE and KEY-LEASE configurations. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gae97479258618dfa49dfcd6b4f392516a` | typedef `struct https://openthread.io/reference/struct/ot-srp-server-lease-info` Includes SRP server lease information of a host/service. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gae10f67acb9e90b4415f865aad5afcd9b` | typedef `struct https://openthread.io/reference/struct/ot-srp-server-response-counters` Includes the statistics of SRP server responses. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0` | typedef `struct https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0` This opaque type represents a SRP service. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6df736de68cadcf28b6acb6246cd214e)(otSrpServerServiceUpdateId aId, const otSrpServerHost *aHost, uint32_t aTimeout, void *aContext)` | typedef `void(*` Handles SRP service updates. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga1b50f7df1bda8c6d215ca8da929843d8` | typedef `uint32_t` The ID of a SRP service update transaction on the SRP Server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6a507c58e7eef956b87286efdffa4b50` | typedef `struct https://openthread.io/reference/struct/ot-srp-server-ttl-config` Includes SRP server TTL configurations. |

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga0ebf5d6f14933c1811ef07ac46c943c6(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-srp-client-service *aService)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Adds a service to be registered with server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6cf0592ef6f460bab6bd336124339def(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/struct/ot-srp-client-buffers-service-entry *` Allocates a new service entry from the pool. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga1205e626e162513f4a05740104d15e30(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Frees all previously allocated service entries. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga9c95ac4579ecac0dbec37edba3f3539f(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-srp-client-buffers-service-entry *aService)` | `void` Frees a previously allocated service entry. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaef0ef22905e6af07c5314a658be58887(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t *aArrayLength)` | `https://openthread.io/reference/struct/ot-ip6-address *` Gets the array of IPv6 address entries to use as SRP client host address list. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga1d4f373abf6831632b440dc9a403de6a(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint16_t *aSize)` | `char *` Gets the string buffer to use for SRP client host name. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga25ae1a7ae1d8af13fe515485db220f49(https://openthread.io/reference/struct/ot-srp-client-buffers-service-entry *aEntry, uint16_t *aSize)` | `char *` Gets the string buffer for service instance name from a service entry. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6be1cac190f771a8b2bd270e6ecc3bcf(https://openthread.io/reference/struct/ot-srp-client-buffers-service-entry *aEntry, uint16_t *aSize)` | `char *` Gets the string buffer for service name from a service entry. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaad5dc3e2c3d9b2b693d4c95a92b7b8b1(https://openthread.io/reference/struct/ot-srp-client-buffers-service-entry *aEntry, uint16_t *aSize)` | `uint8_t *` Gets the buffer for TXT record from a service entry. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga99083f5889173c81f0f1d1b5c2d85e79(https://openthread.io/reference/struct/ot-srp-client-buffers-service-entry *aEntry, uint16_t *aArrayLength)` | `const char **` Gets the array for service subtype labels from the service entry. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga3c9f5f8b8b424c57f27ed06554a978c6(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Clears all host info and all the services. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga0391acc14d6a1b8be69cafd6c706aa03(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-srp-client-service *aService)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Clears a service, immediately removing it from the client service list. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga9e645eb90f7ec489e960f1f0c28d188a(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Disables the auto-start mode. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaaca08836819d126e2e98f4fd5fc6d505(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Enables auto host address mode. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga0170f9817bfc4ab92727c98f7e3c6845(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-srp#group__api-srp_1gae09954870745515d7fa13e31da8c547c aCallback, void *aContext)` | `void` Enables the auto-start mode. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaf0fcdfade5369794b8a9b19cdfac878c(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const https://openthread.io/reference/struct/ot-srp-client-counters *` Gets the SRP client counters. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaced3d5a751548ce3387950638f672945(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const char *` Gets the domain name being used by SRP client. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga4eec8d6bcf3e343e1092909349aae162(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const https://openthread.io/reference/struct/ot-srp-client-host-info *` Gets the host info. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga8681cf238b71720601de4ac180dce12c(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint32_t` Gets the default key lease interval used in SRP update requests. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga13fdfe8a4dcc48973a453559796bd012(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint32_t` Gets the default lease interval used in SRP update requests. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6f89f2d563b20ae7e1cb9eb7d72e192d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const https://openthread.io/reference/struct/ot-sock-addr *` Gets the socket address (IPv6 address and port number) of the SRP server which is being used by SRP client. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga7b4c33b76b4088ba0e0a15af3c55508f(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const https://openthread.io/reference/struct/ot-srp-client-service *` Gets the list of services being managed by client. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga5d6432342538171ab81eb5adf5a11151(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint32_t` Gets the TTL value in every record included in SRP update requests. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaf2f12371a237f5030d753a294ad4bf95(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates the current state of auto-start mode (enabled or disabled). |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga12b11d16fc4aab3b0db6ae393f6c8f9a(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether the SRP client is running or not. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gae45aa350815267eee68ac0670f5366f3(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether the "service key record inclusion" mode is enabled or disabled. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga1ed6d5fcf150e55f268892dee38fc4e2(https://openthread.io/reference/group/api-srp#group__api-srp_1ga4282c995a78d63a59e930f4a67f07e41 aItemState)` | `const char *` Converts a `otSrpClientItemState` to a string. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga43324d90582bbb2f97b5bbaf31e97fe4(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aRemoveKeyLease, bool aSendUnregToServer)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts the remove process of the host info and all services. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga38dfbe1202f775514a9be7ae3b18d568(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-srp-client-service *aService)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Requests a service to be unregistered with server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaebcce893c8fcec8281f27905faf91aa0(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Resets the SRP client counters. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga77e1e309dc3498a9288d38fd1f194a01(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-srp#group__api-srp_1gafe9e9dd2f5d4a2f4fff60cd0e0f82afc aCallback, void *aContext)` | `void` Sets the callback to notify caller of events/changes from SRP client. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga31f1ca4ad65859608aabfdd5678d12c0(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 domain name to be used by SRP client. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga5f94d5e95417fa19eb6dd8069c963701(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-ip6-address *aIp6Addresses, uint8_t aNumAddresses)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets/updates the list of host IPv6 address. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gad00aa82af3a71e91ef2d8eb796099a64(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 host name label. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaba8bfd01db6f1b7f0ce9ccf6fd7239de(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t aInterval)` | `void` Sets the default key lease interval used in SRP update requests. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga534a2901026fa2af0ae9de2bcaf921c4(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t aInterval)` | `void` Sets the default lease interval used in SRP update requests. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga749269648960bf31bec80073811529c7(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnabled)` | `void` Enables/disables "service key record inclusion" mode. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gab8813ca9a5e7a08e4e854daffa32a481(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t aTtl)` | `void` Sets the TTL value in every record included in SRP update requests. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gafc3c0caa4ef2c20440850684746cffbc(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-sock-addr *aServerSockAddr)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Starts the SRP client operation. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga937241edaaf4bd9a2984f3d4bf165721(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Stops the SRP client operation. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gae553bc7f25eced828549268214f8e716(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Enables the "Fast Start Mode" on the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga87676282c7353f464474481f34526dbf(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-srp#group__api-srp_1gab9bd7767a555687de78052e458e64ee7` Returns the address mode being used by the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga9f23b0aabe265875025a941dddb730ba(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Returns the sequence number used with anycast address mode. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaf895b1b9e02806f1bf050ca8c60b3054(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const char *` Returns the domain authorized to the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga247c877759657514d69042bbf240b107(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-srp-server-lease-config *aLeaseConfig)` | `void` Returns SRP server LEASE and KEY-LEASE configurations. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaf04c99dc74f496adc582edf898dc0051(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *aHost)` | `const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *` Returns the next registered host on the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaff5097a8776578ca3c7432cd7b9f0251(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint16_t` Returns the port the SRP server is listening to. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gadaec9bfb2cc2d7b45e2361cc737ccce0(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const https://openthread.io/reference/struct/ot-srp-server-response-counters *` Returns the response counters of the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga3c54a2f0f96ca56d13ff7ae12d48d51a(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-srp#group__api-srp_1ga7165fd138cfec6fb0398c6a1a0834ab6` Returns the state of the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaf123f5f004e37d9c74ba2211c4432511(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-srp-server-ttl-config *aTtlConfig)` | `void` Returns SRP server TTL configuration. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga7d44a2908bea0f1f175bca2aeeefbc05(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-srp#group__api-srp_1ga1b50f7df1bda8c6d215ca8da929843d8 aId, https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49 aError)` | `void` Reports the result of processing a SRP update to the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga143785e2ee682cf2aaaabc0b8ad34c9e(const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *aHost, uint8_t *aAddressesNum)` | `const https://openthread.io/reference/struct/ot-ip6-address *` Returns the addresses of given host. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga5354be7a29f8c3c6b533d907245595ad(const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *aHost)` | `const char *` Returns the full name of the host. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga77d1a5ac7b4244d4f3083d101947c761(const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *aHost, https://openthread.io/reference/struct/ot-srp-server-lease-info *aLeaseInfo)` | `void` Returns the LEASE and KEY-LEASE information of a given host. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga200a90ba6f6f90082384fe604227f5ab(const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *aHost, const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *` Returns the next service of given host. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga8cfaacca17c49578c5e8250590b91303(const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *aHost)` | `bool` Tells if the SRP service host has been deleted. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga58169274da3aa5da8c21605cb32939ed(const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *aHost, const char *aFullName)` | `bool` Indicates whether the host matches a given host name. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga1c690c6c846e5fb6c3030350eafd11b7(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-srp#group__api-srp_1ga3c3919afe284a52187c4860058d86a22(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether the Fast Start Mode is enabled or disabled. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga1dd599715f9a9ee09a77be1796f1c6b8(const char *aSubTypeServiceName, char *aLabel, uint8_t aLabelSize)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Parses a sub-type service name (full name) and extracts the sub-type label. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga9310c4a9376b4728a43fc1aa798e7503(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `const https://openthread.io/reference/group/api-srp#group__api-srp_1ga9d27a2d7aad3b2c70a786117762ccf93 *` Returns the host which the service instance reside on. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga96903edcec31fa858c9c952c33dea012(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `const char *` Returns the service instance label (first label in instance name) of the service. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6ecd83c08e0c51cf01feee25a8bb8426(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `const char *` Returns the full service instance name of the service. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga03d07a0958820e95e2ca5ec125830ddb(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService, https://openthread.io/reference/struct/ot-srp-server-lease-info *aLeaseInfo)` | `void` Returns the LEASE and KEY-LEASE information of a given service. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga4954c15800853aacd38eb6d0f7b1c1b2(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `uint16_t` Gets the number of sub-types of the service. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga0dfd5bac553e9053008f8142e9a2c1a0(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `uint16_t` Returns the port of the service instance. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga5bc108e1eb8fc39573418bf43a842d53(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `uint16_t` Returns the priority of the service instance. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaf376311ba5cd55e53ee64ead0ea553f4(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `const char *` Returns the full service name of the service. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6efde284b10344008265c6cf1b83cd1d(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService, uint16_t aIndex)` | `const char *` Gets the sub-type service name (full name) of the service at a given index. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga35988b171cd26cebe9c68a17aa95b435(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `uint32_t` Returns the TTL of the service instance. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga741ce5b1994926e59ff81a5747ea4023(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService, uint16_t *aDataLength)` | `const uint8_t *` Returns the TXT record data of the service instance. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6b0870115875c4f86a9cf9867c68f2ae(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `uint16_t` Returns the weight of the service instance. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga8afdfe10eeb454bc8f0df4a2d6f47d52(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService, const char *aSubTypeServiceName)` | `bool` Indicates whether or not the service has a given sub-type. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gacd5d9709b2fd3aff8c6152ccd4c63d18(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService)` | `bool` Indicates whether or not the SRP service has been deleted. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga48649fdadba505ac8dbc1426577db48d(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService, const char *aInstanceName)` | `bool` Indicates whether this service matches a given service instance name. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga54de0475168b7e1821d7d94735d31235(const https://openthread.io/reference/group/api-srp#group__api-srp_1gabd4424725bdcabe627cfa2bec37e81e0 *aService, const char *aServiceName)` | `bool` Indicates whether this service matches a given service name. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga30ba6902c8dda9e581565b8281f5f67e(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-srp#group__api-srp_1gab9bd7767a555687de78052e458e64ee7 aMode)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets the address mode to be used by the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gae2f4abd02bf7b97299f183741b998b47(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aSequenceNumber)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets the sequence number used with anycast address mode. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1ga55ab7305434a195c063c033c33a76332(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnabled)` | `void` Enables/disables the auto-enable mode on SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gafc3ecc2b528ee395cfbbd1b871bf2d97(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const char *aDomain)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets the domain on the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gabf2ae6a5695dc7aaef4e0c9c5ed01200(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnabled)` | `void` Enables/disables the SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gac4a00cf36e69fa964c01e9e15b643ce8(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-srp-server-lease-config *aLeaseConfig)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets SRP server LEASE and KEY-LEASE configurations. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gacf29e6c9fb844fc39f5b6c80d3c433dc(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-srp#group__api-srp_1ga6df736de68cadcf28b6acb6246cd214e aServiceHandler, void *aContext)` | `void` Sets the SRP service updates handler on SRP server. |
| `https://openthread.io/reference/group/api-srp#group__api-srp_1gaf276888d2ddc4d02493ccf2821740254(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-srp-server-ttl-config *aTtlConfig)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets SRP server TTL configuration. |

| ### Structs ||
|---|---|
| [otSrpClientBuffersServiceEntry](https://openthread.io/reference/struct/ot-srp-client-buffers-service-entry) | Represents a SRP client service pool entry. |
| [otSrpClientCounters](https://openthread.io/reference/struct/ot-srp-client-counters) | Represents the SRP client counters. |
| [otSrpClientHostInfo](https://openthread.io/reference/struct/ot-srp-client-host-info) | Represents an SRP client host info. |
| [otSrpClientService](https://openthread.io/reference/struct/ot-srp-client-service) | Represents an SRP client service. |
| [otSrpServerLeaseConfig](https://openthread.io/reference/struct/ot-srp-server-lease-config) | Includes SRP server LEASE and KEY-LEASE configurations. |
| [otSrpServerLeaseInfo](https://openthread.io/reference/struct/ot-srp-server-lease-info) | Includes SRP server lease information of a host/service. |
| [otSrpServerResponseCounters](https://openthread.io/reference/struct/ot-srp-server-response-counters) | Includes the statistics of SRP server responses. |
| [otSrpServerTtlConfig](https://openthread.io/reference/struct/ot-srp-server-ttl-config) | Includes SRP server TTL configurations. |

## Enumerations

### otSrpClientItemState

```
 otSrpClientItemState
```
Specifies an SRP client item (service or host info) state.

| Properties ||
|---|---|
| `OT_SRP_CLIENT_ITEM_STATE_ADDING` | Item is being added/registered. |
| `OT_SRP_CLIENT_ITEM_STATE_REFRESHING` | Item is being refreshed. |
| `OT_SRP_CLIENT_ITEM_STATE_REGISTERED` | Item is registered with server. |
| `OT_SRP_CLIENT_ITEM_STATE_REMOVED` | Item is removed. |
| `OT_SRP_CLIENT_ITEM_STATE_REMOVING` | Item is being removed. |
| `OT_SRP_CLIENT_ITEM_STATE_TO_ADD` | Item to be added/registered. |
| `OT_SRP_CLIENT_ITEM_STATE_TO_REFRESH` | Item to be refreshed (re-register to renew lease). |
| `OT_SRP_CLIENT_ITEM_STATE_TO_REMOVE` | Item to be removed. |

### otSrpServerAddressMode

```
 otSrpServerAddressMode
```
Represents the address mode used by the SRP server.

Address mode specifies how the address and port number are determined by the SRP server and how this info is published in the Thread Network Data.

Using the `OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD` option will make the implementation non-compliant with the Thread specification. This option is intended for testing and specific use-cases. When selected, the SRP server, upon being enabled, will bypass the Network Data publisher and always add the "SRP/DNS unicast" entry directly to the Network Data, regardless of how many other similar entries are present.

| Properties ||
|---|---|
| `OT_SRP_SERVER_ADDRESS_MODE_ANYCAST` | Anycast address mode. Use Network Data publisher. |
| `OT_SRP_SERVER_ADDRESS_MODE_UNICAST` | Unicast address mode. Use Network Data publisher. |
| `OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD` | Unicast address mode. Immediately force add to Network Data. |

### otSrpServerState

```
 otSrpServerState
```
Represents the state of the SRP server.

| Properties ||
|---|---|
| `OT_SRP_SERVER_STATE_DISABLED` | The SRP server is disabled. |
| `OT_SRP_SERVER_STATE_RUNNING` | The SRP server is enabled and running. |
| `OT_SRP_SERVER_STATE_STOPPED` | The SRP server is enabled but stopped. |

## Typedefs

### otSrpClientAutoStartCallback

```
void(* otSrpClientAutoStartCallback)(const otSockAddr *aServerSockAddr, void *aContext)
```
Pointer type defines the callback used by SRP client to notify user when it is auto-started or stopped.

This is only used when auto-start feature `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled.

This callback is invoked when auto-start mode is enabled and the SRP client is either automatically started or stopped.

<br />

Details Parameters `[in] aServerSockAddr` A non-NULL pointer indicates SRP server was started and pointer will give the selected server socket address. A NULL pointer indicates SRP server was stopped. `[in] aContext` A pointer to an arbitrary context (provided when callback was registered).

### otSrpClientBuffersServiceEntry

```
struct otSrpClientBuffersServiceEntry otSrpClientBuffersServiceEntry
```
Represents a SRP client service pool entry.

### otSrpClientCallback

```
void(* otSrpClientCallback)(otError aError, const otSrpClientHostInfo *aHostInfo, const otSrpClientService *aServices, const otSrpClientService *aRemovedServices, void *aContext)
```
Pointer type defines the callback used by SRP client to notify user of changes/events/errors.

This callback is invoked on a successful registration of an update (i.e., add/remove of host-info and/or some service(s)) with the SRP server, or if there is a failure or error (e.g., server rejects a update request or client times out waiting for response, etc).

In case of a successful reregistration of an update, `aError` parameter would be `OT_ERROR_NONE` and the host info and the full list of services is provided as input parameters to the callback. Note that host info and services each track its own state in the corresponding `mState` member variable of the related data structure (the state indicating whether the host-info/service is registered or removed or still being added/removed, etc).

The list of removed services is passed as its own linked-list `aRemovedServices` in the callback. Note that when the callback is invoked, the SRP client (OpenThread implementation) is done with the removed service instances listed in `aRemovedServices` and no longer tracks/stores them (i.e., if from the callback we call `https://openthread.io/reference/group/api-srp#group__api-srp_1ga7b4c33b76b4088ba0e0a15af3c55508f` the removed services will not be present in the returned list). Providing a separate list of removed services in the callback helps indicate to user which items are now removed and allow user to re-claim/reuse the instances.

If the server rejects an SRP update request, the DNS response code (RFC 2136) is mapped to the following errors:


- (0) NOERROR Success (no error condition) -\> OT_ERROR_NONE
- (1) FORMERR Server unable to interpret due to format error -\> OT_ERROR_PARSE
- (2) SERVFAIL Server encountered an internal failure -\> OT_ERROR_FAILED
- (3) NXDOMAIN Name that ought to exist, does not exist -\> OT_ERROR_NOT_FOUND
- (4) NOTIMP Server does not support the query type (OpCode) -\> OT_ERROR_NOT_IMPLEMENTED
- (5) REFUSED Server refused for policy/security reasons -\> OT_ERROR_SECURITY
- (6) YXDOMAIN Some name that ought not to exist, does exist -\> OT_ERROR_DUPLICATED
- (7) YXRRSET Some RRset that ought not to exist, does exist -\> OT_ERROR_DUPLICATED
- (8) NXRRSET Some RRset that ought to exist, does not exist -\> OT_ERROR_NOT_FOUND
- (9) NOTAUTH Service is not authoritative for zone -\> OT_ERROR_SECURITY
- (10) NOTZONE A name is not in the zone -\> OT_ERROR_PARSE
- (20) BADNAME Bad name -\> OT_ERROR_PARSE
- (21) BADALG Bad algorithm -\> OT_ERROR_SECURITY
- (22) BADTRUN Bad truncation -\> OT_ERROR_PARSE
- Other response codes -\> OT_ERROR_FAILED

<br />

The following errors are also possible:


- OT_ERROR_RESPONSE_TIMEOUT : Timed out waiting for response from server (client would continue to retry).
- OT_ERROR_INVALID_ARGS : The provided service structure is invalid (e.g., bad service name or `https://openthread.io/reference/struct/ot-dns-txt-entry`).
- OT_ERROR_NO_BUFS : Insufficient buffer to prepare or send the update message.

<br />

Note that in case of any failure, the client continues the operation, i.e. it prepares and (re)transmits the SRP update message to the server, after some wait interval. The retry wait interval starts from the minimum value and is increased by the growth factor every failure up to the max value (please see configuration parameter `OPENTHREAD_CONFIG_SRP_CLIENT_MIN_RETRY_WAIT_INTERVAL` and the related ones for more details).

<br />

Details Parameters `[in] aError` The error (see above). `[in] aHostInfo` A pointer to host info. `[in] aServices` The head of linked-list containing all services (excluding the ones removed). NULL if the list is empty. `[in] aRemovedServices` The head of linked-list containing all removed services. NULL if the list is empty. `[in] aContext` A pointer to an arbitrary context (provided when callback was registered).

### otSrpClientCounters

```
struct otSrpClientCounters otSrpClientCounters
```
Represents the SRP client counters.

### otSrpClientHostInfo

```
struct otSrpClientHostInfo otSrpClientHostInfo
```
Represents an SRP client host info.

### otSrpClientService

```
struct otSrpClientService otSrpClientService
```
Represents an SRP client service.

The values in this structure, including the string buffers for the names and the TXT record entries, MUST persist and stay constant after an instance of this structure is passed to OpenThread from `https://openthread.io/reference/group/api-srp#group__api-srp_1ga0ebf5d6f14933c1811ef07ac46c943c6` or `https://openthread.io/reference/group/api-srp#group__api-srp_1ga38dfbe1202f775514a9be7ae3b18d568`.

The `mState`, `mData`, `mNext` fields are used/managed by OT core only. Their value is ignored when an instance of `https://openthread.io/reference/struct/ot-srp-client-service` is passed in `https://openthread.io/reference/group/api-srp#group__api-srp_1ga0ebf5d6f14933c1811ef07ac46c943c6` or `https://openthread.io/reference/group/api-srp#group__api-srp_1ga38dfbe1202f775514a9be7ae3b18d568` or other functions. The caller does not need to set these fields.

The `mLease` and `mKeyLease` fields specify the desired lease and key lease intervals for this service. Zero value indicates that the interval is unspecified and then the default lease or key lease intervals from `https://openthread.io/reference/group/api-srp#group__api-srp_1ga13fdfe8a4dcc48973a453559796bd012` and `https://openthread.io/reference/group/api-srp#group__api-srp_1ga8681cf238b71720601de4ac180dce12c` are used for this service. If the key lease interval (whether set explicitly or determined from the default) is shorter than the lease interval for a service, SRP client will re-use the lease interval value for key lease interval as well. For example, if in service `mLease` is explicitly set to 2 days and `mKeyLease` is set to zero and default key lease is set to 1 day, then when registering this service, the requested key lease for this service is also set to 2 days.

### otSrpServerAddressMode

```
enum otSrpServerAddressMode otSrpServerAddressMode
```
Represents the address mode used by the SRP server.

Address mode specifies how the address and port number are determined by the SRP server and how this info is published in the Thread Network Data.

Using the `OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD` option will make the implementation non-compliant with the Thread specification. This option is intended for testing and specific use-cases. When selected, the SRP server, upon being enabled, will bypass the Network Data publisher and always add the "SRP/DNS unicast" entry directly to the Network Data, regardless of how many other similar entries are present.

### otSrpServerHost

```
struct otSrpServerHost otSrpServerHost
```
This opaque type represents a SRP service host.

### otSrpServerLeaseConfig

```
struct otSrpServerLeaseConfig otSrpServerLeaseConfig
```
Includes SRP server LEASE and KEY-LEASE configurations.

### otSrpServerLeaseInfo

```
struct otSrpServerLeaseInfo otSrpServerLeaseInfo
```
Includes SRP server lease information of a host/service.

### otSrpServerResponseCounters

```
struct otSrpServerResponseCounters otSrpServerResponseCounters
```
Includes the statistics of SRP server responses.

### otSrpServerService

```
struct otSrpServerService otSrpServerService
```
This opaque type represents a SRP service.

### otSrpServerServiceUpdateHandler

```
void(* otSrpServerServiceUpdateHandler)(otSrpServerServiceUpdateId aId, const otSrpServerHost *aHost, uint32_t aTimeout, void *aContext)
```
Handles SRP service updates.

Is called by the SRP server to notify that a SRP host and possibly SRP services are being updated. It is important that the SRP updates are not committed until the handler returns the result by calling otSrpServerHandleServiceUpdateResult or times out after `aTimeout`.

A SRP service observer should always call otSrpServerHandleServiceUpdateResult with error code OT_ERROR_NONE immediately after receiving the update events.

A more generic handler may perform validations on the SRP host/services and rejects the SRP updates if any validation fails. For example, an Advertising Proxy should advertise (or remove) the host and services on a multicast-capable link and returns specific error code if any failure occurs.

<br />

Details Parameters `[in] aId` The service update transaction ID. This ID must be passed back with `otSrpServerHandleServiceUpdateResult`. `[in] aHost` A pointer to the otSrpServerHost object which contains the SRP updates. The handler should publish/un-publish the host and each service points to this host with below rules:

1. If the host is not deleted (indicated by `otSrpServerHostIsDeleted`), then it should be published or updated with mDNS. Otherwise, the host should be un-published (remove AAAA RRs).
2. For each service points to this host, it must be un-published if the host is to be un-published. Otherwise, the handler should publish or update the service when it is not deleted (indicated by `otSrpServerServiceIsDeleted`) and un-publish it when deleted.
`[in] aTimeout` The maximum time in milliseconds for the handler to process the service event. `[in] aContext` A pointer to application-specific context. **See also:**   
[otSrpServerSetServiceUpdateHandler](https://openthread.io/reference/group/api-srp#group__api-srp_1gacf29e6c9fb844fc39f5b6c80d3c433dc)   
[otSrpServerHandleServiceUpdateResult](https://openthread.io/reference/group/api-srp#group__api-srp_1ga7d44a2908bea0f1f175bca2aeeefbc05)   

### otSrpServerServiceUpdateId

```
uint32_t otSrpServerServiceUpdateId
```
The ID of a SRP service update transaction on the SRP Server.

### otSrpServerTtlConfig

```
struct otSrpServerTtlConfig otSrpServerTtlConfig
```
Includes SRP server TTL configurations.

## Functions

### otSrpClientAddService

```
otError otSrpClientAddService(
  otInstance *aInstance,
  otSrpClientService *aService
)
```
Adds a service to be registered with server.

After a successful call to this function, `otSrpClientCallback` will be called to report the status of the service addition/registration with SRP server.

The `https://openthread.io/reference/struct/ot-srp-client-service` instance being pointed to by `aService` MUST persist and remain unchanged after returning from this function (with `OT_ERROR_NONE`). OpenThread will save the pointer to the service instance.

The `https://openthread.io/reference/struct/ot-srp-client-service` instance is not longer tracked by OpenThread and can be reclaimed only when


- It is removed explicitly by a call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga38dfbe1202f775514a9be7ae3b18d568` or removed along with other services by a call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga43324d90582bbb2f97b5bbaf31e97fe4 and only after the`otSrpClientCallback\` is called indicating the service was removed. Or,
- A call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga3c9f5f8b8b424c57f27ed06554a978c6` which removes the host and all related services immediately.

<br />

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aService` A pointer to a `https://openthread.io/reference/struct/ot-srp-client-service` instance to add. Return Values `OT_ERROR_NONE` The addition of service started successfully. The `otSrpClientCallback` will be called to report the status. `OT_ERROR_ALREADY` A service with the same service and instance names is already in the list. `OT_ERROR_INVALID_ARGS` The service structure is invalid (e.g., bad service name or `https://openthread.io/reference/struct/ot-dns-txt-entry`).

### otSrpClientBuffersAllocateService

```
otSrpClientBuffersServiceEntry * otSrpClientBuffersAllocateService(
  otInstance *aInstance
)
```
Allocates a new service entry from the pool.

The returned service entry instance will be initialized as follows:


- `mService.mName` will point to an allocated string buffer which can be retrieved using the function `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6be1cac190f771a8b2bd270e6ecc3bcf`.
- `mService.mInstanceName` will point to an allocated string buffer which can be retrieved using the function `https://openthread.io/reference/group/api-srp#group__api-srp_1ga25ae1a7ae1d8af13fe515485db220f49`.
- `mService.mSubTypeLabels` points to an array that is returned from `https://openthread.io/reference/group/api-srp#group__api-srp_1ga99083f5889173c81f0f1d1b5c2d85e79`.
- `mService.mTxtEntries` will point to `mTxtEntry`.
- `mService.mNumTxtEntries` will be set to one.
- Other `mService` fields (port, priority, weight) are set to zero.
- `mTxtEntry.mKey` is set to NULL (value is treated as already encoded).
- `mTxtEntry.mValue` will point to an allocated buffer which can be retrieved using the function `https://openthread.io/reference/group/api-srp#group__api-srp_1gaad5dc3e2c3d9b2b693d4c95a92b7b8b1`.
- `mTxtEntry.mValueLength` is set to zero.
- All related data/string buffers and arrays are cleared to all zero.

<br />

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** A pointer to the newly allocated service entry or NULL if not more entry available in the pool.

### otSrpClientBuffersFreeAllServices

```
void otSrpClientBuffersFreeAllServices(
  otInstance *aInstance
)
```
Frees all previously allocated service entries.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance.

### otSrpClientBuffersFreeService

```
void otSrpClientBuffersFreeService(
  otInstance *aInstance,
  otSrpClientBuffersServiceEntry *aService
)
```
Frees a previously allocated service entry.

The `aService` MUST be previously allocated using `https://openthread.io/reference/group/api-srp#group__api-srp_1ga6cf0592ef6f460bab6bd336124339def` and not yet freed. Otherwise the behavior of this function is undefined.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aService` A pointer to the service entry to free (MUST NOT be NULL).

### otSrpClientBuffersGetHostAddressesArray

```
otIp6Address * otSrpClientBuffersGetHostAddressesArray(
  otInstance *aInstance,
  uint8_t *aArrayLength
)
```
Gets the array of IPv6 address entries to use as SRP client host address list.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[out] aArrayLength` Pointer to a variable to return the array length i.e., number of IPv6 address entries in the array (MUST NOT be NULL). **Returns** A pointer to an array of `https://openthread.io/reference/struct/ot-ip6-address` entries (number of entries is returned in `aArrayLength`).

### otSrpClientBuffersGetHostNameString

```
char * otSrpClientBuffersGetHostNameString(
  otInstance *aInstance,
  uint16_t *aSize
)
```
Gets the string buffer to use for SRP client host name.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[out] aSize` Pointer to a variable to return the size (number of bytes) of the string buffer (MUST NOT be NULL). **Returns** A pointer to char buffer to use for SRP client host name.

### otSrpClientBuffersGetServiceEntryInstanceNameString

```
char * otSrpClientBuffersGetServiceEntryInstanceNameString(
  otSrpClientBuffersServiceEntry *aEntry,
  uint16_t *aSize
)
```
Gets the string buffer for service instance name from a service entry.

<br />

Details Parameters `[in] aEntry` A pointer to a previously allocated service entry (MUST NOT be NULL). `[out] aSize` A pointer to a variable to return the size (number of bytes) of the string buffer (MUST NOT be NULL). **Returns** A pointer to the string buffer.

### otSrpClientBuffersGetServiceEntryServiceNameString

```
char * otSrpClientBuffersGetServiceEntryServiceNameString(
  otSrpClientBuffersServiceEntry *aEntry,
  uint16_t *aSize
)
```
Gets the string buffer for service name from a service entry.

<br />

Details Parameters `[in] aEntry` A pointer to a previously allocated service entry (MUST NOT be NULL). `[out] aSize` A pointer to a variable to return the size (number of bytes) of the string buffer (MUST NOT be NULL). **Returns** A pointer to the string buffer.

### otSrpClientBuffersGetServiceEntryTxtBuffer

```
uint8_t * otSrpClientBuffersGetServiceEntryTxtBuffer(
  otSrpClientBuffersServiceEntry *aEntry,
  uint16_t *aSize
)
```
Gets the buffer for TXT record from a service entry.

<br />

Details Parameters `[in] aEntry` A pointer to a previously allocated service entry (MUST NOT be NULL). `[out] aSize` A pointer to a variable to return the size (number of bytes) of the buffer (MUST NOT be NULL). **Returns** A pointer to the buffer.

### otSrpClientBuffersGetSubTypeLabelsArray

```
const char ** otSrpClientBuffersGetSubTypeLabelsArray(
  otSrpClientBuffersServiceEntry *aEntry,
  uint16_t *aArrayLength
)
```
Gets the array for service subtype labels from the service entry.

<br />

Details Parameters `[in] aEntry` A pointer to a previously allocated service entry (MUST NOT be NULL). `[out] aArrayLength` A pointer to a variable to return the array length (MUST NOT be NULL). **Returns** A pointer to the array.

### otSrpClientClearHostAndServices

```
void otSrpClientClearHostAndServices(
  otInstance *aInstance
)
```
Clears all host info and all the services.

Unlike `https://openthread.io/reference/group/api-srp#group__api-srp_1ga43324d90582bbb2f97b5bbaf31e97fe4` which sends an update message to the server to remove all the info, this function clears all the info immediately without any interaction with the server.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance.

### otSrpClientClearService

```
otError otSrpClientClearService(
  otInstance *aInstance,
  otSrpClientService *aService
)
```
Clears a service, immediately removing it from the client service list.

Unlike `https://openthread.io/reference/group/api-srp#group__api-srp_1ga38dfbe1202f775514a9be7ae3b18d568` which sends an update message to the server to remove the service, this function clears the service from the client's service list without any interaction with the server. On a successful call to this function, the `otSrpClientCallback` will NOT be called and the `aService` entry can be reclaimed and re-used by the caller immediately.

Can be used along with a subsequent call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga0ebf5d6f14933c1811ef07ac46c943c6` (potentially reusing the same `aService` entry with the same service and instance names) to update some of the parameters in an existing service.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aService` A pointer to a `https://openthread.io/reference/struct/ot-srp-client-service` instance to delete. Return Values `OT_ERROR_NONE` The `aService` is deleted successfully. It can be reclaimed and re-used immediately. `OT_ERROR_NOT_FOUND` The service could not be found in the list.

### otSrpClientDisableAutoStartMode

```
void otSrpClientDisableAutoStartMode(
  otInstance *aInstance
)
```
Disables the auto-start mode.

This is only available when auto-start feature `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled.

Disabling the auto-start mode will not stop the client if it is already running but the client stops monitoring the Thread Network Data to verify that the selected SRP server is still present in it.

Note that a call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga937241edaaf4bd9a2984f3d4bf165721` will also disable the auto-start mode.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance.

### otSrpClientEnableAutoHostAddress

```
otError otSrpClientEnableAutoHostAddress(
  otInstance *aInstance
)
```
Enables auto host address mode.

When enabled host IPv6 addresses are automatically set by SRP client using all the preferred unicast addresses on Thread netif excluding all link-local and mesh-local addresses. If there is no preferred address, then Mesh Local EID address is added. The SRP client will automatically re-register when/if addresses on Thread netif are updated (new addresses are added or existing addresses are removed or marked as non-preferred).

The auto host address mode can be enabled before start or during operation of SRP client except when the host info is being removed (client is busy handling a remove request from an call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga43324d90582bbb2f97b5bbaf31e97fe4` and host info still being in either `STATE_TO_REMOVE` or `STATE_REMOVING` states).

After auto host address mode is enabled, it can be disabled by a call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga5f94d5e95417fa19eb6dd8069c963701` which then explicitly sets the host addresses.

<br />

Details Return Values `OT_ERROR_NONE` Successfully enabled auto host address mode. `OT_ERROR_INVALID_STATE` Host is being removed and therefore cannot enable auto host address mode.

### otSrpClientEnableAutoStartMode

```
void otSrpClientEnableAutoStartMode(
  otInstance *aInstance,
  otSrpClientAutoStartCallback aCallback,
  void *aContext
)
```
Enables the auto-start mode.

This is only available when auto-start feature `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled.

Config option `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_DEFAULT_MODE` specifies the default auto-start mode (whether it is enabled or disabled at the start of OT stack).

When auto-start is enabled, the SRP client will monitor the Thread Network Data to discover SRP servers and select the preferred server and automatically start and stop the client when an SRP server is detected.

There are three categories of Network Data entries indicating presence of SRP sever. They are preferred in the following order:

1) Preferred unicast entries where server address is included in the service data. If there are multiple options, the one with numerically lowest IPv6 address is preferred.

2) Anycast entries each having a seq number. A larger sequence number in the sense specified by Serial Number Arithmetic logic in RFC-1982 is considered more recent and therefore preferred. The largest seq number using serial number arithmetic is preferred if it is well-defined (i.e., the seq number is larger than all other seq numbers). If it is not well-defined, then the numerically largest seq number is preferred.

3) Unicast entries where the server address info is included in server data. If there are multiple options, the one with numerically lowest IPv6 address is preferred.

When there is a change in the Network Data entries, client will check that the currently selected server is still present in the Network Data and is still the preferred one. Otherwise the client will switch to the new preferred server or stop if there is none.

When the SRP client is explicitly started through a successful call to `https://openthread.io/reference/group/api-srp#group__api-srp_1gafc3c0caa4ef2c20440850684746cffbc`, the given SRP server address in `https://openthread.io/reference/group/api-srp#group__api-srp_1gafc3c0caa4ef2c20440850684746cffbc` will continue to be used regardless of the state of auto-start mode and whether the same SRP server address is discovered or not in the Thread Network Data. In this case, only an explicit `https://openthread.io/reference/group/api-srp#group__api-srp_1ga937241edaaf4bd9a2984f3d4bf165721` call will stop the client.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aCallback` A callback to notify when client is auto-started/stopped. Can be NULL if not needed. `[in] aContext` A context to be passed when invoking `aCallback`.

### otSrpClientGetCounters

```
const otSrpClientCounters * otSrpClientGetCounters(
  otInstance *aInstance
)
```
Gets the SRP client counters.

Requires `OPENTHREAD_CONFIG_SRP_CLIENT_COUNTERS_ENABLE` to be enabled.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. **Returns** A pointer to the SRP client counters.

### otSrpClientGetDomainName

```
const char * otSrpClientGetDomainName(
  otInstance *aInstance
)
```
Gets the domain name being used by SRP client.

Requires `OPENTHREAD_CONFIG_SRP_CLIENT_DOMAIN_NAME_API_ENABLE` to be enabled.

If domain name is not set, "default.service.arpa" will be used.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** The domain name string.

### otSrpClientGetHostInfo

```
const otSrpClientHostInfo * otSrpClientGetHostInfo(
  otInstance *aInstance
)
```
Gets the host info.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** A pointer to host info structure.

### otSrpClientGetKeyLeaseInterval

```
uint32_t otSrpClientGetKeyLeaseInterval(
  otInstance *aInstance
)
```
Gets the default key lease interval used in SRP update requests.

The default interval is used only for `https://openthread.io/reference/struct/ot-srp-client-service` instances with `mKeyLease` set to zero.

Note that this is the lease duration requested by the SRP client. The server may choose to accept a different lease interval.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** The key lease interval (in seconds).

### otSrpClientGetLeaseInterval

```
uint32_t otSrpClientGetLeaseInterval(
  otInstance *aInstance
)
```
Gets the default lease interval used in SRP update requests.

The default interval is used only for `https://openthread.io/reference/struct/ot-srp-client-service` instances with `mLease` set to zero.

Note that this is the lease duration requested by the SRP client. The server may choose to accept a different lease interval.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** The lease interval (in seconds).

### otSrpClientGetServerAddress

```
const otSockAddr * otSrpClientGetServerAddress(
  otInstance *aInstance
)
```
Gets the socket address (IPv6 address and port number) of the SRP server which is being used by SRP client.

If the client is not running, the address is unspecified (all zero) with zero port number.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** A pointer to the SRP server's socket address (is always non-NULL).

### otSrpClientGetServices

```
const otSrpClientService * otSrpClientGetServices(
  otInstance *aInstance
)
```
Gets the list of services being managed by client.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** A pointer to the head of linked-list of all services or NULL if the list is empty.

### otSrpClientGetTtl

```
uint32_t otSrpClientGetTtl(
  otInstance *aInstance
)
```
Gets the TTL value in every record included in SRP update requests.

Note that this is the TTL requested by the SRP client. The server may choose to accept a different TTL.

By default, the TTL will equal the lease interval. Passing 0 or a value larger than the lease interval via `https://openthread.io/reference/group/api-srp#group__api-srp_1gab8813ca9a5e7a08e4e854daffa32a481` will also cause the TTL to equal the lease interval.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** The TTL (in seconds).

### otSrpClientIsAutoStartModeEnabled

```
bool otSrpClientIsAutoStartModeEnabled(
  otInstance *aInstance
)
```
Indicates the current state of auto-start mode (enabled or disabled).

This is only available when auto-start feature `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** TRUE if the auto-start mode is enabled, FALSE otherwise.

### otSrpClientIsRunning

```
bool otSrpClientIsRunning(
  otInstance *aInstance
)
```
Indicates whether the SRP client is running or not.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** TRUE if the SRP client is running, FALSE otherwise.

### otSrpClientIsServiceKeyRecordEnabled

```
bool otSrpClientIsServiceKeyRecordEnabled(
  otInstance *aInstance
)
```
Indicates whether the "service key record inclusion" mode is enabled or disabled.

Is available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` configuration is enabled.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. **Returns** TRUE if "service key record inclusion" mode is enabled, FALSE otherwise.

### otSrpClientItemStateToString

```
const char * otSrpClientItemStateToString(
  otSrpClientItemState aItemState
)
```
Converts a `otSrpClientItemState` to a string.

<br />

Details Parameters `[in] aItemState` An item state. **Returns** A string representation of `aItemState`.

### otSrpClientRemoveHostAndServices

```
otError otSrpClientRemoveHostAndServices(
  otInstance *aInstance,
  bool aRemoveKeyLease,
  bool aSendUnregToServer
)
```
Starts the remove process of the host info and all services.

After returning from this function, `otSrpClientCallback` will be called to report the status of remove request with SRP server.

If the host info is to be permanently removed from server, `aRemoveKeyLease` should be set to `true` which removes the key lease associated with host on server. Otherwise, the key lease record is kept as before, which ensures that the server holds the host name in reserve for when the client is once again able to provide and register its service(s).

The `aSendUnregToServer` determines the behavior when the host info is not yet registered with the server. If `aSendUnregToServer` is set to `false` (which is the default/expected value) then the SRP client will immediately remove the host info and services without sending an update message to server (no need to update the server if nothing is yet registered with it). If `aSendUnregToServer` is set to `true` then the SRP client will send an update message to the server. Note that if the host info is registered then the value of `aSendUnregToServer` does not matter and the SRP client will always send an update message to server requesting removal of all info.

One situation where `aSendUnregToServer` can be useful is on a device reset/reboot, caller may want to remove any previously registered services with the server. In this case, caller can `https://openthread.io/reference/group/api-srp#group__api-srp_1gad00aa82af3a71e91ef2d8eb796099a64` and then request `https://openthread.io/reference/group/api-srp#group__api-srp_1ga43324d90582bbb2f97b5bbaf31e97fe4` with `aSendUnregToServer` as `true`.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aRemoveKeyLease` A boolean indicating whether or not the host key lease should also be removed. `[in] aSendUnregToServer` A boolean indicating whether to send update to server when host info is not registered. Return Values `OT_ERROR_NONE` The removal of host info and services started successfully. The `otSrpClientCallback` will be called to report the status. `OT_ERROR_ALREADY` The host info is already removed.

### otSrpClientRemoveService

```
otError otSrpClientRemoveService(
  otInstance *aInstance,
  otSrpClientService *aService
)
```
Requests a service to be unregistered with server.

After a successful call to this function, `otSrpClientCallback` will be called to report the status of remove request with SRP server.

The `https://openthread.io/reference/struct/ot-srp-client-service` instance being pointed to by `aService` MUST persist and remain unchanged after returning from this function (with `OT_ERROR_NONE`). OpenThread will keep the service instance during the remove process. Only after the `otSrpClientCallback` is called indicating the service instance is removed from SRP client service list and can be be freed/reused.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aService` A pointer to a `https://openthread.io/reference/struct/ot-srp-client-service` instance to remove. Return Values `OT_ERROR_NONE` The removal of service started successfully. The `otSrpClientCallback` will be called to report the status. `OT_ERROR_NOT_FOUND` The service could not be found in the list.

### otSrpClientResetCounters

```
void otSrpClientResetCounters(
  otInstance *aInstance
)
```
Resets the SRP client counters.

Requires `OPENTHREAD_CONFIG_SRP_CLIENT_COUNTERS_ENABLE` to be enabled.

All event counters are cleared and the time-tracking accumulators are restarted.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance.

### otSrpClientSetCallback

```
void otSrpClientSetCallback(
  otInstance *aInstance,
  otSrpClientCallback aCallback,
  void *aContext
)
```
Sets the callback to notify caller of events/changes from SRP client.

The SRP client allows a single callback to be registered. So consecutive calls to this function will overwrite any previously set callback functions.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aCallback` The callback to notify of events and changes. Can be NULL if not needed. `[in] aContext` An arbitrary context used with `aCallback`.

### otSrpClientSetDomainName

```
otError otSrpClientSetDomainName(
  otInstance *aInstance,
  const char *aName
)
```
Sets the domain name to be used by SRP client.

Requires `OPENTHREAD_CONFIG_SRP_CLIENT_DOMAIN_NAME_API_ENABLE` to be enabled.

If not set "default.service.arpa" will be used.

The name string buffer pointed to by `aName` MUST persist and stay unchanged after returning from this function. OpenThread will keep the pointer to the string.

The domain name can be set before client is started or after start but before host info is registered with server (host info should be in either `STATE_TO_ADD` or `STATE_TO_REMOVE`).

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aName` A pointer to the domain name string. If NULL sets it to default "default.service.arpa". Return Values `OT_ERROR_NONE` The domain name label was set successfully. `OT_ERROR_INVALID_STATE` The host info is already registered with server.

### otSrpClientSetHostAddresses

```
otError otSrpClientSetHostAddresses(
  otInstance *aInstance,
  const otIp6Address *aIp6Addresses,
  uint8_t aNumAddresses
)
```
Sets/updates the list of host IPv6 address.

Host IPv6 addresses can be set/changed before start or during operation of SRP client (e.g. to add/remove or change a previously registered host address), except when the host info is being removed (client is busy handling a remove request from an earlier call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga43324d90582bbb2f97b5bbaf31e97fe4` and host info still being in either `STATE_TO_REMOVE` or `STATE_REMOVING` states).

The host IPv6 address array pointed to by `aIp6Addresses` MUST persist and remain unchanged after returning from this function (with `OT_ERROR_NONE`). OpenThread will save the pointer to the array.

After a successful call to this function, `otSrpClientCallback` will be called to report the status of the address registration with SRP server.

Calling this function disables auto host address mode if it was previously enabled from a successful call to `https://openthread.io/reference/group/api-srp#group__api-srp_1gaaca08836819d126e2e98f4fd5fc6d505`.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aIp6Addresses` A pointer to the an array containing the host IPv6 addresses. `[in] aNumAddresses` The number of addresses in the `aIp6Addresses` array. Return Values `OT_ERROR_NONE` The host IPv6 address list change started successfully. The `otSrpClientCallback` will be called to report the status of registering addresses with server. `OT_ERROR_INVALID_ARGS` The address list is invalid (e.g., must contain at least one address). `OT_ERROR_INVALID_STATE` Host is being removed and therefore cannot change host address.

### otSrpClientSetHostName

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

After a successful call to this function, `otSrpClientCallback` will be called to report the status of host info registration with SRP server.

The name string buffer pointed to by `aName` MUST persist and stay unchanged after returning from this function. OpenThread will keep the pointer to the string.

The host name can be set before client is started or after start but before host info is registered with server (host info should be in either `STATE_TO_ADD` or `STATE_REMOVED`).

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aName` A pointer to host name label string (MUST NOT be NULL). Pointer to the string buffer MUST persist and remain valid and constant after return from this function. Return Values `OT_ERROR_NONE` The host name label was set successfully. `OT_ERROR_INVALID_ARGS` The `aName` is NULL. `OT_ERROR_INVALID_STATE` The host name is already set and registered with the server.

### otSrpClientSetKeyLeaseInterval

```
void otSrpClientSetKeyLeaseInterval(
  otInstance *aInstance,
  uint32_t aInterval
)
```
Sets the default key lease interval used in SRP update requests.

The default interval is used only for `https://openthread.io/reference/struct/ot-srp-client-service` instances with `mKeyLease` set to zero.

Changing the lease interval does not impact the accepted lease interval of already registered services/host-info. It only affects any future SRP update messages (i.e., adding new services and/or refreshes of existing services).

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aInterval` The key lease interval (in seconds). If zero, the default value specified by `OPENTHREAD_CONFIG_SRP_CLIENT_DEFAULT_KEY_LEASE` would be used.

### otSrpClientSetLeaseInterval

```
void otSrpClientSetLeaseInterval(
  otInstance *aInstance,
  uint32_t aInterval
)
```
Sets the default lease interval used in SRP update requests.

The default interval is used only for `https://openthread.io/reference/struct/ot-srp-client-service` instances with `mLease` set to zero.

Changing the lease interval does not impact the accepted lease interval of already registered services/host-info. It only affects any future SRP update messages (i.e., adding new services and/or refreshes of the existing services).

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aInterval` The lease interval (in seconds). If zero, the default value specified by `OPENTHREAD_CONFIG_SRP_CLIENT_DEFAULT_LEASE` would be used.

### otSrpClientSetServiceKeyRecordEnabled

```
void otSrpClientSetServiceKeyRecordEnabled(
  otInstance *aInstance,
  bool aEnabled
)
```
Enables/disables "service key record inclusion" mode.

When enabled, SRP client will include KEY record in Service Description Instructions in the SRP update messages that it sends.

Is available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` configuration is enabled.


> [!NOTE]
> **Note:** KEY record is optional in Service Description Instruction (it is required and always included in the Host Description Instruction). The default behavior of SRP client is to not include it. This function is intended to override the default behavior for testing only.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aEnabled` TRUE to enable, FALSE to disable the "service key record inclusion" mode.

### otSrpClientSetTtl

```
void otSrpClientSetTtl(
  otInstance *aInstance,
  uint32_t aTtl
)
```
Sets the TTL value in every record included in SRP update requests.

Changing the TTL does not impact the TTL of already registered services/host-info. It only affects future SRP update messages (i.e., adding new services and/or refreshes of the existing services).

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aTtl` The TTL (in seconds). If value is zero or greater than lease interval, the TTL is set to the lease interval.

### otSrpClientStart

```
otError otSrpClientStart(
  otInstance *aInstance,
  const otSockAddr *aServerSockAddr
)
```
Starts the SRP client operation.

SRP client will prepare and send "SRP Update" message to the SRP server once all the following conditions are met:


- The SRP client is started - `https://openthread.io/reference/group/api-srp#group__api-srp_1gafc3c0caa4ef2c20440850684746cffbc` is called.
- Host name is set - `https://openthread.io/reference/group/api-srp#group__api-srp_1gad00aa82af3a71e91ef2d8eb796099a64` is called.
- At least one host IPv6 address is set - `https://openthread.io/reference/group/api-srp#group__api-srp_1ga5f94d5e95417fa19eb6dd8069c963701` is called.
- At least one service is added - `https://openthread.io/reference/group/api-srp#group__api-srp_1ga0ebf5d6f14933c1811ef07ac46c943c6` is called.

<br />

It does not matter in which order these functions are called. When all conditions are met, the SRP client will wait for a short delay before preparing an "SRP Update" message and sending it to server. This delay allows for user to add multiple services and/or IPv6 addresses before the first SRP Update message is sent (ensuring a single SRP Update is sent containing all the info). The config `OPENTHREAD_CONFIG_SRP_CLIENT_UPDATE_TX_DELAY` specifies the delay interval.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. `[in] aServerSockAddr` The socket address (IPv6 address and port number) of the SRP server. Return Values `OT_ERROR_NONE` SRP client operation started successfully or it is already running with same server socket address and callback. `OT_ERROR_BUSY` SRP client is busy running with a different socket address. `OT_ERROR_FAILED` Failed to open/connect the client's UDP socket.

### otSrpClientStop

```
void otSrpClientStop(
  otInstance *aInstance
)
```
Stops the SRP client operation.

Stops any further interactions with the SRP server. Note that it does not remove or clear host info and/or list of services. It marks all services to be added/removed again once the client is (re)started.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance.

### otSrpServerEnableFastStartMode

```
otError otSrpServerEnableFastStartMode(
  otInstance *aInstance
)
```
Enables the "Fast Start Mode" on the SRP server.

Requires the `OPENTHREAD_CONFIG_SRP_SERVER_FAST_START_MODE_ENABLE` feature to be enabled.

The Fast Start Mode is designed for scenarios where a device, often a mobile device, needs to act as a provisional SRP server (e.g., functioning as a temporary Border Router). The SRP server function is enabled only if no other Border Routers (BRs) are already providing the SRP service within the Thread network. A common use case is a mobile device joining a Thread network where it may be the first, or only, BR. Importantly, Fast Start Mode allows the device to quickly start its SRP server functionality upon joining the network, allowing other Thread devices to quickly connect and register their services without the typical delays associated with standard Border Router initialization (and SRP server startup).

When Fast Start Mode is enabled, the SRP server manages when to start or stop based on the presence of other BRs, following this process:

- Upon initial attachment to the Thread network, the device immediately inspects the received Network Data for any existing "SRP/DNS" entries. These entries indicate the presence of other active BRs providing SRP server service:
  - If no "SRP/DNS" entries from other BRs are found, the device immediately enables its own SRP server. This activation uses `OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD`, which bypasses the usual delay associated with the standard Network Data publisher, directly adding its own "SRP/DNS unicast" entry to the Network Data.
  - If "SRP/DNS" entries from other BRs are detected, the device will not enable its SRP server, deferring to the existing ones.
- After starting its SRP server in Fast Start Mode, the device continuously monitors the Network Data. If, at any point, new "SRP/DNS" entries appear (indicating that another BR has become active), the device automatically disables its own SRP server functionality, relinquishing the role to the newly available BR.

<br />

The Fast Start Mode can be enabled when the device is in the detached or disabled state, the SRP server is currently disabled, and "auto-enable mode" is not in use (i.e., `https://openthread.io/reference/group/api-srp#group__api-srp_1ga1c690c6c846e5fb6c3030350eafd11b7` returns `false`).

After successfully enabling Fast Start Mode, it can be disabled either by a call to `https://openthread.io/reference/group/api-srp#group__api-srp_1gabf2ae6a5695dc7aaef4e0c9c5ed01200`, explicitly enabling or disabling the SRP server, or by a call to `https://openthread.io/reference/group/api-srp#group__api-srp_1ga55ab7305434a195c063c033c33a76332`, enabling or disabling the auto-enable mode. If the Fast Start Mode (while active) enables the SRP server, upon disabling Fast Start Mode (regardless of how it is done), the SRP server will also be stopped, and the use of the `OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD` address mode will be stopped, and the address mode will be automatically reverted back to its previous setting before Fast Start Mode was enabled.

<br />

Details Parameters `[in] aInstance` A pointer to the OpenThread instance. Return Values `OT_ERROR_NONE` Fast Start Mode was successfully enabled. `OT_ERROR_INVALID_STATE` Cannot enable Fast Start Mode (e.g., already attached or server already enabled).

### otSrpServerGetAddressMode

```
otSrpServerAddressMode otSrpServerGetAddressMode(
  otInstance *aInstance
)
```
Returns the address mode being used by the SRP server.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. **Returns** The SRP server's address mode.

### otSrpServerGetAnycastModeSequenceNumber

```
uint8_t otSrpServerGetAnycastModeSequenceNumber(
  otInstance *aInstance
)
```
Returns the sequence number used with anycast address mode.

The sequence number is included in "DNS/SRP Service Anycast Address" entry published in the Network Data.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. **Returns** The anycast sequence number.

### otSrpServerGetDomain

```
const char * otSrpServerGetDomain(
  otInstance *aInstance
)
```
Returns the domain authorized to the SRP server.

If the domain if not set by SetDomain, "default.service.arpa." will be returned. A trailing dot is always appended even if the domain is set without it.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. **Returns** A pointer to the dot-joined domain string.

### otSrpServerGetLeaseConfig

```
void otSrpServerGetLeaseConfig(
  otInstance *aInstance,
  otSrpServerLeaseConfig *aLeaseConfig
)
```
Returns SRP server LEASE and KEY-LEASE configurations.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[out] aLeaseConfig` A pointer to an `https://openthread.io/reference/struct/ot-srp-server-lease-config` instance.

### otSrpServerGetNextHost

```
const otSrpServerHost * otSrpServerGetNextHost(
  otInstance *aInstance,
  const otSrpServerHost *aHost
)
```
Returns the next registered host on the SRP server.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aHost` A pointer to current host; use NULL to get the first host. **Returns** A pointer to the registered host. NULL, if no more hosts can be found.

### otSrpServerGetPort

```
uint16_t otSrpServerGetPort(
  otInstance *aInstance
)
```
Returns the port the SRP server is listening to.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. **Returns** The port of the SRP server. It returns 0 if the server is not running.

### otSrpServerGetResponseCounters

```
const otSrpServerResponseCounters * otSrpServerGetResponseCounters(
  otInstance *aInstance
)
```
Returns the response counters of the SRP server.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. **Returns** A pointer to the response counters of the SRP server.

### otSrpServerGetState

```
otSrpServerState otSrpServerGetState(
  otInstance *aInstance
)
```
Returns the state of the SRP server.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. **Returns** The current state of the SRP server.

### otSrpServerGetTtlConfig

```
void otSrpServerGetTtlConfig(
  otInstance *aInstance,
  otSrpServerTtlConfig *aTtlConfig
)
```
Returns SRP server TTL configuration.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[out] aTtlConfig` A pointer to an `https://openthread.io/reference/struct/ot-srp-server-ttl-config` instance.

### otSrpServerHandleServiceUpdateResult

```
void otSrpServerHandleServiceUpdateResult(
  otInstance *aInstance,
  otSrpServerServiceUpdateId aId,
  otError aError
)
```
Reports the result of processing a SRP update to the SRP server.

The Service Update Handler should call this function to return the result of its processing of a SRP update.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aId` The service update transaction ID. This should be the same ID provided via `otSrpServerServiceUpdateHandler`. `[in] aError` An error to be returned to the SRP server. Use OT_ERROR_DUPLICATED to represent DNS name conflicts.

### otSrpServerHostGetAddresses

```
const otIp6Address * otSrpServerHostGetAddresses(
  const otSrpServerHost *aHost,
  uint8_t *aAddressesNum
)
```
Returns the addresses of given host.

<br />

Details Parameters `[in] aHost` A pointer to the SRP service host. `[out] aAddressesNum` A pointer to where we should output the number of the addresses to. **Returns** A pointer to the array of IPv6 Address.

### otSrpServerHostGetFullName

```
const char * otSrpServerHostGetFullName(
  const otSrpServerHost *aHost
)
```
Returns the full name of the host.

<br />

Details Parameters `[in] aHost` A pointer to the SRP service host. **Returns** A pointer to the null-terminated host name string.

### otSrpServerHostGetLeaseInfo

```
void otSrpServerHostGetLeaseInfo(
  const otSrpServerHost *aHost,
  otSrpServerLeaseInfo *aLeaseInfo
)
```
Returns the LEASE and KEY-LEASE information of a given host.

<br />

Details Parameters `[in] aHost` A pointer to the SRP server host. `[out] aLeaseInfo` A pointer to where to output the LEASE and KEY-LEASE information.

### otSrpServerHostGetNextService

```
const otSrpServerService * otSrpServerHostGetNextService(
  const otSrpServerHost *aHost,
  const otSrpServerService *aService
)
```
Returns the next service of given host.

<br />

Details Parameters `[in] aHost` A pointer to the SRP service host. `[in] aService` A pointer to current SRP service instance; use NULL to get the first service. **Returns** A pointer to the next service or NULL if there is no more services.

### otSrpServerHostIsDeleted

```
bool otSrpServerHostIsDeleted(
  const otSrpServerHost *aHost
)
```
Tells if the SRP service host has been deleted.

A SRP service host can be deleted but retains its name for future uses. In this case, the host instance is not removed from the SRP server/registry.

<br />

Details Parameters `[in] aHost` A pointer to the SRP service host. **Returns** TRUE if the host has been deleted, FALSE if not.

### otSrpServerHostMatchesFullName

```
bool otSrpServerHostMatchesFullName(
  const otSrpServerHost *aHost,
  const char *aFullName
)
```
Indicates whether the host matches a given host name.

DNS name matches are performed using a case-insensitive string comparison (i.e., "Abc" and "aBc" are considered to be the same).

<br />

Details Parameters `[in] aHost` A pointer to the SRP service host. `[in] aFullName` A full host name. Return Values `TRUE` If host matches the host name. `FALSE` If host does not match the host name.

### otSrpServerIsAutoEnableMode

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

Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` feature.

<br />

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

### otSrpServerIsFastStartModeEnabled

```
bool otSrpServerIsFastStartModeEnabled(
  otInstance *aInstance
)
```
Indicates whether the Fast Start Mode is enabled or disabled.

Requires `OPENTHREAD_CONFIG_SRP_SERVER_FAST_START_MODE_ENABLE` feature to be enabled.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. Return Values `TRUE` The fast-start mode is enabled. `FALSE` The fast-start mode is disabled.

### otSrpServerParseSubTypeServiceName

```
otError otSrpServerParseSubTypeServiceName(
  const char *aSubTypeServiceName,
  char *aLabel,
  uint8_t aLabelSize
)
```
Parses a sub-type service name (full name) and extracts the sub-type label.

The full service name for a sub-type service follows "._sub...".

<br />

Details Parameters `[in] aSubTypeServiceName` A sub-type service name (full name). `[out] aLabel` A pointer to a buffer to copy the extracted sub-type label. `[in] aLabelSize` Maximum size of `aLabel` buffer. Return Values `OT_ERROR_NONE` Name was successfully parsed and `aLabel` was updated. `OT_ERROR_NO_BUFS` The sub-type label could not fit in `aLabel` buffer (number of chars from label that could fit are copied in `aLabel` ensuring it is null-terminated). `OT_ERROR_INVALID_ARGS` `aSubTypeServiceName` is not a valid sub-type format.

### otSrpServerServiceGetHost

```
const otSrpServerHost * otSrpServerServiceGetHost(
  const otSrpServerService *aService
)
```
Returns the host which the service instance reside on.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** A pointer to the host instance.

### otSrpServerServiceGetInstanceLabel

```
const char * otSrpServerServiceGetInstanceLabel(
  const otSrpServerService *aService
)
```
Returns the service instance label (first label in instance name) of the service.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** A pointer to the null-terminated service instance label string..

### otSrpServerServiceGetInstanceName

```
const char * otSrpServerServiceGetInstanceName(
  const otSrpServerService *aService
)
```
Returns the full service instance name of the service.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** A pointer to the null-terminated service instance name string.

### otSrpServerServiceGetLeaseInfo

```
void otSrpServerServiceGetLeaseInfo(
  const otSrpServerService *aService,
  otSrpServerLeaseInfo *aLeaseInfo
)
```
Returns the LEASE and KEY-LEASE information of a given service.

<br />

Details Parameters `[in] aService` A pointer to the SRP server service. `[out] aLeaseInfo` A pointer to where to output the LEASE and KEY-LEASE information.

### otSrpServerServiceGetNumberOfSubTypes

```
uint16_t otSrpServerServiceGetNumberOfSubTypes(
  const otSrpServerService *aService
)
```
Gets the number of sub-types of the service.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** The number of sub-types of `aService`.

### otSrpServerServiceGetPort

```
uint16_t otSrpServerServiceGetPort(
  const otSrpServerService *aService
)
```
Returns the port of the service instance.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** The port of the service.

### otSrpServerServiceGetPriority

```
uint16_t otSrpServerServiceGetPriority(
  const otSrpServerService *aService
)
```
Returns the priority of the service instance.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** The priority of the service.

### otSrpServerServiceGetServiceName

```
const char * otSrpServerServiceGetServiceName(
  const otSrpServerService *aService
)
```
Returns the full service name of the service.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** A pointer to the null-terminated service name string.

### otSrpServerServiceGetSubTypeServiceNameAt

```
const char * otSrpServerServiceGetSubTypeServiceNameAt(
  const otSrpServerService *aService,
  uint16_t aIndex
)
```
Gets the sub-type service name (full name) of the service at a given index.

The full service name for a sub-type service follows "._sub...".

<br />

Details Parameters `[in] aService` A pointer to the SRP service. `[in] aIndex` The index to get. **Returns** A pointer to sub-type service name at `aIndex`, or `NULL` if no sub-type at this index.

### otSrpServerServiceGetTtl

```
uint32_t otSrpServerServiceGetTtl(
  const otSrpServerService *aService
)
```
Returns the TTL of the service instance.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** The TTL of the service instance..

### otSrpServerServiceGetTxtData

```
const uint8_t * otSrpServerServiceGetTxtData(
  const otSrpServerService *aService,
  uint16_t *aDataLength
)
```
Returns the TXT record data of the service instance.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. `[out] aDataLength` A pointer to return the TXT record data length. MUST NOT be NULL. **Returns** A pointer to the buffer containing the TXT record data (the TXT data length is returned in `aDataLength`).

### otSrpServerServiceGetWeight

```
uint16_t otSrpServerServiceGetWeight(
  const otSrpServerService *aService
)
```
Returns the weight of the service instance.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** The weight of the service.

### otSrpServerServiceHasSubTypeServiceName

```
bool otSrpServerServiceHasSubTypeServiceName(
  const otSrpServerService *aService,
  const char *aSubTypeServiceName
)
```
Indicates whether or not the service has a given sub-type.

DNS name matches are performed using a case-insensitive string comparison (i.e., "Abc" and "aBc" are considered to be the same).

<br />

Details Parameters `[in] aService` A pointer to the SRP service. `[in] aSubTypeServiceName` The sub-type service name (full name) to check. Return Values `TRUE` Service contains the sub-type `aSubTypeServiceName`. `FALSE` Service does not contain the sub-type `aSubTypeServiceName`.

### otSrpServerServiceIsDeleted

```
bool otSrpServerServiceIsDeleted(
  const otSrpServerService *aService
)
```
Indicates whether or not the SRP service has been deleted.

A SRP service can be deleted but retains its name for future uses. In this case, the service instance is not removed from the SRP server/registry. It is guaranteed that all services are deleted if the host is deleted.

<br />

Details Parameters `[in] aService` A pointer to the SRP service. **Returns** TRUE if the service has been deleted, FALSE if not.

### otSrpServerServiceMatchesInstanceName

```
bool otSrpServerServiceMatchesInstanceName(
  const otSrpServerService *aService,
  const char *aInstanceName
)
```
Indicates whether this service matches a given service instance name.

DNS name matches are performed using a case-insensitive string comparison (i.e., "Abc" and "aBc" are considered to be the same).

<br />

Details Parameters `[in] aService` A pointer to the SRP service. `[in] aInstanceName` The service instance name. Return Values `TRUE` If service matches the service instance name. `FALSE` If service does not match the service instance name.

### otSrpServerServiceMatchesServiceName

```
bool otSrpServerServiceMatchesServiceName(
  const otSrpServerService *aService,
  const char *aServiceName
)
```
Indicates whether this service matches a given service name.

DNS name matches are performed using a case-insensitive string comparison (i.e., "Abc" and "aBc" are considered to be the same).

<br />

Details Parameters `[in] aService` A pointer to the SRP service. `[in] aServiceName` The service name. Return Values `TRUE` If service matches the service name. `FALSE` If service does not match the service name.

### otSrpServerSetAddressMode

```
otError otSrpServerSetAddressMode(
  otInstance *aInstance,
  otSrpServerAddressMode aMode
)
```
Sets the address mode to be used by the SRP server.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aMode` The address mode to use. Return Values `OT_ERROR_NONE` Successfully set the address mode. `OT_ERROR_INVALID_STATE` The SRP server is enabled and the address mode cannot be changed.

### otSrpServerSetAnycastModeSequenceNumber

```
otError otSrpServerSetAnycastModeSequenceNumber(
  otInstance *aInstance,
  uint8_t aSequenceNumber
)
```
Sets the sequence number used with anycast address mode.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aSequenceNumber` The sequence number to use. Return Values `OT_ERROR_NONE` Successfully set the address mode. `OT_ERROR_INVALID_STATE` The SRP server is enabled and the sequence number cannot be changed.

### otSrpServerSetAutoEnableMode

```
void otSrpServerSetAutoEnableMode(
  otInstance *aInstance,
  bool aEnabled
)
```
Enables/disables the auto-enable mode on SRP server.

Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` feature.

When this mode is enabled, the Border Routing Manager controls if/when to enable or disable the SRP server. SRP sever is auto-enabled if/when Border Routing is started and it is done with the initial prefix and route configurations (when the OMR and on-link prefixes are determined, advertised in emitted Router Advertisement message on infrastructure side and published in the Thread Network Data). The SRP server is auto-disabled if/when BR is stopped (e.g., if the infrastructure network interface is brought down or if BR gets detached).

This mode can be disabled by a `https://openthread.io/reference/group/api-srp#group__api-srp_1ga55ab7305434a195c063c033c33a76332` call with `aEnabled` set to `false` or if the SRP server is explicitly enabled or disabled by a call to `https://openthread.io/reference/group/api-srp#group__api-srp_1gabf2ae6a5695dc7aaef4e0c9c5ed01200` function. Disabling auto-enable mode using `otSrpServerSetAutoEnableMode(false)` will not change the current state of SRP sever (e.g., if it is enabled it stays enabled).

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aEnabled` A boolean to enable/disable the auto-enable mode.

### otSrpServerSetDomain

```
otError otSrpServerSetDomain(
  otInstance *aInstance,
  const char *aDomain
)
```
Sets the domain on the SRP server.

A trailing dot will be appended to `aDomain` if it is not already there. Should only be called before the SRP server is enabled.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aDomain` The domain to be set. MUST NOT be NULL. Return Values `OT_ERROR_NONE` Successfully set the domain to `aDomain`. `OT_ERROR_INVALID_STATE` The SRP server is already enabled and the Domain cannot be changed. `OT_ERROR_INVALID_ARGS` The argument `aDomain` is not a valid DNS domain name. `OT_ERROR_NO_BUFS` There is no memory to store content of `aDomain`.

### otSrpServerSetEnabled

```
void otSrpServerSetEnabled(
  otInstance *aInstance,
  bool aEnabled
)
```
Enables/disables the SRP server.

On a Border Router, it is recommended to use `https://openthread.io/reference/group/api-srp#group__api-srp_1ga55ab7305434a195c063c033c33a76332` instead.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aEnabled` A boolean to enable/disable the SRP server.

### otSrpServerSetLeaseConfig

```
otError otSrpServerSetLeaseConfig(
  otInstance *aInstance,
  const otSrpServerLeaseConfig *aLeaseConfig
)
```
Sets SRP server LEASE and KEY-LEASE configurations.

When a non-zero LEASE time is requested from a client, the granted value will be limited in range \[aMinLease, aMaxLease\]; and a non-zero KEY-LEASE will be granted in range \[aMinKeyLease, aMaxKeyLease\]. For zero LEASE or KEY-LEASE time, zero will be granted.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aLeaseConfig` A pointer to an `https://openthread.io/reference/struct/ot-srp-server-lease-config` instance. Return Values `OT_ERROR_NONE` Successfully set the LEASE and KEY-LEASE ranges. `OT_ERROR_INVALID_ARGS` The LEASE or KEY-LEASE range is not valid.

### otSrpServerSetServiceUpdateHandler

```
void otSrpServerSetServiceUpdateHandler(
  otInstance *aInstance,
  otSrpServerServiceUpdateHandler aServiceHandler,
  void *aContext
)
```
Sets the SRP service updates handler on SRP server.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aServiceHandler` A pointer to a service handler. Use NULL to remove the handler. `[in] aContext` A pointer to arbitrary context information. May be NULL if not used.

### otSrpServerSetTtlConfig

```
otError otSrpServerSetTtlConfig(
  otInstance *aInstance,
  const otSrpServerTtlConfig *aTtlConfig
)
```
Sets SRP server TTL configuration.

The granted TTL will always be no greater than the max lease interval configured via `https://openthread.io/reference/group/api-srp#group__api-srp_1gac4a00cf36e69fa964c01e9e15b643ce8`, regardless of the minimum and maximum TTL configuration.

<br />

Details Parameters `[in] aInstance` A pointer to an OpenThread instance. `[in] aTtlConfig` A pointer to an `https://openthread.io/reference/struct/ot-srp-server-ttl-config` instance. Return Values `OT_ERROR_NONE` Successfully set the TTL configuration. `OT_ERROR_INVALID_ARGS` The TTL configuration 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).