Skip to content

Commit 9b12cff

Browse files
committed
openthread: add libraries based on commit ee86dc2
Update OpenThread libraries with newest commit Signed-off-by: Nordic Builder <[email protected]>
1 parent b2ff80c commit 9b12cff

File tree

118 files changed

+9428
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+9428
-263
lines changed

openthread/include/openthread/ble_secure.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@ otError otBleSecureStart(otInstance *aInstance,
109109
bool aTlvMode,
110110
void *aContext);
111111

112+
/**
113+
* Sets TCAT vendor info
114+
*
115+
* @param[in] aInstance A pointer to an OpenThread instance.
116+
* @param[in] aVendorInfo A pointer to the Vendor Information (must remain valid after the method call.
117+
*
118+
* @retval OT_ERROR_NONE Successfully set value.
119+
* @retval OT_ERROR_INVALID_ARGS Value not set.
120+
*/
121+
otError otBleSecureSetTcatVendorInfo(otInstance *aInstance, const otTcatVendorInfo *aVendorInfo);
122+
112123
/**
113124
* Enables the TCAT protocol over BLE Secure.
114125
*
@@ -122,7 +133,7 @@ otError otBleSecureStart(otInstance *aInstance,
122133
* @retval OT_ERROR_INVALID_STATE The BLE function has not been started or line mode is not selected.
123134
*
124135
*/
125-
otError otBleSecureTcatStart(otInstance *aInstance, const otTcatVendorInfo *aVendorInfo, otHandleTcatJoin aHandler);
136+
otError otBleSecureTcatStart(otInstance *aInstance, otHandleTcatJoin aHandler);
126137

127138
/**
128139
* Stops the BLE Secure server.
@@ -323,7 +334,7 @@ otError otBleSecureConnect(otInstance *aInstance);
323334
void otBleSecureDisconnect(otInstance *aInstance);
324335

325336
/**
326-
* Indicates whether or not the TLS session is active (connected or conneting).
337+
* Indicates whether or not the TLS session is active (connected or connecting).
327338
*
328339
* @param[in] aInstance A pointer to an OpenThread instance.
329340
*

openthread/include/openthread/border_agent.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,38 @@ typedef enum otBorderAgentState
110110
OT_BORDER_AGENT_STATE_ACTIVE = 2, ///< Border agent is connected with external commissioner.
111111
} otBorderAgentState;
112112

113+
typedef struct otBorderAgentCounters
114+
{
115+
uint32_t mEpskcActivations; ///< The number of ePSKc activations
116+
uint32_t mEpskcDeactivationClears; ///< The number of ePSKc deactivations via API
117+
uint32_t mEpskcDeactivationTimeouts; ///< The number of ePSKc deactivations due to timeout
118+
uint32_t mEpskcDeactivationMaxAttempts; ///< The number of ePSKc deactivations due to reached max attempts
119+
uint32_t mEpskcDeactivationDisconnects; ///< The number of ePSKc deactivations due to commissioner disconnected
120+
uint32_t mEpskcInvalidBaStateErrors; ///< The number of invalid border agent state errors at ePSKc activation
121+
uint32_t mEpskcInvalidArgsErrors; ///< The number of invalid args errors at ePSKc activation
122+
uint32_t mEpskcStartSecureSessionErrors; ///< The number of start secure session errors at ePSKc activation
123+
uint32_t mEpskcSecureSessionSuccesses; ///< The number of established secure sessions with ePSKc
124+
uint32_t mEpskcSecureSessionFailures; ///< The number of failed secure sessions with ePSKc
125+
uint32_t mEpskcCommissionerPetitions; ///< The number of successful commissioner petitions with ePSKc
126+
127+
uint32_t mPskcSecureSessionSuccesses; ///< The number of established secure sessions with PSKc
128+
uint32_t mPskcSecureSessionFailures; ///< The number of failed secure sessions with PSKc
129+
uint32_t mPskcCommissionerPetitions; ///< The number of successful commissioner petitions with PSKc
130+
131+
uint32_t mMgmtActiveGets; ///< The number of MGMT_ACTIVE_GET.req sent over secure sessions
132+
uint32_t mMgmtPendingGets; ///< The number of MGMT_PENDING_GET.req sent over secure sessions
133+
} otBorderAgentCounters;
134+
135+
/**
136+
* Gets the counters of the Thread Border Agent.
137+
*
138+
* @param[in] aInstance A pointer to an OpenThread instance.
139+
*
140+
* @returns A pointer to the Border Agent counters.
141+
*
142+
*/
143+
const otBorderAgentCounters *otBorderAgentGetCounters(otInstance *aInstance);
144+
113145
/**
114146
* Gets the #otBorderAgentState of the Thread Border Agent role.
115147
*

openthread/include/openthread/border_routing.h

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ typedef struct otBorderRoutingPrefixTableIterator
8585
{
8686
const void *mPtr1;
8787
const void *mPtr2;
88+
uint32_t mData0;
8889
uint32_t mData1;
8990
uint8_t mData2;
9091
uint8_t mData3;
@@ -93,15 +94,23 @@ typedef struct otBorderRoutingPrefixTableIterator
9394
/**
9495
* Represents a discovered router on the infrastructure link.
9596
*
97+
* The `mIsPeerBr` field requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`. Routing Manager
98+
* determines whether the router is a peer BR (connected to the same Thread mesh network) by comparing its advertised
99+
* PIO/RIO prefixes with the entries in the Thread Network Data. While this method is generally effective, it may not
100+
* be 100% accurate in all scenarios, so the `mIsPeerBr` flag should be used with caution.
101+
*
96102
*/
97103
typedef struct otBorderRoutingRouterEntry
98104
{
99105
otIp6Address mAddress; ///< IPv6 address of the router.
100106
uint32_t mMsecSinceLastUpdate; ///< Milliseconds since last update (any message rx) from this router.
107+
uint32_t mAge; ///< The router's age in seconds (duration since its first discovery).
101108
bool mManagedAddressConfigFlag : 1; ///< The router's Managed Address Config flag (`M` flag).
102109
bool mOtherConfigFlag : 1; ///< The router's Other Config flag (`O` flag).
103110
bool mStubRouterFlag : 1; ///< The router's Stub Router flag.
104111
bool mIsLocalDevice : 1; ///< This router is the local device (this BR).
112+
bool mIsReachable : 1; ///< This router is reachable.
113+
bool mIsPeerBr : 1; ///< This router is (likely) a peer BR.
105114
} otBorderRoutingRouterEntry;
106115

107116
/**
@@ -122,6 +131,16 @@ typedef struct otBorderRoutingPrefixTableEntry
122131
uint32_t mPreferredLifetime; ///< Preferred lifetime of the on-link prefix when `mIsOnLink`.
123132
} otBorderRoutingPrefixTableEntry;
124133

134+
/**
135+
* Represents information about a peer Border Router found in the Network Data.
136+
*
137+
*/
138+
typedef struct otBorderRoutingPeerBorderRouterEntry
139+
{
140+
uint16_t mRloc16; ///< The RLOC16 of BR.
141+
uint32_t mAge; ///< Seconds since the BR appeared in the Network Data.
142+
} otBorderRoutingPeerBorderRouterEntry;
143+
125144
/**
126145
* Represents a group of data of platform-generated RA messages processed.
127146
*
@@ -479,6 +498,58 @@ otError otBorderRoutingGetNextRouterEntry(otInstance *aI
479498
otBorderRoutingPrefixTableIterator *aIterator,
480499
otBorderRoutingRouterEntry *aEntry);
481500

501+
/**
502+
* Iterates over the peer BRs found in the Network Data.
503+
*
504+
* Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.
505+
*
506+
* Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered
507+
* to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data
508+
* entries:
509+
*
510+
* - It has added at least one external route entry.
511+
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
512+
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
513+
*
514+
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
515+
*
516+
* @param[in] aInstance The OpenThread instance.
517+
* @param[in,out] aIterator A pointer to the iterator.
518+
* @param[out] aEntry A pointer to the entry to populate.
519+
*
520+
* @retval OT_ERROR_NONE Iterated to the next entry, @p aEntry and @p aIterator are updated.
521+
* @retval OT_ERROR_NOT_FOUND No more entries.
522+
*
523+
*/
524+
otError otBorderRoutingGetNextPeerBrEntry(otInstance *aInstance,
525+
otBorderRoutingPrefixTableIterator *aIterator,
526+
otBorderRoutingPeerBorderRouterEntry *aEntry);
527+
528+
/**
529+
* Returns the number of peer BRs found in the Network Data.
530+
*
531+
* Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.
532+
*
533+
* Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered
534+
* to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data
535+
* entries:
536+
*
537+
* - It has added at least one external route entry.
538+
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
539+
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
540+
*
541+
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
542+
*
543+
* @param[in] aInstance The OpenThread instance.
544+
* @param[out] aMinAge Pointer to an `uint32_t` to return the minimum age among all peer BRs.
545+
* Can be NULL if the caller does not need this information.
546+
* Age is represented as seconds since appearance of the BR entry in the Network Data.
547+
*
548+
* @returns The number of peer BRs.
549+
*
550+
*/
551+
uint16_t otBorderRoutingCountPeerBrs(otInstance *aInstance, uint32_t *aMinAge);
552+
482553
/**
483554
* Enables / Disables DHCPv6 Prefix Delegation.
484555
*
@@ -527,6 +598,18 @@ void otBorderRoutingDhcp6PdSetRequestCallback(otInstance
527598
otBorderRoutingRequestDhcp6PdCallback aCallback,
528599
void *aContext);
529600

601+
/**
602+
* Sets the local on-link prefix.
603+
*
604+
* Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TESTING_API_ENABLE`.
605+
*
606+
* This is intended for testing only and using it will make the BR non-compliant with the Thread Specification.
607+
*
608+
* @param[in] aPrefix The on-link prefix to use.
609+
*
610+
*/
611+
void otBorderRoutingSetOnLinkPrefix(otInstance *aInstance, const otIp6Prefix *aPrefix);
612+
530613
/**
531614
* @}
532615
*

openthread/include/openthread/coap.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,19 @@ otError otCoapMessageAppendObserveOption(otMessage *aMessage, uint32_t aObserve)
608608
*/
609609
otError otCoapMessageAppendUriPathOptions(otMessage *aMessage, const char *aUriPath);
610610

611+
/**
612+
* Appends a Uri-Query option.
613+
*
614+
* @param[in,out] aMessage A pointer to the CoAP message.
615+
* @param[in] aUriQuery A pointer to a NULL-terminated string.
616+
*
617+
* @retval OT_ERROR_NONE Successfully appended the option.
618+
* @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.
619+
* @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size.
620+
*
621+
*/
622+
otError otCoapMessageAppendUriQueryOptions(otMessage *aMessage, const char *aUriQuery);
623+
611624
/**
612625
* Converts a CoAP Block option SZX field to the actual block size
613626
*

openthread/include/openthread/coap_secure.h

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,27 @@ extern "C" {
6767

6868
#define OT_DEFAULT_COAP_SECURE_PORT 5684 ///< Default CoAP Secure port, as specified in RFC 7252
6969

70+
/**
71+
* CoAP secure connection event types.
72+
*
73+
*/
74+
typedef enum otCoapSecureConnectEvent
75+
{
76+
OT_COAP_SECURE_CONNECTED = 0, ///< Connection established
77+
OT_COAP_SECURE_DISCONNECTED_PEER_CLOSED, ///< Disconnected by peer
78+
OT_COAP_SECURE_DISCONNECTED_LOCAL_CLOSED, ///< Disconnected locally
79+
OT_COAP_SECURE_DISCONNECTED_MAX_ATTEMPTS, ///< Disconnected due to reaching the max connection attempts
80+
OT_COAP_SECURE_DISCONNECTED_ERROR, ///< Disconnected due to an error
81+
} otCoapSecureConnectEvent;
82+
7083
/**
7184
* Pointer is called when the DTLS connection state changes.
7285
*
73-
* @param[in] aConnected true, if a connection was established, false otherwise.
86+
* @param[in] aEvent The connection event.
7487
* @param[in] aContext A pointer to arbitrary context information.
7588
*
7689
*/
77-
typedef void (*otHandleCoapSecureClientConnect)(bool aConnected, void *aContext);
90+
typedef void (*otHandleCoapSecureClientConnect)(otCoapSecureConnectEvent aEvent, void *aContext);
7891

7992
/**
8093
* Callback function pointer to notify when the CoAP secure agent is automatically stopped due to reaching the maximum
@@ -368,17 +381,17 @@ void otCoapSecureRemoveBlockWiseResource(otInstance *aInstance, otCoapBlockwiseR
368381
void otCoapSecureSetDefaultHandler(otInstance *aInstance, otCoapRequestHandler aHandler, void *aContext);
369382

370383
/**
371-
* Sets the connected callback to indicate, when
372-
* a Client connect to the CoAP Secure server.
384+
* Sets the connect event callback to indicate when
385+
* a Client connection to the CoAP Secure server has changed.
373386
*
374387
* @param[in] aInstance A pointer to an OpenThread instance.
375-
* @param[in] aHandler A pointer to a function that will be called once DTLS connection is established.
388+
* @param[in] aHandler A pointer to a function that will be called once DTLS connection has changed.
376389
* @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.
377390
*
378391
*/
379-
void otCoapSecureSetClientConnectedCallback(otInstance *aInstance,
380-
otHandleCoapSecureClientConnect aHandler,
381-
void *aContext);
392+
void otCoapSecureSetClientConnectEventCallback(otInstance *aInstance,
393+
otHandleCoapSecureClientConnect aHandler,
394+
void *aContext);
382395

383396
/**
384397
* Sends a CoAP response block-wise from the CoAP Secure server.

openthread/include/openthread/dataset_updater.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ typedef void (*otDatasetUpdaterCallback)(otError aError, void *aContext);
8282
* @param[in] aContext An arbitrary context passed to callback.
8383
*
8484
* @retval OT_ERROR_NONE Dataset update started successfully (@p aCallback will be invoked on completion).
85-
* @retval OT_ERROR_INVALID_STATE Device is disabled (MLE is disabled).
85+
* @retval OT_ERROR_INVALID_STATE Device is disabled or not fully configured (missing or incomplete Active Dataset).
86+
* @retval OT_ERROR_ALREADY The @p aDataset fields already match the existing Active Dataset.
8687
* @retval OT_ERROR_INVALID_ARGS The @p aDataset is not valid (contains Active or Pending Timestamp).
8788
* @retval OT_ERROR_BUSY Cannot start update, a previous one is ongoing.
8889
* @retval OT_ERROR_NO_BUFS Could not allocated buffer to save Dataset.

openthread/include/openthread/diag.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#define OPENTHREAD_DIAG_H_
3737

3838
#include <openthread/instance.h>
39+
#include <openthread/platform/diag.h>
3940

4041
#ifdef __cplusplus
4142
extern "C" {
@@ -51,47 +52,46 @@ extern "C" {
5152
*
5253
*/
5354

55+
/* Represents the pointer to callback to output diag messages. */
56+
typedef otPlatDiagOutputCallback otDiagOutputCallback;
57+
5458
/**
55-
* Processes a factory diagnostics command line.
59+
* Sets the diag output callback.
5660
*
57-
* The output of this function (the content written to @p aOutput) MUST terminate with `\0` and the `\0` is within the
58-
* output buffer.
61+
* @param[in] aInstance The OpenThread instance structure.
62+
* @param[in] aCallback A pointer to a function that is called on outputting diag messages.
63+
* @param[in] aContext A pointer to the user context.
64+
*
65+
*/
66+
void otDiagSetOutputCallback(otInstance *aInstance, otDiagOutputCallback aCallback, void *aContext);
67+
68+
/**
69+
* Processes a factory diagnostics command line.
5970
*
6071
* @param[in] aInstance A pointer to an OpenThread instance.
6172
* @param[in] aArgsLength The number of elements in @p aArgs.
6273
* @param[in] aArgs An array of arguments.
63-
* @param[out] aOutput The diagnostics execution result.
64-
* @param[in] aOutputMaxLen The output buffer size.
6574
*
6675
* @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.
6776
* @retval OT_ERROR_NONE The command is successfully process.
6877
* @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported.
6978
*
7079
*/
71-
otError otDiagProcessCmd(otInstance *aInstance,
72-
uint8_t aArgsLength,
73-
char *aArgs[],
74-
char *aOutput,
75-
size_t aOutputMaxLen);
80+
otError otDiagProcessCmd(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[]);
7681

7782
/**
7883
* Processes a factory diagnostics command line.
7984
*
80-
* The output of this function (the content written to @p aOutput) MUST terminate with `\0` and the `\0` is within the
81-
* output buffer.
82-
*
8385
* @param[in] aInstance A pointer to an OpenThread instance.
8486
* @param[in] aString A NULL-terminated input string.
85-
* @param[out] aOutput The diagnostics execution result.
86-
* @param[in] aOutputMaxLen The output buffer size.
8787
*
8888
* @retval OT_ERROR_NONE The command is successfully process.
8989
* @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.
9090
* @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported.
9191
* @retval OT_ERROR_NO_BUFS The command string is too long.
9292
*
9393
*/
94-
otError otDiagProcessCmdLine(otInstance *aInstance, const char *aString, char *aOutput, size_t aOutputMaxLen);
94+
otError otDiagProcessCmdLine(otInstance *aInstance, const char *aString);
9595

9696
/**
9797
* Indicates whether or not the factory diagnostics mode is enabled.

openthread/include/openthread/icmp6.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ typedef enum otIcmp6Type
7676
*/
7777
typedef enum otIcmp6Code
7878
{
79-
OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE = 0, ///< Destination Unreachable No Route
80-
OT_ICMP6_CODE_FRAGM_REAS_TIME_EX = 1, ///< Fragment Reassembly Time Exceeded
79+
OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE = 0, ///< Destination Unreachable (Type 1) - No Route
80+
OT_ICMP6_CODE_DST_UNREACH_PROHIBITED = 1, ///< Destination Unreachable (Type 1) - Administratively Prohibited
81+
OT_ICMP6_CODE_FRAGM_REAS_TIME_EX = 1, ///< Time Exceeded (Type 3) - Fragment Reassembly
8182
} otIcmp6Code;
8283

8384
#define OT_ICMP6_HEADER_DATA_SIZE 4 ///< Size of ICMPv6 Header.

openthread/include/openthread/instance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extern "C" {
5353
* @note This number versions both OpenThread platform and user APIs.
5454
*
5555
*/
56-
#define OPENTHREAD_API_VERSION (415)
56+
#define OPENTHREAD_API_VERSION (440)
5757

5858
/**
5959
* @addtogroup api-instance

0 commit comments

Comments
 (0)