# Border Agent TXT Data Parser

This module includes APIs for parsing the MeshCoP service TXT data of a Border Agent.

## Summary

| ### Enumerations ||
|---|---|
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga09ccc94a0f092d8ec8892d96f85f2bf7{ https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gga09ccc94a0f092d8ec8892d96f85f2bf7a6e0b9c82a09b70ee31695fe4e220c735 = 0, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gga09ccc94a0f092d8ec8892d96f85f2bf7a1ab566b5825402656a3f93834a68aa29 = 1 }` | enumRepresents the Availability Status in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gaea80dde9b7babbd2fb9f8fc687d5f22c{ https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggaea80dde9b7babbd2fb9f8fc687d5f22ca43bd47d2975f68109b79adb2b4234bfe = 0, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggaea80dde9b7babbd2fb9f8fc687d5f22ca4387dbf0fcca8ed1e14511eb3d971675 = 1, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggaea80dde9b7babbd2fb9f8fc687d5f22ca2c39f54e1cbc134af81e123c8914dfcc = 2, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggaea80dde9b7babbd2fb9f8fc687d5f22caf1a7853efa453549f72c3fac71f00faf = 3, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggaea80dde9b7babbd2fb9f8fc687d5f22cacc4de5224617cd690fcd58b288853ec0 = 4 }` | enumRepresents the Connection Mode in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gaf3f0840b23d7bdb0bfa6947c4c9c9201{ https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggaf3f0840b23d7bdb0bfa6947c4c9c9201a776318945621c6c0632974eac7447808 = 0, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggaf3f0840b23d7bdb0bfa6947c4c9c9201ae8360ee4e0f27c23d26d9f84115f0a79 = 1, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggaf3f0840b23d7bdb0bfa6947c4c9c9201ac36f902017b450babe7c9d9bd01bf895 = 2 }` | enumRepresents the Multi-AIL (Adjacent Infrastructure Link) detection state in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga54e7b2c3c18c8d64ebb8b395ccc49a7e{ https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gga54e7b2c3c18c8d64ebb8b395ccc49a7ea5653e4d33ce3311321fbe3c412985ac0 = 0, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gga54e7b2c3c18c8d64ebb8b395ccc49a7ea4f9493bb5c906d9e27207ef7cf1a3879 = 1, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gga54e7b2c3c18c8d64ebb8b395ccc49a7ea2e945fe4a3dfe2d4982b2229d4096c82 = 2 }` | enumRepresents the Thread Interface Status in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gafb20d1cdbc9be1f8ab2874465209d38a{ https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggafb20d1cdbc9be1f8ab2874465209d38aac79bb1ff8875d8f04f27c12ff08b1b01 = 0, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggafb20d1cdbc9be1f8ab2874465209d38aad2f9f322a0026f98b9609a7d4d9a1c63 = 1, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggafb20d1cdbc9be1f8ab2874465209d38aab5b631b4c1d8f64fde2355acd6cb2e85 = 2, https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ggafb20d1cdbc9be1f8ab2874465209d38aa9d4e798868cdbfe0918ad5e7a0e2b1d5 = 3 }` | enumRepresents the Thread Role in a Border Agent State Bitmap. |

| ### Typedefs ||
|---|---|
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga4ce382e8f564b28cdea1280850f98292` | typedef `enum https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga09ccc94a0f092d8ec8892d96f85f2bf7` Represents the Availability Status in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga0ac6678eba340d2605163518c89f5ef8` | typedef `enum https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gaea80dde9b7babbd2fb9f8fc687d5f22c` Represents the Connection Mode in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga944a63c8b9ab4aa0b714ba492b08faf7` | typedef `enum https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gaf3f0840b23d7bdb0bfa6947c4c9c9201` Represents the Multi-AIL (Adjacent Infrastructure Link) detection state in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga5ecdb9da0dac2a393c80ba3d7ad228ee` | typedef `struct https://openthread.io/reference/struct/ot-border-agent-state-bitmap` Represents Border Agent State Bitmap information. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gac4bfb46caf87efc8a1f37da65422646b` | typedef `enum https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga54e7b2c3c18c8d64ebb8b395ccc49a7e` Represents the Thread Interface Status in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga6604f872e7af2fa05fa304f511b031c7` | typedef `enum https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gafb20d1cdbc9be1f8ab2874465209d38a` Represents the Thread Role in a Border Agent State Bitmap. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga8be1b84455f914a9ded4190b0ceed70c` | typedef `struct https://openthread.io/reference/struct/ot-border-agent-txt-data-info` Represents parsed Border Agent TXT data. |

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gaed30392c1a547fd62c4295a23976f816(https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga09ccc94a0f092d8ec8892d96f85f2bf7 aAvailability)` | `const char *` Converts a given Availability Status in a Border Agent State Bitmap to a human-readable string. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga59931c58c7e4aac0dd3c3ae965b45653(https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gaea80dde9b7babbd2fb9f8fc687d5f22c aConnMode)` | `const char *` Converts a given Connection Mode in a Border Agent State Bitmap to a human-readable string. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gab0c04f8b8039924811c6c4907eec64d3(https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga54e7b2c3c18c8d64ebb8b395ccc49a7e aIfState)` | `const char *` Converts a given Thread Interface State in a Border Agent State Bitmap to a human-readable string. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gaecc94ee27dc59867abca685f129e23cd(https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gaf3f0840b23d7bdb0bfa6947c4c9c9201 aState)` | `const char *` Converts a given Multi-AIL State in a Border Agent State Bitmap to a human-readable string. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga8d450aa65ec6492d2247897b163f16c6(https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gafb20d1cdbc9be1f8ab2874465209d38a aRole)` | `const char *` Converts a given Thread Role in a Border Agent State Bitmap to a human-readable string. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga55e57cbacdbe3f60e18df3c0a3d63d14(const uint8_t *aTxtData, uint16_t aTxtDataLength, https://openthread.io/reference/struct/ot-border-agent-txt-data-info *aInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Parses a Border Agent's MeshCoP service TXT data. |

| ### Macros ||
|---|---|
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gadb8b8c5ed54595d8a2c2efe792f5cddf (32)` | Max size of Model Name string in `https://openthread.io/reference/struct/ot-border-agent-txt-data-info`. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1ga260d48b2eb26178db450dd8c927849bb (8)` | Max size of Record Version string in `https://openthread.io/reference/struct/ot-border-agent-txt-data-info`. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gacbb895cdbeabf7a5e5c95a041ad60284 (16)` | Max size of Thread Version string in `https://openthread.io/reference/struct/ot-border-agent-txt-data-info`. |
| `https://openthread.io/reference/group/api-border-agent-txt-data#group__api-border-agent-txt-data_1gadc761de96cf00a23017a773ecb3ec559 (32)` | Max size of Vendor Name string in `https://openthread.io/reference/struct/ot-border-agent-txt-data-info`. |

| ### Structs ||
|---|---|
| [otBorderAgentStateBitmap](https://openthread.io/reference/struct/ot-border-agent-state-bitmap) | Represents Border Agent State Bitmap information. |
| [otBorderAgentTxtDataInfo](https://openthread.io/reference/struct/ot-border-agent-txt-data-info) | Represents parsed Border Agent TXT data. |

## Enumerations

### otBorderAgentAvailability

```
 otBorderAgentAvailability
```
Represents the Availability Status in a Border Agent State Bitmap.

| Properties ||
|---|---|
| `OT_BORDER_AGENT_AVAILABILITY_HIGH` | High availability. |
| `OT_BORDER_AGENT_AVAILABILITY_INFREQUENT` | Infrequent availability. |

### otBorderAgentConnMode

```
 otBorderAgentConnMode
```
Represents the Connection Mode in a Border Agent State Bitmap.

| Properties ||
|---|---|
| `OT_BORDER_AGENT_CONN_MODE_DISABLED` | DTLS connection not allowed. |
| `OT_BORDER_AGENT_CONN_MODE_PSKC` | DTLS connection with PSKc. |
| `OT_BORDER_AGENT_CONN_MODE_PSKD` | DTLS connection with PSKd. |
| `OT_BORDER_AGENT_CONN_MODE_VENDOR` | DTLS with vendor defined credential. |
| `OT_BORDER_AGENT_CONN_MODE_X509` | DTLS with X.509 certificate. |

### otBorderAgentMultiAilState

```
 otBorderAgentMultiAilState
```
Represents the Multi-AIL (Adjacent Infrastructure Link) detection state in a Border Agent State Bitmap.

| Properties ||
|---|---|
| `OT_BORDER_AGENT_MULTI_AIL_STATE_DETECTED` | Multi-AIL detection is enabled, detected. |
| `OT_BORDER_AGENT_MULTI_AIL_STATE_DISABLED` | Multi-AIL detection is disabled. |
| `OT_BORDER_AGENT_MULTI_AIL_STATE_NOT_DETECTED` | Multi-AIL detection is enabled, not detected. |

### otBorderAgentThreadIfState

```
 otBorderAgentThreadIfState
```
Represents the Thread Interface Status in a Border Agent State Bitmap.

| Properties ||
|---|---|
| `OT_BORDER_AGENT_THREAD_IF_ACTIVE` | Thread interface is initialized and active. |
| `OT_BORDER_AGENT_THREAD_IF_INITIALIZED` | Thread interface is initialized but is not yet active. |
| `OT_BORDER_AGENT_THREAD_IF_NOT_INITIALIZED` | Thread interface is not initialized. |

### otBorderAgentThreadRole

```
 otBorderAgentThreadRole
```
Represents the Thread Role in a Border Agent State Bitmap.

| Properties ||
|---|---|
| `OT_BORDER_AGENT_THREAD_ROLE_CHILD` | End device (child). |
| `OT_BORDER_AGENT_THREAD_ROLE_DISABLED_OR_DETACHED` | Detached or disabled. |
| `OT_BORDER_AGENT_THREAD_ROLE_LEADER` | Leader. |
| `OT_BORDER_AGENT_THREAD_ROLE_ROUTER` | Router. |

## Typedefs

### otBorderAgentAvailability

```
enum otBorderAgentAvailability otBorderAgentAvailability
```
Represents the Availability Status in a Border Agent State Bitmap.

### otBorderAgentConnMode

```
enum otBorderAgentConnMode otBorderAgentConnMode
```
Represents the Connection Mode in a Border Agent State Bitmap.

### otBorderAgentMultiAilState

```
enum otBorderAgentMultiAilState otBorderAgentMultiAilState
```
Represents the Multi-AIL (Adjacent Infrastructure Link) detection state in a Border Agent State Bitmap.

### otBorderAgentStateBitmap

```
struct otBorderAgentStateBitmap otBorderAgentStateBitmap
```
Represents Border Agent State Bitmap information.

### otBorderAgentThreadIfState

```
enum otBorderAgentThreadIfState otBorderAgentThreadIfState
```
Represents the Thread Interface Status in a Border Agent State Bitmap.

### otBorderAgentThreadRole

```
enum otBorderAgentThreadRole otBorderAgentThreadRole
```
Represents the Thread Role in a Border Agent State Bitmap.

### otBorderAgentTxtDataInfo

```
struct otBorderAgentTxtDataInfo otBorderAgentTxtDataInfo
```
Represents parsed Border Agent TXT data.

The boolean flags indicate whether a specific field is present in the parsed TXT data.

## Functions

### otBorderAgentAvailabilityToString

```
const char * otBorderAgentAvailabilityToString(
  otBorderAgentAvailability aAvailability
)
```
Converts a given Availability Status in a Border Agent State Bitmap to a human-readable string.

Requires `OPENTHREAD_CONFIG_BORDER_AGENT_TXT_DATA_PARSER_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aAvailability` | The Availability Status to convert. | |
| **Returns** | The string representation of `aAvailability`. |

### otBorderAgentConnModeToString

```
const char * otBorderAgentConnModeToString(
  otBorderAgentConnMode aConnMode
)
```
Converts a given Connection Mode in a Border Agent State Bitmap to a human-readable string.

Requires `OPENTHREAD_CONFIG_BORDER_AGENT_TXT_DATA_PARSER_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aConnMode` | The Connection Mode to convert. | |
| **Returns** | The string representation of `aConnMode`. |

### otBorderAgentIfStateToString

```
const char * otBorderAgentIfStateToString(
  otBorderAgentThreadIfState aIfState
)
```
Converts a given Thread Interface State in a Border Agent State Bitmap to a human-readable string.

Requires `OPENTHREAD_CONFIG_BORDER_AGENT_TXT_DATA_PARSER_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aIfState` | The Thread Interface State to convert. | |
| **Returns** | The string representation of `aIfState`. |

### otBorderAgentMultiAilStateToString

```
const char * otBorderAgentMultiAilStateToString(
  otBorderAgentMultiAilState aState
)
```
Converts a given Multi-AIL State in a Border Agent State Bitmap to a human-readable string.

Requires `OPENTHREAD_CONFIG_BORDER_AGENT_TXT_DATA_PARSER_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aState` | The Multi-AIL State to convert. | |
| **Returns** | The string representation of `aState`. |

### otBorderAgentThreadRoleToString

```
const char * otBorderAgentThreadRoleToString(
  otBorderAgentThreadRole aRole
)
```
Converts a given Thread Role in a Border Agent State Bitmap to a human-readable string.

Requires `OPENTHREAD_CONFIG_BORDER_AGENT_TXT_DATA_PARSER_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aRole` | The Thread Role to convert. | |
| **Returns** | The string representation of `aRole`. |

### otBorderAgentTxtDataParse

```
otError otBorderAgentTxtDataParse(
  const uint8_t *aTxtData,
  uint16_t aTxtDataLength,
  otBorderAgentTxtDataInfo *aInfo
)
```
Parses a Border Agent's MeshCoP service TXT data.

Requires `OPENTHREAD_CONFIG_BORDER_AGENT_TXT_DATA_PARSER_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aTxtData` | A pointer to the buffer containing the TXT data. | | `[in] aTxtDataLength` | The length of the TXT data in bytes. | | `[out] aInfo` | A pointer to a structure to output the parsed information. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully parsed the TXT data. | | `OT_ERROR_PARSE` | Failed to parse the TXT data. | |

## Macros

### OT_BORDER_AGENT_MODEL_NAME_SIZE

```
 OT_BORDER_AGENT_MODEL_NAME_SIZE (32)
```
Max size of Model Name string in `https://openthread.io/reference/struct/ot-border-agent-txt-data-info`.

### OT_BORDER_AGENT_RECORD_VERSION_SIZE

```
 OT_BORDER_AGENT_RECORD_VERSION_SIZE (8)
```
Max size of Record Version string in `https://openthread.io/reference/struct/ot-border-agent-txt-data-info`.

### OT_BORDER_AGENT_THREAD_VERSION_SIZE

```
 OT_BORDER_AGENT_THREAD_VERSION_SIZE (16)
```
Max size of Thread Version string in `https://openthread.io/reference/struct/ot-border-agent-txt-data-info`.

### OT_BORDER_AGENT_VENDOR_NAME_SIZE

```
 OT_BORDER_AGENT_VENDOR_NAME_SIZE (32)
```
Max size of Vendor Name string in `https://openthread.io/reference/struct/ot-border-agent-txt-data-info`.

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