# otSrpClientService Struct Reference

# otSrpClientService


`#include <openthread/srp_client.h>`

Represents an SRP client service.

## Summary

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.

| ### Public attributes ||
|---|---|
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a82fca7fa49fea7836b58580d3232ddd7` | `uint32_t` Internal data (used by OT core). |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a2e177983dc39f5b96bc17f1cd5d5e28e` | `const char *` The service instance name label (not the full name). |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a01be77ee7746f25ead55cb3c762f6dea` | `uint32_t` Desired key lease interval in sec - zero to use default. |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a66473afb8d5d66d090c539883e80ba41` | `uint32_t` Desired lease interval in sec - zero to use default. |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1aa6ffb572b08c273ad16f072cd8280ff8` | `const char *` The service labels (e.g., "_mt._udp", not the full domain name). |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a145872c334a13ee323ba37c66ce7c241` | `struct https://openthread.io/reference/struct/ot-srp-client-service *` Pointer to next entry in a linked-list (managed by OT core). |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a00397729870b316c30b33525a1bdd58e` | `uint8_t` Number of entries in the `mTxtEntries` array. |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a122659504de948fe6436bf33e8761edc` | `uint16_t` The service port number. |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a066ed668b4d75534d3c66fed8695d499` | `uint16_t` The service priority. |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a6e301508364d150dd5e79c08685ead44` | `https://openthread.io/reference/group/api-srp#group__api-srp_1ga4282c995a78d63a59e930f4a67f07e41` Service state (managed by OT core). |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1ac40fb9dc411a1b9cae2f1181fee189db` | `const char *const *` Array of sub-type labels (must end with `NULL` or can be `NULL`). |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1ae5e35fa8b76b17024043f248cbceab2a` | `const https://openthread.io/reference/struct/ot-dns-txt-entry *` Array of TXT entries (`mNumTxtEntries` gives num of entries). |
| `https://openthread.io/reference/struct/ot-srp-client-service#structot_srp_client_service_1a3a22f82d7c44270db4d27ee4d5a3961b` | `uint16_t` The service weight. |

## Public attributes

### mData

```
uint32_t otSrpClientService::mData
```
Internal data (used by OT core).

### mInstanceName

```
const char * otSrpClientService::mInstanceName
```
The service instance name label (not the full name).

### mKeyLease

```
uint32_t otSrpClientService::mKeyLease
```
Desired key lease interval in sec - zero to use default.

### mLease

```
uint32_t otSrpClientService::mLease
```
Desired lease interval in sec - zero to use default.

### mName

```
const char * otSrpClientService::mName
```
The service labels (e.g., "_mt._udp", not the full domain name).

### mNext

```
struct otSrpClientService * otSrpClientService::mNext
```
Pointer to next entry in a linked-list (managed by OT core).

### mNumTxtEntries

```
uint8_t otSrpClientService::mNumTxtEntries
```
Number of entries in the `mTxtEntries` array.

### mPort

```
uint16_t otSrpClientService::mPort
```
The service port number.

### mPriority

```
uint16_t otSrpClientService::mPriority
```
The service priority.

### mState

```
otSrpClientItemState otSrpClientService::mState
```
Service state (managed by OT core).

### mSubTypeLabels

```
const char *const * otSrpClientService::mSubTypeLabels
```
Array of sub-type labels (must end with `NULL` or can be `NULL`).

### mTxtEntries

```
const otDnsTxtEntry * otSrpClientService::mTxtEntries
```
Array of TXT entries (`mNumTxtEntries` gives num of entries).

### mWeight

```
uint16_t otSrpClientService::mWeight
```
The service weight.

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