Skip to content

Commit

Permalink
openthread: add libraries based on commit b9dcdbc
Browse files Browse the repository at this point in the history
Update OpenThread libraries with newest commit

Signed-off-by: Nordic Builder <[email protected]>
  • Loading branch information
NordicBuilder authored and maciejbaczmanski committed Mar 7, 2024
1 parent 14c71fc commit e9d6fdb
Show file tree
Hide file tree
Showing 67 changed files with 3,419 additions and 16,630 deletions.
434 changes: 434 additions & 0 deletions openthread/include/openthread/ble_secure.h

Large diffs are not rendered by default.

84 changes: 76 additions & 8 deletions openthread/include/openthread/border_routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,47 @@ typedef struct otBorderRoutingPrefixTableIterator
uint32_t mData32;
} otBorderRoutingPrefixTableIterator;

/**
* Represents a discovered router on the infrastructure link.
*
*/
typedef struct otBorderRoutingRouterEntry
{
otIp6Address mAddress; ///< IPv6 address of the router.
bool mManagedAddressConfigFlag : 1; ///< The router's Managed Address Config flag (`M` flag).
bool mOtherConfigFlag : 1; ///< The router's Other Config flag (`O` flag).
bool mStubRouterFlag : 1; ///< The router's Stub Router flag.
} otBorderRoutingRouterEntry;

/**
* Represents an entry from the discovered prefix table.
*
* The entries in the discovered table track the Prefix/Route Info Options in the received Router Advertisement messages
* from other routers on infrastructure link.
* from other routers on the infrastructure link.
*
*/
typedef struct otBorderRoutingPrefixTableEntry
{
otIp6Address mRouterAddress; ///< IPv6 address of the router.
otIp6Prefix mPrefix; ///< The discovered IPv6 prefix.
bool mIsOnLink; ///< Indicates whether the prefix is on-link or route prefix.
uint32_t mMsecSinceLastUpdate; ///< Milliseconds since last update of this prefix.
uint32_t mValidLifetime; ///< Valid lifetime of the prefix (in seconds).
otRoutePreference mRoutePreference; ///< Route preference when `mIsOnlink` is false.
uint32_t mPreferredLifetime; ///< Preferred lifetime of the on-link prefix when `mIsOnLink` is true.
otBorderRoutingRouterEntry mRouter; ///< Information about the router advertising this prefix.
otIp6Prefix mPrefix; ///< The discovered IPv6 prefix.
bool mIsOnLink; ///< Indicates whether the prefix is on-link or route prefix.
uint32_t mMsecSinceLastUpdate; ///< Milliseconds since last update of this prefix.
uint32_t mValidLifetime; ///< Valid lifetime of the prefix (in seconds).
otRoutePreference mRoutePreference; ///< Route preference when `mIsOnlink` is false.
uint32_t mPreferredLifetime; ///< Preferred lifetime of the on-link prefix when `mIsOnLink`.
} otBorderRoutingPrefixTableEntry;

/**
* Represents a group of data of platform-generated RA messages processed.
*
*/
typedef struct otPdProcessedRaInfo
{
uint32_t mNumPlatformRaReceived; ///< The number of platform generated RA handled by ProcessPlatformGeneratedRa.
uint32_t mNumPlatformPioProcessed; ///< The number of PIO processed for adding OMR prefixes.
uint32_t mLastPlatformRaMsec; ///< The timestamp of last processed RA message.
} otPdProcessedRaInfo;

/**
* Represents the state of Border Routing Manager.
*
Expand Down Expand Up @@ -295,6 +318,21 @@ otError otBorderRoutingGetOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix)
*/
otError otBorderRoutingGetPdOmrPrefix(otInstance *aInstance, otBorderRoutingPrefixTableEntry *aPrefixInfo);

/**
* Gets the data of platform generated RA message processed..
*
* `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` must be enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aPrefixInfo A pointer to where the prefix info will be output to.
*
* @retval OT_ERROR_NONE Successfully retrieved the Info.
* @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
* @retval OT_ERROR_NOT_FOUND There are no valid Info on this BR.
*
*/
otError otBorderRoutingGetPdProcessedRaInfo(otInstance *aInstance, otPdProcessedRaInfo *aPdProcessedRaInfo);

/**
* Gets the currently favored Off-Mesh-Routable (OMR) Prefix.
*
Expand Down Expand Up @@ -391,6 +429,9 @@ void otBorderRoutingPrefixTableInitIterator(otInstance *aInstance, otBorderRouti
/**
* Iterates over the entries in the Border Router's discovered prefix table.
*
* Prefix entries associated with the same discovered router on an infrastructure link are guaranteed to be grouped
* together (retrieved back-to-back).
*
* @param[in] aInstance The OpenThread instance.
* @param[in,out] aIterator A pointer to the iterator.
* @param[out] aEntry A pointer to the entry to populate.
Expand All @@ -403,6 +444,21 @@ otError otBorderRoutingGetNextPrefixTableEntry(otInstance
otBorderRoutingPrefixTableIterator *aIterator,
otBorderRoutingPrefixTableEntry *aEntry);

/**
* Iterates over the discovered router entries on the infrastructure link.
*
* @param[in] aInstance The OpenThread instance.
* @param[in,out] aIterator A pointer to the iterator.
* @param[out] aEntry A pointer to the entry to populate.
*
* @retval OT_ERROR_NONE Iterated to the next router, @p aEntry and @p aIterator are updated.
* @retval OT_ERROR_NOT_FOUND No more router entries.
*
*/
otError otBorderRoutingGetNextRouterEntry(otInstance *aInstance,
otBorderRoutingPrefixTableIterator *aIterator,
otBorderRoutingRouterEntry *aEntry);

/**
* Enables / Disables DHCPv6 Prefix Delegation.
*
Expand All @@ -414,6 +470,18 @@ otError otBorderRoutingGetNextPrefixTableEntry(otInstance
*/
void otBorderRoutingDhcp6PdSetEnabled(otInstance *aInstance, bool aEnabled);

/**
* Gets the current state of DHCPv6 Prefix Delegation.
*
* Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` to be enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @returns The current state of DHCPv6 Prefix Delegation.
*
*/
otBorderRoutingDhcp6PdState otBorderRoutingDhcp6PdGetState(otInstance *aInstance);

/**
* @}
*
Expand Down
2 changes: 1 addition & 1 deletion openthread/include/openthread/coap.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ typedef void (*otCoapResponseHandler)(void *aContext,
typedef void (*otCoapRequestHandler)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);

/**
* Pointer is called when a CoAP message with an block-wise transfer option is received.
* Pointer is called when a CoAP message with a block-wise transfer option is received.
*
* Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration
* is enabled.
Expand Down
40 changes: 40 additions & 0 deletions openthread/include/openthread/coap_secure.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ extern "C" {
*/
typedef void (*otHandleCoapSecureClientConnect)(bool aConnected, void *aContext);

/**
* Callback function pointer to notify when the CoAP secure agent is automatically stopped due to reaching the maximum
* number of connection attempts.
*
* @param[in] aContext A pointer to arbitrary context information.
*
*/
typedef void (*otCoapSecureAutoStopCallback)(void *aContext);

/**
* Starts the CoAP Secure service.
*
Expand All @@ -87,6 +96,26 @@ typedef void (*otHandleCoapSecureClientConnect)(bool aConnected, void *aContext)
*/
otError otCoapSecureStart(otInstance *aInstance, uint16_t aPort);

/**
* Starts the CoAP secure service and sets the maximum number of allowed connection attempts before stopping the
* agent automatically.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aPort The local UDP port to bind to.
* @param[in] aMaxAttempts Maximum number of allowed connection request attempts. Zero indicates no limit.
* @param[in] aCallback Callback to notify if max number of attempts has reached and agent is stopped.
* @param[in] aContext A pointer to arbitrary context to use with @p aCallback.
*
* @retval OT_ERROR_NONE Successfully started the CoAP agent.
* @retval OT_ERROR_ALREADY Already started.
*
*/
otError otCoapSecureStartWithMaxConnAttempts(otInstance *aInstance,
uint16_t aPort,
uint16_t aMaxAttempts,
otCoapSecureAutoStopCallback aCallback,
void *aContext);

/**
* Stops the CoAP Secure server.
*
Expand Down Expand Up @@ -230,6 +259,17 @@ bool otCoapSecureIsConnected(otInstance *aInstance);
*/
bool otCoapSecureIsConnectionActive(otInstance *aInstance);

/**
* Indicates whether or not the DTLS session is closed.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @retval TRUE The DTLS session is closed.
* @retval FALSE The DTLS session is not closed.
*
*/
bool otCoapSecureIsClosed(otInstance *aInstance);

/**
* Sends a CoAP request block-wise over secure DTLS connection.
*
Expand Down
1 change: 1 addition & 0 deletions openthread/include/openthread/commissioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ typedef struct otCommissioningDataset
bool mIsSessionIdSet : 1; ///< TRUE if Commissioner Session Id is set, FALSE otherwise.
bool mIsSteeringDataSet : 1; ///< TRUE if Steering Data is set, FALSE otherwise.
bool mIsJoinerUdpPortSet : 1; ///< TRUE if Joiner UDP Port is set, FALSE otherwise.
bool mHasExtraTlv : 1; ///< TRUE if the Dataset contains any extra unknown sub-TLV, FALSE otherwise.
} otCommissioningDataset;

#define OT_JOINER_MAX_PSKD_LENGTH 32 ///< Maximum string length of a Joiner PSKd (does not include null char).
Expand Down
10 changes: 6 additions & 4 deletions openthread/include/openthread/dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ extern "C" {

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

#define OT_DNS_TXT_KEY_ITER_MAX_LENGTH 64 ///< Maximum length of TXT key string supported by `otDnsTxtEntryIterator`.

/**
* Represents a TXT record entry representing a key/value pair (RFC 6763 - section 6.3).
*
Expand Down Expand Up @@ -104,7 +106,7 @@ typedef struct otDnsTxtEntryIterator
{
const void *mPtr;
uint16_t mData[2];
char mChar[OT_DNS_TXT_KEY_MAX_LENGTH + 1];
char mChar[OT_DNS_TXT_KEY_ITER_MAX_LENGTH + 1];
} otDnsTxtEntryIterator;

/**
Expand All @@ -127,9 +129,9 @@ void otDnsInitTxtEntryIterator(otDnsTxtEntryIterator *aIterator, const uint8_t *
* data buffer used to initialize the iterator MUST persist and remain unchanged. Otherwise the behavior of this
* function is undefined.
*
* If the parsed key string length is smaller than or equal to `OT_DNS_TXT_KEY_MAX_LENGTH` (recommended max key length)
* the key string is returned in `mKey` in @p aEntry. But if the key is longer, then `mKey` is set to NULL and the
* entire encoded TXT entry string is returned in `mValue` and `mValueLength`.
* If the parsed key string length is smaller than or equal to `OT_DNS_TXT_KEY_ITER_MAX_LENGTH` the key string is
* returned in `mKey` in @p aEntry. But if the key is longer, then `mKey` is set to NULL and the entire encoded TXT
* entry string is returned in `mValue` and `mValueLength`.
*
* @param[in] aIterator A pointer to the iterator (MUST NOT be NULL).
* @param[out] aEntry A pointer to a `otDnsTxtEntry` structure to output the parsed/read entry (MUST NOT be NULL).
Expand Down
2 changes: 1 addition & 1 deletion openthread/include/openthread/dns_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ otError otDnsBrowseResponseGetServiceName(const otDnsBrowseResponse *aResponse,
* MUST only be used from `otDnsBrowseCallback`.
*
* The response may include multiple service instance records. @p aIndex can be used to iterate through the list. Index
* zero gives the the first record. When we reach end of the list, `OT_ERROR_NOT_FOUND` is returned.
* zero gives the first record. When we reach end of the list, `OT_ERROR_NOT_FOUND` is returned.
*
* Note that this function gets the service instance label and not the full service instance name which is of the form
* `<Instance>.<Service>.<Domain>`.
Expand Down
29 changes: 21 additions & 8 deletions openthread/include/openthread/dnssd_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,33 @@ typedef enum
OT_DNSSD_QUERY_TYPE_RESOLVE_HOST = 3, ///< Service type resolve hostname.
} otDnssdQueryType;

/**
* Represents the count of queries, responses, failures handled by upstream DNS server.
*
* Requires `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE`.
*/
typedef struct otUpstreamDnsCounters
{
uint32_t mQueries; ///< The number of queries forwarded.
uint32_t mResponses; ///< The number of responses forwarded.
uint32_t mFailures; ///< The number of upstream DNS failures.
} otUpstreamDnsCounters;

/**
* Contains the counters of DNS-SD server.
*
*/
typedef struct otDnssdCounters
{
uint32_t mSuccessResponse; ///< The number of successful responses
uint32_t mServerFailureResponse; ///< The number of server failure responses
uint32_t mFormatErrorResponse; ///< The number of format error responses
uint32_t mNameErrorResponse; ///< The number of name error responses
uint32_t mNotImplementedResponse; ///< The number of 'not implemented' responses
uint32_t mOtherResponse; ///< The number of other responses

uint32_t mResolvedBySrp; ///< The number of queries completely resolved by the local SRP server
uint32_t mSuccessResponse; ///< The number of successful responses.
uint32_t mServerFailureResponse; ///< The number of server failure responses.
uint32_t mFormatErrorResponse; ///< The number of format error responses.
uint32_t mNameErrorResponse; ///< The number of name error responses.
uint32_t mNotImplementedResponse; ///< The number of 'not implemented' responses.
uint32_t mOtherResponse; ///< The number of other responses.
uint32_t mResolvedBySrp; ///< The number of queries resolved by the local SRP server.
otUpstreamDnsCounters mUpstreamDnsCounters; ///< The number of queries, responses,
///< failures handled by upstream DNS server.
} otDnssdCounters;

/**
Expand Down
4 changes: 2 additions & 2 deletions openthread/include/openthread/history_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ const otHistoryTrackerExternalRouteInfo *otHistoryTrackerIterateExternalRouteHis
/**
* Converts a given entry age to a human-readable string.
*
* The entry age string follows the format "<hh>:<mm>:<ss>.<mmmm>" for hours, minutes, seconds and millisecond (if
* shorter than one day) or "<dd> days <hh>:<mm>:<ss>.<mmmm>" (if longer than one day).
* The entry age string follows the format `hours:minutes:seconds:milliseconds` (if
* shorter than one day) or `days:hours:minutes:seconds`(if longer than one day).
*
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated
* but the outputted string is always null-terminated.
Expand Down
33 changes: 32 additions & 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 (363)
#define OPENTHREAD_API_VERSION (398)

/**
* @addtogroup api-instance
Expand Down Expand Up @@ -102,6 +102,23 @@ otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize);
*/
otInstance *otInstanceInitSingle(void);

/**
* Initializes the OpenThread instance.
*
* This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be
* called before any other calls to OpenThread. This method utilizes static buffer to initialize the OpenThread
* instance.
*
* This function is available and can only be used when support for multiple OpenThread static instances is
* enabled (`OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE`)
*
* @param[in] aIdx The index of the OpenThread instance to initialize.
*
* @returns A pointer to the new OpenThread instance.
*
*/
otInstance *otInstanceInitMultiple(uint8_t aIdx);

/**
* Gets the instance identifier.
*
Expand Down Expand Up @@ -255,6 +272,20 @@ void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback a
*/
void otInstanceReset(otInstance *aInstance);

/**
* Triggers a platform reset to bootloader mode, if supported.
*
* Requires `OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE`.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @retval OT_ERROR_NONE Reset to bootloader successfully.
* @retval OT_ERROR_BUSY Failed due to another operation is ongoing.
* @retval OT_ERROR_NOT_CAPABLE Not capable of resetting to bootloader.
*
*/
otError otInstanceResetToBootloader(otInstance *aInstance);

/**
* Deletes all the settings stored on non-volatile memory, and then triggers a platform reset.
*
Expand Down
Loading

0 comments on commit e9d6fdb

Please sign in to comment.