Skip to content

Commit

Permalink
openthread: add libraries based on commit ce77ab3c
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
edmont authored and rlubos committed Feb 11, 2022
1 parent 414e8d5 commit 382af40
Show file tree
Hide file tree
Showing 108 changed files with 2,692 additions and 22,078 deletions.
17 changes: 15 additions & 2 deletions openthread/include/openthread/backbone_router_ftd.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,19 @@ void otBackboneRouterMulticastListenerClear(otInstance *aInstance);
*/
otError otBackboneRouterMulticastListenerAdd(otInstance *aInstance, const otIp6Address *aAddress, uint32_t aTimeout);

/**
* This method configures the ability to increase or not the BBR Dataset Sequence Number when a
* BBR recovers its BBR Dataset from the Leader's Network Data.
*
* Note: available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
* Only used for certification.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aSkip Whether to skip the increase of Sequence Number or not.
*
*/
void otBackboneRouterConfigSkipSeqNumIncrease(otInstance *aInstance, bool aSkip);

#define OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ITERATOR_INIT \
0 ///< Initializer for otBackboneRouterMulticastListenerIterator

Expand Down Expand Up @@ -351,12 +364,12 @@ void otBackboneRouterSetNdProxyCallback(otInstance * aInstanc
* Represents the Backbone Router ND Proxy info.
*
*/
struct otBackboneRouterNdProxyInfo
typedef struct otBackboneRouterNdProxyInfo
{
otIp6InterfaceIdentifier *mMeshLocalIid; ///< Mesh-local IID
uint32_t mTimeSinceLastTransaction; ///< Time since last transaction (Seconds)
uint16_t mRloc16; ///< RLOC16
};
} otBackboneRouterNdProxyInfo;

/**
* This method gets the Backbone Router ND Proxy info.
Expand Down
17 changes: 17 additions & 0 deletions openthread/include/openthread/border_router.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,23 @@ otError otBorderRoutingGetOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix)
*/
otError otBorderRoutingGetOnLinkPrefix(otInstance *aInstance, otIp6Prefix *aPrefix);

/**
* This function returns the local NAT64 prefix.
*
* This prefix might not be advertised in the Thread network.
*
* This function is only available when `OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE`
* is enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aPrefix A pointer to where the prefix will be output to.
*
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
* @retval OT_ERROR_NONE Successfully retrieved the NAT64 prefix.
*
*/
otError otBorderRoutingGetNat64Prefix(otInstance *aInstance, otIp6Prefix *aPrefix);

/**
* This method provides a full or stable copy of the local Thread Network Data.
*
Expand Down
9 changes: 9 additions & 0 deletions openthread/include/openthread/coap.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,15 @@ otCoapType otCoapMessageGetType(const otMessage *aMessage);
*/
otCoapCode otCoapMessageGetCode(const otMessage *aMessage);

/**
* This function sets the Code value.
*
* @param[inout] aMessage A pointer to the CoAP message to initialize.
* @param[in] aCode CoAP message code.
*
*/
void otCoapMessageSetCode(otMessage *aMessage, otCoapCode aCode);

/**
* This method returns the CoAP Code as human readable string.
*
Expand Down
79 changes: 70 additions & 9 deletions openthread/include/openthread/history_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <openthread/instance.h>
#include <openthread/ip6.h>
#include <openthread/netdata.h>
#include <openthread/thread.h>

#ifdef __cplusplus
Expand All @@ -38,18 +39,13 @@ extern "C" {
/**
* @addtogroup api-history-tracker
*
* @{
*
*/

/**
* @brief
* This header defines the public API for History Tracker.
* Records the history of different events, for example RX and TX messages or network info changes. All tracked
* entries are timestamped.
*
* History Tracker module records history of different events (e.g. RX and TX messages or network info changes, etc.)
* as the Thread network operates. All tracked entries are timestamped.
* The functions in this module are available when `OPENTHREAD_CONFIG_HISTOR_TRACKER_ENABLE` is enabled.
*
* The functions in this module are available when `OPENTHREAD_CONFIG_HISTOR_TRACKER_ENABLE` is enabled.
* @{
*
*/

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

/**
* This enumeration defines the events for a Network Data entry (i.e., whether an entry is added or removed).
*
*/
typedef enum
{
OT_HISTORY_TRACKER_NET_DATA_ENTRY_ADDED = 0, ///< Network data entry is added.
OT_HISTORY_TRACKER_NET_DATA_ENTRY_REMOVED = 1, ///< Network data entry is removed.
} otHistoryTrackerNetDataEvent;

/**
* This structure represent a Network Data on mesh prefix info.
*
*/
typedef struct otHistoryTrackerOnMeshPrefixInfo
{
otBorderRouterConfig mPrefix; ///< The on mesh prefix entry.
otHistoryTrackerNetDataEvent mEvent; ///< Indicates the event (added/removed).
} otHistoryTrackerOnMeshPrefixInfo;

/**
* This structure represent a Network Data extern route info.
*
*/
typedef struct otHistoryTrackerExternalRouteInfo
{
otExternalRouteConfig mRoute; ///< The external route entry.
otHistoryTrackerNetDataEvent mEvent; ///< Indicates the event (added/removed).
} otHistoryTrackerExternalRouteInfo;

/**
* This function initializes an `otHistoryTrackerIterator`.
*
Expand Down Expand Up @@ -316,6 +342,41 @@ const otHistoryTrackerNeighborInfo *otHistoryTrackerIterateNeighborHistory(otIns
otHistoryTrackerIterator *aIterator,
uint32_t * aEntryAge);

/**
* This function iterates over the entries in the Network Data on mesh prefix entry history list.
*
* @param[in] aInstance A pointer to the OpenThread instance.
* @param[inout] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.
* @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.
* Age is provided as the duration (in milliseconds) from when entry was recorded to
* @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries
* older than max age.
*
* @returns The `otHistoryTrackerOnMeshPrefixInfo` entry or `NULL` if no more entries in the list.
*
*/
const otHistoryTrackerOnMeshPrefixInfo *otHistoryTrackerIterateOnMeshPrefixHistory(otInstance * aInstance,
otHistoryTrackerIterator *aIterator,
uint32_t * aEntryAge);

/**
* This function iterates over the entries in the Network Data external route entry history list.
*
* @param[in] aInstance A pointer to the OpenThread instance.
* @param[inout] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.
* @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.
* Age is provided as the duration (in milliseconds) from when entry was recorded to
* @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries
* older than max age.
*
* @returns The `otHistoryTrackerExternalRouteInfo` entry or `NULL` if no more entries in the list.
*
*/
const otHistoryTrackerExternalRouteInfo *otHistoryTrackerIterateExternalRouteHistory(
otInstance * aInstance,
otHistoryTrackerIterator *aIterator,
uint32_t * aEntryAge);

/**
* This function converts a given entry age to a human-readable string.
*
Expand Down
2 changes: 1 addition & 1 deletion openthread/include/openthread/instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (175)
#define OPENTHREAD_API_VERSION (189)

/**
* @addtogroup api-instance
Expand Down
4 changes: 2 additions & 2 deletions openthread/include/openthread/ip6.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ const otNetifAddress *otIp6GetUnicastAddresses(otInstance *aInstance);
*
* @retval OT_ERROR_NONE Successfully subscribed to the Network Interface Multicast Address.
* @retval OT_ERROR_ALREADY The multicast address is already subscribed.
* @retval OT_ERROR_INVALID_ARGS The IP Address indicated by @p aAddress is invalid address.
* @retval OT_ERROR_INVALID_STATE The Network Interface is not up.
* @retval OT_ERROR_INVALID_ARGS The IP Address indicated by @p aAddress is an invalid multicast address.
* @retval OT_ERROR_REJECTED The IP Address indicated by @p aAddress is an internal multicast address.
* @retval OT_ERROR_NO_BUFS The Network Interface is already storing the maximum allowed external multicast
* addresses.
*
Expand Down
16 changes: 13 additions & 3 deletions openthread/include/openthread/joiner.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void otJoinerStop(otInstance *aInstance);
otJoinerState otJoinerGetState(otInstance *aInstance);

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

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

/**
* This method gets the Joiner Discerner.
* This function gets the Joiner Discerner.
*
* @param[in] aInstance A pointer to the OpenThread instance.
*
Expand All @@ -189,6 +189,16 @@ otError otJoinerSetDiscerner(otInstance *aInstance, otJoinerDiscerner *aDiscerne
*/
const otJoinerDiscerner *otJoinerGetDiscerner(otInstance *aInstance);

/**
* This function converts a given joiner state enumeration value to a human-readable string.
*
* @param[in] aState The joiner state.
*
* @returns A human-readable string representation of @p aState.
*
*/
const char *otJoinerStateToString(otJoinerState aState);

/**
* @}
*
Expand Down
27 changes: 27 additions & 0 deletions openthread/include/openthread/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,33 @@ void otLinkFilterClearAllRssIn(otInstance *aInstance);
*/
otError otLinkFilterGetNextRssIn(otInstance *aInstance, otMacFilterIterator *aIterator, otMacFilterEntry *aEntry);

/**
* This function enables/disables IEEE 802.15.4 radio filter mode.
*
* This function is available when OPENTHREAD_CONFIG_MAC_FILTER_ENABLE configuration is enabled.
*
* The radio filter is mainly intended for testing. It can be used to temporarily block all tx/rx on the 802.15.4 radio.
* When radio filter is enabled, radio is put to sleep instead of receive (to ensure device does not receive any frame
* and/or potentially send ack). Also the frame transmission requests return immediately without sending the frame over
* the air (return "no ack" error if ack is requested, otherwise return success).
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aFilterEnabled TRUE to enable radio filter, FALSE to disable
*
*/
void otLinkSetRadioFilterEnabled(otInstance *aInstance, bool aFilterEnabled);

/**
* This function indicates whether the IEEE 802.15.4 radio filter is enabled or not.
*
* This function is available when OPENTHREAD_CONFIG_MAC_FILTER_ENABLE configuration is enabled.
*
* @retval TRUE If the radio filter is enabled.
* @retval FALSE If the radio filter is disabled.
*
*/
bool otLinkIsRadioFilterEnabled(otInstance *aInstance);

/**
* This method converts received signal strength to link quality.
*
Expand Down
29 changes: 25 additions & 4 deletions openthread/include/openthread/platform/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,8 @@ typedef struct otCryptoContext
/**
* Initialize the Crypto module.
*
* @retval OT_ERROR_NONE Successfully initialized Crypto module.
* @retval OT_ERROR_FAILED Failed to initialize Crypto module.
*
*/
otError otPlatCryptoInit(void);
void otPlatCryptoInit(void);

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

/**
* Initialize cryptographically-secure pseudorandom number generator (CSPRNG).
*
*/
void otPlatCryptoRandomInit(void);

/**
* Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG).
*
*/
void otPlatCryptoRandomDeinit(void);

/**
* Fills a given buffer with cryptographically secure random bytes.
*
* @param[out] aBuffer A pointer to a buffer to fill with the random bytes.
* @param[in] aSize Size of buffer (number of bytes to fill).
*
* @retval OT_ERROR_NONE Successfully filled buffer with random values.
* @retval OT_ERROR_FAILED Operation failed.
*
*/
otError otPlatCryptoRandomGet(uint8_t *aBuffer, uint16_t aSize);

/**
* @}
*
Expand Down
Loading

0 comments on commit 382af40

Please sign in to comment.