Skip to content

Commit c443fd5

Browse files
NordicBuilderjfischer-no
authored andcommitted
openthread: add libraries based on commit b9dcdbc
Update OpenThread libraries with newest commit Signed-off-by: Nordic Builder <[email protected]>
1 parent 743574e commit c443fd5

Some content is hidden

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

67 files changed

+3419
-16630
lines changed

openthread/include/openthread/ble_secure.h

Lines changed: 434 additions & 0 deletions
Large diffs are not rendered by default.

openthread/include/openthread/border_routing.h

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,47 @@ typedef struct otBorderRoutingPrefixTableIterator
8888
uint32_t mData32;
8989
} otBorderRoutingPrefixTableIterator;
9090

91+
/**
92+
* Represents a discovered router on the infrastructure link.
93+
*
94+
*/
95+
typedef struct otBorderRoutingRouterEntry
96+
{
97+
otIp6Address mAddress; ///< IPv6 address of the router.
98+
bool mManagedAddressConfigFlag : 1; ///< The router's Managed Address Config flag (`M` flag).
99+
bool mOtherConfigFlag : 1; ///< The router's Other Config flag (`O` flag).
100+
bool mStubRouterFlag : 1; ///< The router's Stub Router flag.
101+
} otBorderRoutingRouterEntry;
102+
91103
/**
92104
* Represents an entry from the discovered prefix table.
93105
*
94106
* The entries in the discovered table track the Prefix/Route Info Options in the received Router Advertisement messages
95-
* from other routers on infrastructure link.
107+
* from other routers on the infrastructure link.
96108
*
97109
*/
98110
typedef struct otBorderRoutingPrefixTableEntry
99111
{
100-
otIp6Address mRouterAddress; ///< IPv6 address of the router.
101-
otIp6Prefix mPrefix; ///< The discovered IPv6 prefix.
102-
bool mIsOnLink; ///< Indicates whether the prefix is on-link or route prefix.
103-
uint32_t mMsecSinceLastUpdate; ///< Milliseconds since last update of this prefix.
104-
uint32_t mValidLifetime; ///< Valid lifetime of the prefix (in seconds).
105-
otRoutePreference mRoutePreference; ///< Route preference when `mIsOnlink` is false.
106-
uint32_t mPreferredLifetime; ///< Preferred lifetime of the on-link prefix when `mIsOnLink` is true.
112+
otBorderRoutingRouterEntry mRouter; ///< Information about the router advertising this prefix.
113+
otIp6Prefix mPrefix; ///< The discovered IPv6 prefix.
114+
bool mIsOnLink; ///< Indicates whether the prefix is on-link or route prefix.
115+
uint32_t mMsecSinceLastUpdate; ///< Milliseconds since last update of this prefix.
116+
uint32_t mValidLifetime; ///< Valid lifetime of the prefix (in seconds).
117+
otRoutePreference mRoutePreference; ///< Route preference when `mIsOnlink` is false.
118+
uint32_t mPreferredLifetime; ///< Preferred lifetime of the on-link prefix when `mIsOnLink`.
107119
} otBorderRoutingPrefixTableEntry;
108120

121+
/**
122+
* Represents a group of data of platform-generated RA messages processed.
123+
*
124+
*/
125+
typedef struct otPdProcessedRaInfo
126+
{
127+
uint32_t mNumPlatformRaReceived; ///< The number of platform generated RA handled by ProcessPlatformGeneratedRa.
128+
uint32_t mNumPlatformPioProcessed; ///< The number of PIO processed for adding OMR prefixes.
129+
uint32_t mLastPlatformRaMsec; ///< The timestamp of last processed RA message.
130+
} otPdProcessedRaInfo;
131+
109132
/**
110133
* Represents the state of Border Routing Manager.
111134
*
@@ -295,6 +318,21 @@ otError otBorderRoutingGetOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix)
295318
*/
296319
otError otBorderRoutingGetPdOmrPrefix(otInstance *aInstance, otBorderRoutingPrefixTableEntry *aPrefixInfo);
297320

321+
/**
322+
* Gets the data of platform generated RA message processed..
323+
*
324+
* `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` must be enabled.
325+
*
326+
* @param[in] aInstance A pointer to an OpenThread instance.
327+
* @param[out] aPrefixInfo A pointer to where the prefix info will be output to.
328+
*
329+
* @retval OT_ERROR_NONE Successfully retrieved the Info.
330+
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
331+
* @retval OT_ERROR_NOT_FOUND There are no valid Info on this BR.
332+
*
333+
*/
334+
otError otBorderRoutingGetPdProcessedRaInfo(otInstance *aInstance, otPdProcessedRaInfo *aPdProcessedRaInfo);
335+
298336
/**
299337
* Gets the currently favored Off-Mesh-Routable (OMR) Prefix.
300338
*
@@ -391,6 +429,9 @@ void otBorderRoutingPrefixTableInitIterator(otInstance *aInstance, otBorderRouti
391429
/**
392430
* Iterates over the entries in the Border Router's discovered prefix table.
393431
*
432+
* Prefix entries associated with the same discovered router on an infrastructure link are guaranteed to be grouped
433+
* together (retrieved back-to-back).
434+
*
394435
* @param[in] aInstance The OpenThread instance.
395436
* @param[in,out] aIterator A pointer to the iterator.
396437
* @param[out] aEntry A pointer to the entry to populate.
@@ -403,6 +444,21 @@ otError otBorderRoutingGetNextPrefixTableEntry(otInstance
403444
otBorderRoutingPrefixTableIterator *aIterator,
404445
otBorderRoutingPrefixTableEntry *aEntry);
405446

447+
/**
448+
* Iterates over the discovered router entries on the infrastructure link.
449+
*
450+
* @param[in] aInstance The OpenThread instance.
451+
* @param[in,out] aIterator A pointer to the iterator.
452+
* @param[out] aEntry A pointer to the entry to populate.
453+
*
454+
* @retval OT_ERROR_NONE Iterated to the next router, @p aEntry and @p aIterator are updated.
455+
* @retval OT_ERROR_NOT_FOUND No more router entries.
456+
*
457+
*/
458+
otError otBorderRoutingGetNextRouterEntry(otInstance *aInstance,
459+
otBorderRoutingPrefixTableIterator *aIterator,
460+
otBorderRoutingRouterEntry *aEntry);
461+
406462
/**
407463
* Enables / Disables DHCPv6 Prefix Delegation.
408464
*
@@ -414,6 +470,18 @@ otError otBorderRoutingGetNextPrefixTableEntry(otInstance
414470
*/
415471
void otBorderRoutingDhcp6PdSetEnabled(otInstance *aInstance, bool aEnabled);
416472

473+
/**
474+
* Gets the current state of DHCPv6 Prefix Delegation.
475+
*
476+
* Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` to be enabled.
477+
*
478+
* @param[in] aInstance A pointer to an OpenThread instance.
479+
*
480+
* @returns The current state of DHCPv6 Prefix Delegation.
481+
*
482+
*/
483+
otBorderRoutingDhcp6PdState otBorderRoutingDhcp6PdGetState(otInstance *aInstance);
484+
417485
/**
418486
* @}
419487
*

openthread/include/openthread/coap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ typedef void (*otCoapResponseHandler)(void *aContext,
357357
typedef void (*otCoapRequestHandler)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
358358

359359
/**
360-
* Pointer is called when a CoAP message with an block-wise transfer option is received.
360+
* Pointer is called when a CoAP message with a block-wise transfer option is received.
361361
*
362362
* Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration
363363
* is enabled.

openthread/include/openthread/coap_secure.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ extern "C" {
7676
*/
7777
typedef void (*otHandleCoapSecureClientConnect)(bool aConnected, void *aContext);
7878

79+
/**
80+
* Callback function pointer to notify when the CoAP secure agent is automatically stopped due to reaching the maximum
81+
* number of connection attempts.
82+
*
83+
* @param[in] aContext A pointer to arbitrary context information.
84+
*
85+
*/
86+
typedef void (*otCoapSecureAutoStopCallback)(void *aContext);
87+
7988
/**
8089
* Starts the CoAP Secure service.
8190
*
@@ -87,6 +96,26 @@ typedef void (*otHandleCoapSecureClientConnect)(bool aConnected, void *aContext)
8796
*/
8897
otError otCoapSecureStart(otInstance *aInstance, uint16_t aPort);
8998

99+
/**
100+
* Starts the CoAP secure service and sets the maximum number of allowed connection attempts before stopping the
101+
* agent automatically.
102+
*
103+
* @param[in] aInstance A pointer to an OpenThread instance.
104+
* @param[in] aPort The local UDP port to bind to.
105+
* @param[in] aMaxAttempts Maximum number of allowed connection request attempts. Zero indicates no limit.
106+
* @param[in] aCallback Callback to notify if max number of attempts has reached and agent is stopped.
107+
* @param[in] aContext A pointer to arbitrary context to use with @p aCallback.
108+
*
109+
* @retval OT_ERROR_NONE Successfully started the CoAP agent.
110+
* @retval OT_ERROR_ALREADY Already started.
111+
*
112+
*/
113+
otError otCoapSecureStartWithMaxConnAttempts(otInstance *aInstance,
114+
uint16_t aPort,
115+
uint16_t aMaxAttempts,
116+
otCoapSecureAutoStopCallback aCallback,
117+
void *aContext);
118+
90119
/**
91120
* Stops the CoAP Secure server.
92121
*
@@ -230,6 +259,17 @@ bool otCoapSecureIsConnected(otInstance *aInstance);
230259
*/
231260
bool otCoapSecureIsConnectionActive(otInstance *aInstance);
232261

262+
/**
263+
* Indicates whether or not the DTLS session is closed.
264+
*
265+
* @param[in] aInstance A pointer to an OpenThread instance.
266+
*
267+
* @retval TRUE The DTLS session is closed.
268+
* @retval FALSE The DTLS session is not closed.
269+
*
270+
*/
271+
bool otCoapSecureIsClosed(otInstance *aInstance);
272+
233273
/**
234274
* Sends a CoAP request block-wise over secure DTLS connection.
235275
*

openthread/include/openthread/commissioner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ typedef struct otCommissioningDataset
111111
bool mIsSessionIdSet : 1; ///< TRUE if Commissioner Session Id is set, FALSE otherwise.
112112
bool mIsSteeringDataSet : 1; ///< TRUE if Steering Data is set, FALSE otherwise.
113113
bool mIsJoinerUdpPortSet : 1; ///< TRUE if Joiner UDP Port is set, FALSE otherwise.
114+
bool mHasExtraTlv : 1; ///< TRUE if the Dataset contains any extra unknown sub-TLV, FALSE otherwise.
114115
} otCommissioningDataset;
115116

116117
#define OT_JOINER_MAX_PSKD_LENGTH 32 ///< Maximum string length of a Joiner PSKd (does not include null char).

openthread/include/openthread/dns.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ extern "C" {
6262

6363
#define OT_DNS_TXT_KEY_MAX_LENGTH 9 ///< Recommended maximum length of TXT record key string (RFC 6763 - section 6.4).
6464

65+
#define OT_DNS_TXT_KEY_ITER_MAX_LENGTH 64 ///< Maximum length of TXT key string supported by `otDnsTxtEntryIterator`.
66+
6567
/**
6668
* Represents a TXT record entry representing a key/value pair (RFC 6763 - section 6.3).
6769
*
@@ -104,7 +106,7 @@ typedef struct otDnsTxtEntryIterator
104106
{
105107
const void *mPtr;
106108
uint16_t mData[2];
107-
char mChar[OT_DNS_TXT_KEY_MAX_LENGTH + 1];
109+
char mChar[OT_DNS_TXT_KEY_ITER_MAX_LENGTH + 1];
108110
} otDnsTxtEntryIterator;
109111

110112
/**
@@ -127,9 +129,9 @@ void otDnsInitTxtEntryIterator(otDnsTxtEntryIterator *aIterator, const uint8_t *
127129
* data buffer used to initialize the iterator MUST persist and remain unchanged. Otherwise the behavior of this
128130
* function is undefined.
129131
*
130-
* If the parsed key string length is smaller than or equal to `OT_DNS_TXT_KEY_MAX_LENGTH` (recommended max key length)
131-
* the key string is returned in `mKey` in @p aEntry. But if the key is longer, then `mKey` is set to NULL and the
132-
* entire encoded TXT entry string is returned in `mValue` and `mValueLength`.
132+
* If the parsed key string length is smaller than or equal to `OT_DNS_TXT_KEY_ITER_MAX_LENGTH` the key string is
133+
* returned in `mKey` in @p aEntry. But if the key is longer, then `mKey` is set to NULL and the entire encoded TXT
134+
* entry string is returned in `mValue` and `mValueLength`.
133135
*
134136
* @param[in] aIterator A pointer to the iterator (MUST NOT be NULL).
135137
* @param[out] aEntry A pointer to a `otDnsTxtEntry` structure to output the parsed/read entry (MUST NOT be NULL).

openthread/include/openthread/dns_client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ otError otDnsBrowseResponseGetServiceName(const otDnsBrowseResponse *aResponse,
408408
* MUST only be used from `otDnsBrowseCallback`.
409409
*
410410
* The response may include multiple service instance records. @p aIndex can be used to iterate through the list. Index
411-
* zero gives the the first record. When we reach end of the list, `OT_ERROR_NOT_FOUND` is returned.
411+
* zero gives the first record. When we reach end of the list, `OT_ERROR_NOT_FOUND` is returned.
412412
*
413413
* Note that this function gets the service instance label and not the full service instance name which is of the form
414414
* `<Instance>.<Service>.<Domain>`.

openthread/include/openthread/dnssd_server.h

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,33 @@ typedef enum
147147
OT_DNSSD_QUERY_TYPE_RESOLVE_HOST = 3, ///< Service type resolve hostname.
148148
} otDnssdQueryType;
149149

150+
/**
151+
* Represents the count of queries, responses, failures handled by upstream DNS server.
152+
*
153+
* Requires `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE`.
154+
*/
155+
typedef struct otUpstreamDnsCounters
156+
{
157+
uint32_t mQueries; ///< The number of queries forwarded.
158+
uint32_t mResponses; ///< The number of responses forwarded.
159+
uint32_t mFailures; ///< The number of upstream DNS failures.
160+
} otUpstreamDnsCounters;
161+
150162
/**
151163
* Contains the counters of DNS-SD server.
152164
*
153165
*/
154166
typedef struct otDnssdCounters
155167
{
156-
uint32_t mSuccessResponse; ///< The number of successful responses
157-
uint32_t mServerFailureResponse; ///< The number of server failure responses
158-
uint32_t mFormatErrorResponse; ///< The number of format error responses
159-
uint32_t mNameErrorResponse; ///< The number of name error responses
160-
uint32_t mNotImplementedResponse; ///< The number of 'not implemented' responses
161-
uint32_t mOtherResponse; ///< The number of other responses
162-
163-
uint32_t mResolvedBySrp; ///< The number of queries completely resolved by the local SRP server
168+
uint32_t mSuccessResponse; ///< The number of successful responses.
169+
uint32_t mServerFailureResponse; ///< The number of server failure responses.
170+
uint32_t mFormatErrorResponse; ///< The number of format error responses.
171+
uint32_t mNameErrorResponse; ///< The number of name error responses.
172+
uint32_t mNotImplementedResponse; ///< The number of 'not implemented' responses.
173+
uint32_t mOtherResponse; ///< The number of other responses.
174+
uint32_t mResolvedBySrp; ///< The number of queries resolved by the local SRP server.
175+
otUpstreamDnsCounters mUpstreamDnsCounters; ///< The number of queries, responses,
176+
///< failures handled by upstream DNS server.
164177
} otDnssdCounters;
165178

166179
/**

openthread/include/openthread/history_tracker.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ const otHistoryTrackerExternalRouteInfo *otHistoryTrackerIterateExternalRouteHis
426426
/**
427427
* Converts a given entry age to a human-readable string.
428428
*
429-
* The entry age string follows the format "<hh>:<mm>:<ss>.<mmmm>" for hours, minutes, seconds and millisecond (if
430-
* shorter than one day) or "<dd> days <hh>:<mm>:<ss>.<mmmm>" (if longer than one day).
429+
* The entry age string follows the format `hours:minutes:seconds:milliseconds` (if
430+
* shorter than one day) or `days:hours:minutes:seconds`(if longer than one day).
431431
*
432432
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated
433433
* but the outputted string is always null-terminated.

openthread/include/openthread/instance.h

Lines changed: 32 additions & 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 (363)
56+
#define OPENTHREAD_API_VERSION (398)
5757

5858
/**
5959
* @addtogroup api-instance
@@ -102,6 +102,23 @@ otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize);
102102
*/
103103
otInstance *otInstanceInitSingle(void);
104104

105+
/**
106+
* Initializes the OpenThread instance.
107+
*
108+
* This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be
109+
* called before any other calls to OpenThread. This method utilizes static buffer to initialize the OpenThread
110+
* instance.
111+
*
112+
* This function is available and can only be used when support for multiple OpenThread static instances is
113+
* enabled (`OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE`)
114+
*
115+
* @param[in] aIdx The index of the OpenThread instance to initialize.
116+
*
117+
* @returns A pointer to the new OpenThread instance.
118+
*
119+
*/
120+
otInstance *otInstanceInitMultiple(uint8_t aIdx);
121+
105122
/**
106123
* Gets the instance identifier.
107124
*
@@ -255,6 +272,20 @@ void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback a
255272
*/
256273
void otInstanceReset(otInstance *aInstance);
257274

275+
/**
276+
* Triggers a platform reset to bootloader mode, if supported.
277+
*
278+
* Requires `OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE`.
279+
*
280+
* @param[in] aInstance A pointer to an OpenThread instance.
281+
*
282+
* @retval OT_ERROR_NONE Reset to bootloader successfully.
283+
* @retval OT_ERROR_BUSY Failed due to another operation is ongoing.
284+
* @retval OT_ERROR_NOT_CAPABLE Not capable of resetting to bootloader.
285+
*
286+
*/
287+
otError otInstanceResetToBootloader(otInstance *aInstance);
288+
258289
/**
259290
* Deletes all the settings stored on non-volatile memory, and then triggers a platform reset.
260291
*

0 commit comments

Comments
 (0)