路由器/領導者
該模塊包括線程路由器和領導者的功能。
概要
枚舉 | |
---|---|
otCacheEntryState | 枚舉 此枚舉定義EID緩存條目狀態。 |
otNeighborTableEvent { | 枚舉 此枚舉定義了 otNeighborTableCallback 使用的常量,以指示是否要添加或刪除子鄰居或路由器鄰居。 |
類型定義 | |
---|---|
otCacheEntryInfo | 類型定義struct otCacheEntryInfo 此結構表示EID緩存條目。 |
otCacheEntryIterator | 類型定義struct otCacheEntryIterator 此類型表示用於迭代EID緩存表條目的迭代器。 |
otCacheEntryState | 類型定義enum otCacheEntryState 此枚舉定義EID緩存條目狀態。 |
otChildIp6AddressIterator | 類型定義uint16_t 用於遍歷線程子項的IPv6地址。 |
otNeighborTableCallback )(otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo) | 類型定義void(* 調用此函數指針以通知子鄰居或路由器鄰居正在添加到鄰居表中或從鄰居表中刪除。 |
職能 | |
---|---|
otThreadBecomeLeader ( otInstance *aInstance) | 成為領導者並啟動新分區。 |
otThreadBecomeRouter ( otInstance *aInstance) | 嘗試成為路由器。 |
otThreadGetChildInfoById ( otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo) | 該功能通過子代ID或RLOC16保留有關子代的診斷信息。 |
otThreadGetChildInfoByIndex ( otInstance *aInstance, uint16_t aChildIndex, otChildInfo *aChildInfo) | 該函數通過內部表索引保留附加的Child的診斷信息。 |
otThreadGetChildNextIp6Address ( otInstance *aInstance, uint16_t aChildIndex, otChildIp6AddressIterator *aIterator, otIp6Address *aAddress) | 此函數獲取給定子項的下一個IPv6地址(使用迭代器)。 |
otThreadGetContextIdReuseDelay ( otInstance *aInstance) | uint32_t 獲取領導者角色中使用的CONTEXT_ID_REUSE_DELAY參數。 |
otThreadGetJoinerUdpPort ( otInstance *aInstance) | uint16_t 獲取Joiner UDP端口。 |
otThreadGetLocalLeaderWeight ( otInstance *aInstance) | uint8_t 獲取以“領導者”角色操作時使用的“線程領導權重”。 |
otThreadGetMaxAllowedChildren ( otInstance *aInstance) | uint16_t 獲取當前允許的最大兒童數量。 |
otThreadGetMaxChildIpAddresses ( otInstance *aInstance) | uint8_t 此功能獲取每個MTD子級可以將此設備註冊為父級的IP地址的最大數量。 |
otThreadGetMaxRouterId ( otInstance *aInstance) | uint8_t 該函數返回允許的最大路由器ID。 |
otThreadGetNetworkIdTimeout ( otInstance *aInstance) | uint8_t 獲取路由器角色中使用的NETWORK_ID_TIMEOUT參數。 |
otThreadGetNextCacheEntry ( otInstance *aInstance, otCacheEntryInfo *aEntryInfo, otCacheEntryIterator *aIterator) | 此函數獲取下一個EID緩存條目(使用迭代器)。 |
otThreadGetParentPriority ( otInstance *aInstance) | int8_t 獲取分配的父級優先級。 |
otThreadGetPreferredLeaderPartitionId ( otInstance *aInstance) | uint32_t 獲取以“領導者”角色進行操作時使用的首選“線程領導者分區ID”。 |
otThreadGetPskc ( otInstance *aInstance) | const otPskc * 獲取線程PSKc。 |
otThreadGetRouterDowngradeThreshold ( otInstance *aInstance) | uint8_t 獲取路由器角色中使用的ROUTER_DOWNGRADE_THRESHOLD參數。 |
otThreadGetRouterIdSequence ( otInstance *aInstance) | uint8_t 獲取當前的路由器ID序列。 |
otThreadGetRouterInfo ( otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo) | 該功能保留給定線程路由器的診斷信息。 |
otThreadGetRouterSelectionJitter ( otInstance *aInstance) | uint8_t 獲取在REED /路由器角色中使用的ROUTER_SELECTION_JITTER參數。 |
otThreadGetRouterUpgradeThreshold ( otInstance *aInstance) | uint8_t 獲取在REED角色中使用的ROUTER_UPGRADE_THRESHOLD參數。 |
otThreadIsRouterEligible ( otInstance *aInstance) | bool 此方法指示設備是否符合路由器資格。 |
otThreadRegisterNeighborTableCallback ( otInstance *aInstance, otNeighborTableCallback aCallback) | void 該函數註冊鄰居表回調函數。 |
otThreadReleaseRouterId ( otInstance *aInstance, uint8_t aRouterId) | 釋放由設備以領導者角色分配的路由器ID。 |
otThreadSetContextIdReuseDelay ( otInstance *aInstance, uint32_t aDelay) | void 設置在“領導者”角色中使用的CONTEXT_ID_REUSE_DELAY參數。 |
otThreadSetJoinerUdpPort ( otInstance *aInstance, uint16_t aJoinerUdpPort) | 設置Joiner UDP端口。 |
otThreadSetLocalLeaderWeight ( otInstance *aInstance, uint8_t aWeight) | void 設置在“領導者”角色中操作時使用的“線程領導權重”。 |
otThreadSetMaxAllowedChildren ( otInstance *aInstance, uint16_t aMaxChildren) | 設置當前允許的最大孩子數。 |
otThreadSetMaxChildIpAddresses ( otInstance *aInstance, uint8_t aMaxIpAddresses) | 此功能設置/恢復每個MTD子級可以向該設備註冊為父級的IP地址的最大數量。 |
otThreadSetNetworkIdTimeout ( otInstance *aInstance, uint8_t aTimeout) | void 設置在“領導者”角色中使用的NETWORK_ID_TIMEOUT參數。 |
otThreadSetParentPriority ( otInstance *aInstance, int8_t aParentPriority) | 設置父級優先級。 |
otThreadSetPreferredLeaderPartitionId ( otInstance *aInstance, uint32_t aPartitionId) | void 設置以“領導者”角色進行操作時首選的線程領導者分區ID。 |
otThreadSetPreferredRouterId ( otInstance *aInstance, uint8_t aRouterId) | 設置首選路由器ID。 |
otThreadSetPskc ( otInstance *aInstance, const otPskc *aPskc) | 設置線程PSKc。 |
otThreadSetRouterDowngradeThreshold ( otInstance *aInstance, uint8_t aThreshold) | void 設置在“領導者”角色中使用的ROUTER_DOWNGRADE_THRESHOLD參數。 |
otThreadSetRouterEligible ( otInstance *aInstance, bool aEligible) | 此功能設置設備是否符合路由器要求。 |
otThreadSetRouterSelectionJitter ( otInstance *aInstance, uint8_t aRouterJitter) | void 設置REED /路由器角色中使用的ROUTER_SELECTION_JITTER參數。 |
otThreadSetRouterUpgradeThreshold ( otInstance *aInstance, uint8_t aThreshold) | void 設置在“領導者”角色中使用的ROUTER_UPGRADE_THRESHOLD參數。 |
otThreadSetSteeringData ( otInstance *aInstance, const otExtAddress *aExtAddress) | void 將轉向數據設置為帶外。 |
結構 | |
---|---|
otCacheEntryInfo | 此結構表示EID緩存條目。 |
otCacheEntryIterator | 此類型表示用於迭代EID緩存表條目的迭代器。 |
otChildInfo | 此結構保存線程子代的診斷信息。 |
otNeighborTableEntryInfo | 此類型表示鄰居表條目信息(子級或路由器),並用作鄰居表回調 |
枚舉
otCacheEntryState
otCacheEntryState
此枚舉定義EID緩存條目狀態。
otNeighborTableEvent
otNeighborTableEvent
類型定義
otCacheEntryIterator
struct otCacheEntryIterator otCacheEntryIterator
此類型表示用於迭代EID緩存表條目的迭代器。
要初始化迭代器並從緩存表中的第一個條目開始,請將結構中其所有字段設置為零(例如,將迭代器memset
設置為零)。
otChildIp6AddressIterator
uint16_t otChildIp6AddressIterator
用於遍歷線程子項的IPv6地址。
otNeighborTableCallback
void(* otNeighborTableCallback)(otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo)
調用此函數指針以通知子鄰居或路由器鄰居正在添加到鄰居表中或從鄰居表中刪除。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
職能
otThreadBecomeLeader
otError otThreadBecomeLeader( otInstance *aInstance )
成為領導者並啟動新分區。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadBecomeRouter
otError otThreadBecomeRouter( otInstance *aInstance )
嘗試成為路由器。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadGetChildInfoById
otError otThreadGetChildInfoById( otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo )
該功能通過子代ID或RLOC16保留有關子代的診斷信息。
細節 | |||||||
---|---|---|---|---|---|---|---|
參量 |
| ||||||
返回值 |
|
otThreadGetChildInfoByIndex
otError otThreadGetChildInfoByIndex( otInstance *aInstance, uint16_t aChildIndex, otChildInfo *aChildInfo )
該函數通過內部表索引保留附加的Child的診斷信息。
細節 | |||||||
---|---|---|---|---|---|---|---|
參量 |
| ||||||
返回值 |
|
otGetMaxAllowedChildren
otThreadGetChildNextIp6Address
otError otThreadGetChildNextIp6Address( otInstance *aInstance, uint16_t aChildIndex, otChildIp6AddressIterator *aIterator, otIp6Address *aAddress )
此函數獲取給定子項的下一個IPv6地址(使用迭代器)。
細節 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參量 |
| ||||||||
返回值 |
|
otThreadGetChildInfoByIndex
otThreadGetContextIdReuseDelay
uint32_t otThreadGetContextIdReuseDelay( otInstance *aInstance )
獲取領導者角色中使用的CONTEXT_ID_REUSE_DELAY參數。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | CONTEXT_ID_REUSE_DELAY值。 |
otThreadSetContextIdReuseDelay
otThreadGetJoinerUdpPort
uint16_t otThreadGetJoinerUdpPort( otInstance *aInstance )
otThreadGetLocalLeaderWeight
uint8_t otThreadGetLocalLeaderWeight( otInstance *aInstance )
獲取在執行“領導者”角色時使用的“線程領導者權重”。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | 線引導權重值。 |
otThreadSetLeaderWeight
otThreadGetMaxAllowedChildren
uint16_t otThreadGetMaxAllowedChildren( otInstance *aInstance )
獲取當前允許的最大兒童數量。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | 當前允許的最大兒童人數。 |
otThreadSetMaxAllowedChildren
otThreadGetMaxChildIpAddresses
uint8_t otThreadGetMaxChildIpAddresses( otInstance *aInstance )
此功能獲取每個MTD子級可以將此設備註冊為父級的IP地址的最大數量。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | 每個MTD子級可以在此設備上註冊為父級的IP地址的最大數量。 |
otThreadSetMaxChildIpAddresses
otThreadGetMaxRouterId
uint8_t otThreadGetMaxRouterId( otInstance *aInstance )
該函數返回允許的最大路由器ID。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | 允許的最大路由器ID。 |
otThreadGetNetworkIdTimeout
uint8_t otThreadGetNetworkIdTimeout( otInstance *aInstance )
獲取路由器角色中使用的NETWORK_ID_TIMEOUT參數。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | NETWORK_ID_TIMEOUT值。 |
otThreadSetNetworkIdTimeout
otThreadGetNextCacheEntry
otError otThreadGetNextCacheEntry( otInstance *aInstance, otCacheEntryInfo *aEntryInfo, otCacheEntryIterator *aIterator )
此函數獲取下一個EID緩存條目(使用迭代器)。
細節 | |||||||
---|---|---|---|---|---|---|---|
參量 |
| ||||||
返回值 |
|
otThreadGetParentPriority
int8_t otThreadGetParentPriority( otInstance *aInstance )
獲取分配的父級優先級。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | 已分配的父級優先級值,-2表示未分配。 |
otThreadSetParentPriority
otThreadGetPreferredLeaderPartitionId
uint32_t otThreadGetPreferredLeaderPartitionId( otInstance *aInstance )
獲取以“領導者”角色進行操作時使用的首選“線程領導者分區ID”。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | 線程領導者分區ID值。 |
otThreadGetPskc
const otPskc * otThreadGetPskc( otInstance *aInstance )
otThreadGetRouterDowngradeThreshold
uint8_t otThreadGetRouterDowngradeThreshold( otInstance *aInstance )
獲取路由器角色中使用的ROUTER_DOWNGRADE_THRESHOLD參數。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | ROUTER_DOWNGRADE_THRESHOLD值。 |
otThreadSetRouterDowngradeThreshold
otThreadGetRouterIdSequence
uint8_t otThreadGetRouterIdSequence( otInstance *aInstance )
獲取當前的路由器ID序列。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | 路由器ID序列。 |
otThreadGetRouterInfo
otError otThreadGetRouterInfo( otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo )
該功能保留給定線程路由器的診斷信息。
細節 | |||||||
---|---|---|---|---|---|---|---|
參量 |
| ||||||
返回值 |
|
otThreadGetRouterSelectionJitter
uint8_t otThreadGetRouterSelectionJitter( otInstance *aInstance )
獲取在REED /路由器角色中使用的ROUTER_SELECTION_JITTER參數。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | ROUTER_SELECTION_JITTER值。 |
otThreadSetRouterSelectionJitter
otThreadGetRouterUpgradeThreshold
uint8_t otThreadGetRouterUpgradeThreshold( otInstance *aInstance )
獲取在REED角色中使用的ROUTER_UPGRADE_THRESHOLD參數。
細節 | |||
---|---|---|---|
參量 |
| ||
退貨 | ROUTER_UPGRADE_THRESHOLD值。 |
otThreadSetRouterUpgradeThreshold
otThreadIsRouterEligible
bool otThreadIsRouterEligible( otInstance *aInstance )
此方法指示設備是否符合路由器資格。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadRegisterNeighborTableCallback
void otThreadRegisterNeighborTableCallback( otInstance *aInstance, otNeighborTableCallback aCallback )
該函數註冊鄰居表回調函數。
當將子項或路由器鄰居條目添加到鄰居表中/從鄰居表中刪除時,將調用提供的回調(如果非NULL)。隨後對該方法的調用將覆蓋先前的回調。請注意,在更新鄰居/子表時且始終在otStateChangedCallback
之前調用此回調。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
otThreadReleaseRouterId
otError otThreadReleaseRouterId( otInstance *aInstance, uint8_t aRouterId )
釋放由設備以領導者角色分配的路由器ID。
細節 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參量 |
| ||||||||
返回值 |
|
otThreadSetContextIdReuseDelay
void otThreadSetContextIdReuseDelay( otInstance *aInstance, uint32_t aDelay )
設置在“領導者”角色中使用的CONTEXT_ID_REUSE_DELAY參數。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
otThreadGetContextIdReuseDelay
otThreadSetJoinerUdpPort
otError otThreadSetJoinerUdpPort( otInstance *aInstance, uint16_t aJoinerUdpPort )
設置Joiner UDP端口。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadGetJoinerUdpPort
otThreadSetLocalLeaderWeight
void otThreadSetLocalLeaderWeight( otInstance *aInstance, uint8_t aWeight )
設置以“領導者”角色操作時使用的“線程領導權重”。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
otThreadGetLeaderWeight
otThreadSetMaxAllowedChildren
otError otThreadSetMaxAllowedChildren( otInstance *aInstance, uint16_t aMaxChildren )
設置當前允許的最大孩子數。
僅當線程協議操作已停止時才能設置此參數。
細節 | |||||||
---|---|---|---|---|---|---|---|
參量 |
| ||||||
返回值 |
|
otThreadGetMaxAllowedChildren
otThreadSetMaxChildIpAddresses
otError otThreadSetMaxChildIpAddresses( otInstance *aInstance, uint8_t aMaxIpAddresses )
此功能設置/恢復每個MTD子級可以向該設備註冊為父級的IP地址的最大數量。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadGetMaxChildIpAddresses
otThreadSetNetworkIdTimeout
void otThreadSetNetworkIdTimeout( otInstance *aInstance, uint8_t aTimeout )
設置在“領導者”角色中使用的NETWORK_ID_TIMEOUT參數。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
otThreadGetNetworkIdTimeout
otThreadSetParentPriority
otError otThreadSetParentPriority( otInstance *aInstance, int8_t aParentPriority )
設置父級優先級。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadGetParentPriority
otThreadSetPreferredLeaderPartitionId
void otThreadSetPreferredLeaderPartitionId( otInstance *aInstance, uint32_t aPartitionId )
設置以“領導者”角色進行操作時首選的“線程領導者分區ID”。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
otThreadSetPreferredRouterId
otError otThreadSetPreferredRouterId( otInstance *aInstance, uint8_t aRouterId )
設置首選路由器ID。
成為路由器/領導者後,節點嘗試使用此路由器ID。如果未設置首選路由器ID或無法使用它,則將選擇隨機生成的路由器ID。僅當分離或禁用設備角色時才能設置此屬性。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadSetPskc
otError otThreadSetPskc( otInstance *aInstance, const otPskc *aPskc )
設置線程PSKc。
僅當禁用線程協議時,此功能才會成功。成功調用此函數還將使非易失性存儲器中的活動和待處理操作數據集無效。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadGetPskc
otThreadSetRouterDowngradeThreshold
void otThreadSetRouterDowngradeThreshold( otInstance *aInstance, uint8_t aThreshold )
設置在“領導者”角色中使用的ROUTER_DOWNGRADE_THRESHOLD參數。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
otThreadGetRouterDowngradeThreshold
otThreadSetRouterEligible
otError otThreadSetRouterEligible( otInstance *aInstance, bool aEligible )
此功能設置設備是否符合路由器要求。
如果aEligible
為false並且設備當前正在作為路由器運行,則此調用將導致設備分離並嘗試以子設備的形式重新連接。
細節 | |||||
---|---|---|---|---|---|
參量 |
| ||||
返回值 |
|
otThreadSetRouterSelectionJitter
void otThreadSetRouterSelectionJitter( otInstance *aInstance, uint8_t aRouterJitter )
設置REED /路由器角色中使用的ROUTER_SELECTION_JITTER參數。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
otThreadGetRouterSelectionJitter
otThreadSetRouterUpgradeThreshold
void otThreadSetRouterUpgradeThreshold( otInstance *aInstance, uint8_t aThreshold )
設置在“領導者”角色中使用的ROUTER_UPGRADE_THRESHOLD參數。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
otThreadGetRouterUpgradeThreshold
otThreadSetSteeringData
void otThreadSetSteeringData( otInstance *aInstance, const otExtAddress *aExtAddress )
將轉向數據設置為帶外。
應該設置配置選項OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE
以啟用帶外引導數據的設置。
細節 | |||||
---|---|---|---|---|---|
參量 |
|
巨集
OT_CHILD_IP6_ADDRESS_ITERATOR_INIT
OT_CHILD_IP6_ADDRESS_ITERATOR_INIT 0
otChildIP6AddressIterator的初始化程序。