# Router/Leader

This module includes functions for Thread Routers and Leaders.

## Summary

| ### Enumerations ||
|---|---|
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gafc8f547e17334f8da4f087618b97902f` | enumDefines the EID cache entry state. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga59fe0c526ac3edeb76b33f79805403c9{ https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga59fe0c526ac3edeb76b33f79805403c9a20fea01e4fa4b55170f272d9c28c16bf, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga59fe0c526ac3edeb76b33f79805403c9ab3ac496cba23bb138f598723d2275a34, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga59fe0c526ac3edeb76b33f79805403c9aa8ab7e13b40060014bf27e0df663a33a, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga59fe0c526ac3edeb76b33f79805403c9a8f1a93a6204c9e26ad74e518b576a5b0, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga59fe0c526ac3edeb76b33f79805403c9a8d0907c4189af082c893bcf91714a3df }` | enumDefines the constants used in `otNeighborTableCallback` to indicate changes in neighbor table. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga72c8f91012f9369a6647f422e66215e7{ https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga72c8f91012f9369a6647f422e66215e7ab83e0f2cddabcb1aff3776115aac9164 = 0, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga72c8f91012f9369a6647f422e66215e7a40055194384bd6ee78180994a220d522 = 1, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga72c8f91012f9369a6647f422e66215e7a4a8ac18ef6f89f56811c29ed8332f19c = 2, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gga72c8f91012f9369a6647f422e66215e7aaed8423b46425563c89fc914618bd082 = 3 }` | enumRepresents the power supply property on a device. |

| ### Typedefs ||
|---|---|
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga25240d56c0001ea481b9664b23ee22df` | typedef `struct https://openthread.io/reference/struct/ot-cache-entry-info` Represents an EID cache entry. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gad76802d7db941de687563b33585c61c3` | typedef `struct https://openthread.io/reference/struct/ot-cache-entry-iterator` Represents an iterator used for iterating through the EID cache table entries. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaed6cc2984db656526e3ff3fadb8c4710` | typedef `enum https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gafc8f547e17334f8da4f087618b97902f` Defines the EID cache entry state. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga814dd1f768ff47faad84ced1a336347b` | typedef `uint16_t` Used to iterate through IPv6 addresses of a Thread Child entry. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaaca02e4c1738db6e79433560de5816a0` | typedef `struct https://openthread.io/reference/struct/ot-device-properties` Represents the device properties which are used for calculating the local leader weight on a device. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga5952037cdb6d7b2fcd59c9ed98c44337)(otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo)` | typedef `void(*` Pointer is called to notify that there is a change in the neighbor table. |

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6058f4c435d6ae0e939834ee659ebbf5(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Become a leader and start a new partition. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga80acf85ed7146397c518180009994eac(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Attempt to become a router. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6f5b706ec2a8a387dc55a7049b50f1b2(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `void` Clears the EID cache. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gadfdd24c241d937d155bc5fd6d06b8027(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint32_t` Gets the current Interval Max value used by Advertisement trickle timer. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga431ac6e86b0f87a94794b0118f0fe515(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint16_t aChildId, https://openthread.io/reference/struct/ot-child-info *aChildInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets diagnostic information for an attached Child by its Child ID or RLOC16. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga63d7b5071ddf136657ce8f13358ea129(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint16_t aChildIndex, https://openthread.io/reference/struct/ot-child-info *aChildInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` The function retains diagnostic information for an attached Child by the internal table index. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gad4c9e17a07de6229b0dd1371f822258e(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint16_t aChildIndex, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga814dd1f768ff47faad84ced1a336347b *aIterator, https://openthread.io/reference/struct/ot-ip6-address *aAddress)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the next IPv6 address (using an iterator) for a given child. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga712a3665998239e56f3d1d7aa45f79ae(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Get the MLE_CHILD_ROUTER_LINKS parameter used in the REED role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gabf4a270b2b3d18f569c9113599df7a10(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint32_t` Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6a3d2eaa15123f82f421c1bd187b4ca3(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `const https://openthread.io/reference/struct/ot-device-properties *` Get the current device properties. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga8540c6b25d0609ffb3acdf72baf32c43(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint16_t` Gets the Joiner UDP Port. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gab5d0a4a74b5a02a09eec3315aad91bce(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Gets the Thread Leader Weight used when operating in the Leader role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga73b08e8d3a7424cca1640aa44f09ebf3(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint16_t` Gets the maximum number of children currently allowed. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga4e03c15d83bf178a96078c803ac1208c(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Gets the maximum number of IP addresses that each MTD child may register with this device as parent. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga24b236145e8e4622f5b632cfd76ce248(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` The function returns the maximum allowed router ID. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaebc75d5fd282431f02b4d3d0210f818d(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Get the `NETWORK_ID_TIMEOUT` parameter. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga52930b3360e1ef377d058a0d7f8ef170(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-cache-entry-info *aEntryInfo, https://openthread.io/reference/struct/ot-cache-entry-iterator *aIterator)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Gets the next EID cache entry (using an iterator). |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga55c1ac0fc16b3b42cda70900c21e27fc(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint16_t aDestRloc16, uint16_t *aNextHopRloc16, uint8_t *aPathCost)` | `void` Gets the next hop and path cost towards a given RLOC16 destination. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6254d1e084f299c079dee522df2176fa(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `int8_t` Get the assigned parent priority. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6565e5aace06b4e5a0e3fe358aad1d3b(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint32_t` Get the preferred Thread Leader Partition Id used when operating in the Leader role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga1ae5ce889df8fc67f1e9f5591fe843ab(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/struct/ot-pskc *aPskc)` | `void` Get the Thread PSKc. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gae198f738af134e29427c3afa0ee96e88(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `https://openthread.io/reference/group/api-operational-dataset#group__api-operational-dataset_1ga714e872d0f2b7a6496ec500ad3ad9555` Get Key Reference to Thread PSKc stored. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaa5e4304ecdcee727adf695358e8631f6(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga8c074841055ad4adb673a25502e62076(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t *aMinRouterId, uint8_t *aMaxRouterId)` | `void` Gets the range of router IDs that are allowed to assign to nodes within the thread network. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga7f443bd19fa8e8764565b3caf24a2915(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Get the current Router ID Sequence. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaaf9c969a76465923efd0ae4113d7bbf5(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint16_t aRouterId, https://openthread.io/reference/struct/ot-router-info *aRouterInfo)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` The function retains diagnostic information for a given Thread Router. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga269bb85940cb759004f161b10cb7dd6c(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Get the ROUTER_SELECTION_JITTER parameter used in the REED/Router role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga842370f58b93edcf40c23585bd0396af(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Get the ROUTER_UPGRADE_THRESHOLD parameter used in the REED role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga96cb4b5fb057bb46e0710a9a87d46936(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether or not the device is allowed to take router or leader roles. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaca5366dc14d836cb37ddc2799a4111f1(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aRouterId)` | `bool` Indicates whether or not a Router ID is currently allocated. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6186ec22725f835e1e82ed98dd154c3a(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `bool` Indicates whether the filter that drops TMF UDP messages from untrusted origin is enabled or not. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga2de37cb5df009ce8bb029daf0afcf758(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga5952037cdb6d7b2fcd59c9ed98c44337 aCallback)` | `void` Registers a neighbor table callback function. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga9c38a5f640283ba70dfca5b8ceafe611(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aRouterId)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Release a Router ID that has been allocated by the device in the Leader role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga0a3c186f1d15ba23cae994f728ccec92(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnabled)` | `void` Sets whether the device was commissioned using CCM. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6ec8ebba6657946ffe7527f078ece636(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aChildRouterLinks)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Set the MLE_CHILD_ROUTER_LINKS parameter used in the REED role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga46fc8338032037d06685557dfd1fae22(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t aDelay)` | `void` Set the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga38c997ceb4cc0dcda31f36fef6019b70(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-device-properties *aDeviceProperties)` | `void` Set the device properties which are then used to determine and set the Leader Weight. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga83057db009c10d2915dee6de329e3aa6(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint16_t aJoinerUdpPort)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets the Joiner UDP Port. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga0392e445a417ff04f2289e5f7d8a23b3(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aWeight)` | `void` Sets the Thread Leader Weight used when operating in the Leader role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gab8a0dafce0a78b73b535b36285bf6c23(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint16_t aMaxChildren)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets the maximum number of children currently allowed. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gae7a2e1e6e28fa2c67ec4fb6ad10b6104(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aMaxIpAddresses)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets or restores the maximum number of IP addresses that each MTD child may register with this device as parent. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaea8561bac9648d40cb9267303d7b2400(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aTimeout)` | `void` Set the `NETWORK_ID_TIMEOUT` parameter. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6bac909027ba6d165860d3e30dcea397(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, int8_t aParentPriority)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Set the parent priority. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gacae245c66cdcd9fbb9926fb72b93f025(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint32_t aPartitionId)` | `void` Set the preferred Thread Leader Partition Id used when operating in the Leader role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga8a800e2c3d87e5b73044750ca6dc9b31(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aRouterId)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets the preferred Router Id. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga47c22d5faaa09eeb7cb4026629c9778c(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-pskc *aPskc)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Set the Thread PSKc. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga1c23256199f5faf349652783e110bb87(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, https://openthread.io/reference/group/api-operational-dataset#group__api-operational-dataset_1ga714e872d0f2b7a6496ec500ad3ad9555 aKeyRef)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Set the Key Reference to the Thread PSKc. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga3f164a0dddd9e58122a9356efd8a679f(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aThreshold)` | `void` Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga82101affe91acd922af07a25fcc5a420(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEligible)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets whether or not the device is router-eligible. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga2881977d86b1a62832a34ad0047697a5(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aMinRouterId, uint8_t aMaxRouterId)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Sets the range of router IDs that are allowed to assign to nodes within the thread network. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gab791ab69b1ffe58a0acccd0fbd9892a4(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aRouterJitter)` | `void` Set the ROUTER_SELECTION_JITTER parameter used in the REED/Router role. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gad6377e3fd63d2463ab84ecd5539706c7(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, uint8_t aThreshold)` | `void` Sets the ROUTER_UPGRADE_THRESHOLD parameter. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga0712431ab37aec1c559b298232e860c8(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, const https://openthread.io/reference/struct/ot-ext-address *aExtAddress)` | `void` Set Steering data out of band. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga545cbc892e6e4e764aead04e0a18c429(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnabled)` | `void` Sets whether the Security Policy TLV version-threshold for routing (VR field) is enabled. |
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gace172ca2cfb92deafcb6ccb50af77e90(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aEnabled)` | `void` Enables or disables the filter to drop TMF UDP messages from untrusted origin. |

| ### Macros ||
|---|---|
| `https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga7637fd5e93611bd5903b71cc65fc3e17 0` | Initializer for otChildIP6AddressIterator. |

| ### Structs ||
|---|---|
| [otCacheEntryInfo](https://openthread.io/reference/struct/ot-cache-entry-info) | Represents an EID cache entry. |
| [otCacheEntryIterator](https://openthread.io/reference/struct/ot-cache-entry-iterator) | Represents an iterator used for iterating through the EID cache table entries. |
| [otChildInfo](https://openthread.io/reference/struct/ot-child-info) | Holds diagnostic information for a Thread Child. |
| [otDeviceProperties](https://openthread.io/reference/struct/ot-device-properties) | Represents the device properties which are used for calculating the local leader weight on a device. |
| [otNeighborTableEntryInfo](https://openthread.io/reference/struct/ot-neighbor-table-entry-info) | Represent a neighbor table entry info (child or router) and is used as a parameter in the neighbor table callback `otNeighborTableCallback`. |

## Enumerations

### otCacheEntryState

```
 otCacheEntryState
```
Defines the EID cache entry state.

### otNeighborTableEvent

```
 otNeighborTableEvent
```
Defines the constants used in `otNeighborTableCallback` to indicate changes in neighbor table.

| Properties ||
|---|---|
| `OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED` | A child is being added. |
| `OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED` | An existing child's mode is changed. |
| `OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED` | A child is being removed. |
| `OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED` | A router is being added. |
| `OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED` | A router is being removed. |

### otPowerSupply

```
 otPowerSupply
```
Represents the power supply property on a device.

This is used as a property in `https://openthread.io/reference/struct/ot-device-properties` to calculate the leader weight.

| Properties ||
|---|---|
| `OT_POWER_SUPPLY_BATTERY` | Battery powered. |
| `OT_POWER_SUPPLY_EXTERNAL` | Externally powered (mains-powered). |
| `OT_POWER_SUPPLY_EXTERNAL_STABLE` | Stable external power with a battery backup or UPS. |
| `OT_POWER_SUPPLY_EXTERNAL_UNSTABLE` | Potentially unstable ext power (e.g. light bulb powered via a switch). |

## Typedefs

### otCacheEntryInfo

```
struct otCacheEntryInfo otCacheEntryInfo
```
Represents an EID cache entry.

### otCacheEntryIterator

```
struct otCacheEntryIterator otCacheEntryIterator
```
Represents an iterator used for iterating through the EID cache table entries.

To initialize the iterator and start from the first entry in the cache table, set all its fields in the structure to zero (e.g., `memset` the iterator to zero).

### otCacheEntryState

```
enum otCacheEntryState otCacheEntryState
```
Defines the EID cache entry state.

### otChildIp6AddressIterator

```
uint16_t otChildIp6AddressIterator
```
Used to iterate through IPv6 addresses of a Thread Child entry.

### otDeviceProperties

```
struct otDeviceProperties otDeviceProperties
```
Represents the device properties which are used for calculating the local leader weight on a device.

The parameters are set based on device's capability, whether acting as border router, its power supply config, etc.

`mIsUnstable` indicates operational stability of device and is determined via a vendor specific mechanism. It can include the following cases:

- Device internally detects that it loses external power supply more often than usual. What is usual is determined by the vendor.
- Device internally detects that it reboots more often than usual. What is usual is determined by the vendor.

<br />

### otNeighborTableCallback

```
void(* otNeighborTableCallback)(otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo)
```
Pointer is called to notify that there is a change in the neighbor table.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aEvent` | A event flag. | | `[in] aEntryInfo` | A pointer to table entry info. | |

## Functions

### otThreadBecomeLeader

```
otError otThreadBecomeLeader(
  otInstance *aInstance
)
```
Become a leader and start a new partition.

If the device is not attached, this API will force the device to start as the leader of the network. This use case is only intended for testing and demo purposes, and using the API while the device is detached can make a production application non-compliant with the Thread Specification.

If the device is already attached, this API can be used to try to take over as the leader, creating a new partition. For this to work, the local leader weight (`https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gab5d0a4a74b5a02a09eec3315aad91bce`) must be larger than the weight of the current leader (`https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1gac8d242d1ebb7fff38111ca4be2eacc21`). If it is not, `OT_ERROR_NOT_CAPABLE` is returned to indicate to the caller that they need to adjust the weight.

Taking over the leader role in this way is only allowed when triggered by an explicit user action. Using this API without such user action can make a production application non-compliant with the Thread Specification.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully became a leader and started a new partition, or was leader already. | | `OT_ERROR_INVALID_STATE` | Thread is disabled. | | `OT_ERROR_NOT_CAPABLE` | Device cannot override the current leader due to its local leader weight being same or smaller than current leader's weight, or device is not router eligible. | |

### otThreadBecomeRouter

```
otError otThreadBecomeRouter(
  otInstance *aInstance
)
```
Attempt to become a router.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully begin attempt to become a router. | | `OT_ERROR_INVALID_STATE` | Thread is disabled. | |

### otThreadClearEidCache

```
void otThreadClearEidCache(
  otInstance *aInstance
)
```
Clears the EID cache.

Intended for testing only.

<br />

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

### otThreadGetAdvertisementTrickleIntervalMax

```
uint32_t otThreadGetAdvertisementTrickleIntervalMax(
  otInstance *aInstance
)
```
Gets the current Interval Max value used by Advertisement trickle timer.

This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is intended for testing only.

<br />

| Details ||
|---|---|
| **Returns** | The Interval Max of Advertisement trickle timer in milliseconds. |

### otThreadGetChildInfoById

```
otError otThreadGetChildInfoById(
  otInstance *aInstance,
  uint16_t aChildId,
  otChildInfo *aChildInfo
)
```
Gets diagnostic information for an attached Child by its Child ID or RLOC16.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aChildId` | The Child ID or RLOC16 for the attached child. | | `[out] aChildInfo` | A pointer to where the child information is placed. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aChildInfo` was successfully updated with the info for the given ID. | | `OT_ERROR_NOT_FOUND` | No valid child with this Child ID. | | `OT_ERROR_INVALID_ARGS` | If `aChildInfo` is NULL. | |

### otThreadGetChildInfoByIndex

```
otError otThreadGetChildInfoByIndex(
  otInstance *aInstance,
  uint16_t aChildIndex,
  otChildInfo *aChildInfo
)
```
The function retains diagnostic information for an attached Child by the internal table index.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aChildIndex` | The table index. | | `[out] aChildInfo` | A pointer to where the child information is placed. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | `aChildInfo` was successfully updated with the info for the given index. | | `OT_ERROR_NOT_FOUND` | No valid child at this index. | | `OT_ERROR_INVALID_ARGS` | Either `aChildInfo` is NULL, or `aChildIndex` is out of range (higher than max table index). | |

**See also:**   
otGetMaxAllowedChildren   

### otThreadGetChildNextIp6Address

```
otError otThreadGetChildNextIp6Address(
  otInstance *aInstance,
  uint16_t aChildIndex,
  otChildIp6AddressIterator *aIterator,
  otIp6Address *aAddress
)
```
Gets the next IPv6 address (using an iterator) for a given child.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aChildIndex` | The child index. | | `[in,out] aIterator` | A pointer to the iterator. On success the iterator will be updated to point to next entry in the list. To get the first IPv6 address the iterator should be set to OT_CHILD_IP6_ADDRESS_ITERATOR_INIT. | | `[out] aAddress` | A pointer to an IPv6 address where the child's next address is placed (on success). | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully found the next IPv6 address (`aAddress` was successfully updated). | | `OT_ERROR_NOT_FOUND` | The child has no subsequent IPv6 address entry. | | `OT_ERROR_INVALID_ARGS` | `aIterator` or `aAddress` are NULL, or child at `aChildIndex` is not valid. | |

**See also:**   
[otThreadGetChildInfoByIndex](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga63d7b5071ddf136657ce8f13358ea129)   

### otThreadGetChildRouterLinks

```
uint8_t otThreadGetChildRouterLinks(
  otInstance *aInstance
)
```
Get the MLE_CHILD_ROUTER_LINKS parameter used in the REED role.

This parameter specifies the max number of neighboring routers with which the device (as an FED) will try to establish link.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The MLE_CHILD_ROUTER_LINKS value. |

**See also:**   
[otThreadSetChildRouterLinks](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6ec8ebba6657946ffe7527f078ece636)   

### otThreadGetContextIdReuseDelay

```
uint32_t otThreadGetContextIdReuseDelay(
  otInstance *aInstance
)
```
Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The CONTEXT_ID_REUSE_DELAY value. |

**See also:**   
[otThreadSetContextIdReuseDelay](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga46fc8338032037d06685557dfd1fae22)   

### otThreadGetDeviceProperties

```
const otDeviceProperties * otThreadGetDeviceProperties(
  otInstance *aInstance
)
```
Get the current device properties.

Requires `OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE`.

<br />

| Details ||
|---|---|
| **Returns** | The device properties `https://openthread.io/reference/struct/ot-device-properties`. |

### otThreadGetJoinerUdpPort

```
uint16_t otThreadGetJoinerUdpPort(
  otInstance *aInstance
)
```
Gets the Joiner UDP Port.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The Joiner UDP Port number. |

**See also:**   
[otThreadSetJoinerUdpPort](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga83057db009c10d2915dee6de329e3aa6)   

### otThreadGetLocalLeaderWeight

```
uint8_t otThreadGetLocalLeaderWeight(
  otInstance *aInstance
)
```
Gets the Thread Leader Weight used when operating in the Leader role.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The Thread Leader Weight value. |

**See also:**   
otThreadSetLeaderWeight   
[otThreadSetDeviceProperties](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga38c997ceb4cc0dcda31f36fef6019b70)  

### otThreadGetMaxAllowedChildren

```
uint16_t otThreadGetMaxAllowedChildren(
  otInstance *aInstance
)
```
Gets the maximum number of children currently allowed.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The maximum number of children currently allowed. |

**See also:**   
[otThreadSetMaxAllowedChildren](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gab8a0dafce0a78b73b535b36285bf6c23)   

### otThreadGetMaxChildIpAddresses

```
uint8_t otThreadGetMaxChildIpAddresses(
  otInstance *aInstance
)
```
Gets the maximum number of IP addresses that each MTD child may register with this device as parent.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The maximum number of IP addresses that each MTD child may register with this device as parent. |

**See also:**   
[otThreadSetMaxChildIpAddresses](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gae7a2e1e6e28fa2c67ec4fb6ad10b6104)   

### otThreadGetMaxRouterId

```
uint8_t otThreadGetMaxRouterId(
  otInstance *aInstance
)
```
The function returns the maximum allowed router ID.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The maximum allowed router ID. |

### otThreadGetNetworkIdTimeout

```
uint8_t otThreadGetNetworkIdTimeout(
  otInstance *aInstance
)
```
Get the `NETWORK_ID_TIMEOUT` parameter.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The `NETWORK_ID_TIMEOUT` value. |

**See also:**   
[otThreadSetNetworkIdTimeout](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaea8561bac9648d40cb9267303d7b2400)   

### otThreadGetNextCacheEntry

```
otError otThreadGetNextCacheEntry(
  otInstance *aInstance,
  otCacheEntryInfo *aEntryInfo,
  otCacheEntryIterator *aIterator
)
```
Gets the next EID cache entry (using an iterator).

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aEntryInfo` | A pointer to where the EID cache entry information is placed. | | `[in,out] aIterator` | A pointer to an iterator. It will be updated to point to next entry on success. To get the first entry, initialize the iterator by setting all its fields to zero (e.g., `memset` the iterator structure to zero). | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully populated `aEntryInfo` for next EID cache entry. | | `OT_ERROR_NOT_FOUND` | No more entries in the address cache table. | |

### otThreadGetNextHopAndPathCost

```
void otThreadGetNextHopAndPathCost(
  otInstance *aInstance,
  uint16_t aDestRloc16,
  uint16_t *aNextHopRloc16,
  uint8_t *aPathCost
)
```
Gets the next hop and path cost towards a given RLOC16 destination.

Can be used with either `aNextHopRloc16` or `aPathCost` being NULL indicating caller does not want to get the value.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aDestRloc16` | The RLOC16 of destination. | | `[out] aNextHopRloc16` | A pointer to return RLOC16 of next hop, 0xfffe if no next hop. | | `[out] aPathCost` | A pointer to return path cost towards destination. | |

### otThreadGetParentPriority

```
int8_t otThreadGetParentPriority(
  otInstance *aInstance
)
```
Get the assigned parent priority.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The assigned parent priority value, -2 means not assigned. |

**See also:**   
[otThreadSetParentPriority](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6bac909027ba6d165860d3e30dcea397)   

### otThreadGetPreferredLeaderPartitionId

```
uint32_t otThreadGetPreferredLeaderPartitionId(
  otInstance *aInstance
)
```
Get the preferred Thread Leader Partition Id used when operating in the Leader role.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The Thread Leader Partition Id value. |

### otThreadGetPskc

```
void otThreadGetPskc(
  otInstance *aInstance,
  otPskc *aPskc
)
```
Get the Thread PSKc.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aPskc` | A pointer to an `https://openthread.io/reference/struct/ot-pskc` to return the retrieved Thread PSKc. | |

**See also:**   
[otThreadSetPskc](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga47c22d5faaa09eeb7cb4026629c9778c)   

### otThreadGetPskcRef

```
otPskcRef otThreadGetPskcRef(
  otInstance *aInstance
)
```
Get Key Reference to Thread PSKc stored.

Requires the build-time feature `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` to be enabled.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | Key Reference to PSKc |

**See also:**   
[otThreadSetPskcRef](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga1c23256199f5faf349652783e110bb87)   

### otThreadGetRouterDowngradeThreshold

```
uint8_t otThreadGetRouterDowngradeThreshold(
  otInstance *aInstance
)
```
Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The ROUTER_DOWNGRADE_THRESHOLD value. |

**See also:**   
[otThreadSetRouterDowngradeThreshold](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga3f164a0dddd9e58122a9356efd8a679f)   

### otThreadGetRouterIdRange

```
void otThreadGetRouterIdRange(
  otInstance *aInstance,
  uint8_t *aMinRouterId,
  uint8_t *aMaxRouterId
)
```
Gets the range of router IDs that are allowed to assign to nodes within the thread network.


> [!NOTE]
> **Note:** This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used for test purpose. All the router IDs in the range \[aMinRouterId, aMaxRouterId\] are allowed.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[out] aMinRouterId` | The minimum router ID. | | `[out] aMaxRouterId` | The maximum router ID. | |

**See also:**   
[otThreadSetRouterIdRange](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga2881977d86b1a62832a34ad0047697a5)   

### otThreadGetRouterIdSequence

```
uint8_t otThreadGetRouterIdSequence(
  otInstance *aInstance
)
```
Get the current Router ID Sequence.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The Router ID Sequence. |

### otThreadGetRouterInfo

```
otError otThreadGetRouterInfo(
  otInstance *aInstance,
  uint16_t aRouterId,
  otRouterInfo *aRouterInfo
)
```
The function retains diagnostic information for a given Thread Router.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aRouterId` | The router ID or RLOC16 for a given router. | | `[out] aRouterInfo` | A pointer to where the router information is placed. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully retrieved the router info for given id. | | `OT_ERROR_NOT_FOUND` | No router entry with the given id. | | `OT_ERROR_INVALID_ARGS` | `aRouterInfo` is NULL. | |

### otThreadGetRouterSelectionJitter

```
uint8_t otThreadGetRouterSelectionJitter(
  otInstance *aInstance
)
```
Get the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The ROUTER_SELECTION_JITTER value. |

**See also:**   
[otThreadSetRouterSelectionJitter](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gab791ab69b1ffe58a0acccd0fbd9892a4)   

### otThreadGetRouterUpgradeThreshold

```
uint8_t otThreadGetRouterUpgradeThreshold(
  otInstance *aInstance
)
```
Get the ROUTER_UPGRADE_THRESHOLD parameter used in the REED role.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| **Returns** | The ROUTER_UPGRADE_THRESHOLD value. |

**See also:**   
[otThreadSetRouterUpgradeThreshold](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gad6377e3fd63d2463ab84ecd5539706c7)   

### otThreadIsRouterEligible

```
bool otThreadIsRouterEligible(
  otInstance *aInstance
)
```
Indicates whether or not the device is allowed to take router or leader roles.

A device is allowed to become a router if it is a Full Thread Device (FTD), is currently configured to be router-eligible (see `otThreadSetRouterEligible(true)`), and the active Security Policy permits routers.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | |
| Return Values | |---|---| | `TRUE` | If the router role is allowed. | | `FALSE` | If the router role is not allowed. | |

### otThreadIsRouterIdAllocated

```
bool otThreadIsRouterIdAllocated(
  otInstance *aInstance,
  uint8_t aRouterId
)
```
Indicates whether or not a Router ID is currently allocated.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aRouterId` | The router ID to check. | |
| Return Values | |---|---| | `TRUE` | The `aRouterId` is allocated. | | `FALSE` | The `aRouterId` is not allocated. | |

### otThreadIsTmfOriginFilterEnabled

```
bool otThreadIsTmfOriginFilterEnabled(
  otInstance *aInstance
)
```
Indicates whether the filter that drops TMF UDP messages from untrusted origin is enabled or not.

This is intended for testing only and available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` config is enabled.

<br />

| Details ||
|---|---|
| Return Values | |---|---| | `TRUE` | The filter is enabled. | | `FALSE` | The filter is not enabled. | |

### otThreadRegisterNeighborTableCallback

```
void otThreadRegisterNeighborTableCallback(
  otInstance *aInstance,
  otNeighborTableCallback aCallback
)
```
Registers a neighbor table callback function.

The provided callback (if non-NULL) will be invoked when there is a change in the neighbor table (e.g., a child or a router neighbor entry is being added/removed or an existing child's mode is changed).

Subsequent calls to this method will overwrite the previous callback. Note that this callback in invoked while the neighbor/child table is being updated and always before the `otStateChangedCallback`.

<br />

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

### otThreadReleaseRouterId

```
otError otThreadReleaseRouterId(
  otInstance *aInstance,
  uint8_t aRouterId
)
```
Release a Router ID that has been allocated by the device in the Leader role.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aRouterId` | The Router ID to release. Valid range is \[0, 62\]. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully released the router id. | | `OT_ERROR_INVALID_ARGS` | `aRouterId` is not in the range \[0, 62\]. | | `OT_ERROR_INVALID_STATE` | The device is not currently operating as a leader. | | `OT_ERROR_NOT_FOUND` | The router id is not currently allocated. | |

### otThreadSetCcmEnabled

```
void otThreadSetCcmEnabled(
  otInstance *aInstance,
  bool aEnabled
)
```
Sets whether the device was commissioned using CCM.


> [!NOTE]
> **Note:** This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used by Thread Test Harness to indicate whether this device was commissioned using CCM.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aEnabled` | TRUE if the device was commissioned using CCM, FALSE otherwise. | |

### otThreadSetChildRouterLinks

```
otError otThreadSetChildRouterLinks(
  otInstance *aInstance,
  uint8_t aChildRouterLinks
)
```
Set the MLE_CHILD_ROUTER_LINKS parameter used in the REED role.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aChildRouterLinks` | The MLE_CHILD_ROUTER_LINKS value. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the value. | | `OT_ERROR_INVALID_STATE` | Thread protocols are enabled. | |

**See also:**   
[otThreadGetChildRouterLinks](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga712a3665998239e56f3d1d7aa45f79ae)   

### otThreadSetContextIdReuseDelay

```
void otThreadSetContextIdReuseDelay(
  otInstance *aInstance,
  uint32_t aDelay
)
```
Set the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

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

**See also:**   
[otThreadGetContextIdReuseDelay](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gabf4a270b2b3d18f569c9113599df7a10)   

### otThreadSetDeviceProperties

```
void otThreadSetDeviceProperties(
  otInstance *aInstance,
  const otDeviceProperties *aDeviceProperties
)
```
Set the device properties which are then used to determine and set the Leader Weight.

Requires `OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE`.

<br />

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

### otThreadSetJoinerUdpPort

```
otError otThreadSetJoinerUdpPort(
  otInstance *aInstance,
  uint16_t aJoinerUdpPort
)
```
Sets the Joiner UDP Port.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aJoinerUdpPort` | The Joiner UDP Port number. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the Joiner UDP Port. | |

**See also:**   
[otThreadGetJoinerUdpPort](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga8540c6b25d0609ffb3acdf72baf32c43)   

### otThreadSetLocalLeaderWeight

```
void otThreadSetLocalLeaderWeight(
  otInstance *aInstance,
  uint8_t aWeight
)
```
Sets the Thread Leader Weight used when operating in the Leader role.

Directly sets the Leader Weight to the new value, replacing its previous value (which may have been determined from the current `https://openthread.io/reference/struct/ot-device-properties`).

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aWeight` | The Thread Leader Weight value. | |

**See also:**   
[otThreadGetLeaderWeight](https://openthread.io/reference/group/api-thread-general#group__api-thread-general_1gac8d242d1ebb7fff38111ca4be2eacc21)   

### otThreadSetMaxAllowedChildren

```
otError otThreadSetMaxAllowedChildren(
  otInstance *aInstance,
  uint16_t aMaxChildren
)
```
Sets the maximum number of children currently allowed.

This parameter can only be set when Thread protocol operation has been stopped.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aMaxChildren` | The maximum allowed children. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the max. | | `OT_ERROR_INVALID_ARGS` | If `aMaxChildren` is not in the range \[1, OPENTHREAD_CONFIG_MLE_MAX_CHILDREN\]. | | `OT_ERROR_INVALID_STATE` | If Thread isn't stopped. | |

**See also:**   
[otThreadGetMaxAllowedChildren](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga73b08e8d3a7424cca1640aa44f09ebf3)   

### otThreadSetMaxChildIpAddresses

```
otError otThreadSetMaxChildIpAddresses(
  otInstance *aInstance,
  uint8_t aMaxIpAddresses
)
```
Sets or restores the maximum number of IP addresses that each MTD child may register with this device as parent.

Pass `0` to clear the setting and restore the default.

Available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.


> [!NOTE]
> **Note:** Only used by Thread Test Harness to limit the address registrations of the reference parent in order to test the MTD DUT reaction.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aMaxIpAddresses` | The maximum number of IP addresses that each MTD child may register with this device as parent. 0 to clear the setting and restore the default. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set/cleared the number. | | `OT_ERROR_INVALID_ARGS` | If exceeds the allowed maximum number. | |

**See also:**   
[otThreadGetMaxChildIpAddresses](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga4e03c15d83bf178a96078c803ac1208c)   

### otThreadSetNetworkIdTimeout

```
void otThreadSetNetworkIdTimeout(
  otInstance *aInstance,
  uint8_t aTimeout
)
```
Set the `NETWORK_ID_TIMEOUT` parameter.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

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

**See also:**   
[otThreadGetNetworkIdTimeout](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaebc75d5fd282431f02b4d3d0210f818d)   

### otThreadSetParentPriority

```
otError otThreadSetParentPriority(
  otInstance *aInstance,
  int8_t aParentPriority
)
```
Set the parent priority.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aParentPriority` | The parent priority value. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the parent priority. | | `OT_ERROR_INVALID_ARGS` | If the parent priority value is not among 1, 0, -1 and -2. | |

**See also:**   
[otThreadGetParentPriority](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga6254d1e084f299c079dee522df2176fa)   

### otThreadSetPreferredLeaderPartitionId

```
void otThreadSetPreferredLeaderPartitionId(
  otInstance *aInstance,
  uint32_t aPartitionId
)
```
Set the preferred Thread Leader Partition Id used when operating in the Leader role.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aPartitionId` | The Thread Leader Partition Id value. | |

### otThreadSetPreferredRouterId

```
otError otThreadSetPreferredRouterId(
  otInstance *aInstance,
  uint8_t aRouterId
)
```
Sets the preferred Router Id.

Requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`.

Upon becoming a router/leader the node attempts to use this Router Id. If the preferred Router Id is not set or if it can not be used, a randomly generated router id is picked. This property can be set only when the device role is either detached or disabled.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aRouterId` | The preferred Router Id. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the preferred Router Id. | | `OT_ERROR_INVALID_STATE` | Could not set (role is not detached or disabled) | |

### otThreadSetPskc

```
otError otThreadSetPskc(
  otInstance *aInstance,
  const otPskc *aPskc
)
```
Set the Thread PSKc.

Will only succeed when Thread protocols are disabled. A successful call to this function will also invalidate the Active and Pending Operational Datasets in non-volatile memory.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aPskc` | A pointer to the new Thread PSKc. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the Thread PSKc. | | `OT_ERROR_INVALID_STATE` | Thread protocols are enabled. | |

**See also:**   
[otThreadGetPskc](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga1ae5ce889df8fc67f1e9f5591fe843ab)   

### otThreadSetPskcRef

```
otError otThreadSetPskcRef(
  otInstance *aInstance,
  otPskcRef aKeyRef
)
```
Set the Key Reference to the Thread PSKc.

Requires the build-time feature `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` to be enabled.

Will only succeed when Thread protocols are disabled. Upon success, this will also invalidate the Active and Pending Operational Datasets in non-volatile memory.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aKeyRef` | Key Reference to the new Thread PSKc. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the Thread PSKc. | | `OT_ERROR_INVALID_STATE` | Thread protocols are enabled. | |

**See also:**   
[otThreadGetPskcRef](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gae198f738af134e29427c3afa0ee96e88)   

### otThreadSetRouterDowngradeThreshold

```
void otThreadSetRouterDowngradeThreshold(
  otInstance *aInstance,
  uint8_t aThreshold
)
```
Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

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

**See also:**   
[otThreadGetRouterDowngradeThreshold](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1gaa5e4304ecdcee727adf695358e8631f6)   

### otThreadSetRouterEligible

```
otError otThreadSetRouterEligible(
  otInstance *aInstance,
  bool aEligible
)
```
Sets whether or not the device is router-eligible.

If `aEligible` is false and the device is currently operating as a router, this call will cause the device to detach and attempt to reattach as a child.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aEligible` | TRUE to configure the device as router-eligible, FALSE otherwise. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the router-eligible configuration. | | `OT_ERROR_NOT_CAPABLE` | The device is not capable of becoming a router. | |

### otThreadSetRouterIdRange

```
otError otThreadSetRouterIdRange(
  otInstance *aInstance,
  uint8_t aMinRouterId,
  uint8_t aMaxRouterId
)
```
Sets the range of router IDs that are allowed to assign to nodes within the thread network.


> [!NOTE]
> **Note:** This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used for test purpose. All the router IDs in the range \[aMinRouterId, aMaxRouterId\] are allowed.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aMinRouterId` | The minimum router ID. | | `[in] aMaxRouterId` | The maximum router ID. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the range. | | `OT_ERROR_INVALID_ARGS` | aMinRouterId \> aMaxRouterId, or the range is not covered by \[0, 62\]. | |

**See also:**   
[otThreadGetRouterIdRange](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga8c074841055ad4adb673a25502e62076)   

### otThreadSetRouterSelectionJitter

```
void otThreadSetRouterSelectionJitter(
  otInstance *aInstance,
  uint8_t aRouterJitter
)
```
Set the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.


> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

<br />

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

**See also:**   
[otThreadGetRouterSelectionJitter](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga269bb85940cb759004f161b10cb7dd6c)   

### otThreadSetRouterUpgradeThreshold

```
void otThreadSetRouterUpgradeThreshold(
  otInstance *aInstance,
  uint8_t aThreshold
)
```
Sets the ROUTER_UPGRADE_THRESHOLD parameter.

<br />

> [!NOTE]
> **Note:** This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.

This API historically set a single threshold value that was used for both local role transitions (deciding when the device itself should upgrade to a router) and by the leader (deciding whether to allow other devices to upgrade). These behaviors have now been separated into distinct router and leader thresholds. To preserve backward compatibility with existing applications and test scripts, this function continues to configure both thresholds (both the local router upgrade threshold and the leader upgrade threshold).

<br />

<br />

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

**See also:**   
[otThreadGetRouterUpgradeThreshold](https://openthread.io/reference/group/api-thread-router#group__api-thread-router_1ga842370f58b93edcf40c23585bd0396af)   

### otThreadSetSteeringData

```
void otThreadSetSteeringData(
  otInstance *aInstance,
  const otExtAddress *aExtAddress
)
```
Set Steering data out of band.

Configuration option `OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE` should be set to enable setting of steering data out of band.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aExtAddress` | Address used to update the steering data. All zeros to clear the steering data (no steering data). All 0xFFs to set steering data/bloom filter to accept/allow all. A specific EUI64 which is then added to current steering data/bloom filter. | |

### otThreadSetThreadVersionCheckEnabled

```
void otThreadSetThreadVersionCheckEnabled(
  otInstance *aInstance,
  bool aEnabled
)
```
Sets whether the Security Policy TLV version-threshold for routing (VR field) is enabled.


> [!NOTE]
> **Note:** This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used by Thread Test Harness to indicate that thread protocol version check VR should be skipped.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aEnabled` | TRUE to enable Security Policy TLV version-threshold for routing, FALSE otherwise. | |

### otThreadSetTmfOriginFilterEnabled

```
void otThreadSetTmfOriginFilterEnabled(
  otInstance *aInstance,
  bool aEnabled
)
```
Enables or disables the filter to drop TMF UDP messages from untrusted origin.

TMF messages are only trusted when they originate from a trusted source, such as the Thread interface. In special cases, such as when a device uses platform UDP socket to send TMF messages, they will be dropped due to untrusted origin. This filter is enabled by default.

When this filter is disabled, UDP messages sent to the TMF port that originate from untrusted origin (such as host, CLI or an external IPv6 node) will be allowed.


> [!NOTE]
> **Note:** This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` and is only used by Thread Test Harness to test network behavior by sending special TMF messages from the CLI on a POSIX host.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | A pointer to an OpenThread instance. | | `[in] aEnabled` | TRUE to enable filter, FALSE otherwise. | |

## Macros

### OT_CHILD_IP6_ADDRESS_ITERATOR_INIT

```
 OT_CHILD_IP6_ADDRESS_ITERATOR_INIT 0
```
Initializer for otChildIP6AddressIterator.

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