Skip to content

Commit 382af40

Browse files
edmontrlubos
authored andcommitted
openthread: add libraries based on commit ce77ab3c
Update OpenThread libraries with newest commit and remove the ones not intended for certification. Include nRF52840 Thread 1.2 libraries as well. Signed-off-by: Eduardo Montoya <[email protected]>
1 parent 414e8d5 commit 382af40

File tree

108 files changed

+2692
-22078
lines changed

Some content is hidden

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

108 files changed

+2692
-22078
lines changed

openthread/include/openthread/backbone_router_ftd.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,19 @@ void otBackboneRouterMulticastListenerClear(otInstance *aInstance);
273273
*/
274274
otError otBackboneRouterMulticastListenerAdd(otInstance *aInstance, const otIp6Address *aAddress, uint32_t aTimeout);
275275

276+
/**
277+
* This method configures the ability to increase or not the BBR Dataset Sequence Number when a
278+
* BBR recovers its BBR Dataset from the Leader's Network Data.
279+
*
280+
* Note: available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
281+
* Only used for certification.
282+
*
283+
* @param[in] aInstance A pointer to an OpenThread instance.
284+
* @param[in] aSkip Whether to skip the increase of Sequence Number or not.
285+
*
286+
*/
287+
void otBackboneRouterConfigSkipSeqNumIncrease(otInstance *aInstance, bool aSkip);
288+
276289
#define OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ITERATOR_INIT \
277290
0 ///< Initializer for otBackboneRouterMulticastListenerIterator
278291

@@ -351,12 +364,12 @@ void otBackboneRouterSetNdProxyCallback(otInstance * aInstanc
351364
* Represents the Backbone Router ND Proxy info.
352365
*
353366
*/
354-
struct otBackboneRouterNdProxyInfo
367+
typedef struct otBackboneRouterNdProxyInfo
355368
{
356369
otIp6InterfaceIdentifier *mMeshLocalIid; ///< Mesh-local IID
357370
uint32_t mTimeSinceLastTransaction; ///< Time since last transaction (Seconds)
358371
uint16_t mRloc16; ///< RLOC16
359-
};
372+
} otBackboneRouterNdProxyInfo;
360373

361374
/**
362375
* This method gets the Backbone Router ND Proxy info.

openthread/include/openthread/border_router.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,23 @@ otError otBorderRoutingGetOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix)
117117
*/
118118
otError otBorderRoutingGetOnLinkPrefix(otInstance *aInstance, otIp6Prefix *aPrefix);
119119

120+
/**
121+
* This function returns the local NAT64 prefix.
122+
*
123+
* This prefix might not be advertised in the Thread network.
124+
*
125+
* This function is only available when `OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE`
126+
* is enabled.
127+
*
128+
* @param[in] aInstance A pointer to an OpenThread instance.
129+
* @param[out] aPrefix A pointer to where the prefix will be output to.
130+
*
131+
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
132+
* @retval OT_ERROR_NONE Successfully retrieved the NAT64 prefix.
133+
*
134+
*/
135+
otError otBorderRoutingGetNat64Prefix(otInstance *aInstance, otIp6Prefix *aPrefix);
136+
120137
/**
121138
* This method provides a full or stable copy of the local Thread Network Data.
122139
*

openthread/include/openthread/coap.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,15 @@ otCoapType otCoapMessageGetType(const otMessage *aMessage);
717717
*/
718718
otCoapCode otCoapMessageGetCode(const otMessage *aMessage);
719719

720+
/**
721+
* This function sets the Code value.
722+
*
723+
* @param[inout] aMessage A pointer to the CoAP message to initialize.
724+
* @param[in] aCode CoAP message code.
725+
*
726+
*/
727+
void otCoapMessageSetCode(otMessage *aMessage, otCoapCode aCode);
728+
720729
/**
721730
* This method returns the CoAP Code as human readable string.
722731
*

openthread/include/openthread/history_tracker.h

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include <openthread/instance.h>
3131
#include <openthread/ip6.h>
32+
#include <openthread/netdata.h>
3233
#include <openthread/thread.h>
3334

3435
#ifdef __cplusplus
@@ -38,18 +39,13 @@ extern "C" {
3839
/**
3940
* @addtogroup api-history-tracker
4041
*
41-
* @{
42-
*
43-
*/
44-
45-
/**
4642
* @brief
47-
* This header defines the public API for History Tracker.
43+
* Records the history of different events, for example RX and TX messages or network info changes. All tracked
44+
* entries are timestamped.
4845
*
49-
* History Tracker module records history of different events (e.g. RX and TX messages or network info changes, etc.)
50-
* as the Thread network operates. All tracked entries are timestamped.
46+
* The functions in this module are available when `OPENTHREAD_CONFIG_HISTOR_TRACKER_ENABLE` is enabled.
5147
*
52-
* The functions in this module are available when `OPENTHREAD_CONFIG_HISTOR_TRACKER_ENABLE` is enabled.
48+
* @{
5349
*
5450
*/
5551

@@ -196,6 +192,36 @@ typedef struct otHistoryTrackerNeighborInfo
196192
bool mIsChild : 1; ///< Indicates whether or not the neighbor is a child.
197193
} otHistoryTrackerNeighborInfo;
198194

195+
/**
196+
* This enumeration defines the events for a Network Data entry (i.e., whether an entry is added or removed).
197+
*
198+
*/
199+
typedef enum
200+
{
201+
OT_HISTORY_TRACKER_NET_DATA_ENTRY_ADDED = 0, ///< Network data entry is added.
202+
OT_HISTORY_TRACKER_NET_DATA_ENTRY_REMOVED = 1, ///< Network data entry is removed.
203+
} otHistoryTrackerNetDataEvent;
204+
205+
/**
206+
* This structure represent a Network Data on mesh prefix info.
207+
*
208+
*/
209+
typedef struct otHistoryTrackerOnMeshPrefixInfo
210+
{
211+
otBorderRouterConfig mPrefix; ///< The on mesh prefix entry.
212+
otHistoryTrackerNetDataEvent mEvent; ///< Indicates the event (added/removed).
213+
} otHistoryTrackerOnMeshPrefixInfo;
214+
215+
/**
216+
* This structure represent a Network Data extern route info.
217+
*
218+
*/
219+
typedef struct otHistoryTrackerExternalRouteInfo
220+
{
221+
otExternalRouteConfig mRoute; ///< The external route entry.
222+
otHistoryTrackerNetDataEvent mEvent; ///< Indicates the event (added/removed).
223+
} otHistoryTrackerExternalRouteInfo;
224+
199225
/**
200226
* This function initializes an `otHistoryTrackerIterator`.
201227
*
@@ -316,6 +342,41 @@ const otHistoryTrackerNeighborInfo *otHistoryTrackerIterateNeighborHistory(otIns
316342
otHistoryTrackerIterator *aIterator,
317343
uint32_t * aEntryAge);
318344

345+
/**
346+
* This function iterates over the entries in the Network Data on mesh prefix entry history list.
347+
*
348+
* @param[in] aInstance A pointer to the OpenThread instance.
349+
* @param[inout] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.
350+
* @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.
351+
* Age is provided as the duration (in milliseconds) from when entry was recorded to
352+
* @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries
353+
* older than max age.
354+
*
355+
* @returns The `otHistoryTrackerOnMeshPrefixInfo` entry or `NULL` if no more entries in the list.
356+
*
357+
*/
358+
const otHistoryTrackerOnMeshPrefixInfo *otHistoryTrackerIterateOnMeshPrefixHistory(otInstance * aInstance,
359+
otHistoryTrackerIterator *aIterator,
360+
uint32_t * aEntryAge);
361+
362+
/**
363+
* This function iterates over the entries in the Network Data external route entry history list.
364+
*
365+
* @param[in] aInstance A pointer to the OpenThread instance.
366+
* @param[inout] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.
367+
* @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.
368+
* Age is provided as the duration (in milliseconds) from when entry was recorded to
369+
* @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries
370+
* older than max age.
371+
*
372+
* @returns The `otHistoryTrackerExternalRouteInfo` entry or `NULL` if no more entries in the list.
373+
*
374+
*/
375+
const otHistoryTrackerExternalRouteInfo *otHistoryTrackerIterateExternalRouteHistory(
376+
otInstance * aInstance,
377+
otHistoryTrackerIterator *aIterator,
378+
uint32_t * aEntryAge);
379+
319380
/**
320381
* This function converts a given entry age to a human-readable string.
321382
*

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 (175)
56+
#define OPENTHREAD_API_VERSION (189)
5757

5858
/**
5959
* @addtogroup api-instance

openthread/include/openthread/ip6.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ const otNetifAddress *otIp6GetUnicastAddresses(otInstance *aInstance);
329329
*
330330
* @retval OT_ERROR_NONE Successfully subscribed to the Network Interface Multicast Address.
331331
* @retval OT_ERROR_ALREADY The multicast address is already subscribed.
332-
* @retval OT_ERROR_INVALID_ARGS The IP Address indicated by @p aAddress is invalid address.
333-
* @retval OT_ERROR_INVALID_STATE The Network Interface is not up.
332+
* @retval OT_ERROR_INVALID_ARGS The IP Address indicated by @p aAddress is an invalid multicast address.
333+
* @retval OT_ERROR_REJECTED The IP Address indicated by @p aAddress is an internal multicast address.
334334
* @retval OT_ERROR_NO_BUFS The Network Interface is already storing the maximum allowed external multicast
335335
* addresses.
336336
*

openthread/include/openthread/joiner.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void otJoinerStop(otInstance *aInstance);
146146
otJoinerState otJoinerGetState(otInstance *aInstance);
147147

148148
/**
149-
* This method gets the Joiner ID.
149+
* This function gets the Joiner ID.
150150
*
151151
* If a Joiner Discerner is not set, Joiner ID is the first 64 bits of the result of computing SHA-256 over
152152
* factory-assigned IEEE EUI-64. Otherwise the Joiner ID is calculated from the Joiner Discerner value.
@@ -161,7 +161,7 @@ otJoinerState otJoinerGetState(otInstance *aInstance);
161161
const otExtAddress *otJoinerGetId(otInstance *aInstance);
162162

163163
/**
164-
* This method sets the Joiner Discerner.
164+
* This function sets the Joiner Discerner.
165165
*
166166
* The Joiner Discerner is used to calculate the Joiner ID used during commissioning/joining process.
167167
*
@@ -180,7 +180,7 @@ const otExtAddress *otJoinerGetId(otInstance *aInstance);
180180
otError otJoinerSetDiscerner(otInstance *aInstance, otJoinerDiscerner *aDiscerner);
181181

182182
/**
183-
* This method gets the Joiner Discerner.
183+
* This function gets the Joiner Discerner.
184184
*
185185
* @param[in] aInstance A pointer to the OpenThread instance.
186186
*
@@ -189,6 +189,16 @@ otError otJoinerSetDiscerner(otInstance *aInstance, otJoinerDiscerner *aDiscerne
189189
*/
190190
const otJoinerDiscerner *otJoinerGetDiscerner(otInstance *aInstance);
191191

192+
/**
193+
* This function converts a given joiner state enumeration value to a human-readable string.
194+
*
195+
* @param[in] aState The joiner state.
196+
*
197+
* @returns A human-readable string representation of @p aState.
198+
*
199+
*/
200+
const char *otJoinerStateToString(otJoinerState aState);
201+
192202
/**
193203
* @}
194204
*

openthread/include/openthread/link.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,33 @@ void otLinkFilterClearAllRssIn(otInstance *aInstance);
864864
*/
865865
otError otLinkFilterGetNextRssIn(otInstance *aInstance, otMacFilterIterator *aIterator, otMacFilterEntry *aEntry);
866866

867+
/**
868+
* This function enables/disables IEEE 802.15.4 radio filter mode.
869+
*
870+
* This function is available when OPENTHREAD_CONFIG_MAC_FILTER_ENABLE configuration is enabled.
871+
*
872+
* The radio filter is mainly intended for testing. It can be used to temporarily block all tx/rx on the 802.15.4 radio.
873+
* When radio filter is enabled, radio is put to sleep instead of receive (to ensure device does not receive any frame
874+
* and/or potentially send ack). Also the frame transmission requests return immediately without sending the frame over
875+
* the air (return "no ack" error if ack is requested, otherwise return success).
876+
*
877+
* @param[in] aInstance A pointer to an OpenThread instance.
878+
* @param[in] aFilterEnabled TRUE to enable radio filter, FALSE to disable
879+
*
880+
*/
881+
void otLinkSetRadioFilterEnabled(otInstance *aInstance, bool aFilterEnabled);
882+
883+
/**
884+
* This function indicates whether the IEEE 802.15.4 radio filter is enabled or not.
885+
*
886+
* This function is available when OPENTHREAD_CONFIG_MAC_FILTER_ENABLE configuration is enabled.
887+
*
888+
* @retval TRUE If the radio filter is enabled.
889+
* @retval FALSE If the radio filter is disabled.
890+
*
891+
*/
892+
bool otLinkIsRadioFilterEnabled(otInstance *aInstance);
893+
867894
/**
868895
* This method converts received signal strength to link quality.
869896
*

openthread/include/openthread/platform/crypto.h

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,8 @@ typedef struct otCryptoContext
133133
/**
134134
* Initialize the Crypto module.
135135
*
136-
* @retval OT_ERROR_NONE Successfully initialized Crypto module.
137-
* @retval OT_ERROR_FAILED Failed to initialize Crypto module.
138-
*
139136
*/
140-
otError otPlatCryptoInit(void);
137+
void otPlatCryptoInit(void);
141138

142139
/**
143140
* Import a key into PSA ITS.
@@ -469,6 +466,30 @@ otError otPlatCryptoSha256Update(otCryptoContext *aContext, const void *aBuf, ui
469466
*/
470467
otError otPlatCryptoSha256Finish(otCryptoContext *aContext, uint8_t *aHash, uint16_t aHashSize);
471468

469+
/**
470+
* Initialize cryptographically-secure pseudorandom number generator (CSPRNG).
471+
*
472+
*/
473+
void otPlatCryptoRandomInit(void);
474+
475+
/**
476+
* Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG).
477+
*
478+
*/
479+
void otPlatCryptoRandomDeinit(void);
480+
481+
/**
482+
* Fills a given buffer with cryptographically secure random bytes.
483+
*
484+
* @param[out] aBuffer A pointer to a buffer to fill with the random bytes.
485+
* @param[in] aSize Size of buffer (number of bytes to fill).
486+
*
487+
* @retval OT_ERROR_NONE Successfully filled buffer with random values.
488+
* @retval OT_ERROR_FAILED Operation failed.
489+
*
490+
*/
491+
otError otPlatCryptoRandomGet(uint8_t *aBuffer, uint16_t aSize);
492+
472493
/**
473494
* @}
474495
*

0 commit comments

Comments
 (0)