Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions openthread/include/openthread/ble_secure.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ otError otBleSecureStart(otInstance *aInstance,
bool aTlvMode,
void *aContext);

/**
* Sets TCAT vendor info
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aVendorInfo A pointer to the Vendor Information (must remain valid after the method call.
*
* @retval OT_ERROR_NONE Successfully set value.
* @retval OT_ERROR_INVALID_ARGS Value not set.
*/
otError otBleSecureSetTcatVendorInfo(otInstance *aInstance, const otTcatVendorInfo *aVendorInfo);

/**
* Enables the TCAT protocol over BLE Secure.
*
Expand All @@ -122,7 +133,7 @@ otError otBleSecureStart(otInstance *aInstance,
* @retval OT_ERROR_INVALID_STATE The BLE function has not been started or line mode is not selected.
*
*/
otError otBleSecureTcatStart(otInstance *aInstance, const otTcatVendorInfo *aVendorInfo, otHandleTcatJoin aHandler);
otError otBleSecureTcatStart(otInstance *aInstance, otHandleTcatJoin aHandler);

/**
* Stops the BLE Secure server.
Expand Down Expand Up @@ -323,7 +334,7 @@ otError otBleSecureConnect(otInstance *aInstance);
void otBleSecureDisconnect(otInstance *aInstance);

/**
* Indicates whether or not the TLS session is active (connected or conneting).
* Indicates whether or not the TLS session is active (connected or connecting).
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
Expand Down
32 changes: 32 additions & 0 deletions openthread/include/openthread/border_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,38 @@ typedef enum otBorderAgentState
OT_BORDER_AGENT_STATE_ACTIVE = 2, ///< Border agent is connected with external commissioner.
} otBorderAgentState;

typedef struct otBorderAgentCounters
{
uint32_t mEpskcActivations; ///< The number of ePSKc activations
uint32_t mEpskcDeactivationClears; ///< The number of ePSKc deactivations via API
uint32_t mEpskcDeactivationTimeouts; ///< The number of ePSKc deactivations due to timeout
uint32_t mEpskcDeactivationMaxAttempts; ///< The number of ePSKc deactivations due to reached max attempts
uint32_t mEpskcDeactivationDisconnects; ///< The number of ePSKc deactivations due to commissioner disconnected
uint32_t mEpskcInvalidBaStateErrors; ///< The number of invalid border agent state errors at ePSKc activation
uint32_t mEpskcInvalidArgsErrors; ///< The number of invalid args errors at ePSKc activation
uint32_t mEpskcStartSecureSessionErrors; ///< The number of start secure session errors at ePSKc activation
uint32_t mEpskcSecureSessionSuccesses; ///< The number of established secure sessions with ePSKc
uint32_t mEpskcSecureSessionFailures; ///< The number of failed secure sessions with ePSKc
uint32_t mEpskcCommissionerPetitions; ///< The number of successful commissioner petitions with ePSKc

uint32_t mPskcSecureSessionSuccesses; ///< The number of established secure sessions with PSKc
uint32_t mPskcSecureSessionFailures; ///< The number of failed secure sessions with PSKc
uint32_t mPskcCommissionerPetitions; ///< The number of successful commissioner petitions with PSKc

uint32_t mMgmtActiveGets; ///< The number of MGMT_ACTIVE_GET.req sent over secure sessions
uint32_t mMgmtPendingGets; ///< The number of MGMT_PENDING_GET.req sent over secure sessions
} otBorderAgentCounters;

/**
* Gets the counters of the Thread Border Agent.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @returns A pointer to the Border Agent counters.
*
*/
const otBorderAgentCounters *otBorderAgentGetCounters(otInstance *aInstance);

/**
* Gets the #otBorderAgentState of the Thread Border Agent role.
*
Expand Down
83 changes: 83 additions & 0 deletions openthread/include/openthread/border_routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ typedef struct otBorderRoutingPrefixTableIterator
{
const void *mPtr1;
const void *mPtr2;
uint32_t mData0;
uint32_t mData1;
uint8_t mData2;
uint8_t mData3;
Expand All @@ -93,15 +94,23 @@ typedef struct otBorderRoutingPrefixTableIterator
/**
* Represents a discovered router on the infrastructure link.
*
* The `mIsPeerBr` field requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`. Routing Manager
* determines whether the router is a peer BR (connected to the same Thread mesh network) by comparing its advertised
* PIO/RIO prefixes with the entries in the Thread Network Data. While this method is generally effective, it may not
* be 100% accurate in all scenarios, so the `mIsPeerBr` flag should be used with caution.
*
*/
typedef struct otBorderRoutingRouterEntry
{
otIp6Address mAddress; ///< IPv6 address of the router.
uint32_t mMsecSinceLastUpdate; ///< Milliseconds since last update (any message rx) from this router.
uint32_t mAge; ///< The router's age in seconds (duration since its first discovery).
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.
bool mIsLocalDevice : 1; ///< This router is the local device (this BR).
bool mIsReachable : 1; ///< This router is reachable.
bool mIsPeerBr : 1; ///< This router is (likely) a peer BR.
} otBorderRoutingRouterEntry;

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

/**
* Represents information about a peer Border Router found in the Network Data.
*
*/
typedef struct otBorderRoutingPeerBorderRouterEntry
{
uint16_t mRloc16; ///< The RLOC16 of BR.
uint32_t mAge; ///< Seconds since the BR appeared in the Network Data.
} otBorderRoutingPeerBorderRouterEntry;

/**
* Represents a group of data of platform-generated RA messages processed.
*
Expand Down Expand Up @@ -479,6 +498,58 @@ otError otBorderRoutingGetNextRouterEntry(otInstance *aI
otBorderRoutingPrefixTableIterator *aIterator,
otBorderRoutingRouterEntry *aEntry);

/**
* Iterates over the peer BRs found in the Network Data.
*
* Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.
*
* Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered
* to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data
* entries:
*
* - It has added at least one external route entry.
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
*
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
*
* @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 entry, @p aEntry and @p aIterator are updated.
* @retval OT_ERROR_NOT_FOUND No more entries.
*
*/
otError otBorderRoutingGetNextPeerBrEntry(otInstance *aInstance,
otBorderRoutingPrefixTableIterator *aIterator,
otBorderRoutingPeerBorderRouterEntry *aEntry);

/**
* Returns the number of peer BRs found in the Network Data.
*
* Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.
*
* Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered
* to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data
* entries:
*
* - It has added at least one external route entry.
* - It has added at least one prefix entry with both the default-route and on-mesh flags set.
* - It has added at least one domain prefix (with both the domain and on-mesh flags set).
*
* The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
*
* @param[in] aInstance The OpenThread instance.
* @param[out] aMinAge Pointer to an `uint32_t` to return the minimum age among all peer BRs.
* Can be NULL if the caller does not need this information.
* Age is represented as seconds since appearance of the BR entry in the Network Data.
*
* @returns The number of peer BRs.
*
*/
uint16_t otBorderRoutingCountPeerBrs(otInstance *aInstance, uint32_t *aMinAge);

/**
* Enables / Disables DHCPv6 Prefix Delegation.
*
Expand Down Expand Up @@ -527,6 +598,18 @@ void otBorderRoutingDhcp6PdSetRequestCallback(otInstance
otBorderRoutingRequestDhcp6PdCallback aCallback,
void *aContext);

/**
* Sets the local on-link prefix.
*
* Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TESTING_API_ENABLE`.
*
* This is intended for testing only and using it will make the BR non-compliant with the Thread Specification.
*
* @param[in] aPrefix The on-link prefix to use.
*
*/
void otBorderRoutingSetOnLinkPrefix(otInstance *aInstance, const otIp6Prefix *aPrefix);

/**
* @}
*
Expand Down
13 changes: 13 additions & 0 deletions openthread/include/openthread/coap.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,19 @@ otError otCoapMessageAppendObserveOption(otMessage *aMessage, uint32_t aObserve)
*/
otError otCoapMessageAppendUriPathOptions(otMessage *aMessage, const char *aUriPath);

/**
* Appends a Uri-Query option.
*
* @param[in,out] aMessage A pointer to the CoAP message.
* @param[in] aUriQuery A pointer to a NULL-terminated string.
*
* @retval OT_ERROR_NONE Successfully appended the option.
* @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.
* @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size.
*
*/
otError otCoapMessageAppendUriQueryOptions(otMessage *aMessage, const char *aUriQuery);

/**
* Converts a CoAP Block option SZX field to the actual block size
*
Expand Down
29 changes: 21 additions & 8 deletions openthread/include/openthread/coap_secure.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,27 @@ extern "C" {

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

/**
* CoAP secure connection event types.
*
*/
typedef enum otCoapSecureConnectEvent
{
OT_COAP_SECURE_CONNECTED = 0, ///< Connection established
OT_COAP_SECURE_DISCONNECTED_PEER_CLOSED, ///< Disconnected by peer
OT_COAP_SECURE_DISCONNECTED_LOCAL_CLOSED, ///< Disconnected locally
OT_COAP_SECURE_DISCONNECTED_MAX_ATTEMPTS, ///< Disconnected due to reaching the max connection attempts
OT_COAP_SECURE_DISCONNECTED_ERROR, ///< Disconnected due to an error
} otCoapSecureConnectEvent;

/**
* Pointer is called when the DTLS connection state changes.
*
* @param[in] aConnected true, if a connection was established, false otherwise.
* @param[in] aEvent The connection event.
* @param[in] aContext A pointer to arbitrary context information.
*
*/
typedef void (*otHandleCoapSecureClientConnect)(bool aConnected, void *aContext);
typedef void (*otHandleCoapSecureClientConnect)(otCoapSecureConnectEvent aEvent, void *aContext);

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

/**
* Sets the connected callback to indicate, when
* a Client connect to the CoAP Secure server.
* Sets the connect event callback to indicate when
* a Client connection to the CoAP Secure server has changed.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aHandler A pointer to a function that will be called once DTLS connection is established.
* @param[in] aHandler A pointer to a function that will be called once DTLS connection has changed.
* @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.
*
*/
void otCoapSecureSetClientConnectedCallback(otInstance *aInstance,
otHandleCoapSecureClientConnect aHandler,
void *aContext);
void otCoapSecureSetClientConnectEventCallback(otInstance *aInstance,
otHandleCoapSecureClientConnect aHandler,
void *aContext);

/**
* Sends a CoAP response block-wise from the CoAP Secure server.
Expand Down
3 changes: 2 additions & 1 deletion openthread/include/openthread/dataset_updater.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ typedef void (*otDatasetUpdaterCallback)(otError aError, void *aContext);
* @param[in] aContext An arbitrary context passed to callback.
*
* @retval OT_ERROR_NONE Dataset update started successfully (@p aCallback will be invoked on completion).
* @retval OT_ERROR_INVALID_STATE Device is disabled (MLE is disabled).
* @retval OT_ERROR_INVALID_STATE Device is disabled or not fully configured (missing or incomplete Active Dataset).
* @retval OT_ERROR_ALREADY The @p aDataset fields already match the existing Active Dataset.
* @retval OT_ERROR_INVALID_ARGS The @p aDataset is not valid (contains Active or Pending Timestamp).
* @retval OT_ERROR_BUSY Cannot start update, a previous one is ongoing.
* @retval OT_ERROR_NO_BUFS Could not allocated buffer to save Dataset.
Expand Down
32 changes: 16 additions & 16 deletions openthread/include/openthread/diag.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#define OPENTHREAD_DIAG_H_

#include <openthread/instance.h>
#include <openthread/platform/diag.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -51,47 +52,46 @@ extern "C" {
*
*/

/* Represents the pointer to callback to output diag messages. */
typedef otPlatDiagOutputCallback otDiagOutputCallback;

/**
* Processes a factory diagnostics command line.
* Sets the diag output callback.
*
* The output of this function (the content written to @p aOutput) MUST terminate with `\0` and the `\0` is within the
* output buffer.
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aCallback A pointer to a function that is called on outputting diag messages.
* @param[in] aContext A pointer to the user context.
*
*/
void otDiagSetOutputCallback(otInstance *aInstance, otDiagOutputCallback aCallback, void *aContext);

/**
* Processes a factory diagnostics command line.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aArgsLength The number of elements in @p aArgs.
* @param[in] aArgs An array of arguments.
* @param[out] aOutput The diagnostics execution result.
* @param[in] aOutputMaxLen The output buffer size.
*
* @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.
* @retval OT_ERROR_NONE The command is successfully process.
* @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported.
*
*/
otError otDiagProcessCmd(otInstance *aInstance,
uint8_t aArgsLength,
char *aArgs[],
char *aOutput,
size_t aOutputMaxLen);
otError otDiagProcessCmd(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[]);

/**
* Processes a factory diagnostics command line.
*
* The output of this function (the content written to @p aOutput) MUST terminate with `\0` and the `\0` is within the
* output buffer.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aString A NULL-terminated input string.
* @param[out] aOutput The diagnostics execution result.
* @param[in] aOutputMaxLen The output buffer size.
*
* @retval OT_ERROR_NONE The command is successfully process.
* @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.
* @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported.
* @retval OT_ERROR_NO_BUFS The command string is too long.
*
*/
otError otDiagProcessCmdLine(otInstance *aInstance, const char *aString, char *aOutput, size_t aOutputMaxLen);
otError otDiagProcessCmdLine(otInstance *aInstance, const char *aString);

/**
* Indicates whether or not the factory diagnostics mode is enabled.
Expand Down
5 changes: 3 additions & 2 deletions openthread/include/openthread/icmp6.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ typedef enum otIcmp6Type
*/
typedef enum otIcmp6Code
{
OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE = 0, ///< Destination Unreachable No Route
OT_ICMP6_CODE_FRAGM_REAS_TIME_EX = 1, ///< Fragment Reassembly Time Exceeded
OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE = 0, ///< Destination Unreachable (Type 1) - No Route
OT_ICMP6_CODE_DST_UNREACH_PROHIBITED = 1, ///< Destination Unreachable (Type 1) - Administratively Prohibited
OT_ICMP6_CODE_FRAGM_REAS_TIME_EX = 1, ///< Time Exceeded (Type 3) - Fragment Reassembly
} otIcmp6Code;

#define OT_ICMP6_HEADER_DATA_SIZE 4 ///< Size of ICMPv6 Header.
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 (415)
#define OPENTHREAD_API_VERSION (440)

/**
* @addtogroup api-instance
Expand Down
Loading
Loading