# Border Routing Manager

This module includes definitions related to Border Routing Manager.

## Summary

All the functions in this module require `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` to be enabled.

Border Routing Manager handles bi-directional routing between Thread network and adjacent infrastructure link (AIL).

It emits ICMRv6 ND Router Advertisement (RA) messages on AIL to advertise on-link and route prefixes. It also processes received RA messages from infrastructure and mirrors the discovered prefixes on the Thread Network Data to ensure devices on Thread mesh can reach AIL through the Border Router.

Routing Manager manages the Off-Mesh Routable (OMR) prefix on the Thread Network data which configures Thread devices with a suitable Off-Mesh Routable IPv6 address. It announces the reachability of this prefix on AIL by including it in the emitted RA messages as an IPv6 Route Information Option (RIO).

Routing Manager also monitors and adds on-link prefix on the infrastructure network. If a router on AIL is already providing RA messages containing an IPv6 Prefix Information Option (PIO) that enables IPv6 devices on the link to self-configure their own routable unicast IPv6 address, this address can be used by Thread devices to reach AIL. If Border Router finds no such RA message on AIL, it generates a ULA on-link prefix which it then advertises on AIL in the emitted RA messages.

| ### Enumerations ||
|---|---|
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga61d12d67227b11963cbe56a7d6ca0da7{ https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga61d12d67227b11963cbe56a7d6ca0da7a412b2e24166492888684136a0fd26538, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga61d12d67227b11963cbe56a7d6ca0da7a6b83db75922eddd98043fd6bb4d44b33, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga61d12d67227b11963cbe56a7d6ca0da7a2d9e873eba75889bd882377ebfb9a35f, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga61d12d67227b11963cbe56a7d6ca0da7acf6eb0f4c464576f6fd3f147e6019f20 }` | enumThis enumeration represents the state of DHCPv6 Prefix Delegation State. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga1306af950c7dd6aeabb5762ef898a8f6{ https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga1306af950c7dd6aeabb5762ef898a8f6a127cb43977c9a956aaf974288eda8f09, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga1306af950c7dd6aeabb5762ef898a8f6a09ee06d2c920a20fae172ec6921d3243, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga1306af950c7dd6aeabb5762ef898a8f6a53863f2e1bf87f7256db6a405fca4bb6 }` | enumRepresents the configuration options related to the OMR prefix. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga9552cad9ae4f9b7f0e4d412f34bc9c23{ https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga9552cad9ae4f9b7f0e4d412f34bc9c23a62fdc562ba79a9f487526d8691c67dd0 = 0, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga9552cad9ae4f9b7f0e4d412f34bc9c23ab8aaad45ea3cb6f72d377147f3f244ad = 1, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga9552cad9ae4f9b7f0e4d412f34bc9c23a29a9a1b67426cf4037c92db39f89d590 = 2, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gga9552cad9ae4f9b7f0e4d412f34bc9c23a0953cd1ebd2891efb8f56eb91276336a = 3 }` | enumRepresents the state of Border Routing Manager. |

| ### Typedefs ||
|---|---|
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga1a8704924e31f15a24ce9638959ce6c9` | typedef `struct https://openthread.io/reference/struct/ot-border-routing-if-addr-entry` Represents an infra-if IPv6 address entry (an address used by this BR itself on the AIL). |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gad509f6c269f4e78ddefea10ef77929a1` | typedef `struct https://openthread.io/reference/struct/ot-border-routing-nat64-prefix-entry` Represents an entry from the discovered NAT64 prefix table. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gabbc1b15de2c03491348ac035aee10e6f` | typedef `struct https://openthread.io/reference/struct/ot-border-routing-peer-border-router-entry` Represents information about a peer Border Router found in the Network Data. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga9787e8406bb6b1e83c8d3fc1f7e7d446` | typedef `struct https://openthread.io/reference/struct/ot-border-routing-prefix-table-entry` Represents an entry from the discovered prefix table. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gacfc10b5e60bf0e0b99e85c0193ce43a0` | typedef `struct https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator` Represents an iterator to iterate through the Border Router's discovered prefix table. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga608e2587db05d5962a5321d1c06b629f)(void *aContext)` | typedef `void(*` Callback function pointer to notify of changes to discovered Recursive DNS Server (RDNSS) address entries. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gaf28d3e724e303205c9769c589ec8142b` | typedef `struct https://openthread.io/reference/struct/ot-border-routing-rdnss-addr-entry` Represents a discovered Recursive DNS Server (RDNSS) address entry. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gaa531d25665e30e4741d7f73e51276672)(otBorderRoutingDhcp6PdState aState, void *aContext)` | typedef `void(*` When the state of a DHCPv6 Prefix Delegation (PD) on the Thread interface changes, this callback notifies processes in the OS of this changed state. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga0f1643064157c282afc52ec45c912ef2` | typedef `struct https://openthread.io/reference/struct/ot-border-routing-router-entry` Represents a discovered router on the infrastructure link. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gadde621c8a13016fc00164676c8781eed` | typedef `struct https://openthread.io/reference/struct/ot-pd-processed-ra-info` Represents a group of data of platform-generated RA messages processed. |

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga5d800a91422df0e4d3560d30c543caba(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Clears a previously set preference value for advertised Route Info Options. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga3ee36a96337d0ba07b45e378add3bbf4(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Clears a previously set preference value for published routes in Network Data. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gaf6cd4292a95114f9ddabf15845f26865(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t *aMinAge)` | `uint16_t` Returns the number of peer BRs found in the Network Data. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gab39e1553a0ed0e897982096885b598c2(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga61d12d67227b11963cbe56a7d6ca0da7` Gets the current state of DHCPv6 Prefix Delegation. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gab3c94fb8a505857b1dd95978b1e270dd(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnabled)` | `void` Enables / Disables DHCPv6 Prefix Delegation. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga9cc337af3edfcc862a8b6fd1adcb38a5(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gaa531d25665e30e4741d7f73e51276672 aCallback, void *aContext)` | `void` Sets the callback whenever the DHCPv6 PD state changes on the Thread interface. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga6a0bcf88d120a8fc859f98a7505b1d75(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-ip6-prefix *aPrefix, https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1ga6085e64b90c7645b8d206edad0b14e1c *aPreference)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the currently favored NAT64 prefix. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga2a7745ab18bb5d3f15d98928edebc2c9(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-ip6-prefix *aPrefix, https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1ga6085e64b90c7645b8d206edad0b14e1c *aPreference)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the currently favored Off-Mesh-Routable (OMR) Prefix. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga9d7265c17ea801b22ee1b657e97ead3d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-ip6-prefix *aPrefix)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the currently favored On-Link Prefix. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gad70ca8f54128b85806a046891d60c421(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t *aInfraIfIndex, bool *aInfraIfIsRunning)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the interface index and running state of the configured infrastructure interface. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga1ca49c4b30d0664381590650926ad474(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-ip6-prefix *aPrefix)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the local NAT64 Prefix of the Border Router. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga717de02c9cb222d6a9c6a60590e02a81(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator *aIterator, https://openthread.io/reference/struct/ot-border-routing-if-addr-entry *aEntry)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over the infrastructure interface address entries. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga66060a2ff5437a36400dba6326f9bbfb(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator *aIterator, https://openthread.io/reference/struct/ot-border-routing-nat64-prefix-entry *aEntry)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates through the RA-discovered NAT64 prefix table. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gaa197227722473590b08452daf4341d50(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator *aIterator, https://openthread.io/reference/struct/ot-border-routing-peer-border-router-entry *aEntry)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over the peer BRs found in the Network Data. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga2dabe14d283c7955c5ea519cbf608ebe(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator *aIterator, https://openthread.io/reference/struct/ot-border-routing-prefix-table-entry *aEntry)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over the entries in the Border Router's discovered prefix table. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gacb7e19e0a37f4a9a6a70cfed1e62563b(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator *aIterator, https://openthread.io/reference/struct/ot-border-routing-rdnss-addr-entry *aEntry)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over the Recursive DNS Server (RDNSS) address entries. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gae803f34f39124d89e07e63c366d0f3cb(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator *aIterator, https://openthread.io/reference/struct/ot-border-routing-router-entry *aEntry)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Iterates over the discovered router entries on the infrastructure link. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gab769ac646458dae995fcc79d36745956(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-ip6-prefix *aOmrPrefix, https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1ga6085e64b90c7645b8d206edad0b14e1c *aPreference)` | `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga1306af950c7dd6aeabb5762ef898a8f6` Gets the current OMR prefix configuration mode. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga543d2be812eae47eabf023a9414be047(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-ip6-prefix *aPrefix)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the local Off-Mesh-Routable (OMR) Prefix, for example `fdfc:1ff5:1512:5622::/64`. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga8429ad6ac6890e6d63ad977361bfea30(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-ip6-prefix *aPrefix)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the local On-Link Prefix for the adjacent infrastructure link. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga9045b43f0d74891f69b63236d02b74e1(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-border-routing-prefix-table-entry *aPrefixInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the DHCPv6 Prefix Delegation (PD) provided off-mesh-routable (OMR) prefix. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga5371e6fb13caec971cc430894f62528b(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-pd-processed-ra-info *aPdProcessedRaInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the data of platform generated RA message processed. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga81b977008d92c3602bdccc5cb648c86f(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1ga6085e64b90c7645b8d206edad0b14e1c` Gets the current preference used when advertising Route Info Options (RIO) in Router Advertisement messages sent over the infrastructure link. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gafc0666d0a7fa1dca3f9293f56ecb8626(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1ga6085e64b90c7645b8d206edad0b14e1c` Gets the current preference used for published routes in Network Data. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gab5fe89dca764c317ffb4ea922fca8851(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga9552cad9ae4f9b7f0e4d412f34bc9c23` Gets the current state of Border Routing Manager. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gac8da634c6f717dcd2070ae0ecb5ea9c9(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t aInfraIfIndex, bool aInfraIfIsRunning)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Initializes the Border Routing Manager on given infrastructure interface. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga62eeb9d4aeece2a65f20c73ee3d34cff(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator *aIterator)` | `void` Initializes an `https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator`. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga0b17e9bc5360cfaa1b12cf51d271adbc(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnabled)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Enables or disables the Border Routing Manager. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gaaa5b7bc34a706ccdf7efaa40e103f8b6(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const uint8_t *aOptions, uint16_t aLength)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets additional options to append at the end of emitted Router Advertisement (RA) messages. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga89480498847429f5f2762a3928b815a5(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga1306af950c7dd6aeabb5762ef898a8f6 aConfig, const https://openthread.io/reference/struct/ot-ip6-prefix *aOmrPrefix, https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1ga6085e64b90c7645b8d206edad0b14e1c aPreference)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Configures the OMR prefix handling in the Border Routing Manager. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga8e398e234abe85895f0ac72e492b3897(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-ip6-prefix *aPrefix)` | `void` Sets the local on-link prefix. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga7801b8d30b430f8b4e1605cabc48cded(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga608e2587db05d5962a5321d1c06b629f aCallback, void *aContext)` | `void` Sets the callback to be notified of changes to discovered Recursive DNS Server (RDNSS) address entries. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gaaf33366522d3c25f88300a231ba848ff(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1ga6085e64b90c7645b8d206edad0b14e1c aPreference)` | `void` Explicitly sets the preference to use when advertising Route Info Options (RIO) in Router Advertisement messages sent over the infrastructure link. |
| `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gad888777e797f565007d585a7f81f0a17(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1ga6085e64b90c7645b8d206edad0b14e1c aPreference)` | `void` Explicitly sets the preference of published routes in Network Data. |

| ### Structs ||
|---|---|
| [otBorderRoutingIfAddrEntry](https://openthread.io/reference/struct/ot-border-routing-if-addr-entry) | Represents an infra-if IPv6 address entry (an address used by this BR itself on the AIL). |
| [otBorderRoutingNat64PrefixEntry](https://openthread.io/reference/struct/ot-border-routing-nat64-prefix-entry) | Represents an entry from the discovered NAT64 prefix table. |
| [otBorderRoutingPeerBorderRouterEntry](https://openthread.io/reference/struct/ot-border-routing-peer-border-router-entry) | Represents information about a peer Border Router found in the Network Data. |
| [otBorderRoutingPrefixTableEntry](https://openthread.io/reference/struct/ot-border-routing-prefix-table-entry) | Represents an entry from the discovered prefix table. |
| [otBorderRoutingPrefixTableIterator](https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator) | Represents an iterator to iterate through the Border Router's discovered prefix table. |
| [otBorderRoutingRdnssAddrEntry](https://openthread.io/reference/struct/ot-border-routing-rdnss-addr-entry) | Represents a discovered Recursive DNS Server (RDNSS) address entry. |
| [otBorderRoutingRouterEntry](https://openthread.io/reference/struct/ot-border-routing-router-entry) | Represents a discovered router on the infrastructure link. |
| [otPdProcessedRaInfo](https://openthread.io/reference/struct/ot-pd-processed-ra-info) | Represents a group of data of platform-generated RA messages processed. |

## Enumerations

### otBorderRoutingDhcp6PdState

```
 otBorderRoutingDhcp6PdState
```
This enumeration represents the state of DHCPv6 Prefix Delegation State.

| Properties ||
|---|---|
| `OT_BORDER_ROUTING_DHCP6_PD_STATE_DISABLED` | DHCPv6 PD is disabled on the border router. |
| `OT_BORDER_ROUTING_DHCP6_PD_STATE_IDLE` | DHCPv6 PD is idle; Higher-prf prefix published by other BRs. |
| `OT_BORDER_ROUTING_DHCP6_PD_STATE_RUNNING` | DHCPv6 PD is enabled and will try to request and publish a prefix. |
| `OT_BORDER_ROUTING_DHCP6_PD_STATE_STOPPED` | DHCPv6 PD in enabled but won't try to request and publish a prefix. |

### otBorderRoutingOmrConfig

```
 otBorderRoutingOmrConfig
```
Represents the configuration options related to the OMR prefix.

This is used in `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga89480498847429f5f2762a3928b815a5` to offer manual administration options to explicitly configure the OMR prefix or to disable it.

| Properties ||
|---|---|
| `OT_BORDER_ROUTING_OMR_CONFIG_AUTO` | BR auto-generates the local OMR prefix. |
| `OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM` | BR uses a given custom OMR prefix. |
| `OT_BORDER_ROUTING_OMR_CONFIG_DISABLED` | BR does not add local/PD OMR prefix in Network Data. |

### otBorderRoutingState

```
 otBorderRoutingState
```
Represents the state of Border Routing Manager.

| Properties ||
|---|---|
| `OT_BORDER_ROUTING_STATE_DISABLED` | Routing Manager is initialized but disabled. |
| `OT_BORDER_ROUTING_STATE_RUNNING` | Routing Manager is initialized, enabled, and running. |
| `OT_BORDER_ROUTING_STATE_STOPPED` | Routing Manager in initialized and enabled but currently stopped. |
| `OT_BORDER_ROUTING_STATE_UNINITIALIZED` | Routing Manager is uninitialized. |

## Typedefs

### otBorderRoutingIfAddrEntry

```
struct otBorderRoutingIfAddrEntry otBorderRoutingIfAddrEntry
```
Represents an infra-if IPv6 address entry (an address used by this BR itself on the AIL).

### otBorderRoutingNat64PrefixEntry

```
struct otBorderRoutingNat64PrefixEntry otBorderRoutingNat64PrefixEntry
```
Represents an entry from the discovered NAT64 prefix table.

The entries in the discovered table track the NAT64 Prefix Options in the received Router Advertisement messages from other routers on the infrastructure link.

### otBorderRoutingPeerBorderRouterEntry

```
struct otBorderRoutingPeerBorderRouterEntry otBorderRoutingPeerBorderRouterEntry
```
Represents information about a peer Border Router found in the Network Data.

### otBorderRoutingPrefixTableEntry

```
struct otBorderRoutingPrefixTableEntry otBorderRoutingPrefixTableEntry
```
Represents an entry from the discovered prefix table.

The entries in the discovered table track the Prefix/Route Info Options in the received Router Advertisement messages from other routers on the infrastructure link.

### otBorderRoutingPrefixTableIterator

```
struct otBorderRoutingPrefixTableIterator otBorderRoutingPrefixTableIterator
```
Represents an iterator to iterate through the Border Router's discovered prefix table.

The fields in this type are opaque (intended for use by OpenThread core only) and therefore should not be accessed or used by caller.

Before using an iterator, it MUST be initialized using `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga62eeb9d4aeece2a65f20c73ee3d34cff`.

### otBorderRoutingRdnssAddrCallback

```
void(* otBorderRoutingRdnssAddrCallback)(void *aContext)
```
Callback function pointer to notify of changes to discovered Recursive DNS Server (RDNSS) address entries.

Address entries are discovered by processing the RDNSS options within received Router Advertisement messages from routers on infrastructure link.

The `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gacb7e19e0a37f4a9a6a70cfed1e62563b` function can be used to iterate over the discovered RDNSS address entries.

This callback is invoked when any of the following changes occur to the address entries associated with a discovered router:

- A new RDNSS address is advertised by the router.
- A previously discovered address is removed due to the router advertising it with a zero lifetime.
- A previously discovered address has aged out (its lifetime expired without being re-advertised).
- We determine that the router that advertised the address is now unreachable, and therefore all its associated entries are removed.

<br />

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aContext` | A pointer to arbitrary context information. | |

### otBorderRoutingRdnssAddrEntry

```
struct otBorderRoutingRdnssAddrEntry otBorderRoutingRdnssAddrEntry
```
Represents a discovered Recursive DNS Server (RDNSS) address entry.

Address entries are discovered by processing the RDNSS options within received Router Advertisement messages from routers on infrastructure link.

### otBorderRoutingRequestDhcp6PdCallback

```
void(* otBorderRoutingRequestDhcp6PdCallback)(otBorderRoutingDhcp6PdState aState, void *aContext)
```
When the state of a DHCPv6 Prefix Delegation (PD) on the Thread interface changes, this callback notifies processes in the OS of this changed state.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aState` | The state of DHCPv6 Prefix Delegation State. | | `[in] aContext` | A pointer to arbitrary context information. | |

### otBorderRoutingRouterEntry

```
struct otBorderRoutingRouterEntry otBorderRoutingRouterEntry
```
Represents a discovered router on the infrastructure link.

The `mIsPeerBr` field requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`. Routing Manager determines whether the router is a peer BR (connected to the same Thread mesh network) by comparing its advertised PIO/RIO prefixes with the entries in the Thread Network Data. While this method is generally effective, it may not be 100% accurate in all scenarios, so the `mIsPeerBr` flag should be used with caution.

### otPdProcessedRaInfo

```
struct otPdProcessedRaInfo otPdProcessedRaInfo
```
Represents a group of data of platform-generated RA messages processed.

## Functions

### otBorderRoutingClearRouteInfoOptionPreference

```
void otBorderRoutingClearRouteInfoOptionPreference(
  otInstance *aInstance
)
```
Clears a previously set preference value for advertised Route Info Options.

After a call to this function, BR will use device's role to determine the RIO preference: Medium preference when in router/leader role and low preference when in child role.

<br />

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

### otBorderRoutingClearRoutePreference

```
void otBorderRoutingClearRoutePreference(
  otInstance *aInstance
)
```
Clears a previously set preference value for published routes in Network Data.

After a call to this function, BR will determine the preference automatically based on the device's role and link quality (to the parent when acting as end-device).

<br />

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

### otBorderRoutingCountPeerBrs

```
uint16_t otBorderRoutingCountPeerBrs(
  otInstance *aInstance,
  uint32_t *aMinAge
)
```
Returns the number of peer BRs found in the Network Data.

Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.

Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data entries:


- It has added at least one external route entry.
- It has added at least one prefix entry with both the default-route and on-mesh flags set.

<br />

The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[out] aMinAge` | Pointer to an `uint32_t` to return the minimum age among all peer BRs. Can be NULL if the caller does not need this information. Age is represented as seconds since appearance of the BR entry in the Network Data. | |
| **Returns** | The number of peer BRs. |

### otBorderRoutingDhcp6PdGetState

```
otBorderRoutingDhcp6PdState otBorderRoutingDhcp6PdGetState(
  otInstance *aInstance
)
```
Gets the current state of DHCPv6 Prefix Delegation.

Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` to be enabled.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The current state of DHCPv6 Prefix Delegation. |

### otBorderRoutingDhcp6PdSetEnabled

```
void otBorderRoutingDhcp6PdSetEnabled(
  otInstance *aInstance,
  bool aEnabled
)
```
Enables / Disables DHCPv6 Prefix Delegation.

`OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` must be enabled.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aEnabled` | Whether to accept platform generated RA messages. | |

### otBorderRoutingDhcp6PdSetRequestCallback

```
void otBorderRoutingDhcp6PdSetRequestCallback(
  otInstance *aInstance,
  otBorderRoutingRequestDhcp6PdCallback aCallback,
  void *aContext
)
```
Sets the callback whenever the DHCPv6 PD state changes on the Thread interface.

Subsequent calls to this function replace the previously set callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aCallback` | A pointer to a function that is called whenever the DHCPv6 PD state changes. | | `[in] aContext` | A pointer to arbitrary context information. | |

### otBorderRoutingGetFavoredNat64Prefix

```
otError otBorderRoutingGetFavoredNat64Prefix(
  otInstance *aInstance,
  otIp6Prefix *aPrefix,
  otRoutePreference *aPreference
)
```
Gets the currently favored NAT64 prefix.

The favored NAT64 prefix can be discovered from infrastructure link or can be this device's local NAT64 prefix.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPrefix` | A pointer to output the favored NAT64 prefix. | | `[out] aPreference` | A pointer to output the preference associated the favored prefix. | |
| Return Values | |---|---| | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized yet. | | `OT_ERROR_NONE` | Successfully retrieved the favored NAT64 prefix. | |

### otBorderRoutingGetFavoredOmrPrefix

```
otError otBorderRoutingGetFavoredOmrPrefix(
  otInstance *aInstance,
  otIp6Prefix *aPrefix,
  otRoutePreference *aPreference
)
```
Gets the currently favored Off-Mesh-Routable (OMR) Prefix.

The favored OMR prefix can be discovered from Network Data or can be this device's local OMR prefix.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPrefix` | A pointer to output the favored OMR prefix. | | `[out] aPreference` | A pointer to output the preference associated the favored prefix. | |
| Return Values | |---|---| | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not running yet. | | `OT_ERROR_NONE` | Successfully retrieved the favored OMR prefix. | |

### otBorderRoutingGetFavoredOnLinkPrefix

```
otError otBorderRoutingGetFavoredOnLinkPrefix(
  otInstance *aInstance,
  otIp6Prefix *aPrefix
)
```
Gets the currently favored On-Link Prefix.

The favored prefix is either a discovered on-link prefix on the infrastructure link or the local on-link prefix.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPrefix` | A pointer to where the prefix will be output to. | |
| Return Values | |---|---| | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized yet. | | `OT_ERROR_NONE` | Successfully retrieved the favored on-link prefix. | |

### otBorderRoutingGetInfraIfInfo

```
otError otBorderRoutingGetInfraIfInfo(
  otInstance *aInstance,
  uint32_t *aInfraIfIndex,
  bool *aInfraIfIsRunning
)
```
Gets the interface index and running state of the configured infrastructure interface.


> [!NOTE]
> **Note:** The running state in `aInfraIfIsRunning` reflects the Border Routing Manager's perspective. This state is set when `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gac8da634c6f717dcd2070ae0ecb5ea9c9` is called and is subsequently updated by the platform signaling changes via `https://openthread.io/reference/group/plat-infra-if#group__plat-infra-if_1ga972ec6661c5c3f2d917dbb55a954f622`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aInfraIfIndex` | A pointer to output the interface index. MUST NOT be NULL. | | `[out] aInfraIfIsRunning` | A pointer to output whether the interface is running. Can be NULL if not needed. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully retrieved the interface information. | | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized. | |

**See also:**   
[otBorderRoutingInit](https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gac8da634c6f717dcd2070ae0ecb5ea9c9)   
[otPlatInfraIfStateChanged](https://openthread.io/reference/group/plat-infra-if#group__plat-infra-if_1ga972ec6661c5c3f2d917dbb55a954f622)   

### otBorderRoutingGetNat64Prefix

```
otError otBorderRoutingGetNat64Prefix(
  otInstance *aInstance,
  otIp6Prefix *aPrefix
)
```
Gets the local NAT64 Prefix of the Border Router.

NAT64 Prefix might not be advertised in the Thread network.

`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` must be enabled.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPrefix` | A pointer to where the prefix will be output to. | |
| Return Values | |---|---| | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized yet. | | `OT_ERROR_NONE` | Successfully retrieved the NAT64 prefix. | |

### otBorderRoutingGetNextIfAddrEntry

```
otError otBorderRoutingGetNextIfAddrEntry(
  otInstance *aInstance,
  otBorderRoutingPrefixTableIterator *aIterator,
  otBorderRoutingIfAddrEntry *aEntry
)
```
Iterates over the infrastructure interface address entries.

These are addresses used by the BR itself, for example, when sending Router Advertisements.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in,out] aIterator` | A pointer to the iterator. | | `[out] aEntry` | A pointer to the entry to populate. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Iterated to the next address entry, `aEntry` and `aIterator` are updated. | | `OT_ERROR_NOT_FOUND` | No more entries in the table. | | `OT_ERROR_INVALID_ARGS` | The iterator is invalid (used to iterate over other entry types, e.g., prefix). | |

### otBorderRoutingGetNextNat64PrefixEntry

```
otError otBorderRoutingGetNextNat64PrefixEntry(
  otInstance *aInstance,
  otBorderRoutingPrefixTableIterator *aIterator,
  otBorderRoutingNat64PrefixEntry *aEntry
)
```
Iterates through the RA-discovered NAT64 prefix table.

Requires `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in,out] aIterator` | A pointer to the iterator. | | `[out] aEntry` | A pointer to the entry to populate. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Iterated to the next NAT64 prefix entry, `aEntry` and `aIterator` are updated. | | `OT_ERROR_NOT_FOUND` | No more entries in the table. | | `OT_ERROR_INVALID_ARGS` | The iterator is invalid (used to iterate over other entry types). | |

### otBorderRoutingGetNextPeerBrEntry

```
otError otBorderRoutingGetNextPeerBrEntry(
  otInstance *aInstance,
  otBorderRoutingPrefixTableIterator *aIterator,
  otBorderRoutingPeerBorderRouterEntry *aEntry
)
```
Iterates over the peer BRs found in the Network Data.

Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.

Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data entries:


- It has added at least one external route entry.
- It has added at least one prefix entry with both the default-route and on-mesh flags set.

<br />

The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in,out] aIterator` | A pointer to the iterator. | | `[out] aEntry` | A pointer to the entry to populate. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Iterated to the next entry, `aEntry` and `aIterator` are updated. | | `OT_ERROR_NOT_FOUND` | No more entries. | |

### otBorderRoutingGetNextPrefixTableEntry

```
otError otBorderRoutingGetNextPrefixTableEntry(
  otInstance *aInstance,
  otBorderRoutingPrefixTableIterator *aIterator,
  otBorderRoutingPrefixTableEntry *aEntry
)
```
Iterates over the entries in the Border Router's discovered prefix table.

Prefix entries associated with the same discovered router on an infrastructure link are guaranteed to be grouped together (retrieved back-to-back).

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in,out] aIterator` | A pointer to the iterator. | | `[out] aEntry` | A pointer to the entry to populate. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Iterated to the next entry, `aEntry` and `aIterator` are updated. | | `OT_ERROR_NOT_FOUND` | No more entries in the table. | |

### otBorderRoutingGetNextRdnssAddrEntry

```
otError otBorderRoutingGetNextRdnssAddrEntry(
  otInstance *aInstance,
  otBorderRoutingPrefixTableIterator *aIterator,
  otBorderRoutingRdnssAddrEntry *aEntry
)
```
Iterates over the Recursive DNS Server (RDNSS) address entries.

Address entries are discovered by processing the RDNSS options within received Router Advertisement messages from routers on infrastructure link.

Address entries associated with the same discovered router on an infrastructure link are guaranteed to be grouped together (retrieved back-to-back).

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in,out] aIterator` | A pointer to the iterator. | | `[out] aEntry` | A pointer to the entry to populate. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Iterated to the next address entry, `aEntry` and `aIterator` are updated. | | `OT_ERROR_NOT_FOUND` | No more entries in the table. | | `OT_ERROR_INVALID_ARGS` | The iterator is invalid (used to iterate over other entry types, e.g. prefix). | |

### otBorderRoutingGetNextRouterEntry

```
otError otBorderRoutingGetNextRouterEntry(
  otInstance *aInstance,
  otBorderRoutingPrefixTableIterator *aIterator,
  otBorderRoutingRouterEntry *aEntry
)
```
Iterates over the discovered router entries on the infrastructure link.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in,out] aIterator` | A pointer to the iterator. | | `[out] aEntry` | A pointer to the entry to populate. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Iterated to the next router, `aEntry` and `aIterator` are updated. | | `OT_ERROR_NOT_FOUND` | No more router entries. | |

### otBorderRoutingGetOmrConfig

```
otBorderRoutingOmrConfig otBorderRoutingGetOmrConfig(
  otInstance *aInstance,
  otIp6Prefix *aOmrPrefix,
  otRoutePreference *aPreference
)
```
Gets the current OMR prefix configuration mode.

This function retrieves the current OMR configuration and, if a custom OMR prefix is configured, the custom prefix and its associated preference.

If the caller does not require the custom OMR prefix and preference, the `aOmrPrefix` and `aPreference` parameters can be set to `NULL`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to the OpenThread instance. | | `[out] aOmrPrefix` | A pointer to an `https://openthread.io/reference/struct/ot-ip6-prefix` to return the custom OMR prefix, if the configuration is `OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM`. | | `[out] aPreference` | A pointer to return the preference associated with the custom OMR prefix. | |
| **Returns** | The current OMR prefix configuration mode. |

### otBorderRoutingGetOmrPrefix

```
otError otBorderRoutingGetOmrPrefix(
  otInstance *aInstance,
  otIp6Prefix *aPrefix
)
```
Gets the local Off-Mesh-Routable (OMR) Prefix, for example `fdfc:1ff5:1512:5622::/64`.

An OMR Prefix is a randomly generated 64-bit prefix that's published in the Thread network if there isn't already an OMR prefix. This prefix can be reached from the local Wi-Fi or Ethernet network.

Note: When DHCPv6 PD is enabled, the border router may publish the prefix from DHCPv6 PD.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPrefix` | A pointer to where the prefix will be output to. | |
| Return Values | |---|---| | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized yet. | | `OT_ERROR_NONE` | Successfully retrieved the OMR prefix. | |

**See also:**   
[otBorderRoutingGetPdOmrPrefix](https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga9045b43f0d74891f69b63236d02b74e1)   

### otBorderRoutingGetOnLinkPrefix

```
otError otBorderRoutingGetOnLinkPrefix(
  otInstance *aInstance,
  otIp6Prefix *aPrefix
)
```
Gets the local On-Link Prefix for the adjacent infrastructure link.

The local On-Link Prefix is a 64-bit prefix that's advertised on the infrastructure link if there isn't already a usable on-link prefix being advertised on the link.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPrefix` | A pointer to where the prefix will be output to. | |
| Return Values | |---|---| | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized yet. | | `OT_ERROR_NONE` | Successfully retrieved the local on-link prefix. | |

### otBorderRoutingGetPdOmrPrefix

```
otError otBorderRoutingGetPdOmrPrefix(
  otInstance *aInstance,
  otBorderRoutingPrefixTableEntry *aPrefixInfo
)
```
Gets the DHCPv6 Prefix Delegation (PD) provided off-mesh-routable (OMR) prefix.

Only mPrefix, mValidLifetime and mPreferredLifetime fields are used in the returned prefix info.

`OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` must be enabled.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPrefixInfo` | A pointer to where the prefix info will be output to. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully retrieved the OMR prefix. | | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized yet. | | `OT_ERROR_NOT_FOUND` | There are no valid PD prefix on this BR. | |

**See also:**   
[otBorderRoutingGetOmrPrefix](https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga543d2be812eae47eabf023a9414be047)   
[otPlatBorderRoutingProcessIcmp6Ra](https://openthread.io/reference/other/platform-2border-routing.h#platform_2border__routing_8h_1ae7b3aed5620f16ab550e87522169e67a)   

### otBorderRoutingGetPdProcessedRaInfo

```
otError otBorderRoutingGetPdProcessedRaInfo(
  otInstance *aInstance,
  otPdProcessedRaInfo *aPdProcessedRaInfo
)
```
Gets the data of platform generated RA message processed.

`OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` must be enabled.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPrefixInfo` | A pointer to where the prefix info will be output to. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully retrieved the Info. | | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized yet. | | `OT_ERROR_NOT_FOUND` | There are no valid Info on this BR. | |

### otBorderRoutingGetRouteInfoOptionPreference

```
otRoutePreference otBorderRoutingGetRouteInfoOptionPreference(
  otInstance *aInstance
)
```
Gets the current preference used when advertising Route Info Options (RIO) in Router Advertisement messages sent over the infrastructure link.

The RIO preference is determined as follows:


- If explicitly set by user by calling `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gaaf33366522d3c25f88300a231ba848ff`, the given preference is used.
- Otherwise, it is determined based on device's current role: Medium preference when in router/leader role and low preference when in child role.

<br />

<br />

| Details ||
|---|---|
| **Returns** | The current Route Info Option preference. |

### otBorderRoutingGetRoutePreference

```
otRoutePreference otBorderRoutingGetRoutePreference(
  otInstance *aInstance
)
```
Gets the current preference used for published routes in Network Data.

The preference is determined as follows:


- If explicitly set by user by calling `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1gad888777e797f565007d585a7f81f0a17`, the given preference is used.
- Otherwise, it is determined automatically by `RoutingManager` based on the device's role and link quality.

<br />

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The current published route preference. |

### otBorderRoutingGetState

```
otBorderRoutingState otBorderRoutingGetState(
  otInstance *aInstance
)
```
Gets the current state of Border Routing Manager.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The current state of Border Routing Manager. |

### otBorderRoutingInit

```
otError otBorderRoutingInit(
  otInstance *aInstance,
  uint32_t aInfraIfIndex,
  bool aInfraIfIsRunning
)
```
Initializes the Border Routing Manager on given infrastructure interface.

This function MUST be called before any other otBorderRouting\* APIs.

This function can also be used to re-initialize and switch the infrastructure interface index to a new one. Switching the interface index will trigger all components running on the previous interface (Border Routing, mDNS, etc) to be stopped (as if the previous if-index is no longer running) before restarting operations on the new interface.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aInfraIfIndex` | The infrastructure interface index. | | `[in] aInfraIfIsRunning` | A boolean that indicates whether the infrastructure | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully started the Border Routing Manager on given infrastructure. | |

**See also:**   
[otPlatInfraIfStateChanged](https://openthread.io/reference/group/plat-infra-if#group__plat-infra-if_1ga972ec6661c5c3f2d917dbb55a954f622).   
[otBorderRoutingSetEnabled](https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga0b17e9bc5360cfaa1b12cf51d271adbc).   

### otBorderRoutingPrefixTableInitIterator

```
void otBorderRoutingPrefixTableInitIterator(
  otInstance *aInstance,
  otBorderRoutingPrefixTableIterator *aIterator
)
```
Initializes an `https://openthread.io/reference/struct/ot-border-routing-prefix-table-iterator`.

An iterator MUST be initialized before it is used.

An iterator can be initialized again to restart from the beginning of the table.

When iterating over entries in the table, to ensure the update times `mMsecSinceLastUpdate` of entries are consistent, they are given relative to the time the iterator was initialized.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[out] aIterator` | A pointer to the iterator to initialize. | |

### otBorderRoutingSetEnabled

```
otError otBorderRoutingSetEnabled(
  otInstance *aInstance,
  bool aEnabled
)
```
Enables or disables the Border Routing Manager.


> [!NOTE]
> **Note:** The Border Routing Manager is disabled by default.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aEnabled` | A boolean to enable/disable the routing manager. | |
| Return Values | |---|---| | `OT_ERROR_INVALID_STATE` | The Border Routing Manager is not initialized yet. | | `OT_ERROR_NONE` | Successfully enabled/disabled the Border Routing Manager. | |

### otBorderRoutingSetExtraRouterAdvertOptions

```
otError otBorderRoutingSetExtraRouterAdvertOptions(
  otInstance *aInstance,
  const uint8_t *aOptions,
  uint16_t aLength
)
```
Sets additional options to append at the end of emitted Router Advertisement (RA) messages.

The content of `aOptions` is copied internally, so it can be a temporary buffer (e.g., a stack allocated array).

Subsequent calls to this function overwrite the previously set value.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aOptions` | A pointer to the encoded options. Can be `NULL` to clear. | | `[in] aLength` | Number of bytes in `aOptions`. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the extra option bytes. | | `OT_ERROR_NO_BUFS` | Could not allocate buffer to save the buffer. | |

### otBorderRoutingSetOmrConfig

```
otError otBorderRoutingSetOmrConfig(
  otInstance *aInstance,
  otBorderRoutingOmrConfig aConfig,
  const otIp6Prefix *aOmrPrefix,
  otRoutePreference aPreference
)
```
Configures the OMR prefix handling in the Border Routing Manager.

This function offers manual administration options to explicitly configure the OMR prefix or to disable it.

By default, `OT_BORDER_ROUTING_OMR_CONFIG_AUTO` is used. In this mode, the Border Routing Manager automatically selects and manages the OMR prefix. This can involve auto-generating a local prefix or utilizing a prefix obtained through DHCPv6 PD (Prefix Delegation), if the feature is enabled.

The `OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM` option enables the use of a user-specified OMR prefix. When this option is selected, the `aOmrPrefix` and `aPreference` parameters are used to define the custom OMR prefix and its associated preference. These parameters are ignored for other configuration modes, and `aOmrPrefix` can be `NULL`.

The `OT_BORDER_ROUTING_OMR_CONFIG_DISABLED` option disables the Border Routing Manager's management of the OMR prefix. The Routing Manager module itself will not add any local or DHCPv6 PD OMR prefixes to the Network Data.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to the OpenThread instance. | | `[in] aConfig` | The desired OMR configuration. | | `[in] aOmrPrefix` | A pointer to the custom OMR prefix. Required only when `aConfig` is `OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM`. Otherwise, it can be `NULL`. | | `[in] aPreference` | The preference associated with the custom OMR prefix. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | The OMR configuration was successfully set to `aConfig`. | | `OT_ERROR_INVALID_ARGS` | The provided custom OMR prefix (`aOmrPrefix`) is invalid. | |

### otBorderRoutingSetOnLinkPrefix

```
void otBorderRoutingSetOnLinkPrefix(
  otInstance *aInstance,
  const otIp6Prefix *aPrefix
)
```
Sets the local on-link prefix.

Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TESTING_API_ENABLE`.

This is intended for testing only and using it will make the BR non-compliant with the Thread Specification.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aPrefix` | The on-link prefix to use. | |

### otBorderRoutingSetRdnssAddrCallback

```
void otBorderRoutingSetRdnssAddrCallback(
  otInstance *aInstance,
  otBorderRoutingRdnssAddrCallback aCallback,
  void *aContext
)
```
Sets the callback to be notified of changes to discovered Recursive DNS Server (RDNSS) address entries.

A subsequent call to this function, replaces a previously set callback.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance. | | `[in] aCallback` | The callback function pointer. Can be `NULL` if no callback is required. | | `[in] aConext` | An arbitrary context information (used when invoking the callback). | |

### otBorderRoutingSetRouteInfoOptionPreference

```
void otBorderRoutingSetRouteInfoOptionPreference(
  otInstance *aInstance,
  otRoutePreference aPreference
)
```
Explicitly sets the preference to use when advertising Route Info Options (RIO) in Router Advertisement messages sent over the infrastructure link.

After a call to this function, BR will use the given preference for all its advertised RIOs. The preference can be cleared by calling `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga5d800a91422df0e4d3560d30c543caba`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aPreference` | The route preference to use. | |

### otBorderRoutingSetRoutePreference

```
void otBorderRoutingSetRoutePreference(
  otInstance *aInstance,
  otRoutePreference aPreference
)
```
Explicitly sets the preference of published routes in Network Data.

After a call to this function, BR will use the given preference. The preference can be cleared by calling `https://openthread.io/reference/group/api-border-routing#group__api-border-routing_1ga3ee36a96337d0ba07b45e378add3bbf4`.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aPreference` | The route preference to use. | |

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