Compare commits

...

61 Commits

Author SHA1 Message Date
Abtin Keshavarzian 593fc53fcf [netdiag] add support for Vendor OUI TLV (#13260)
This commit introduces the Vendor OUI Network Diagnostic TLV (type 44),
enabling devices to query and report their Vendor Organizationally Unique
Identifier (OUI).

Specifically, this commit implements TLV generation and parsing in the
Network Diagnostics `Client` and `Server` modules, exposing the parsed
OUI through public client APIs. It also updates the `networkdiagnostic`
CLI commands to support querying and  outputting Vendor OUI information.

It also extends the existing toranj tests to cover the new TLV
(`test-020-net-diag-vendor-info.py`).
2026-06-24 23:17:59 -07:00
Abtin Keshavarzian c34311ff50 [vendor-info] generalize vendor OUI to support variable lengths (#13258)
This commit generalizes the Vendor OUI (Organizationally Unique
Identifier) handling to support IEEE MAC Address Block Large
(MA-L, 24-bit), Medium(MA-M, 28-bit), and Small (MA-S, 36-bit)
assignments.

Key enhancements:

- Backward-Compatible Config Parsing: The
  `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_OUI` configuration remains fully
  backward compatible. If the macro is set to a traditional 24-bit
  integer (e.g., `0x641666`), it is implicitly parsed as a 24-bit
  OUI.

  For larger or variable-length OUIs, a new explicit 48-bit format is
  supported: `0x[BitLengthInHex][5 OUI Bytes]` (e.g. `0x1c001a2b3000ULL`
  for 28-bit, and `0x24001a2b3c40ULL` for 36-bit). This format
  encodes both prefix length and value into a single integer, making
  it trivial to pass through command-line flags (e.g. `-D...`).

- Compile-Time Validation: Introduced `VendorInfo::OuiParser` template
  class to parse and validate the configured OUI at compile-time
  (`static_assert`). It ensures invalid lengths, out-of-range
  configurations, or non-zero trailing bits fail the build
  immediately.

- New APIs: Replaced legacy `uint32_t` representations with the
  `otThreadVendorOui` containing `mBitLength` and a 5-byte buffer
  `mBytes`. Added new public APIs `otThreadGetVendorOuiInfo()` and
  `otThreadSetVendorOuiInfo()`, while deprecating the older 24-bit OUI
  getters and setters.

- Border Agent & CLI Updates:
  - Updated Border Agent TXT data generation (`vo` key) and parsing
    to correctly handling of new OUI lengths.
  - Updated CLI command utilities to output variable-length OUI bytes
    formatted correctly.
  - Added new `test_vendor_oui.cpp` unit tests to thoroughly validate
    compile-time parsing and runtime class logic.
2026-06-23 11:59:38 -07:00
Abtin Keshavarzian ac689dd9a4 [mac] redesign Information Element (IE) processing and generation (#13263)
This commit redesigns IEEE 802.15.4 Information Element (IE) handling by
introducing dedicated subclass definitions (`CslIe`, `TimeIe`,
`ConnectionIe`, `RendezvousTimeIe`, `LinkMetricsProbingIe`, etc.) inheriting
from `HeaderIe` or `VendorIe`.

In addition, `Mac::Frame` is updated with generic template methods:
- `Has<IeType>()`: Checks if the frame contains a well-formed instance of
  the specified IE subclass.
- `Find<IeType>()`: Finds, validates and returns a type-safe pointer to the
  IE.

Key benefits of this redesign:

- Streamlined IE Generation: Constructing and populating IEs is significantly
  simplified. Each subclass exposes a unified `Init()` method that cleanly
  computes the exact IE content length, sets the Element ID and known content
  (e.g. vendor OUI) in a single step.

- True Encapsulation: Each IE subclass serves as the single source of truth
  for its Element ID (`kId`), content layout, and structural validation logic
  (`IsValid()`). Callers no longer pass magic ID constants or perform
  error-prone pointer arithmetic.

- By implementing `HeaderIe::ValidateAs<IeType>()` as a static polymorphic
  matcher passed to `FindHeaderIe()`, the compiler devirtualizes
  and inlines ID match and content verifications directly into MAC frame
  parsing loops.

- Scalable Integration: Adding new Information Elements is trivial. Defining
  a new subclass automatically equips MAC frame handling with type-safe
  search without bloating `Mac::Frame` with ad-hoc getter methods.
2026-06-23 11:05:15 -07:00
Abtin Keshavarzian 9b8d5b7471 [cli] add CLI commands for testing otPlatTcp APIs (#13204)
This commit introduces a new `plattcp` CLI command designed primarily
for testing and evaluating `otPlatTcp` platform implementations.

The new CLI provides commands to manually drive the platform TCP API.

These commands act as a thin wrapper around the `Ip6::PlatTcp`
classes, allowing to manually invoke and observe connection events,
states, and data reception from a console. The feature is guarded by
`OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE`.
2026-06-23 10:22:30 -07:00
Abtin Keshavarzian 7874555efb [mle] separate router and leader upgrade thresholds (#13227)
This commit separates the single `ROUTER_UPGRADE_THRESHOLD` into two
distinct concepts: a local threshold for role transitions (used by a
REED deciding when to upgrade) and a leader threshold (used by the
Leader deciding whether to accept a router upgrade request).

This prepares for adding support for a new Router Config feature,
where the local threshold can be changed while the threshold used
when the device acts as a leader must remain the spec-defined value.

To preserve backward compatibility with existing tests and tools,
`otThreadSetRouterUpgradeThreshold` continues to set both thresholds
simultaneously.

Several Nexus test scenarios have been updated to explicitly set
the new leader threshold alongside the local router threshold.
2026-06-22 17:32:35 -07:00
Abtin Keshavarzian 6e8570e233 [mac] enforce single initialization lifecycle for TxFrames (#13264)
This commit refactors `Mac::Links` and `Mac` frame preparation to ensure
`TxFrames` buffers are initialized (`Clear()`) exactly once per TX cycle.

Specifically, this commit:
- Replaces `Links::GetTxFrames()` with `Links::InitTxFrames()`, which
  encapsulates calling `Clear()` on `mTxFrames` prior to returning its
  reference. This prevents callers from retrieving uninitialized or dirty
  transmission buffers from a previous radio cycle.
- Updates `PrepareBeaconRequest()` and `PrepareBeacon()` to accept the
  initialized `TxFrames &` reference directly as a parameter, making the
  data flow explicit.
- Replaces non-const `GetTxFrames()` calls in `HandleTransmitDone()` with
  `GetTxFramesRequiredRadioTypes()`, enforcing const-correctness during
  TX completion handling.
2026-06-22 15:10:22 -07:00
Zhangwx ff121bfce3 [spinel] fix out-of-bounds read in GetNextSavedFrame when RCP recover (#13189) 2026-06-22 14:59:38 -07:00
Abtin Keshavarzian 4394c0944b [mac] simplify and enhance Header IE processing (#13261)
This commit refactors `Mac::HeaderIe` generation and parsing to
improve code readability, type safety, and bounds checking.

Key changes include:
- Adds `HeaderIe::GetSize()` and `HeaderIe::GetContent()` to
  encapsulate pointer arithmetic inside the class and eliminate ad-hoc
  pointer offset math across `Mac` modules.
- Updates `Frame::FindPayloadIndex()`, `Frame::GetHeaderIe()`,
  `Frame::GetThreadIe()`, and `Frame::GetTimeIe()` to utilize the
  new helper methods, simplifying boundary checks.
- Simplifies `HeaderIe::Init()` by replacing the union with a clearer
  `mLenIdType` field and updating the internal bitwise operations
  to use `bit_utils.hpp` helper methods.
2026-06-22 13:46:52 -07:00
Abtin Keshavarzian 5f9fe671e9 [mesh-diag] support requesting extra TLVs during topology discovery (#13257)
This commit enhances the Mesh Diag topology discovery process
(`otMeshDiagDiscoverTopology()`) by allowing users to request an array
of extra Network Diagnostic TLVs from each discovered router.

Key changes:
- Extended `otMeshDiagDiscoverConfig` to include an `mExtraTlvTypes`
  array and `mExtraTlvTypesLength`.
- Added the `otMeshDiagTlvIterator` opaque type and
  `otMeshDiagGetNextTlvInfo()` API to iterate over the parsed extra
  TLVs retrieved from each router.
- Exposed the new `TlvIterator` via `otMeshDiagRouterInfo` in the
  `otMeshDiagDiscoverCallback`.
- Updated `MeshDiag::DiscoverTopology()` to dynamically include the
  extra TLVs in the CoAP diagnostic request, along with robust
  validation ensuring standard TLVs are not requested twice.
- Introduced `test_mesh_diag.cpp` under Nexus to validate base
  discovery, IPv6 and Child Table discovery, extra TLV retrieval,
  and API argument validation.
2026-06-22 10:28:27 -07:00
dependabot[bot] 879b54bc29 github-actions: bump umbrelladocs/action-linkspector from 1.5.1 to 1.5.4 (#13267)
Bumps [umbrelladocs/action-linkspector](https://github.com/umbrelladocs/action-linkspector) from 1.5.1 to 1.5.4.
- [Release notes](https://github.com/umbrelladocs/action-linkspector/releases)
- [Commits](https://github.com/umbrelladocs/action-linkspector/compare/963b6264d7de32c904942a70b488d3407453049e...6c637d70424624231467a4ca918be54fa3b792d0)

---
updated-dependencies:
- dependency-name: umbrelladocs/action-linkspector
  dependency-version: 1.5.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 09:38:22 -07:00
Tongze Wang 9cc2cb3e96 [spinel] improve RCP crash dump request logic (#13150)
This commit updates the RCP crash dump request logic to provide better
debug information while ensuring the recovery process is not interrupted:
- `RadioSpinel::HandleRcpUnexpectedReset` now explicitly clears
  `mWaitingTid` and requests a crash dump if RCP restoration is disabled
  before proceeding with the abort / exit logic. If RCP restoration is
  enabled, request for crash dump will be deferred to `RecoverFromRcpFailure`,
  before resetting the coprocessor.
- Updates crash dump requests to use `IgnoreReturnValue` instead.
  Failing to retrieve a crash dump is not a fatal error and should not
  halt the initialization or recovery process.
2026-06-18 10:31:40 -05:00
Luc1fer 54323a2953 [mle] reject malformed Network Data in Child ID Response (#13213)
This change makes MLE Child ID Response handling fail safely when the
Network Data TLV is present but cannot be parsed or applied.

The attach path requires Network Data in a Child ID Response. This
patch checks the result of applying the Network Data TLV and avoids
completing attach if the required Network Data cannot be applied.

Signed-off-by: OneThing4101 <b.purewsuren123@gmail.com>
2026-06-18 10:25:50 -05:00
Abtin Keshavarzian da08ac73fd [netdiag] refactor network diagnostics TLV parsing (#13247)
This commit refactors the TLV parsing logic within the Network
Diagnostics `Client`.

The monolithic `GetNextDiagTlv` method has been refactored. The large
switch statement that parsed individual TLV payloads was extracted
into a dedicated `ParseDiagTlv` helper method. This separation of
concerns cleans up the `while` loop that iterates over TLVs,
improving readability and making future TLV parsing updates easier.
The new `ParseDiagTlv()` method can also be used in the future by
other modules such as `MeshDiag`.

Additionally, `ParseEnhancedRoute()` was refactored and simplified
to be a member method instead of a static standalone function,
utilizing the newly introduced `EnhRoute` typedef.
2026-06-16 08:52:59 -05:00
Abtin Keshavarzian 9c8374a44c [netdiag] extract answer sending logic into AnswerSender (#13242)
This commit introduces the `NetDiag::AnswerSender` class to manage the
transmission of multipart CoAP answer messages for Network Diagnostics
and History Tracker queries.

Previously, both `NetDiag::Server` and `HistoryTracker::Server`
contained duplicated logic to queue allocated answer messages, track
responses, and send subsequent messages one by one using an internal
CoAP message queue.

By extracting this into the new `AnswerSender` class, it eliminates the
redundancy in message queue management, freeing of related answers, and
CoAP response handling across both modules. The `AnswerSender` takes
ownership of the messages generated by an `AnswerBuilder` and manages
the asynchronous transmission lifecycle.
2026-06-16 08:39:05 -05:00
Yakun Xu 0a6d0e793f [radio] remove unused mCslPresent (#13232)
This commit removes RadioContext.mCslPresent. Instead we directly
check whether the CSL is in the frame data, so there is not risk of
mismatch.
2026-06-15 09:38:43 -05:00
Abtin Keshavarzian a411e563d6 [mle] remove unused router threshold variables (#13239)
This commit removes `mRouterUpgradeThreshold` and
`mRouterDowngradeThreshold` from the `Mle` class. These variables
were previously moved into the `RoleTransitioner` class, but their
declarations in `Mle` were left behind. Removing them cleans up the
class definition and eliminates unused state.
2026-06-15 09:31:47 -05:00
Abtin Keshavarzian f833942769 [netdiag] extend AnswerBuilder to support HistoryTracker (#13235)
This commit extends the `NetDiag::AnswerBuilder` class to support
generating and managing answer messages for the `HistoryTracker` module.

This refactor eliminates redundant implementation in
`HistoryTracker::Server`, removing its internal `AnswerInfo` struct
and related message allocation and length checking methods, replacing
them with the unified `NetDiag::AnswerBuilder` workflow.
2026-06-15 09:30:22 -05:00
dependabot[bot] bf9d441ebd github-actions: bump step-security/harden-runner from 2.14.2 to 2.19.4 (#13246)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.14.2 to 2.19.4.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/5ef0c079ce82195b2a36a210272d6b661572d83e...9af89fc71515a100421586dfdb3dc9c984fbf411)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.19.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-15 09:24:53 -05:00
Abtin Keshavarzian 252918bf10 [tmf] introduce SendResponseWithStateTlv() helper (#13238)
This commit adds `SendResponseWithStateTlv()` to `Tmf::Agent` to
streamline sending TMF responses that consist solely of a `StateTlv`.

By encapsulating message allocation, TLV appending, and message
transmission into a single method, this reduces duplicate boilerplate
code across `DatasetManager`, `Leader`, and `NetworkData::Leader`.
2026-06-12 10:47:40 -07:00
Abtin Keshavarzian b1d4150426 [posix] implement otPlatTcp platform abstraction (#13193)
This commit provides a complete POSIX implementation of the new
`otPlatTcp` platform abstraction APIs. It leverages the existing
OpenThread `Mainloop` polling mechanism to build a fully event-driven,
non-blocking TCP socket implementation without requiring extra threads.

Key features and implementation details:
- Uses `Mainloop` read/write/error sets to monitor socket states.
- Implements `otPlatTcpEnableListener` and `otPlatTcpAccept` to handle
  incoming connection requests over IPv6.
- Implements `otPlatTcpConnect` for asynchronous non-blocking outgoing
  TCP connections, monitoring `SO_ERROR` to detect handshake completion.
- Handles data transmission utilizing `otPlatTcpIsTxPending` to
  monitor the write descriptor and correctly signal `HandleTxReady`.
- Implements `otPlatTcpSend` and `otPlatTcpReceive` ensuring proper
  buffering, suppressing `SIGPIPE` safely using `SO_NOSIGPIPE` and
  `MSG_NOSIGNAL`.
- Encodes socket file descriptors directly within the platform data
  `mData.mDescriptor` union, avoiding dynamic memory allocation.
2026-06-11 20:22:29 -07:00
Jonathan Hui fcf7b4cef5 [spi-hdlc-adapter] define explicit worst-case HDLC frame size macro (#13237)
This commit replaces the implicit sizing of `escaped_frame_buffer`
with an explicit macro `HDLC_MAX_FRAME_SIZE` in the standalone
`spi-hdlc-adapter` tool.

Previously, `escaped_frame_buffer` was sized statically to
`MAX_FRAME_SIZE * 2` (4096 bytes). While this size is mathematically
sufficient to hold a worst-case escaped payload (4091 bytes for a
2043-byte max payload, 4 escaped CRC bytes, and 1 flag byte), it was
not self-documenting and relied on implicit math.

This commit defines `HDLC_MAX_FRAME_SIZE` explicitly as:
`((MAX_FRAME_SIZE - HEADER_LEN) * 2 + 5)`
making the worst-case framing overhead bounds clear and robust to
any future changes to the constants.
2026-06-11 18:00:57 -07:00
Jonathan Hui 11acd4a26e [posix] fix SPI platform driver sanity check boundaries (#13236)
This commit corrects the SPI frame sanity checks in the POSIX platform
driver (`spi_interface.cpp`).

Previously, the sanity checks compared `mSpiSlaveDataLen` and
`slaveAcceptLen` against `kMaxFrameSize` (8192). However,
`mSpiSlaveDataLen` is the payload size, which excludes the 5-byte SPI
frame header. If the slave advertised a data length of exactly
`kMaxFrameSize` (8192), it would pass the sanity check, but the
subsequent `DoSpiTransfer` would request a transfer length of
`kMaxFrameSize + kSpiFrameHeaderSize + alignment` (e.g. 8213 bytes).
This would cause an out-of-bounds read on `mSpiTxFrameBuffer` which is
sized `kMaxFrameSize + kSpiAlignAllowanceMax` (8208 bytes).

This commit updates the sanity checks to use
`kMaxFrameSize - kSpiFrameHeaderSize` as the maximum allowed payload
length, ensuring that worst-case transfers always fit within the
tx buffer allocation.
2026-06-11 18:00:38 -07:00
evilgensec 1f8d922465 [spi-hdlc-adapter] validate RCP frame lengths against the MTU (#13206)
The slave (RCP) controls the `data_len` and `accept_len` fields of the SPI
header. Both carry a payload length that excludes the 5-byte header, as
shown by `sMTU = MAX_FRAME_SIZE - HEADER_LEN`, so the largest valid value
is the MTU, `MAX_FRAME_SIZE - HEADER_LEN`.

The two sanity checks in `push_pull_spi()` only rejected values greater
than `MAX_FRAME_SIZE`, allowing an RCP to advertise a length in the range
(MAX_FRAME_SIZE - HEADER_LEN, MAX_FRAME_SIZE]. That value flows into
`spi_xfer_bytes`, and `do_spi_xfer()` then transfers
`spi_xfer_bytes + HEADER_LEN + sSpiRxAlignAllowance` bytes into
`sSpiRxFrameBuffer` / `sSpiTxFrameBuffer`. Those buffers are sized
`MAX_FRAME_SIZE + SPI_RX_ALIGN_ALLOWANCE_MAX`, so the extra HEADER_LEN
added by the transfer can write up to 5 bytes past the end of both.

Clamp both checks to `MAX_FRAME_SIZE - HEADER_LEN` so the advertised
payload plus the header always fits within the existing buffers.
2026-06-11 16:18:19 -07:00
Jake Swensen 5e68d008b5 [posix] add build time config of netinf loss (#13192)
Allow build time configuration of `OPENTHREAD_POSIX_CONFIG_EXIT_ON_INFRA_NETIF_LOST_ENABLE`
2026-06-11 11:50:41 -07:00
Abtin Keshavarzian 0fbee98fd5 [crypto] simplify AesCcm public APIs and introduce internal Engine (#13215)
This commit refactors the `AesCcm` class to simplify its public interface,
decoupling the high-level API from the underlying cryptographic execution.

Key improvements:
- Redesigned the API from a series of procedural method calls
  (`Init()`, `Header()`, `Payload()`, `Finalize()`) into a unified,
  stateful model. Callers now pre-configure the operation parameters using
  dedicated setters (`SetKey()`, `SetNonce()`, `SetAuthData()`,
  `SetTagLength()`) and execute the entire cryptographic operation in a
  single step via unified `Process()` methods.
- Introduced a nested `Engine` class to encapsulate the low-level AES-CCM
  mathematical and cryptographic state. The `Engine` provides clean internal
  interfaces for both optimized one-shot (single-part) and multi-part
  operations.
- This architectural separation allows the outer `AesCcm` class to focus on
  parameter validation, high-level buffer management, and complex `Message`
  chunk iterations, while the `Engine` remains focused purely on the
  cryptographic core. This also provides a clean extension point to easily
  route one-shot operations to platform-specific hardware acceleration APIs
  in the future.
- Updated `Mac` and `Mle` modules to use the simplified APIs, reducing
   boilerplate code.
- Retained a static `Perform()` wrapper to support the legacy public
  `otCrypto` API.
- Updated unit tests to validate the new stateful interfaces, including
  robust in-place message chunk processing and separate-buffer
  validations.
2026-06-10 10:24:34 -07:00
Abtin Keshavarzian a055c4b9b8 [platform] define otPlatTcp platform abstraction APIs (#13175)
This commit introduces a new platform abstraction layer for TCP
connections and listeners, enabling OpenThread to leverage platform-
provided TCP stacks. The API is designed for asynchronous, event-driven
environments and can easily support POSIX as well as various embedded
network stacks.

In the core, `Ip6::PlatTcp` and its nested `Connection` and `Listener`
classes are introduced to manage these platform interactions, providing
a clean C++ interface for the OpenThread core. The `PlatTcp` manager
is integrated into the `Instance` class and utilizes `Tasklet` for
asynchronous resource cleanup.

Additionally, this commit adds a comprehensive unit test to verify the
TCP platform abstraction and `Ip6::PlatTcp` implementation. The tests
cover listener and connection lifecycles, data flow, flow control,
incoming connection acceptance, and active object iteration.
2026-06-10 10:23:06 -07:00
Abtin Keshavarzian 1b80561802 [mle] introduce AesCcmAuthData for message security processing (#13210)
This commit refactors `Mle::ProcessMessageSecurity()` to use a new packed
structure, `AesCcmAuthData`, to represent the authenticated data used during
AES-CCM security processing.

The `AesCcmAuthData` structure encapsulates the sender and receiver IPv6
addresses along with the Auxiliary Security Header. By packing these fields
together, we can pass them as a single contiguous buffer to `AesCcm::Header()`.
This eliminates the need for multiple separate calls to `AesCcm::Header()`
and allows the removal of the generic template-based `Header<ObjectType>()`
method in the `AesCcm` class.

Callers to `ProcessMessageSecurity()` have been updated to populate the
`AesCcmAuthData` structure before passing it for processing.
2026-06-09 08:40:38 -07:00
Abtin Keshavarzian a49c1f5c98 [mle] introduce ComposeMeshLocalAddress() helper method (#13225)
This commit introduces a new `ComposeMeshLocalAddress()` helper method
in the `Mle` class. This method constructs a full IPv6 Address by
combining the Mesh-Local Prefix with a provided Interface Identifier (IID).

By using this helper, we eliminate the repetitive two-step process of
calling `SetPrefix()` followed by `SetIid()` previously scattered across
`Commissioner`, `AddressResolver`, `Child`, and unit tests. This
improves code readability and correctly encapsulates address composition
logic within the `Mle` module.
2026-06-08 20:44:46 -07:00
Abtin Keshavarzian c238bd9a62 [ip6] remove InitAsRoutingLocator and InitAsAnycastLocator (#13222)
This commit replaces `Ip6::Address::InitAsRoutingLocator()` and
the now unused `Ip6::Address::InitAsAnycastLocator()` with the
single unified method `Ip6::Address::InitAsLocator()`.

Callers in `Mle` have been updated to use the unified method.
2026-06-08 19:43:31 -07:00
Abtin Keshavarzian 8abf9667c3 [common] refactor FrameBuilder and FrameData to use templated API (#13216)
This commit refactors the `FrameBuilder` and `FrameData` modules,
replacing multiple distinct endian-specific methods with a unified,
type-safe templated API.

Key changes:
- Introduced `enum Encoding` (`kBigEndian`, `kLittleEndian`) and a
  templated `HostSwap<Encoding, UintType>` helper in `encoding.hpp` to
  centralize byte-swapping logic.
- Replaced `AppendBigEndianUint16()`, `AppendLittleEndianUint32()`,
  and other variations in `FrameBuilder` with a single templated
  method: `AppendUint<Encoding, UintType>()`.
- Replaced `ReadBigEndianUint16()`, `ReadLittleEndianUint32()`,
  and other variations in `FrameData` with a single templated
  method: `ReadUint<Encoding, UintType>()`.
- Updated all callers in `Lowpan` and `Mac` modules to use the new
  templated encoding APIs.
- Updated `test_frame_builder.cpp` to validate the new syntax.
2026-06-08 19:34:19 -07:00
Abtin Keshavarzian 87b971ef96 [child-table] use Array to manage mChildren (#13217)
This commit replaces the raw array `mChildren` in `ChildTable` with
the `Array` class from the common utilities.

By switching to `Array`, we can leverage its built-in array management,
bounds checking, and iterator support. This removes boilerplate code
associated with keeping track of `mMaxChildrenAllowed` and simplifies
methods like `GetChildAtIndex`, `FindChild`, `HasChildren`, and
`GetNumChildren` by using `Array` methods.

Additionally, the commit renames `Neighbor::MatchesFilter()` to simply
`Neighbor::Matches()`, which aligns with the expected indicator matching
API used by `Array` and `LinkedList`.
2026-06-08 19:33:49 -07:00
Jonathan Hui 44f5382330 [mac] update HasCslIe and refactor GetTimeIe for robust IE parsing (#13224)
This commit introduces two robustness improvements to Header Information
Element (IE) parsing in Frame:

1. Aligned HasCslIe() with GetCslIe():
Previously, HasCslIe() returned true if a Header IE matching the CSL ID
was present, regardless of whether its declared content length was valid
(>= 4 bytes). Updating HasCslIe() to check GetCslIe() != nullptr ensures
that presence checks enforce the same length validation as retrieval,
preventing callers from assuming a malformed CSL IE is valid.

2. Robust Multi-Vendor IE Iteration in GetTimeIe():
GetTimeIe() previously retrieved the Vendor IE by matching ID 0x00
using GetHeaderIe(), which returns only the first matching element. If
a frame contained multiple Vendor IEs (e.g., a standard Thread Vendor IE
followed by a Nest Time Vendor IE), GetTimeIe() inspected only the
first element, failed the OUI check, and returned nullptr. GetTimeIe()
is refactored to iterate through all Header IEs until a matching Nest
OUI and Time SubType are found, ensuring correct discovery across
multi-vendor frames.
2026-06-08 19:33:10 -07:00
Esko Dijk 2d602dcd9c [ble] update BLE API docs to make platform's BLE advertising explicit (#12913)
Also, changes term 'method' to correct term 'function'.
2026-06-08 14:47:21 -07:00
Esko Dijk baaf93a74f [tcat][ble] update BLE API with missing error status values and aInterval details (#12913)
Both otPlatBleGapAdvSetData() and otPlatBleGapAdvUpdateData() now have the same set of retvals.
The aInterval parameter is explained better: it's a request/hint to the BLE platform for the
advertising interval, but not a requirement.
2026-06-08 14:47:21 -07:00
Esko Dijk 926dc828d2 [tcat][ble] improve internal state management of ble simulation platform (#12913)
This adds sIsEnabled for more realistic BLE simulation platform behavior. Also
improves internal disconnection state management, per review comments.

Adds asynchronous calling of otPlatBleGapOnDisconnected() to avoid doing the
'disconnected' callback twice, per review comments. A unit test is extended to
verify that the callback happens once.

For test_platform.cpp 2 instances of '#ifdef' are fixed to '#if'.
2026-06-08 14:47:21 -07:00
Esko Dijk ec498f0c0e [tcat][ble] introduce notifier events to update TCAT advertisement data / use bool for advertising state (#12913)
To get an update of TCAT advertisement data when the active dataset changes, notifier events are
introduced. This also refactors the existing adv update on MLE role change to use a notifier event.

This update now covers all cases where an application/CLI/user changes the active dataset, which should
be then reflected in TCAT advertisement flag values.

The 'requested advertising state' is refactored from a BleState to a bool, to make the code more
readable and avoid subtle errors.
2026-06-08 14:47:21 -07:00
Esko Dijk 9403edeaaf [tcat][ble] Fix BLE advertisement contents after Commissioner disconnect (#12913)
This fixes the issue observed in tests, that the BLE advertisement contents (flags) were not updated
after a TCAT Commissioner disconnects. A unit test is added for BLE advertisement contents to
validate the advertisement data changes.

It also adds an explicit 'disconnect' CLI command to the TCAT expect tests, which wasn't tested
before.
2026-06-08 14:47:21 -07:00
Esko Dijk fee7292f15 [tcat][ble] update BLE API and related TCAT agent change to re-enable advertising after disconnect (#12913)
This fixes some ble.h issues and makes explicit that BLE advertising will stop once a client connects.
The TCAT agent is updated to re-enable advertising after a client disconnects (in the default case).
This fixes an issue observed in cert tests. For easier testing in the future, debug log messages are
added for the simulation BLE platform.

The simulation platform (ble.c) is improved to act more like a real BLE platform, by now supporting
client connection state and calling of otPlatBleGapOnConnected() and otPlatBleGapOnDisconnected().
This is required to manually test the TCAT Commissioner/Device flow in Posix simulation.
2026-06-08 14:47:21 -07:00
Adil Burak Şen c801d291b3 [mac] validate Header IE content length before reading IE structs (#13184)
GetThreadIe(), GetCslIe(), and GetTimeIe() read a fixed content struct
(VendorIeHeader / CslIe / TimeIe) at `ie + sizeof(HeaderIe)` after
matching the IE id, without first checking that the IE's Length field
covers that struct. FindPayloadIndex() only guarantees the IE header
plus its declared Length fit within the frame, so a matching IE whose
Length is shorter than the content struct (e.g. a zero-length vendor IE
placed at the end of the header-IE region) causes a read past the IE
content, and past the PSDU buffer when the IE ends at the frame
boundary.

Gate each content read on the IE Length being at least the
corresponding kIeContentSize before dereferencing the struct.
2026-06-08 14:30:09 -07:00
Abtin Keshavarzian 9b180d4c09 [crypto] introduce AesCcm::Nonce for IEEE 802.15.4 nonce (#13208)
This commit introduces the `AesCcm::Nonce` class to represent the IEEE
802.15.4 nonce byte sequence, replacing the previous `GenerateNonce()`
method which operated on a raw byte array.

Replacing `uint8_t *` buffers and `kNonceSize` with a dedicated, packed
`Nonce` class makes the code cleaner and prevents potential buffer size
mismatches at call sites. The new class provides an `InitFrom()` method
to safely initialize the nonce from an extended address, frame counter,
and security level.

All callers in `Mac` (frame transmission and reception) and `Mle`
(message security) have been updated to use the new `Nonce` class.
2026-06-08 14:21:27 -07:00
Jonathan Hui 260f44f2d3 [mesh-forwarder] evict insecure reassembly messages first (#13211)
Enhance `MeshForwarder::EvictMessage` to prioritize evicting messages
from `mReassemblyList` that were received without link security when
reclaiming message buffers (reason `kEvictReasonNoMessageBuffer`).

This helps protect secure messages in the send queue from being
evicted due to buffer exhaustion, by prioritizing the dropping of
insecure, potentially incomplete, reassembled fragments.

Both FTD and MTD implementations of `EvictMessage` are updated.
2026-06-08 13:00:02 -07:00
dependabot[bot] 709a1b00a3 github-actions: bump docker/setup-buildx-action from 3.11.1 to 4.1.0 (#13220)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3.11.1 to 4.1.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/e468171a9de216ec08956ac3ada2f0791b6bd435...d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-08 12:49:39 -07:00
Jonathan Hui 21c983f0fb [github-actions] update codecov-action pin to fb8b358 (v7.0.0) (#13221)
This commit updates the commit hash pin for codecov/codecov-action
from 671740a (v5.5.2) to fb8b358 (v7.0.0) across all CI workflows.

Workflows updated:
- otbr.yml
- posix.yml
- simulation.yml
- toranj.yml
- unit.yml
2026-06-08 11:06:07 -07:00
Abtin Keshavarzian 1316bcebc8 [mle] introduce ComposeRloc() and ComposeAloc() (#13199)
This commit introduces `ComposeRloc()` and `ComposeAloc()` in the `Mle`
module and updates the codebase to use them.

These methods streamline the construction of Routing Locators and
Anycast Locators by automatically combining the Mesh-Local Prefix with
the provided RLOC16 or ALOC16. This centralizes address composition
logic within `Mle` instead of relying on manually formatting
`Ip6::Address` instances across various modules.
2026-06-08 09:12:47 -07:00
Jonathan Hui 318b4b0771 [bbr] remove domain prefix support from stack and harness (#13203)
This commit removes all Domain Prefix configuration and management logic
from the OpenThread stack, CLI commands, unit tests, and GRL harness
THCI wrapper.

- Removed public Backbone Router Domain Prefix APIs.
- Removed Domain Prefix flag ('mDp') and 'D' flag parser/formatter
  from core network data types, Spinel, and CLI.
- Cleaned up local Backbone Router and Leader logic to exclude Domain
  Prefix configuration, tracking, and events.
- Updated RoutingManager prefix advertisement (RIO) to exclude
  special handling for Domain Prefix.
- Updated CLI documentation to remove Domain Prefix references.
- Removed domain prefix helper methods from python test certification
  scripts.
- Removed auto-addition of default domain prefix and D flag support
  from GRL harness OpenThread.py.
2026-06-04 19:36:33 -07:00
Jonathan Hui c4a85578f5 [mle] validate peer extended address in Link Accept (#13207)
This commit ensures that the peer's extended address matches the stored
extended address when receiving a Link Accept for an already valid link,
preventing unintended frame counter resets and neighbor table updates.

To achieve this:
- We validate that the peer's extended address (extracted from the
  IPv6 peer address IID) matches the router's stored extended address
  when processing Link Accepts for a neighbor that is already in the
  kStateValid state. If there is a mismatch, the packet is rejected
  with kErrorSecurity.
- We gate InitNeighbor() and the resetting of MLE frame counters
  so they only execute if the neighbor is not already kStateValid.
  For valid neighbors, we only update link statistics (RSS, last
  heard, link quality, key sequence) and clear the Link Accept
  timeout without modifying the frame counters or average RSS history.
2026-06-04 13:33:07 -07:00
Abtin Keshavarzian b72d7144ee [cli] refactor IPv6 address parsing and synthesis helper (#13205)
This commit renames the static helper `Utils::ParseToIp6Address()` to
`Utils::ParseOrSynthesizeIp6Address()` to better reflect its behavior
of parsing an IPv6 address or synthesizing one from an IPv4 address
via NAT64.

Additionally, the method is refactored into a non-static member of the
`Utils` class. This eliminates the need to manually pass the `otInstance`
pointer, as the `Utils` class already maintains it. The internal
implementation is also simplified to reduce nesting by exiting early
upon successful IPv6 address parsing.

All callers in the CLI module (TCP, UDP, Ping, DNS) have been updated
to use the new member method.
2026-06-03 19:19:25 -07:00
Abtin Keshavarzian b2093f4f9e [dns] check for null character in read label (#13187)
This commit updates `Name::LabelIterator::ReadLabel()` to explicitly
check that the read label from the message does not contain any embedded
`kNullChar` (`\0`) characters. It uses `StringLength()` to verify that
the length of the string matches the expected label length. If a null
character is found before the end of the label, `kErrorParse` is
returned to prevent potential string truncation issues or
misinterpretation of the label name.

This broader check replaces a recent fix in `PtrRecord::ReadPtrName()`
from #13183 which only verified that the first label was not empty
or malformed by checking for a single-character label with a null
byte. By enforcing this validation centrally at the `ReadLabel()`
level, we now ensure that labels of any length are properly
protected against embedded null characters across all DNS record
types.
2026-06-03 14:55:20 -07:00
Abtin Keshavarzian 15e1c233bf [tests] simplify RLOC address creation using GetMeshLocalRloc() (#13198)
This commit refactors several Nexus diagnostic test cases to use the
existing `Mle::GetMeshLocalRloc()` method instead of manually assembling
the RLOC by combining the mesh-local prefix and the node's RLOC16. This
improves code readability and adheres to the standard pattern for
retrieving a node's Routing Locator.
2026-06-03 14:45:42 -07:00
Abtin Keshavarzian 3d7b9fb686 [mle] rename Get{Addr}() to Compose{Addr}() (#13197)
This commit renames several methods in the `Mle` class that construct
an IPv6 address from the mesh-local prefix and an RLOC16/ALOC16 from
`Get...()` to `Compose...()` to better reflect their behavior.

The affected methods are:
- `GetLeaderRloc()` -> `ComposeLeaderRloc()`
- `GetLeaderAloc()` -> `ComposeLeaderAloc()`
- `GetCommissionerAloc()` -> `ComposeCommissionerAloc()`
- `GetServiceAloc()` -> `ComposeServiceAloc()`
2026-06-03 14:42:43 -07:00
Abtin Keshavarzian ab3c6600a0 [icmp6] use Icmp6Header instead of Icmp::Header (#13194)
This commit updates the codebase to use the `Icmp6Header` type
directly, replacing the nested `Ip6::Icmp::Header` definition.
This change aligns the ICMPv6 header type definition with the
conventions used for other network protocol headers and simplifies
type references across the network, border router, and utility
modules.
2026-06-03 14:39:21 -07:00
Jonathan Hui ecd4c92465 [dua] completely remove DUA features and configurations (#13191)
This commit removes the OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE feature
and all associated code, tests, CLI commands, and harness references.

Changes:
- Removed OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE definition and all
  assert/preprocessor checks.
- Completely deleted dua_manager.cpp and dua_manager.hpp.
- Removed DUA registration notifying and request URI paths.
- Cleaned up all references to Domain Unicast Address (DUA) across
  child management, notifier, time ticker, and MLE.
- Removed DUA commands and logic from the CLI and Python cert tests
  (including packet verifier).
- Verified that the entire codebase compiles clean and all tests
  successfully pass using the Nexus test suite.
2026-06-03 12:29:18 -07:00
Jonathan Hui b69c905763 [nexus] fix and update 1_3_SRP_TC_1 integration test (#13200)
This commit updates the SRP registration and verification logic to pass
the 1_3_SRP_TC_1 test case in the Nexus simulator:

1. In test_1_3_SRP_TC_1.cpp, temporarily disable/enable the eth1 DNS-SD
   agent during SRV, AAAA, and browser resolver queries to force a
   clear of the local cache. This ensures the queries are sent over the
   wire to the Border Router (DUT) instead of being answered from the
   resolver's cache.
2. In verify_1_3_SRP_TC_1.py, add checks for mDNS query and response
   packets for Steps 9b, 9c, 15b, and 15c. Relax the Step 15c check to
   not require the ML-EID in the mDNS response, as advertising
   Mesh-Local addresses on the infrastructure link is optional and not
   done by the OpenThread SRP advertising proxy.
2026-06-03 10:55:54 -07:00
Abtin Keshavarzian c410733490 [tcp] add OPENTHREAD_CONFIG_TCP_ENABLE guards to headers (#13195)
This commit wraps the contents of `tcp6.hpp` and `tcp6_ext.hpp` with
`#if OPENTHREAD_CONFIG_TCP_ENABLE` feature guards to ensure that TCP
definitions and types are cleanly excluded when TCP support is disabled
in the build configuration. Additionally, it explicitly disables the
`OPENTHREAD_CONFIG_TCP_ENABLE` feature flag in the Toranj test
configuration to validate building without TCP support.
2026-06-03 08:29:35 -07:00
Jonathan Hui 1b238bffc0 [tests] remove test_trel_connectivity.py (#13196)
This commit removes the deprecated `test_trel_connectivity.py`
integration test. The TREL connectivity test functionality is
already fully covered by the Nexus simulation test suite, which
provides faster and more reliable testing.
2026-06-03 08:06:30 -07:00
Jonathan Hui c01cad7ba2 [nexus] migrate publish meshcop service cert test to nexus (#13186)
This commit migrates the legacy Thread certification test
'test_publish_meshcop_service.py' to the C++ simulation test suite
in the Nexus platform.

To avoid redundancy and keep the test suite clean, the coverage
is consolidated directly within 'tests/nexus/test_border_agent.cpp'
instead of introducing a new redundant test file.

Consolidated coverage and changes:
- Extended the state bitmap parser and 'ValidateMeshCoPTxtData' in
  'test_border_agent.cpp' to verify Backbone Router (BBR) active
  and primary flags (kFlagBbrIsActive, kFlagBbrIsPrimary) when
  OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE is enabled.
- Added a new test block in 'TestBorderAgentServiceRegistration' to
  enable Backbone Router on node0, verify that BBR active and primary
  flags are dynamically advertised in the MeshCoP TXT record over
  mDNS, and verify that disabling BBR correctly updates the TXT
  record state bitmap.
- Fully deleted the legacy Python certification script
  'test_publish_meshcop_service.py' from 'thread-cert'.
2026-06-02 07:46:15 -07:00
Abtin Keshavarzian 7ad13c8adb [ip4] use Icmp4Header directly for ICMPv4 (#13180)
This commit updates the codebase to use the `Icmp4Header` type directly,
replacing the nested `Ip4::Icmp::Header` type. The empty `Ip4::Icmp`
wrapper class is removed to simplify the header definition. This change
aligns the ICMPv4 header structure with the flat naming conventions used
for other IP headers (e.g., `Ip6::Icmp6Header`, `Ip6::UpdHeader`).
2026-06-02 07:45:50 -07:00
dependabot[bot] f6598900cf github-actions: bump docker/build-push-action from 7.1.0 to 7.2.0 (#13188)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 7.1.0 to 7.2.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/bcafcacb16a39f128d818304e6c9c0c18556b85f...f9f3042f7e2789586610d6e8b85c8f03e5195baf)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: 7.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-02 07:33:12 -07:00
Jonathan Hui 136bdb6e2a [dua] remove OPENTHREAD_CONFIG_DUA_ENABLE build feature (#13165)
This commit completely removes the local Domain Unicast Address (DUA)
registration feature flag (OPENTHREAD_CONFIG_DUA_ENABLE) and all of
its associated implementation, public APIs, CLI commands, Spinel
property handlers, and certification tests.

Thread 1.2 FTD Border Router/Router DUA proxying features for MTD
children (OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) are preserved and
updated to only compile/instantiate components when proxy DUA
features are active.

Detailed Changes:
- Remove default definition of OPENTHREAD_CONFIG_DUA_ENABLE from
  misc.h.
- Remove OT_DUA and openthread_config_dua_enable from CMake/GN
  configs.
- Remove otThreadSetFixedDuaInterfaceIdentifier and
  otThreadGetFixedDuaInterfaceIdentifier from
  include/openthread/thread.h
  and implementation src/core/api/thread_api.cpp.
- Remove CLI DUA interpreter from src/cli/cli.cpp.
- Remove SPINEL_CAP_DUA capability and SPINEL_PROP_THREAD_DUA_ID
  Spinel property handlers and dispatchers from NCP.
- Strip local DUA management features (conflict checking, SLAAC DUA
  interface identifiers, and dad info settings) from DuaManager, MLE,
  Address Resolver, and settings.
- Clean up Notifier, TimeTicker, and TMF dispatcher guards.
- Clean up -DOT_DUA=ON compilation flags across build/test scripts.
- Delete obsolete DUA certification tests:
  - v1_2_test_domain_unicast_address
  - v1_2_test_domain_unicast_address_registration
  - v1_2_test_dua_handle_address_error
2026-06-01 15:16:19 -07:00
mohammadmseet-hue 675162556b [mdns] reject empty PTR target label on receive (#13183)
`PtrRecord::ReadPtrName()` reads a PTR target's first label with
`Name::ReadLabel()`, which performs no emptiness check. A response whose
first label is a single NUL byte (wire `01 00`) is stored as an empty
C-string and cached by the browse cache as a service instance. When the
cache later builds a known-answer question, it calls
`Name::AppendLabel("")`, which returns `kErrorInvalidArgs`; the
surrounding `SuccessOrAssert()` turns that into an abort. A single
unauthenticated link-local mDNS response thus crashes any node with an
active browser.

Reject an empty first label in `ReadPtrName()` so the record is dropped
on receive and never cached. This matches the `Name::ValidateLabel`
checks already applied on the registration and resolver paths, and makes
the "ReadPtrName() validates that PTR record is well-formed" comment at
the call site accurate.

Add a regression test that delivers a PTR response with a single
NUL-byte instance label and verifies no result is reported and the
browser keeps querying without the malformed entry.
2026-06-01 13:19:16 -07:00
Abtin Keshavarzian 32b96a0d98 [docs] add missing TCP and UDP Doxygen groups (#13178)
This commit adds the missing Doxygen groups for TCP (`core-tcp`),
TCP Extensions (`core-tcp-ext`), and UDP (`core-udp`). These groups
are used in the code but were not previously defined.
2026-06-01 13:13:33 -07:00
274 changed files with 8577 additions and 6122 deletions
+13 -13
View File
@@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -73,14 +73,14 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Run linkspector
uses: umbrelladocs/action-linkspector@963b6264d7de32c904942a70b488d3407453049e # v1.5.1
uses: umbrelladocs/action-linkspector@6c637d70424624231467a4ca918be54fa3b792d0 # v1.5.4
env:
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
with:
@@ -92,7 +92,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -111,7 +111,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -151,7 +151,7 @@ jobs:
CXX: ${{ matrix.compiler_cpp }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -170,7 +170,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -189,7 +189,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -246,7 +246,7 @@ jobs:
gcc_extract_dir: arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -279,7 +279,7 @@ jobs:
CXX: g++-${{ matrix.gcc_ver }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -312,7 +312,7 @@ jobs:
CXX: clang++-${{ matrix.clang_ver }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -335,7 +335,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -366,7 +366,7 @@ jobs:
CXX: ${{ matrix.CXX }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
+1 -1
View File
@@ -54,7 +54,7 @@ jobs:
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
+5 -5
View File
@@ -61,7 +61,7 @@ jobs:
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -89,12 +89,12 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Build and push by digest
if: success()
id: build
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
file: etc/docker/environment/Dockerfile
platforms: ${{ matrix.platform }}
@@ -125,7 +125,7 @@ jobs:
- build
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -143,7 +143,7 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Docker meta
id: meta
+1 -1
View File
@@ -53,7 +53,7 @@ jobs:
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
+2 -2
View File
@@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
+1 -1
View File
@@ -52,7 +52,7 @@ jobs:
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: block
allowed-endpoints: >
+5 -5
View File
@@ -50,7 +50,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
@@ -82,7 +82,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -118,7 +118,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -150,7 +150,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
@@ -180,7 +180,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
+2 -2
View File
@@ -55,7 +55,7 @@ jobs:
PR_BODY: "${{ github.event.pull_request.body }}"
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -73,7 +73,7 @@ jobs:
rsync -r --exclude=.git --exclude=build --exclude=ot_testing "${OPENTHREAD_DIR}/." third_party/openthread/repo
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Build DinD Runner Image
run: |
+1 -1
View File
@@ -168,7 +168,7 @@ jobs:
script/test combine_coverage
- name: Upload Coverage
continue-on-error: true
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
+2 -2
View File
@@ -58,7 +58,7 @@ jobs:
REAL_DEVICE: 0
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -80,7 +80,7 @@ jobs:
PYTHONPATH=./tests/scripts/thread-cert pytype tools/otci
- name: Build
run: |
./script/cmake-build simulation -DOT_THREAD_VERSION=1.4 -DOT_DUA=ON -DOT_MLR=ON -DOT_BACKBONE_ROUTER=ON \
./script/cmake-build simulation -DOT_THREAD_VERSION=1.4 -DOT_MLR=ON -DOT_BACKBONE_ROUTER=ON \
-DOT_CSL_RECEIVER=ON -DOT_SIMULATION_VIRTUAL_TIME=${VIRTUAL_TIME}
- name: Install OTCI Python Library
run: |
+3 -3
View File
@@ -58,7 +58,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -164,7 +164,7 @@ jobs:
STRESS_LEVEL: ${{ matrix.stress_level }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -214,7 +214,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
+7 -7
View File
@@ -52,7 +52,7 @@ jobs:
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -150,7 +150,7 @@ jobs:
OT_READLINE: 'readline'
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -196,7 +196,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -226,7 +226,7 @@ jobs:
OT_READLINE: 'off'
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -259,7 +259,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -295,7 +295,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -314,7 +314,7 @@ jobs:
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
+6 -6
View File
@@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -103,7 +103,7 @@ jobs:
COVERAGE: 1
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -136,7 +136,7 @@ jobs:
OT_VT_USE_UNIX_SOCKET: 1
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -180,7 +180,7 @@ jobs:
VIRTUAL_TIME: 0
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -231,7 +231,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -250,7 +250,7 @@ jobs:
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
+1 -1
View File
@@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
+6 -6
View File
@@ -59,7 +59,7 @@ jobs:
TORANJ_EVENT_NAME: ${{ github.event_name }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -94,7 +94,7 @@ jobs:
TORANJ_CLI: 1
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -131,7 +131,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -189,7 +189,7 @@ jobs:
runs-on: macos-14
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -212,7 +212,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -231,7 +231,7 @@ jobs:
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
+4 -4
View File
@@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -67,7 +67,7 @@ jobs:
COVERAGE: 1
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -109,7 +109,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
@@ -128,7 +128,7 @@ jobs:
run: |
script/test combine_coverage
- name: Upload Coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
+1 -1
View File
@@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
+1
View File
@@ -215,6 +215,7 @@
* @defgroup plat-radio Radio
* @defgroup plat-settings Settings
* @defgroup plat-spi-slave SPI Slave
* @defgroup plat-tcp TCP - Platform
* @defgroup plat-time Time Service
* @defgroup plat-toolchain Toolchain
* @defgroup plat-trel TREL - Platform
+1 -1
View File
@@ -210,7 +210,6 @@ ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations (
ot_option(OT_DNS_UPSTREAM_QUERY OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE "Allow sending DNS queries to upstream")
ot_option(OT_DNSSD_DISCOVERY_PROXY OPENTHREAD_CONFIG_DNSSD_DISCOVERY_PROXY_ENABLE "DNS-SD discovery proxy")
ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server")
ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)")
ot_option(OT_DYNAMIC_STORE_FRAME_AHEAD_COUNTER OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE "dynamic store frame ahead counter")
ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA")
ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap")
@@ -251,6 +250,7 @@ ot_option(OT_PLATFORM_KEY_REF OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE "
ot_option(OT_PLATFORM_LOG_CRASH_DUMP OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE "platform log crash dump")
ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif")
ot_option(OT_PLATFORM_POWER_CALIBRATION OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE "power calibration")
ot_option(OT_PLATFORM_TCP OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE "Platform TCP")
ot_option(OT_PLATFORM_UDP OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE "platform UDP")
ot_option(OT_REFERENCE_DEVICE OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE "test harness reference device")
ot_option(OT_SEEKER OPENTHREAD_CONFIG_SEEKER_ENABLE "seeker")
-3
View File
@@ -138,9 +138,6 @@ if (openthread_enable_core_config_args) {
# Enable ECDSA support
openthread_config_ecdsa_enable = false
# Enable Domain Unicast Address feature for Thread 1.2
openthread_config_dua_enable = false
# Enable Multicast Listener Registration feature for Thread 1.2
openthread_config_mlr_enable = false
@@ -60,7 +60,6 @@
#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 1
#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 1
#define OPENTHREAD_CONFIG_DUA_ENABLE 1
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 1
#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 1
@@ -59,7 +59,6 @@
#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 0
#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0
#define OPENTHREAD_CONFIG_DUA_ENABLE 1
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 0
#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 0
@@ -59,7 +59,6 @@
#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 0
#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0
#define OPENTHREAD_CONFIG_DUA_ENABLE 1
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 0
#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 0
@@ -90,6 +90,7 @@ add_library(openthread-simulation
simul_utils.c
spi-stubs.c
system.c
tcp.c
trel.c
uart.c
virtual_time/alarm-sim.c
+87 -9
View File
@@ -28,12 +28,15 @@
#include "platform-simulation.h"
#if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <openthread/error.h>
#include <openthread/logging.h>
#include <openthread/tcat.h>
#include <openthread/platform/ble.h>
@@ -43,7 +46,10 @@
#define PLAT_BLE_MSG_DATA_MAX 2048
static uint8_t sBleBuffer[PLAT_BLE_MSG_DATA_MAX];
static int sFd = -1;
static int sFd = -1;
static bool sIsConnected = false;
static bool sIsDisconnecting = false;
static bool sIsEnabled = false;
static const uint16_t kPortBase = 10000;
static uint16_t sPort = 0;
@@ -103,33 +109,59 @@ otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvert
otError otPlatBleEnable(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
initFds();
if (!sIsEnabled)
{
initFds();
sIsEnabled = true;
sIsConnected = false;
sIsDisconnecting = false;
}
return OT_ERROR_NONE;
}
otError otPlatBleDisable(otInstance *aInstance)
{
deinitFds();
OT_UNUSED_VARIABLE(aInstance);
if (sIsEnabled)
{
deinitFds();
sIsEnabled = false;
}
return OT_ERROR_NONE;
}
otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aInterval);
if (sIsConnected || !sIsEnabled)
{
return OT_ERROR_INVALID_STATE;
}
otLogDebgPlat("BLE adv start (interval %u)", aInterval);
return OT_ERROR_NONE;
}
otError otPlatBleGapAdvStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
if (!sIsEnabled)
{
return OT_ERROR_INVALID_STATE;
}
otLogDebgPlat("BLE adv stop");
return OT_ERROR_NONE;
}
otError otPlatBleGapDisconnect(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
if (!sIsConnected)
{
return OT_ERROR_INVALID_STATE;
}
// Only flag the disconnection here. The 'disconnected' event is delivered asynchronously
// by platformBleProcess() (via otPlatBleGapOnDisconnected), per API contract.
sIsDisconnecting = true;
return OT_ERROR_NONE;
}
@@ -164,7 +196,6 @@ void platformBleDeinit(void) { deinitFds(); }
void platformBleUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct timeval *aTimeout, int *aMaxFd)
{
OT_UNUSED_VARIABLE(aTimeout);
OT_UNUSED_VARIABLE(aWriteFdSet);
if (aReadFdSet != NULL && sFd != -1)
@@ -176,6 +207,13 @@ void platformBleUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, struct time
*aMaxFd = sFd;
}
}
// A pending disconnection must be delivered promptly; ensure the main loop does not block.
if (sIsDisconnecting && aTimeout != NULL)
{
aTimeout->tv_sec = 0;
aTimeout->tv_usec = 0;
}
}
void platformBleProcess(otInstance *aInstance, const fd_set *aReadFdSet, const fd_set *aWriteFdSet)
@@ -184,6 +222,14 @@ void platformBleProcess(otInstance *aInstance, const fd_set *aReadFdSet, const f
otEXPECT(sFd != -1);
// Deliver a pending disconnection (requested earlier via otPlatBleGapDisconnect)
if (sIsDisconnecting)
{
sIsConnected = false;
otPlatBleGapOnDisconnected(aInstance, 0);
sIsDisconnecting = false;
}
if (FD_ISSET(sFd, aReadFdSet))
{
socklen_t len = sizeof(sSockaddr);
@@ -193,6 +239,14 @@ void platformBleProcess(otInstance *aInstance, const fd_set *aReadFdSet, const f
if (rval > 0)
{
otBleRadioPacket myPacket;
if (!sIsConnected)
{
sIsConnected = true;
otLogDebgPlat("BLE client connected");
otPlatBleGapOnConnected(aInstance, 0);
}
myPacket.mValue = sBleBuffer;
myPacket.mLength = (uint16_t)rval;
myPacket.mPower = 0;
@@ -211,10 +265,27 @@ void platformBleProcess(otInstance *aInstance, const fd_set *aReadFdSet, const f
DieNow(OT_EXIT_FAILURE);
}
}
exit:
return;
}
/* Weak stubs for callbacks defined in the FTD/MTD core library, not available for RCP targets. */
OT_TOOL_WEAK void otPlatBleGapOnConnected(otInstance *aInstance, uint16_t aConnectionId)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aConnectionId);
assert(false);
}
OT_TOOL_WEAK void otPlatBleGapOnDisconnected(otInstance *aInstance, uint16_t aConnectionId)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aConnectionId);
assert(false);
}
OT_TOOL_WEAK void otPlatBleGattServerOnWriteRequest(otInstance *aInstance,
uint16_t aHandle,
const otBleRadioPacket *aPacket)
@@ -223,9 +294,6 @@ OT_TOOL_WEAK void otPlatBleGattServerOnWriteRequest(otInstance *aIns
OT_UNUSED_VARIABLE(aHandle);
OT_UNUSED_VARIABLE(aPacket);
assert(false);
/* In case of rcp there is a problem with linking to otPlatBleGattServerOnWriteRequest
* which is available in FTD/MTD library.
*/
}
void otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities)
@@ -241,6 +309,10 @@ otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementDat
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aAdvertisementData);
OT_UNUSED_VARIABLE(aAdvertisementLen);
if (!sIsEnabled)
{
return OT_ERROR_INVALID_STATE;
}
return OT_ERROR_NONE;
}
@@ -249,11 +321,17 @@ otError otPlatBleGapAdvUpdateData(otInstance *aInstance, uint8_t *aAdvertisement
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aAdvertisementData);
OT_UNUSED_VARIABLE(aAdvertisementLen);
if (!sIsEnabled)
{
return OT_ERROR_INVALID_STATE;
}
return OT_ERROR_NONE;
}
bool otPlatBleSupportsMultiRadio(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return false;
return true;
}
#endif // OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
+1 -5
View File
@@ -645,7 +645,6 @@ void radioSendMessage(otInstance *aInstance)
{
uint64_t sfdTxTime = otPlatTimeGet();
sRadioContext.mCslPresent = sTransmitFrame.mInfo.mTxInfo.mCslPresent;
otEXPECT(otMacFrameProcessTxSfd(&sTransmitFrame, sfdTxTime, &sRadioContext) == OT_ERROR_NONE);
}
@@ -1061,10 +1060,7 @@ static uint8_t generateAckIeData(uint8_t *aLinkMetricsIeData,
uint8_t offset = 0;
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
sRadioContext.mCslPresent =
(sRadioContext.mCslPeriod > 0) && otMacFrameSrcAddrMatchCslReceiverPeer(aReceivedFrame, &sRadioContext);
if (sRadioContext.mCslPresent)
if ((sRadioContext.mCslPeriod > 0) && otMacFrameSrcAddrMatchCslReceiverPeer(aReceivedFrame, &sRadioContext))
{
offset += otMacFrameGenerateCslIeTemplate(sAckIeData);
}
+71
View File
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2026, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "platform-simulation.h"
#include <openthread/platform/tcp.h>
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE
otError otPlatTcpEnableListener(otPlatTcpListener *aListener, const otPlatTcpSockAddr *aLocalSockAddr)
{
OT_UNUSED_VARIABLE(aListener);
OT_UNUSED_VARIABLE(aLocalSockAddr);
return OT_ERROR_FAILED;
}
void otPlatTcpDisableListener(otPlatTcpListener *aListener) { OT_UNUSED_VARIABLE(aListener); }
otError otPlatTcpConnect(otPlatTcpConnection *aConn,
const otPlatTcpSockAddr *aPeerSockAddr,
const otPlatTcpSockAddr *aLocalSockAddr)
{
OT_UNUSED_VARIABLE(aConn);
OT_UNUSED_VARIABLE(aPeerSockAddr);
OT_UNUSED_VARIABLE(aLocalSockAddr);
return OT_ERROR_FAILED;
}
void otPlatTcpNotifyTxPending(otPlatTcpConnection *aConn) { OT_UNUSED_VARIABLE(aConn); }
uint16_t otPlatTcpSend(otPlatTcpConnection *aConn, const uint8_t *aBuffer, uint16_t aLength)
{
OT_UNUSED_VARIABLE(aConn);
OT_UNUSED_VARIABLE(aBuffer);
OT_UNUSED_VARIABLE(aLength);
return 0;
}
void otPlatTcpClose(otPlatTcpConnection *aConn) { OT_UNUSED_VARIABLE(aConn); }
void otPlatTcpAbort(otPlatTcpConnection *aConn) { OT_UNUSED_VARIABLE(aConn); }
#endif // #if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE
+10 -17
View File
@@ -205,7 +205,7 @@ otError otMacFrameGenerateEnhAck(const otRadioFrame *aFrame,
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
void otMacFrameSetCslIe(otRadioFrame *aFrame, uint16_t aCslPeriod, uint16_t aCslPhase)
{
static_cast<Mac::Frame *>(aFrame)->SetCslIe(aCslPeriod, aCslPhase);
static_cast<Mac::Frame *>(aFrame)->UpdateCslIe(aCslPeriod, aCslPhase);
}
#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
@@ -264,44 +264,37 @@ uint8_t otMacFrameGenerateCslIeTemplate(uint8_t *aDest)
{
assert(aDest != nullptr);
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetId(Mac::CslIe::kHeaderIeId);
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetLength(sizeof(Mac::CslIe));
reinterpret_cast<Mac::CslIe *>(aDest)->Init();
return sizeof(Mac::HeaderIe) + sizeof(Mac::CslIe);
return sizeof(Mac::CslIe);
}
#endif
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
uint8_t otMacFrameGenerateEnhAckProbingIe(uint8_t *aDest, const uint8_t *aIeData, uint8_t aIeDataLength)
{
uint8_t len = sizeof(Mac::VendorIeHeader) + aIeDataLength;
Mac::LinkMetricsProbingIe *probingIe = reinterpret_cast<Mac::LinkMetricsProbingIe *>(aDest);
assert(aDest != nullptr);
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetId(Mac::ThreadIe::kHeaderIeId);
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetLength(len);
aDest += sizeof(Mac::HeaderIe);
reinterpret_cast<Mac::VendorIeHeader *>(aDest)->SetVendorOui(Mac::ThreadIe::kVendorOuiThreadCompanyId);
reinterpret_cast<Mac::VendorIeHeader *>(aDest)->SetSubType(Mac::ThreadIe::kEnhAckProbingIe);
probingIe->Init(aIeDataLength);
if (aIeData != nullptr)
{
aDest += sizeof(Mac::VendorIeHeader);
memcpy(aDest, aIeData, aIeDataLength);
probingIe->WriteMetricsDataFrom(aIeData);
}
return sizeof(Mac::HeaderIe) + len;
return probingIe->GetSize();
}
void otMacFrameSetEnhAckProbingIe(otRadioFrame *aFrame, const uint8_t *aData, uint8_t aDataLen)
{
assert(aFrame != nullptr && aData != nullptr);
reinterpret_cast<Mac::Frame *>(aFrame)->SetEnhAckProbingIe(aData, aDataLen);
reinterpret_cast<Mac::Frame *>(aFrame)->UpdateEnhAckProbingIe(aData, aDataLen);
}
#endif // OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
static uint16_t ComputeCslPhase(uint32_t aRadioTime, otRadioContext *aRadioContext)
{
@@ -411,7 +404,7 @@ otError otMacFrameProcessTxSfd(otRadioFrame *aFrame, uint64_t aRadioTime, otRadi
VerifyOrExit(!otMacFrameIsSecurityEnabled(aFrame) || !aFrame->mInfo.mTxInfo.mIsSecurityProcessed);
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
if (aRadioContext->mCslPresent) // CSL IE should be filled for every transmit attempt
if (static_cast<Mac::Frame *>(aFrame)->Has<Mac::CslIe>()) // CSL IE should be filled for every transmit attempt
{
otMacFrameSetCslIe(aFrame, aRadioContext->mCslPeriod, ComputeCslPhase(aRadioTime, aRadioContext));
}
-1
View File
@@ -349,7 +349,6 @@ typedef struct otRadioContext
uint16_t mCslPeriod; ///< In unit of 10 symbols.
otShortAddress mCslShortAddress; ///< The short address of the CSL receiver's peer.
otExtAddress mCslExtAddress; ///< The extended address of the CSL receiver's peer.
bool mCslPresent : 1; ///< Indicates whether the CSL header IE is present.
otShortAddress mShortAddress;
otShortAddress mAlternateShortAddress;
otRadioKeyType mKeyType;
+1
View File
@@ -112,6 +112,7 @@ source_set("openthread") {
"platform/radio.h",
"platform/settings.h",
"platform/spi-slave.h",
"platform/tcp.h",
"platform/time.h",
"platform/toolchain.h",
"platform/trel.h",
-43
View File
@@ -43,7 +43,6 @@
#include <openthread/error.h>
#include <openthread/instance.h>
#include <openthread/ip6.h>
#include <openthread/netdata.h>
#ifdef __cplusplus
extern "C" {
@@ -175,17 +174,6 @@ uint8_t otBackboneRouterGetRegistrationJitter(otInstance *aInstance);
*/
void otBackboneRouterSetRegistrationJitter(otInstance *aInstance, uint8_t aJitter);
/**
* Gets the local Domain Prefix configuration.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aConfig A pointer to the Domain Prefix configuration.
*
* @retval OT_ERROR_NONE Successfully got the Domain Prefix configuration.
* @retval OT_ERROR_NOT_FOUND No Domain Prefix was configured.
*/
otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterConfig *aConfig);
/**
* Configures the response status for the next Multicast Listener Registration.
*
@@ -300,37 +288,6 @@ otError otBackboneRouterMulticastListenerGetNext(otInstance
otBackboneRouterMulticastListenerIterator *aIterator,
otBackboneRouterMulticastListenerInfo *aListenerInfo);
/**
* Represents the Domain Prefix events.
*/
typedef enum
{
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED = 0, ///< Domain Prefix was added.
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED = 1, ///< Domain Prefix was removed.
OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED = 2, ///< Domain Prefix was changed.
} otBackboneRouterDomainPrefixEvent;
/**
* Pointer is called whenever the Domain Prefix changed.
*
* @param[in] aContext The user context pointer.
* @param[in] aEvent The Domain Prefix event.
* @param[in] aDomainPrefix The new Domain Prefix if added or changed, NULL otherwise.
*/
typedef void (*otBackboneRouterDomainPrefixCallback)(void *aContext,
otBackboneRouterDomainPrefixEvent aEvent,
const otIp6Prefix *aDomainPrefix);
/**
* Sets the Backbone Router Domain Prefix callback.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aCallback A pointer to the Domain Prefix callback.
* @param[in] aContext A user context pointer.
*/
void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance,
otBackboneRouterDomainPrefixCallback aCallback,
void *aContext);
/**
* @}
*/
+2 -2
View File
@@ -42,6 +42,7 @@
#include <openthread/dataset.h>
#include <openthread/error.h>
#include <openthread/ip6.h>
#include <openthread/netdiag.h>
#include <openthread/platform/radio.h>
#ifdef __cplusplus
@@ -61,7 +62,6 @@ extern "C" {
#define OT_BORDER_AGENT_THREAD_VERSION_SIZE (16) ///< Max size of Thread Version string in `otBorderAgentTxtDataInfo`.
#define OT_BORDER_AGENT_VENDOR_NAME_SIZE (32) ///< Max size of Vendor Name string in `otBorderAgentTxtDataInfo`.
#define OT_BORDER_AGENT_MODEL_NAME_SIZE (32) ///< Max size of Model Name string in `otBorderAgentTxtDataInfo`.
#define OT_BORDER_AGENT_VENDOR_OUI_SIZE (3) ///< Size of Vendor OUI (in bytes) in `otBorderAgentTxtDataInfo`.
/**
* Represents the Connection Mode in a Border Agent State Bitmap.
@@ -169,7 +169,7 @@ typedef struct otBorderAgentTxtDataInfo
otExtAddress mExtAddress; ///< Extended Address.
char mVendorName[OT_BORDER_AGENT_VENDOR_NAME_SIZE]; ///< Vendor Name string.
char mModelName[OT_BORDER_AGENT_MODEL_NAME_SIZE]; ///< Model Name string.
uint8_t mVendorOui[OT_BORDER_AGENT_VENDOR_OUI_SIZE]; ///< Vendor OUI (24-bit).
otThreadVendorOui mVendorOui; ///< Vendor OUI.
} otBorderAgentTxtDataInfo;
/**
-2
View File
@@ -603,7 +603,6 @@ otError otBorderRoutingGetNextRouterEntry(otInstance *aI
*
* - 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.
*
@@ -629,7 +628,6 @@ otError otBorderRoutingGetNextPeerBrEntry(otInstance *
*
* - 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.
*
+1 -1
View File
@@ -52,7 +52,7 @@ extern "C" {
*
* @note This number versions both OpenThread platform and user APIs.
*/
#define OPENTHREAD_API_VERSION (601)
#define OPENTHREAD_API_VERSION (609)
/**
* @addtogroup api-instance
+78 -3
View File
@@ -41,6 +41,7 @@
#include <openthread/error.h>
#include <openthread/instance.h>
#include <openthread/ip6.h>
#include <openthread/netdiag.h>
#include <openthread/thread.h>
#include <openthread/platform/radio.h>
@@ -62,11 +63,15 @@ extern "C" {
/**
* Represents the set of configurations used when discovering mesh topology indicating which items to
* discover.
*
* The `mExtraTlvTypes` pointer can be NULL if `mExtraTlvTypesLength` is zero.
*/
typedef struct otMeshDiagDiscoverConfig
{
bool mDiscoverIp6Addresses : 1; ///< Whether or not to discover IPv6 addresses of every router.
bool mDiscoverChildTable : 1; ///< Whether or not to discover children of every router.
bool mDiscoverIp6Addresses : 1; ///< Whether or not to discover IPv6 addresses of every router.
bool mDiscoverChildTable : 1; ///< Whether or not to discover children of every router.
const uint8_t *mExtraTlvTypes; ///< An array of extra Net Diag TLV types to request from every router.
uint8_t mExtraTlvTypesLength; ///< The length of the `mExtraTlvTypes` array. Can be zero.
} otMeshDiagDiscoverConfig;
/**
@@ -83,6 +88,18 @@ typedef struct otMeshDiagIp6AddrIterator otMeshDiagIp6AddrIterator;
*/
typedef struct otMeshDiagChildIterator otMeshDiagChildIterator;
/**
* An opaque iterator to iterate over the list of extra Network Diagnostic TLVs returned by a router.
*
* Pointers to instances of this type are provided in `otMeshDiagRouterInfo`.
*/
typedef struct otMeshDiagTlvIterator otMeshDiagTlvIterator;
/**
* Represents information about a parsed Network Diagnostic TLV.
*/
typedef otNetworkDiagTlv otMeshDiagTlvInfo;
/**
* Specifies that Thread Version is unknown.
*
@@ -136,6 +153,16 @@ typedef struct otMeshDiagRouterInfo
* if the router did not provide the list.
*/
otMeshDiagChildIterator *mChildIterator;
/**
* A pointer to an iterator to go through the list of extra Network Diagnostic TLVs returned by the router.
*
* The pointer is valid only while `otMeshDiagRouterInfo` is valid. It can be used in `otMeshDiagGetNextTlvInfo`
* to iterate through the extra TLVs returned by the router.
*
* The pointer may be NULL if there are no extra TLVs (in `otMeshDiagDiscoverConfig`).
*/
otMeshDiagTlvIterator *mTlvIterator;
} otMeshDiagRouterInfo;
/**
@@ -168,6 +195,39 @@ typedef void (*otMeshDiagDiscoverCallback)(otError aError, otMeshDiagRouterInfo
/**
* Starts network topology discovery.
*
* This function initiates a query to discover routers in the Thread network.
*
* The @p aConfig configuration controls what optional topology information is discovered:
* - If `mDiscoverIp6Addresses` is set to true, the list of IPv6 addresses for each router is discovered.
* - If `mDiscoverChildTable` is set to true, the list of children for each router is discovered.
*
* The @p aConfig parameter can be used to request additional standard Network Diagnostic TLVs to be retrieved from
* each discovered router during topology discovery. These extra TLVs can then be accessed via the `mTlvIterator` in
* the callback's router info.
*
* The following restrictions and recommendations apply to the use of `mExtraTlvTypes`:
* - It MUST NOT contain any of the TLV types that are already requested by the discovery process itself.
* These are:
* - `OT_NETWORK_DIAGNOSTIC_TLV_SHORT_ADDRESS`
* - `OT_NETWORK_DIAGNOSTIC_TLV_EXT_ADDRESS`
* - `OT_NETWORK_DIAGNOSTIC_TLV_ROUTE`
* - `OT_NETWORK_DIAGNOSTIC_TLV_VERSION`
* - `OT_NETWORK_DIAGNOSTIC_TLV_IP6_ADDR_LIST`
* - `OT_NETWORK_DIAGNOSTIC_TLV_CHILD_TABLE`
* If any of these types are included in @p aConfig.mExtraTlvTypes, `OT_ERROR_INVALID_ARGS` is returned.
* - The total number of requested TLV types is limited to 32. This limit applies to all TLV types combined, including
* those automatically added by the discovery process and any additional TLVs specified by the caller in
* `mExtraTlvTypes`. If the total count exceeds this limit, `OT_ERROR_NO_BUFS` is returned.
* - It is highly recommended to keep the number of additional TLVs small. Requesting many or large TLVs increases the
* size of the Network Diagnostics responses, which can cause message fragmentation, higher network traffic, or
* response packet drops.
* - Additional TLVs should be restricted to small metadata elements useful during topology discovery (for example,
* `OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_NAME`, `OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_MODEL`, etc).
* For retrieving larger information (like counters, etc.), separate individual queries should be sent to specific
* nodes instead of using this method.
* - The @p aConfig struct and the memory pointed to by its @p mExtraTlvTypes array do not need to persist beyond
* the call to this function.
*
* @param[in] aInstance The OpenThread instance.
* @param[in] aConfig The configuration to use for discovery (e.g., which items to discover).
* @param[in] aCallback The callback to report the discovered routers.
@@ -176,7 +236,8 @@ typedef void (*otMeshDiagDiscoverCallback)(otError aError, otMeshDiagRouterInfo
* @retval OT_ERROR_NONE The network topology discovery started successfully.
* @retval OT_ERROR_BUSY A previous discovery request is still ongoing.
* @retval OT_ERROR_INVALID_STATE Device is not attached.
* @retval OT_ERROR_NO_BUFS Could not allocate buffer to send discovery messages.
* @retval OT_ERROR_NO_BUFS Could not allocate buffer to send discovery messages or too many extra TLVs.
* @retval OT_ERROR_INVALID_ARGS Invalid @p aConfig (e.g., includes restricted extra TLVs as listed above).
*/
otError otMeshDiagDiscoverTopology(otInstance *aInstance,
const otMeshDiagDiscoverConfig *aConfig,
@@ -220,6 +281,20 @@ otError otMeshDiagGetNextIp6Address(otMeshDiagIp6AddrIterator *aIterator, otIp6A
*/
otError otMeshDiagGetNextChildInfo(otMeshDiagChildIterator *aIterator, otMeshDiagChildInfo *aChildInfo);
/**
* Iterates through the discovered extra Network Diagnostic TLVs of a router.
*
* This function MUST be used from the callback `otMeshDiagDiscoverCallback()` and use the `mTlvIterator` from the
* `aRouterInfo` struct that is provided as input to the callback.
*
* @param[in,out] aIterator The TLV iterator to use.
* @param[out] aTlvInfo A pointer to return the extra TLV info (if any).
*
* @retval OT_ERROR_NONE Successfully retrieved the next extra TLV. @p aTlvInfo and @p aIterator are updated.
* @retval OT_ERROR_NOT_FOUND No more extra TLVs. Reached the end of the list.
*/
otError otMeshDiagGetNextTlvInfo(otMeshDiagTlvIterator *aIterator, otMeshDiagTlvInfo *aTlvInfo);
/**
* Represents information about a child entry from `otMeshDiagQueryChildTable()`.
*
+1 -1
View File
@@ -73,7 +73,7 @@ typedef struct otBorderRouterConfig
bool mOnMesh : 1; ///< Whether this prefix is considered on-mesh.
bool mStable : 1; ///< Whether this configuration is considered Stable Network Data.
bool mNdDns : 1; ///< Whether this border router can supply DNS information via ND.
bool mDp : 1; ///< Whether prefix is a Thread Domain Prefix (added since Thread 1.2).
bool mDp : 1; ///< Reserved (previously Thread Domain Prefix flag).
uint16_t mRloc16; ///< The border router's RLOC16 (value ignored on config add).
} otBorderRouterConfig;
+109 -18
View File
@@ -94,6 +94,7 @@ extern "C" {
#define OT_NETWORK_DIAGNOSTIC_TLV_BR_DHCP6_PD_OMR_PREFIX 41 ///< Border Router DHCPv6-PD OMR Prefix TLV
#define OT_NETWORK_DIAGNOSTIC_TLV_BR_LOCAL_OL_PREFIX 42 ///< Border Router Local On-link Prefix TLV
#define OT_NETWORK_DIAGNOSTIC_TLV_BR_FAVORED_OL_PREFIX 43 ///< Border Router Favored On-link Prefix TLV
#define OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_OUI 44 ///< Vendor OUI TLV
#define OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_NAME_TLV_LENGTH 32 ///< Max length of Vendor Name TLV.
#define OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_MODEL_TLV_LENGTH 32 ///< Max length of Vendor Model TLV.
@@ -273,6 +274,50 @@ typedef struct otNetworkDiagChildTable
*/
typedef otBorderRoutingState otNetworkDiagBrState;
/**
* Specifies the maximum size of a Thread Vendor OUI in bytes.
*/
#define OT_THREAD_VENDOR_OUI_MAX_SIZE 5
/**
* Specifies the bit length of a MAC Address Block Large (MA-L) Vendor OUI.
*/
#define OT_THREAD_VENDOR_OUI_MA_L_BIT_LENGTH 24
/**
* Specifies the bit length of a MAC Address Block Medium (MA-M) Vendor OUI.
*/
#define OT_THREAD_VENDOR_OUI_MA_M_BIT_LENGTH 28
/**
* Specifies the bit length of a MAC Address Block Small (MA-S) Vendor OUI.
*/
#define OT_THREAD_VENDOR_OUI_MA_S_BIT_LENGTH 36
/**
* Represents a Thread Vendor OUI (Organizationally Unique Identifier) which can have different lengths.
*
* A Vendor OUI can be assigned in one of the following formats:
*
* - 24-bit Prefix (MA-L): Exactly 3 bytes (24 bits).
* Example: `00-1A-2B` is represented with `mBitLength = 24` and `mBytes = [0x00, 0x1A, 0x2B, 0x00, 0x00]`.
*
* - 28-bit Prefix (MA-M): Exactly 3.5 bytes (28 bits).
* The half-byte (4 bits) at the end of the prefix occupies the Most Significant Nibble of the 4th byte.
* The Least Significant Nibble of the 4th byte is set to zero.
* Example: `00-1A-2B-3` is represented with `mBitLength = 28` and `mBytes = [0x00, 0x1A, 0x2B, 0x30, 0x00]`.
*
* - 36-bit Prefix (MA-S): Exactly 4.5 bytes (36 bits).
* The half-byte (4 bits) at the end of the prefix occupies the Most Significant Nibble of the 5th byte.
* The Least Significant Nibble of the 5th byte is set to zero.
* Example: `00-1A-2B-3C-4` is represented with `mBitLength = 36` and `mBytes = [0x00, 0x1A, 0x2B, 0x3C, 0x40]`.
*/
typedef struct otThreadVendorOui
{
uint8_t mBitLength; ///< The OUI prefix length in bits (24, 28, or 36).
uint8_t mBytes[OT_THREAD_VENDOR_OUI_MAX_SIZE]; ///< The OUI bytes in big-endian order.
} otThreadVendorOui;
/**
* Represents a Network Diagnostic TLV.
*/
@@ -304,6 +349,7 @@ typedef struct otNetworkDiagTlv
char mVendorSwVersion[OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_SW_VERSION_TLV_LENGTH + 1];
char mThreadStackVersion[OT_NETWORK_DIAGNOSTIC_MAX_THREAD_STACK_VERSION_TLV_LENGTH + 1];
char mVendorAppUrl[OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_APP_URL_TLV_LENGTH + 1];
otThreadVendorOui mVendorOui;
otChannelMask mNonPreferredChannels;
otNetworkDiagData mChannelPages;
otNetworkDiagChildTable mChildTable;
@@ -426,19 +472,78 @@ const char *otThreadGetVendorSwVersion(otInstance *aInstance);
const char *otThreadGetVendorAppUrl(otInstance *aInstance);
/**
* Represents an unspecified Vendor OUI.
* Gets the vendor OUI.
*
* If no vendor OUI is yet set/configured on device, the `mBitLength` in @p aOui will be zero.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aOui A pointer to an `otThreadVendorOui` to return the vendor OUI.
*/
#define OT_THREAD_UNSPECIFIED_VENDOR_OUI (0xffffffff)
void otThreadGetVendorOuiInfo(otInstance *aInstance, otThreadVendorOui *aOui);
/**
* Get the vendor OUI-24
* Sets the vendor OUI.
*
* Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aOui A pointer to the `otThreadVendorOui` to set.
*
* @retval OT_ERROR_NONE Successfully set the vendor OUI.
* @retval OT_ERROR_INVALID_ARGS @p aOui has an invalid length.
*/
otError otThreadSetVendorOuiInfo(otInstance *aInstance, const otThreadVendorOui *aOui);
#define OT_THREAD_VENDOR_OUI_STRING_SIZE 16 ///< Recommended size for string representation of a vendor OUI.
/**
* Converts a given vendor OUI to a human-readable string.
*
* The generated string format is hyphen-separated uppercase hexadecimal bytes (e.g., "00-1A-2B" for a 24-bit OUI).
* For 28-bit and 36-bit OUIs, the trailing 4-bit nibble is appended as a single hexadecimal digit (e.g., "00-1A-2B-3"
* for a 28-bit OUI). If @p aOui is invalid or unspecified, the string "unspecified" is returned.
*
* 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.
*
* @param[in] aOui The vendor OUI to convert.
* @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be NULL).
* @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_THREAD_VENDOR_OUI_STRING_SIZE`.
*/
void otThreadVendorOuiToString(const otThreadVendorOui *aOui, char *aBuffer, uint16_t aSize);
#define OT_THREAD_UNSPECIFIED_VENDOR_OUI (0xffffffff) ///< Represents an unspecified Vendor OUI.
/**
* Gets the vendor OUI-24.
*
* @deprecated This function is deprecated. Use `otThreadGetVendorOuiInfo()` instead.
*
* If the configured Vendor OUI has a prefix length greater than 24 bits, this function returns the most significant
* 24 bits (first 3 bytes) of the OUI to maintain backward compatibility.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @returns The vendor OUI-24 value in hex format, or `OT_THREAD_UNSPECIFIED_VENDOR_OUI` is not specified.
* @returns The vendor OUI-24 value, or `OT_THREAD_UNSPECIFIED_VENDOR_OUI` if not specified.
*/
uint32_t otThreadGetVendorOui(otInstance *aInstance);
/**
* Sets the vendor OUI-24.
*
* @deprecated This function is deprecated. Use `otThreadSetVendorOuiInfo()` instead.
*
* Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aVendorOui The vendor OUI-24 value in Hexadecimal representation (e.g., OUI 64-16-66 is represented as
* `0x641666`). Must be a 24-bit value.
*
* @retval OT_ERROR_NONE Successfully set the vendor OUI.
* @retval OT_ERROR_INVALID_ARGS @p aVendorOui is not a valid 24-bit value.
*/
otError otThreadSetVendorOui(otInstance *aInstance, uint32_t aVendorOui);
/**
* Set the vendor name string.
*
@@ -508,20 +613,6 @@ otError otThreadSetVendorSwVersion(otInstance *aInstance, const char *aVendorSwV
*/
otError otThreadSetVendorAppUrl(otInstance *aInstance, const char *aVendorAppUrl);
/**
* Set the vendor OUI-24.
*
* Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aVendorOui The vendor OUI-24 value in Hexadecimal representation (e.g., OUI 64-16-66 is represented as
* `0x641666`). Must be a 24-bit value.
*
* @retval OT_ERROR_NONE Successfully set the vendor OUI.
* @retval OT_ERROR_INVALID_ARGS @p aVendorOui is not a valid 24-bit value.
*/
otError otThreadSetVendorOui(otInstance *aInstance, uint32_t aVendorOui);
/**
* Callback function pointer to notify when a Network Diagnostic Reset request message is received for the
* `OT_NETWORK_DIAGNOSTIC_TLV_NON_PREFERRED_CHANNELS` TLV.
+44 -31
View File
@@ -74,10 +74,10 @@ extern "C" {
#define OT_BLE_ADV_INTERVAL_MAX 0x4000
/**
* Default interval for advertising packet (ms).
* Default interval for advertising packet in OT_BLE_ADV_INTERVAL_UNIT units (100 ms).
*/
#define OT_BLE_ADV_INTERVAL_DEFAULT 100
#define OT_BLE_ADV_INTERVAL_DEFAULT 160
/**
* Unit used to calculate interval duration (0.625ms).
@@ -104,13 +104,13 @@ extern "C" {
#define OT_BLE_ATT_MTU_DEFAULT 23
/**
* Default power value for BLE.
* Default Tx power value for BLE in dBm.
*/
#define OT_BLE_DEFAULT_POWER 0
/**
* TOBLE service UUID
* ToBLE service UUID (a GATT service UUID for Thread over BLE)
*/
#define OT_TOBLE_SERVICE_UUID 0xfffb
@@ -130,7 +130,7 @@ typedef struct otBleLinkCapabilities
*/
typedef struct otBleRadioPacket
{
uint8_t *mValue; ///< The value of an attribute
uint8_t *mValue; ///< Pointer to the packet data
uint16_t mLength; ///< Length of the @p mValue.
int8_t mPower; ///< Transmit/receive power in dBm.
} otBleRadioPacket;
@@ -171,18 +171,16 @@ otError otPlatBleDisable(otInstance *aInstance);
* @section Bluetooth Low Energy GAP.
***************************************************************************/
/**
* Gets BLE Advertising buffer.
* Gets a platform-provided buffer for BLE advertising data.
*
* @note This function shall be used only for BLE Peripheral role.
* Returned buffer should have enough space to fit max advertisement
* defined by specification.
* The platform must provide a buffer of at least @p OT_TCAT_ADVERTISEMENT_MAX_LEN bytes.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aAdvertisementData The formatted TCAT advertisement frame.
* @param[in] aAdvertisementLen The TCAT advertisement frame length.
* @param[in] aInstance The OpenThread instance structure.
* @param[out] aAdvertisementBuffer A pointer to be set to the platform-provided advertisement buffer.
*
* @retval OT_ERROR_NONE Advertising procedure has been started.
* @retval OT_ERROR_NO_BUFS No bufferspace available.
* @retval OT_ERROR_NONE Successfully retrieved the advertisement buffer.
* @retval OT_ERROR_NO_BUFS No buffer space available.
*/
otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvertisementBuffer);
@@ -190,13 +188,15 @@ otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvert
* Sets BLE Advertising data.
*
* @note This function shall be used only for BLE Peripheral role.
* It shall only be called while advertising is not active.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aAdvertisementData The formatted TCAT advertisement frame.
* @param[in] aAdvertisementLen The TCAT advertisement frame length.
* @param[in] aAdvertisementLen The length of the @p aAdvertisementData frame.
*
* @retval OT_ERROR_NONE Advertising procedure has been started.
* @retval OT_ERROR_NONE Advertising data set successfully.
* @retval OT_ERROR_INVALID_STATE BLE Device is in invalid state.
* @retval OT_ERROR_FAILED Setting of data failed.
* @retval OT_ERROR_INVALID_ARGS Invalid value has been supplied.
*/
otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementData, uint16_t aAdvertisementLen);
@@ -205,12 +205,14 @@ otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementDat
* Updates BLE Advertising data.
*
* @note This function shall be used only for BLE Peripheral role.
* It shall only be called while advertising is active.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aAdvertisementData The formatted TCAT advertisement frame.
* @param[in] aAdvertisementLen The TCAT advertisement frame length.
* @param[in] aAdvertisementLen The length of the @p aAdvertisementData frame.
*
* @retval OT_ERROR_NONE Advertising procedure has been started.
* @retval OT_ERROR_NONE Advertising data updated successfully.
* @retval OT_ERROR_INVALID_STATE BLE Device is in invalid state.
* @retval OT_ERROR_FAILED Update of data failed.
* @retval OT_ERROR_INVALID_ARGS Invalid value has been supplied.
*/
@@ -222,11 +224,15 @@ otError otPlatBleGapAdvUpdateData(otInstance *aInstance, uint8_t *aAdvertisement
* The BLE device shall use undirected advertising with no filter applied.
* A single BLE Advertising packet must be sent on all advertising
* channels (37, 38 and 39).
* The advertising shall remain active until either otPlatBleGapAdvStop() is
* called or a BLE Central Device connects (otPlatBleGapOnConnected()).
* The BLE platform is not obliged to exactly match the requested interval
* between subsequent advertising packets: it is a requested/desired value.
*
* @note This function shall be used only for BLE Peripheral role.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aInterval The interval between subsequent advertising packets
* @param[in] aInterval The requested interval between subsequent advertising packets
* in OT_BLE_ADV_INTERVAL_UNIT units.
* Shall be within OT_BLE_ADV_INTERVAL_MIN and
* OT_BLE_ADV_INTERVAL_MAX range or OT_BLE_ADV_INTERVAL_DEFAULT
@@ -251,8 +257,8 @@ otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval);
otError otPlatBleGapAdvStop(otInstance *aInstance);
/**
* The BLE driver calls this method to notify OpenThread that a BLE Central Device has
* been connected.
* The BLE driver calls this function to notify OpenThread that a BLE Central Device has
* been connected. The BLE driver MUST stop advertising before calling this function.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aConnectionId The identifier of the open connection.
@@ -260,8 +266,9 @@ otError otPlatBleGapAdvStop(otInstance *aInstance);
extern void otPlatBleGapOnConnected(otInstance *aInstance, uint16_t aConnectionId);
/**
* The BLE driver calls this method to notify OpenThread that the BLE Central Device
* has been disconnected.
* The BLE driver calls this function to notify OpenThread that the BLE Central Device
* has been disconnected. The BLE driver MUST NOT start advertising before or after this
* call: this is controlled explicitly via otPlatBleGapAdvStart().
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aConnectionId The identifier of the closed connection.
@@ -272,7 +279,11 @@ extern void otPlatBleGapOnDisconnected(otInstance *aInstance, uint16_t aConnecti
* Disconnects BLE connection.
*
* The BLE device shall use the Remote User Terminated Connection (0x13) reason
* code when disconnecting from the peer BLE device..
* code when disconnecting from the peer BLE device.
*
* This function only triggers the disconnection procedure. When OT_ERROR_NONE is returned,
* the platform MUST report completion of the disconnection asynchronously, by invoking
* otPlatBleGapOnDisconnected().
*
* @param[in] aInstance The OpenThread instance structure.
*
@@ -297,7 +308,7 @@ otError otPlatBleGapDisconnect(otInstance *aInstance);
otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu);
/**
* The BLE driver calls this method to notify OpenThread that ATT_MTU has been updated.
* The BLE driver calls this function to notify OpenThread that ATT_MTU has been updated.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aMtu The updated ATT_MTU value. It MUST be >=OT_BLE_ATT_MTU_MIN.
@@ -315,7 +326,7 @@ extern void otPlatBleGattOnMtuUpdate(otInstance *aInstance, uint16_t aMtu);
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aHandle The handle of the attribute to be indicated.
* @param[in] aPacket A pointer to the packet contains value to be indicated.
* @param[in] aPacket A pointer to the packet containing the value to be indicated.
*
* @retval OT_ERROR_NONE ATT Handle Value Indication has been sent.
* @retval OT_ERROR_INVALID_STATE BLE Device is in invalid state.
@@ -325,29 +336,31 @@ extern void otPlatBleGattOnMtuUpdate(otInstance *aInstance, uint16_t aMtu);
otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket);
/**
* The BLE driver calls this method to notify OpenThread that an ATT Write Request
* The BLE driver calls this function to notify OpenThread that an ATT Write Request
* packet has been received.
*
* @note This function shall be used only for GATT Server.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aHandle The handle of the attribute to be written.
* @param[in] aPacket A pointer to the packet contains value to be written to the attribute.
* @param[in] aPacket A pointer to the packet containing the value to be written to the attribute.
*/
extern void otPlatBleGattServerOnWriteRequest(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket);
/**
* Function to retrieve from platform BLE link capabilities.
* Retrieve BLE link capabilities from the platform.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[out] aBleLinkCapabilities The pointer to retrieve the BLE ling capabilities.
* @param[out] aBleLinkCapabilities The pointer to retrieve the BLE link capabilities into.
*/
void otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities);
/**
* Function to retrieve from platform multiradio support of BLE and IEEE.
* Check if the platform has multi-radio support for BLE and IEEE 802.15.4.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aInstance The OpenThread instance structure.
*
* @returns TRUE if the platform supports simultaneous BLE and IEEE 802.15.4 operation, FALSE otherwise.
*/
bool otPlatBleSupportsMultiRadio(otInstance *aInstance);
/**
+439
View File
@@ -0,0 +1,439 @@
/*
* Copyright (c) 2026, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* @brief
* This file includes the abstraction for the platform TCP
*/
#ifndef OPENTHREAD_PLATFORM_TCP_H_
#define OPENTHREAD_PLATFORM_TCP_H_
#include <stdbool.h>
#include <stdint.h>
#include <openthread/error.h>
#include <openthread/instance.h>
#include <openthread/ip6.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup plat-tcp
*
* @brief
* This module includes the platform abstraction for TCP connections and listeners.
*
* All APIs in this module are applicable only when `OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE` feature is enabled.
*
* @{
*/
/**
* Represents platform-specific data associated with a connection or a listener.
*
* This union is provided to add flexibility for the platform. A platform can choose to store a file descriptor
* (e.g., an `int` for a POSIX socket) or a pointer to an arbitrary context or state structure needed by the
* platform implementation.
*
* The OpenThread stack guarantees that the `otPlatTcpPlatformData` is fully cleared (all bytes set to zero) when a
* new listener or connection instance is initialized.
*
* For an `otPlatTcpListener`, the `otPlatTcpEnableListener()` call provides an opportunity for the platform to allocate
* or update this information. The OpenThread stack guarantees that `otPlatTcpDisableListener()` will be invoked on any
* previously enabled listener, providing a deterministic point for the platform implementation to perform cleanup
* (e.g., deallocating memory or context structures).
*
* For an `otPlatTcpConnection`, the `otPlatTcpConnect()` call or the `otPlatTcpAccept()` callback indicate when a new
* connection instance is provided, allowing the platform data to be initialized. The platform is responsible for
* cleaning up this data either before invoking `otPlatTcpHandleDisconnected()` (which invalidates the connection) or
* from an `otPlatTcpAbort()` call. The OpenThread stack guarantees that it will eventually disconnect or abort any
* active connection, ensuring a reliable cleanup path.
*/
typedef union
{
int mDescriptor; ///< A value (like a file descriptor).
void *mContext; ///< Pointer to arbitrary platform data.
} otPlatTcpPlatformData;
/**
* Represents a TCP listener.
*
* The OpenThread core owns and manages the `otPlatTcpListener` instances. The platform should track the pointers
* to these instances and use them when invoking the callbacks. The `otPlatTcpListener *` can be viewed as
* a "descriptor" or "handle" to the listener.
*/
typedef struct otPlatTcpListener
{
otPlatTcpPlatformData mData; ///< Platform implementation specific data.
} otPlatTcpListener;
/**
* Represents a TCP connection.
*
* The OpenThread core owns and manages the `otPlatTcpConnection` instances. The platform should track the pointers
* to these instances and pass them when invoking the `otPlatTcpHandle*` callbacks. The `otPlatTcpConnection *` can
* be viewed as a "descriptor" or "handle" to the connection.
*
* The `otPlatTcpConnection` instance remains valid as long as the connection is active.
*/
typedef struct otPlatTcpConnection
{
otPlatTcpPlatformData mData; ///< Platform implementation specific data.
} otPlatTcpConnection;
/**
* Represents a TCP socket address.
*/
typedef struct otPlatTcpSockAddr
{
otSockAddr mSockAddr; ///< The socket address (IP address and port number). Use IPv4-mapped IPv6 for IPv4.
uint32_t mIfIndex; ///< Interface index. Zero indicates any/unspecified.
} otPlatTcpSockAddr;
/**
* Defines the reason for a TCP connection disconnection.
*/
typedef enum otPlatTcpDisconnectReason
{
OT_PLAT_TCP_DISCONNECT_REASON_CLOSED, ///< Connection was gracefully closed.
OT_PLAT_TCP_DISCONNECT_REASON_TIMEOUT, ///< Connection timed out (e.g., failed to connect or keepalive failure).
OT_PLAT_TCP_DISCONNECT_REASON_REFUSED, ///< Connection was refused by the peer (RST received during handshake).
OT_PLAT_TCP_DISCONNECT_REASON_RESET, ///< Connection was reset by the peer (RST received on established conn).
OT_PLAT_TCP_DISCONNECT_REASON_ERROR, ///< Connection was aborted due to other errors.
} otPlatTcpDisconnectReason;
/**
* Enables a TCP listener.
*
* The platform should start listening for incoming TCP connections on the provided @p aLocalSockAddr. When an
* incoming connection request is received, the platform must invoke the `otPlatTcpAccept()` callback to accept the
* request.
*
* The @p aLocalSockAddr specifies the local interface, address, and port to bind to. Importantly, the port number
* within @p aLocalSockAddr must not be zero. The IP address may be unspecified (all zeros) to indicate that the
* listener should accept connections on any local address.
*
* @param[in] aListener The TCP listener.
* @param[in] aLocalSockAddr The local socket address to listen on.
*
* @retval OT_ERROR_NONE Successfully enabled or disabled the listener.
* @retval OT_ERROR_ALREADY Already listening on the same port/address.
* @retval OT_ERROR_FAILED Failed to enable the listener.
*/
otError otPlatTcpEnableListener(otPlatTcpListener *aListener, const otPlatTcpSockAddr *aLocalSockAddr);
/**
* Disables a TCP listener.
*
* The platform should stop listening for incoming connections on the socket associated with the listener.
* Any incoming connection requests that have not yet been accepted should be discarded.
*
* @param[in] aListener The TCP listener.
*/
void otPlatTcpDisableListener(otPlatTcpListener *aListener);
/**
* Callback to accept an incoming TCP connection request on an active listener.
*
* This function is implemented and provided by the OpenThread stack for the platform to use.
*
* The callback returns a pointer to an `otPlatTcpConnection` for the new connection. If the callback returns NULL,
* the incoming connection is rejected.
*
* @param[in] aListener The TCP listener.
* @param[in] aPeerSockAddr The peer's socket address.
*
* @returns A pointer for the newly accepted connection, or NULL to reject the connection request.
*/
extern otPlatTcpConnection *otPlatTcpAccept(otPlatTcpListener *aListener, const otPlatTcpSockAddr *aPeerSockAddr);
/**
* Initiates a TCP connection to a peer.
*
* The platform should initiate a TCP connection to the @p aPeerSockAddr.
*
* The @p aLocalSockAddr specifies the local address and port to bind to before connecting. It can be NULL if the
* OpenThread stack does not specify a preference. If provided, fields within @p aLocalSockAddr may still be left
* unspecified (e.g., the IP address can be all zeros, or the port can be zero). In all such cases, the platform
* and the underlying TCP stack should automatically select an appropriate local IP address and/or an ephemeral port.
*
* If `OT_ERROR_NONE` is returned (indicating successful initialization of the connection process), the platform must
* subsequently report the status. Upon successful connection establishment, the platform must invoke the
* `otPlatTcpHandleConnected` callback. If it fails to establish the connection, the `otPlatTcpHandleDisconnected`
* callback must be called to indicate the failure.
*
* @param[in] aConn The TCP connection.
* @param[in] aPeerSockAddr The peer's socket address.
* @param[in] aLocalSockAddr The local socket address. Can be NULL.
*
* @retval OT_ERROR_NONE Successfully initiated the connection.
* @retval OT_ERROR_FAILED Failed to initiate the connection.
*/
otError otPlatTcpConnect(otPlatTcpConnection *aConn,
const otPlatTcpSockAddr *aPeerSockAddr,
const otPlatTcpSockAddr *aLocalSockAddr);
/**
* Indicates whether the TCP connection is currently in the connecting state.
*
* This function is provided by the OpenThread stack. The platform can use it to determine if a TCP connection is still
* waiting for the TCP handshake to complete.
*
* @param[in] aConn The TCP connection.
*
* @retval TRUE The connection is currently in the connecting state.
* @retval FALSE The connection is not in the connecting state.
*/
extern bool otPlatTcpIsConnecting(otPlatTcpConnection *aConn);
/**
* Callback to notify the connection establishment.
*
* This callback is implemented and provided by the OpenThread stack. It must be invoked by the platform to indicate
* that the TCP handshake is complete and that the connection is now established.
*
* The platform must call this after a successful call to `otPlatTcpConnect()` when the connection is established.
* For incoming connection requests (on an `otPlatTcpListener`), the platform must call this after the
* `otPlatTcpAccept()` callback returns successfully and when the connection is established.
*
* @param[in] aConn The TCP connection.
*/
extern void otPlatTcpHandleConnected(otPlatTcpConnection *aConn);
/**
* Notifies the platform that there is pending data for transmission.
*
* This function is called by the OpenThread stack when it has new data for transmission. After this call, the platform
* should indicate when it is ready to accept the data by invoking the `otPlatTcpHandleTxReady()` callback.
*
* The platform can also use `otPlatTcpIsTxPending()` to check if there is pending data for transmission.
*
* It is permissible for the platform implementation to invoke the `otPlatTcpHandleTxReady()` callback directly from
* within `otPlatTcpNotifyTxPending()` before returning, if the underlying TCP transmit buffer is already available.
* The OpenThread stack will handle this correctly.
*
* @param[in] aConn The TCP connection.
*/
void otPlatTcpNotifyTxPending(otPlatTcpConnection *aConn);
/**
* Indicates whether the TCP connection has pending data for transmission.
*
* This function is provided by the OpenThread stack. The platform can use it to check if there is any pending data
* for transmission over the TCP connection.
*
* @param[in] aConn The TCP connection.
*
* @retval TRUE The connection has pending transmit data.
* @retval FALSE The connection does not have pending transmit data.
*/
extern bool otPlatTcpIsTxPending(otPlatTcpConnection *aConn);
/**
* Callback to notify that the platform is ready to accept more transmit data.
*
* This function is implemented and provided by the OpenThread stack for the platform to use.
*
* The platform should invoke this callback when it is ready to accept more data for transmission over the TCP
* connection, in response to a prior `otPlatTcpNotifyTxPending()` call. Upon being called, the OpenThread stack will
* use `otPlatTcpSend()` to provide the pending TX data to the platform. The stack may call `otPlatTcpSend()` multiple
* times during the execution of this callback.
*
* @param[in] aConn The TCP connection.
*/
extern void otPlatTcpHandleTxReady(otPlatTcpConnection *aConn);
/**
* Sends data over an active TCP connection.
*
* This function is called by the OpenThread stack to provide data for the platform to transmit. The data is provided
* in a buffer. The platform should copy as much data as it can from the given buffer into its underlying platform
* transmit buffer.
*
* The provided @p aBuffer is temporary. The platform must not store the pointer or assume the content remains valid
* after this function returns. All required data must be copied during this call.
*
* The OpenThread stack typically invokes this function from the `otPlatTcpHandleTxReady()` callback. However, the
* platform implementation must not assume this and should support being called at any time. If there is no space
* available to accept any data, the platform can return zero.
*
* The OpenThread stack may call this function multiple times back-to-back to provide all queued transmit content
* in chunks. The platform should be prepared to handle consecutive calls efficiently.
*
* @param[in] aConn The TCP connection.
* @param[in] aBuffer A pointer to the buffer containing the data to send.
* @param[in] aLength The length (in bytes) of the data in the buffer.
*
* @returns The actual number of bytes accepted for transmission.
*/
uint16_t otPlatTcpSend(otPlatTcpConnection *aConn, const uint8_t *aBuffer, uint16_t aLength);
/**
* Callback to notify the reception of data on a connection.
*
* This function is implemented and provided by the OpenThread stack for the platform to use.
*
* The platform invokes this callback to provide received data to the OpenThread stack. The provided @p aBuffer
* only needs to remain valid for the duration of this call. The OpenThread stack will process and copy the
* bytes as needed, and will not retain the @p aBuffer pointer after the function returns.
*
* Since TCP is a stream protocol, data can arrive in arbitrarily sized chunks. The platform does not need to
* buffer or reassemble these; it can invoke this callback immediately as data is received, even if it is expecting
* more data. The OpenThread stack handles all stream-level behavior, processing, and retention of the
* received data. This helps simplify the platform implementation.
*
* On certain platforms (such as standard POSIX), a return value of 0 from `read()` or `recv()` indicates an
* End-of-File (EOF) or graceful closure by the peer. The platform implementation must check for this condition and
* report it by invoking `otPlatTcpHandleDisconnected()` with the reason set to `OT_PLAT_TCP_DISCONNECT_REASON_CLOSED`.
* Importantly, calling `otPlatTcpHandleReceive()` with `aLength` set to zero does not signify a graceful closure in
* the `otPlatTcp` APIs; such a call is treated as a no-op receive event by the OpenThread stack and is ignored.
*
* @param[in] aConn The TCP connection.
* @param[in] aBuffer A pointer to the buffer containing the received data. Must not be NULL if @p aLength > 0.
* @param[in] aLength The length (in bytes) of the received data.
*/
extern void otPlatTcpHandleReceive(otPlatTcpConnection *aConn, const uint8_t *aBuffer, uint16_t aLength);
/**
* Gracefully closes the TCP connection.
*
* This function initiates a graceful closure of the connection. The platform should transmit any remaining data
* before performing the standard TCP connection termination.
*
* Once the connection is fully disconnected, or if it is already closed, or if an error occurs during the close
* operation, the platform must indicate this by invoking the `otPlatTcpHandleDisconnected` callback.
*
* The platform must always call `otPlatTcpHandleDisconnected()` to report the final outcome of the connection.
* It is permissible for the platform implementation to invoke this callback directly from within `otPlatTcpClose()`
* before returning. The OpenThread stack will handle this correctly.
*
* @param[in] aConn The TCP connection.
*/
void otPlatTcpClose(otPlatTcpConnection *aConn);
/**
* Aborts the TCP connection.
*
* This function forcefully terminates the connection. Any unsent data is discarded.
*
* After this call, the platform must forget the @p aConn. Importantly, it must not invoke any callbacks using the
* @p aConn any longer, including `otPlatTcpHandleDisconnected`. This effectively indicates to the platform that the
* OpenThread core is de-allocating the @p aConn instance and it is no longer valid.
*
* @param[in] aConn The TCP connection.
*/
void otPlatTcpAbort(otPlatTcpConnection *aConn);
/**
* Callback to notify the connection disconnection.
*
* This function is implemented and provided by the OpenThread stack for the platform to use.
*
* This callback should be invoked by the platform when it fails to establish a connection, when an established
* connection is successfully closed (by both endpoints), when it times out, or is reset or aborted.
*
* After this callback is invoked, the `otPlatTcpConnection` instance is no longer valid. The platform must not use it
* in any future callbacks.
*
* @param[in] aConn The TCP connection.
* @param[in] aReason The reason for the disconnection.
*/
extern void otPlatTcpHandleDisconnected(otPlatTcpConnection *aConn, otPlatTcpDisconnectReason aReason);
/**
* Gets the OpenThread instance associated with a given TCP connection.
*
* This function is provided by OpenThread core. Platform implementations can use it to get the OpenThread instance
* associated with an active `otPlatTcpConnection`.
*
* @param[in] aConn The TCP connection.
*
* @returns The OpenThread instance.
*/
extern otInstance *otPlatTcpGetInstanceForConnection(otPlatTcpConnection *aConn);
/**
* Gets the OpenThread instance associated with a given TCP listener.
*
* This function is provided by OpenThread core. Platform implementations can use it to get the OpenThread instance
* associated with an active `otPlatTcpListener`.
*
* @param[in] aListener The TCP listener.
*
* @returns The OpenThread instance.
*/
extern otInstance *otPlatTcpGetInstanceForListener(otPlatTcpListener *aListener);
/**
* Iterates through the active TCP listeners.
*
* This function can be used to iterate over all currently active TCP listeners associated with the OpenThread
* instance. It allows platform implementations to process or manage listeners without needing to maintain their own
* list of active listeners.
*
* The iteration is guaranteed to remain consistent even if callbacks (e.g., `otPlatTcpAccept`) are invoked during the
* process.
*
* @param[in] aInstance The OpenThread instance.
* @param[in] aPrevListener A pointer to the previous listener, or `NULL` to start the iteration from the beginning.
*
* @returns A pointer to the next listener, or `NULL` if there are no more listeners.
*/
extern otPlatTcpListener *otPlatTcpIterateListeners(otInstance *aInstance, otPlatTcpListener *aPrevListener);
/**
* Iterates through the active TCP connections.
*
* This function can be used to iterate over all currently active TCP connections associated with the OpenThread
* instance. It allows platform implementations to process or manage connections without needing to maintain their own
* list of active connections.
*
* The iteration is guaranteed to remain consistent and safe even if callbacks are invoked during the process. For
* example, if a connection is reported as disconnected via `otPlatTcpHandleDisconnected` during iteration, the
* OpenThread stack ensures that the connection entry remains valid until the iteration is completed.
*
* @param[in] aInstance The OpenThread instance.
* @param[in] aPrevConn A pointer to the previous connection, or `NULL` to start the iteration from the beginning.
*
* @returns A pointer to the next connection, or `NULL` if there are no more connections.
*/
extern otPlatTcpConnection *otPlatTcpIterateConnections(otInstance *aInstance, otPlatTcpConnection *aPrevConn);
/**
* @}
*/
#ifdef __cplusplus
} // extern "C"
#endif
#endif // OPENTHREAD_PLATFORM_TCP_H_
-32
View File
@@ -628,38 +628,6 @@ const char *otThreadGetDomainName(otInstance *aInstance);
*/
otError otThreadSetDomainName(otInstance *aInstance, const char *aDomainName);
/**
* Sets or clears the Interface Identifier manually specified for the Thread Domain Unicast Address.
*
* Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
*
* @note Only available since Thread 1.2.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aIid A pointer to the Interface Identifier to set or NULL to clear.
*
* @retval OT_ERROR_NONE Successfully set/cleared the Interface Identifier.
* @retval OT_ERROR_INVALID_ARGS The specified Interface Identifier is reserved.
*
* @sa otThreadGetFixedDuaInterfaceIdentifier
*/
otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid);
/**
* Gets the Interface Identifier manually specified for the Thread Domain Unicast Address.
*
* Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
*
* @note Only available since Thread 1.2.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @returns A pointer to the Interface Identifier which was set manually, or NULL if none was set.
*
* @sa otThreadSetFixedDuaInterfaceIdentifier
*/
const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance);
/**
* Gets the thrKeySequenceCounter.
*
+7 -1
View File
@@ -394,11 +394,17 @@ void otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTimeout);
uint8_t otThreadGetRouterUpgradeThreshold(otInstance *aInstance);
/**
* Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.
* Sets the ROUTER_UPGRADE_THRESHOLD parameter.
*
* @note This API is reserved for testing and demo purposes only. Changing settings with
* this API will render a production application non-compliant with the Thread Specification.
*
* This API historically set a single threshold value that was used for both local role transitions (deciding when
* the device itself should upgrade to a router) and by the leader (deciding whether to allow other devices to
* upgrade). These behaviors have now been separated into distinct router and leader thresholds. To preserve backward
* compatibility with existing applications and test scripts, this function continues to configure both thresholds
* (both the local router upgrade threshold and the leader upgrade threshold).
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value.
*
-1
View File
@@ -54,7 +54,6 @@ build_nrf52840()
"-DOT_DIAGNOSTIC=ON"
"-DOT_DNSSD_SERVER=ON"
"-DOT_DNS_CLIENT=ON"
"-DOT_DUA=ON"
"-DOT_ECDSA=ON"
"-DOT_FULL_LOGS=ON"
"-DOT_JAM_DETECTION=ON"
+5 -5
View File
@@ -158,23 +158,23 @@ build_all_features()
# Build Thread 1.4 with full features
reset_source
CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON
"$(dirname "$0")"/cmake-build simulation "${options[@]}"
# Build Thread 1.4 with external heap and msg pool using heap
reset_source
CFLAGS="${cppflags[*]} ${CFLAGS} -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1" \
CXXFLAGS="${cppflags[*]} ${CXXFLAGS} -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1" \
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON
"$(dirname "$0")"/cmake-build simulation "${options[@]}"
# Build Thread 1.4 with full features and no log
reset_source
CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_LOG_OUTPUT=NONE
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_LOG_OUTPUT=NONE
# Build Thread 1.4 with full features and full logs
reset_source
CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_FULL_LOGS=ON
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_FULL_LOGS=ON
# Build with Vendor Extension
reset_source
@@ -188,7 +188,7 @@ build_all_features()
# Build Thread 1.4 with full features and OT_ASSERT=OFF
reset_source
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_ASSERT=OFF
"$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_ASSERT=OFF
# Build with RAM settings
reset_source
-1
View File
@@ -112,7 +112,6 @@ OT_CLANG_TIDY_BUILD_OPTS=(
'-DOT_DNS_UPSTREAM_QUERY=ON'
"-DOT_DNSSD_DISCOVERY_PROXY=ON"
'-DOT_DNSSD_SERVER=ON'
'-DOT_DUA=ON'
'-DOT_MLR=ON'
'-DOT_ECDSA=ON'
'-DOT_HISTORY_TRACKER=ON'
-4
View File
@@ -125,7 +125,6 @@ build_simulation()
fi
if [[ ${version} != "1.1" ]]; then
options+=("-DOT_DUA=ON")
options+=("-DOT_MLR=ON")
fi
@@ -184,7 +183,6 @@ build_posix()
)
if [[ ${version} != "1.1" ]]; then
options+=("-DOT_DUA=ON")
options+=("-DOT_MLR=ON")
options+=("-DOT_LINK_METRICS_INITIATOR=ON")
options+=("-DOT_LINK_METRICS_SUBJECT=ON")
@@ -346,14 +344,12 @@ do_build_otbr_docker()
"-DOT_ANYCAST_LOCATOR=ON"
"-DOT_COVERAGE=ON"
"-DOT_DNS_CLIENT=ON"
"-DOT_DUA=ON"
"-DOT_MLR=ON"
"-DOT_NETDATA_PUBLISHER=ON"
"-DOT_SLAAC=ON"
"-DOT_SRP_CLIENT=ON"
"-DOT_FULL_LOGS=ON"
"-DOT_UPTIME=ON"
"-DOTBR_DUA_ROUTING=ON"
"-DOTBR_DHCP6_PD=ON"
)
local args=(
+2
View File
@@ -63,6 +63,8 @@ openthread_cli_sources = [
"cli_network_data.hpp",
"cli_ping.cpp",
"cli_ping.hpp",
"cli_plat_tcp.cpp",
"cli_plat_tcp.hpp",
"cli_srp_client.cpp",
"cli_srp_client.hpp",
"cli_srp_server.cpp",
+1
View File
@@ -51,6 +51,7 @@ set(COMMON_SOURCES
cli_mesh_diag.cpp
cli_network_data.cpp
cli_ping.cpp
cli_plat_tcp.cpp
cli_srp_client.cpp
cli_srp_server.cpp
cli_tcat.cpp
+1 -57
View File
@@ -50,7 +50,6 @@ Done
- [discover](#discover-channel)
- [dns](#dns-config)
- [domainname](#domainname)
- [dua](#dua-iid)
- [eidcache](#eidcache)
- [eui64](#eui64)
- [extaddr](#extaddr)
@@ -174,30 +173,6 @@ BBR Primary: None
Done
```
### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
Configure the response status for DUA.req with meshLocalIid in payload. Without meshLocalIid, simply respond any coming DUA.req next with the specified status or COAP code.
Only for testing/reference device.
known status value:
- 0: ST_DUA_SUCCESS
- 1: ST_DUA_REREGISTER
- 2: ST_DUA_INVALID
- 3: ST_DUA_DUPLICATE
- 4: ST_DUA_NO_RESOURCES
- 5: ST_DUA_BBR_NOT_PRIMARY
- 6: ST_DUA_GENERAL_FAILURE
- 160: COAP code 5.00
```bash
> bbr mgmt dua 1 2f7c235e5025a2fd
Done
> bbr mgmt dua 160
Done
```
### bbr mgmt mlr listener
Show the Multicast Listeners.
@@ -1959,34 +1934,6 @@ Set the Thread Domain Name for Thread 1.2 device.
Done
```
### dua iid
Get the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
```bash
> dua iid
0004000300020001
Done
```
### dua iid \<iid\>
Set the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
```bash
> dua iid 0004000300020001
Done
```
### dua iid clear
Clear the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
```bash
> dua iid clear
Done
```
### eidcache
Print the EID-to-RLOC cache entries.
@@ -3596,7 +3543,7 @@ Done
### prefix
Get the prefix list in the local Network Data. Note: For the Thread 1.2 border router with backbone capability, the local Domain Prefix would be listed as well (with flag `D`), with preceding `-` if backbone functionality is disabled.
Get the prefix list in the local Network Data.
```bash
> prefix
@@ -3609,8 +3556,6 @@ Done
Add a valid prefix to the Network Data.
Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
- p: Preferred flag
- a: Stateless IPv6 Address Autoconfiguration flag
- d: DHCPv6 IPv6 Address Configuration flag
@@ -3619,7 +3564,6 @@ Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
- o: On Mesh flag
- s: Stable flag
- n: Nd Dns flag
- D: Domain Prefix flag
- prf: Default router preference, which may be 'high', 'med', or 'low'.
```bash
-1
View File
@@ -430,7 +430,6 @@ Peer BRs are other devices within the Thread mesh that provide external IP conne
- 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.
-1
View File
@@ -466,7 +466,6 @@ The flags are as follows:
- `o`: On Mesh flag
- `s`: Stable flag
- `n`: Nd Dns flag
- `D`: Domain Prefix flag
Print the history as a table.
-2
View File
@@ -283,7 +283,6 @@ Publish an on-mesh prefix entry.
- o: On Mesh flag
- s: Stable flag
- n: Nd Dns flag
- D: Domain Prefix flag (only available for Thread 1.2).
- prf: Preference, which may be 'high', 'med', or 'low'.
```bash
@@ -352,7 +351,6 @@ On-mesh prefixes are listed under `Prefixes` header:
- o: On Mesh flag
- s: Stable flag
- n: Nd Dns flag
- D: Domain Prefix flag (only available for Thread 1.2).
- Preference `high`, `med`, or `low`
- RLOC16 of device which added the on-mesh prefix
+21 -92
View File
@@ -108,6 +108,9 @@ Interpreter::Interpreter(Instance *aInstance, otCliOutputCallback aCallback, voi
#if OPENTHREAD_CONFIG_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_TCP_ENABLE
, mTcp(aInstance, *this)
#endif
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
, mPlatTcp(aInstance, *this)
#endif
#if OPENTHREAD_CONFIG_COAP_API_ENABLE
, mCoap(aInstance, *this)
#endif
@@ -753,8 +756,8 @@ void Interpreter::OutputBorderAgentTxtDataInfo(uint8_t aIndentSize, const otBord
if (aInfo.mHasVendorOui)
{
OutputLine(aIndentSize, "VendorOui: %02X-%02X-%02X", aInfo.mVendorOui[0], aInfo.mVendorOui[1],
aInfo.mVendorOui[2]);
OutputFormat(aIndentSize, "VendorOui: ");
OutputVendorOuiLine(aInfo.mVendorOui);
}
if (aInfo.mHasStateBitmap)
@@ -1102,70 +1105,6 @@ template <> otError Interpreter::Process<Cmd("domainname")>(Arg aArgs[])
return ProcessGetSet(aArgs, otThreadGetDomainName, otThreadSetDomainName);
}
#if OPENTHREAD_CONFIG_DUA_ENABLE
template <> otError Interpreter::Process<Cmd("dua")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
/**
* @cli dua iid
* @code
* dua iid
* 0004000300020001
* Done
* @endcode
* @par api_copy
* #otThreadGetFixedDuaInterfaceIdentifier
*/
if (aArgs[0] == "iid")
{
if (aArgs[1].IsEmpty())
{
const otIp6InterfaceIdentifier *iid = otThreadGetFixedDuaInterfaceIdentifier(GetInstancePtr());
if (iid != nullptr)
{
OutputBytesLine(iid->mFields.m8);
}
}
/**
* @cli dua iid (set,clear)
* @code
* dua iid 0004000300020001
* Done
* @endcode
* @code
* dua iid clear
* Done
* @endcode
* @cparam dua iid @ca{iid|clear}
* `dua iid clear` passes a `nullptr` to #otThreadSetFixedDuaInterfaceIdentifier.
* Otherwise, you can pass the `iid`.
* @par api_copy
* #otThreadSetFixedDuaInterfaceIdentifier
*/
else if (aArgs[1] == "clear")
{
error = otThreadSetFixedDuaInterfaceIdentifier(GetInstancePtr(), nullptr);
}
else
{
otIp6InterfaceIdentifier iid;
SuccessOrExit(error = aArgs[1].ParseAsHexString(iid.mFields.m8));
error = otThreadSetFixedDuaInterfaceIdentifier(GetInstancePtr(), &iid);
}
}
else
{
error = OT_ERROR_INVALID_COMMAND;
}
exit:
return error;
}
#endif // OPENTHREAD_CONFIG_DUA_ENABLE
#endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
/**
@@ -5514,9 +5453,6 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
* @endcode
* @par
* Get the prefix list in the local Network Data.
* @note For the Thread 1.2 border router with backbone capability, the local Domain Prefix
* is listed as well and includes the `D` flag. If backbone functionality is disabled, a dash
* `-` is printed before the local Domain Prefix.
* @par
* For more information about #otBorderRouterConfig flags, refer to @overview.
* @sa otBorderRouterGetNextOnMeshPrefix
@@ -5530,15 +5466,6 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
{
mNetworkData.OutputPrefix(config);
}
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
if (otBackboneRouterGetState(GetInstancePtr()) == OT_BACKBONE_ROUTER_STATE_DISABLED)
{
SuccessOrExit(otBackboneRouterGetDomainPrefix(GetInstancePtr(), &config));
OutputFormat("- ");
mNetworkData.OutputPrefix(config);
}
#endif
}
/**
* @cli prefix add
@@ -7011,6 +6938,10 @@ template <> otError Interpreter::Process<Cmd("tcat")>(Arg aArgs[]) { return mTca
template <> otError Interpreter::Process<Cmd("tcp")>(Arg aArgs[]) { return mTcp.Process(aArgs); }
#endif
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
template <> otError Interpreter::Process<Cmd("plattcp")>(Arg aArgs[]) { return mPlatTcp.Process(aArgs); }
#endif
template <> otError Interpreter::Process<Cmd("udp")>(Arg aArgs[]) { return mUdp.Process(aArgs); }
template <> otError Interpreter::Process<Cmd("unsecureport")>(Arg aArgs[])
@@ -7669,23 +7600,16 @@ template <> otError Interpreter::Process<Cmd("vendor")>(Arg aArgs[])
* Done
* @endcode
* @par api_copy
* #otThreadGetVendorOui
* #otThreadGetVendorOuiInfo
*/
else if (aArgs[0] == "oui")
{
if (aArgs[1].IsEmpty())
{
uint32_t oui = otThreadGetVendorOui(GetInstancePtr());
otThreadVendorOui oui;
if (oui == OT_THREAD_UNSPECIFIED_VENDOR_OUI)
{
OutputLine("unspecified");
}
else
{
OutputLine("%02X-%02X-%02X", static_cast<uint8_t>((oui >> 16) & 0xff),
static_cast<uint8_t>((oui >> 8) & 0xff), static_cast<uint8_t>(oui & 0xff));
}
otThreadGetVendorOuiInfo(GetInstancePtr(), &oui);
OutputVendorOuiLine(oui);
error = OT_ERROR_NONE;
}
@@ -7833,6 +7757,7 @@ template <> otError Interpreter::Process<Cmd("networkdiagnostic")>(Arg aArgs[])
* - `41`: Border Router DHCPv6-PD OMR Prefix TLV
* - `42`: Border Router Local On-link Prefix TLV
* - `43`: Border Router Favored On-link Prefix TLV
* - `44`: Vendor OUI TLV
*
* @par
* Sends a network diagnostic request to retrieve specified Type Length Values (TLVs)
@@ -8003,6 +7928,10 @@ void Interpreter::HandleDiagnosticGetResponse(otError aError,
case OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_APP_URL:
OutputLine("Vendor App URL: %s", diagTlv.mData.mVendorAppUrl);
break;
case OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_OUI:
OutputFormat("Vendor OUI: ");
OutputVendorOuiLine(diagTlv.mData.mVendorOui);
break;
case OT_NETWORK_DIAGNOSTIC_TLV_THREAD_STACK_VERSION:
OutputLine("Thread Stack Version: %s", diagTlv.mData.mThreadStackVersion);
break;
@@ -8671,9 +8600,6 @@ otError Interpreter::ProcessCommand(Arg aArgs[])
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
CmdEntry("domainname"),
#endif
#if OPENTHREAD_CONFIG_DUA_ENABLE
CmdEntry("dua"),
#endif
#if OPENTHREAD_FTD
CmdEntry("eidcache"),
#endif
@@ -8774,6 +8700,9 @@ otError Interpreter::ProcessCommand(Arg aArgs[])
CmdEntry("ping"),
#endif
CmdEntry("platform"),
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
CmdEntry("plattcp"),
#endif
CmdEntry("pollperiod"),
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
CmdEntry("preferrouterid"),
+5
View File
@@ -73,6 +73,7 @@
#include "cli/cli_mesh_diag.hpp"
#include "cli/cli_network_data.hpp"
#include "cli/cli_ping.hpp"
#include "cli/cli_plat_tcp.hpp"
#include "cli/cli_srp_client.hpp"
#include "cli/cli_srp_server.hpp"
#include "cli/cli_tcat.hpp"
@@ -445,6 +446,10 @@ private:
TcpExample mTcp;
#endif
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
PlatTcp mPlatTcp;
#endif
#if OPENTHREAD_CONFIG_COAP_API_ENABLE
Coap mCoap;
#endif
-1
View File
@@ -670,7 +670,6 @@ template <> otError Br::Process<Cmd("peers")>(Arg aArgs[])
* 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 its is itself acting as a BR.
* Info per BR entry:
* - RLOC16 of the BR
+12
View File
@@ -97,6 +97,18 @@
#define OPENTHREAD_CONFIG_CLI_IFCONFIG_INIT_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
*
* Indicates whether the plat-tcp CLI commands are enabled.
*
* These CLI commands are intended primarily for testing and evaluation of the `otPlatTcp` API implementations.
*
*/
#ifndef OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
#define OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_CLI_TCP_ENABLE
*
+2 -1
View File
@@ -452,7 +452,8 @@ otError Dns::GetDnsConfig(Arg aArgs[], otDnsQueryConfig *&aConfig)
VerifyOrExit(!aArgs[0].IsEmpty(), aConfig = nullptr);
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], aConfig->mServerSockAddr.mAddress, nat64Synth));
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], aConfig->mServerSockAddr.mAddress, nat64Synth));
if (nat64Synth)
{
OutputFormat("Synthesized IPv6 DNS server address: ");
-1
View File
@@ -1305,7 +1305,6 @@ void History::OutputRxTxEntryTableFormat(const otHistoryTrackerMessageInfo &aInf
* * `o`: On mesh flag.
* * `s`: Stable flag.
* * `n`: Nd Dns flag.
* * `D`: Domain prefix flag.
* * Pref: Preference. Values can be either `high`, `med`, or `low`.
* * RLOC16
* @sa otHistoryTrackerIterateOnMeshPrefixHistory
+1
View File
@@ -125,6 +125,7 @@ template <> otError MeshDiag::Process<Cmd("topology")>(Arg aArgs[])
otError error = OT_ERROR_NONE;
otMeshDiagDiscoverConfig config;
ClearAllBytes(config);
config.mDiscoverIp6Addresses = false;
config.mDiscoverChildTable = false;
-6
View File
@@ -96,11 +96,6 @@ void NetworkData::PrefixFlagsToString(const otBorderRouterConfig &aConfig, Flags
*flagsPtr++ = 'n';
}
if (aConfig.mDp)
{
*flagsPtr++ = 'D';
}
*flagsPtr = '\0';
}
@@ -804,7 +799,6 @@ exit:
* * o: On Mesh flag
* * s: Stable flag
* * n: Nd Dns flag
* * D: Domain Prefix flag (only available for Thread 1.2).
* * Preference `high`, `med`, or `low`
* * RLOC16 of device which added the on-mesh prefix
* @par
+1 -1
View File
@@ -96,7 +96,7 @@ otError PingSender::Process(Arg aArgs[])
aArgs++;
}
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], config.mDestination, nat64Synth));
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], config.mDestination, nat64Synth));
if (nat64Synth)
{
+302
View File
@@ -0,0 +1,302 @@
/*
* Copyright (c) 2026, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file implements a TCP CLI tool.
*/
#include "openthread-core-config.h"
#include "cli_config.h"
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
#include "cli_plat_tcp.hpp"
#include "instance/instance.hpp"
namespace ot {
namespace Cli {
//---------------------------------------------------------------------------------------------------------------------
// PlatTcp::Listener
PlatTcp::Listener::Listener(Instance &aInstance, PlatTcp &aOwner)
: Ip6::PlatTcp::Listener(aInstance, Accept, nullptr)
, mOwner(aOwner)
{
}
Ip6::PlatTcp::Connection *PlatTcp::Listener::Accept(Ip6::PlatTcp::Listener &aListener, const SockAddr &aPeerSockAddr)
{
return static_cast<Listener &>(aListener).mOwner.Accept(aPeerSockAddr);
}
//---------------------------------------------------------------------------------------------------------------------
// PlatTcp::Connection
PlatTcp::Connection::Connection(Instance &aInstance, PlatTcp &aOwner)
: Ip6::PlatTcp::Connection(aInstance, HandleEvent, nullptr)
, mOwner(aOwner)
{
}
void PlatTcp::Connection::HandleEvent(Ip6::PlatTcp::Connection &aConnection, const Event aEvent)
{
return static_cast<Connection &>(aConnection).mOwner.HandleEvent(aEvent);
}
//---------------------------------------------------------------------------------------------------------------------
// PlatTcp
PlatTcp::PlatTcp(otInstance *aInstance, OutputImplementer &aOutputImplementer)
: Utils(aInstance, aOutputImplementer)
, mListener(AsCoreType(aInstance), *this)
, mConnection(AsCoreType(aInstance), *this)
, mIsBound(false)
{
}
PlatTcp::Connection *PlatTcp::Accept(const SockAddr &aPeerSockAddr)
{
OutputLine("PlatTcp: Accept %s", aPeerSockAddr.ToString().AsCString());
return &mConnection;
}
void PlatTcp::HandleEvent(Connection::Event aEvent)
{
OutputLine("PlatTcp:: HandleEvent %s", Connection::EventToString(aEvent));
if (aEvent == Connection::kEventDisconnected)
{
OutputLine("PlatTcp:: DisconnectReason: %s",
Connection::DisconnectReasonToString(mConnection.GetDisconnectReason()));
}
if (aEvent == Connection::kEventReceive)
{
const Message *rxMessage = mConnection.GetRxMessage();
VerifyOrExit(rxMessage != nullptr);
OutputLine("PlatTcp: Received %u bytes", rxMessage->GetLength());
for (uint16_t offset = 0; offset < rxMessage->GetLength();)
{
uint8_t buffer[32];
uint16_t readLength = rxMessage->ReadBytes(offset, buffer, sizeof(buffer));
OutputSpaces(4);
OutputBytesLine(buffer, readLength);
offset += readLength;
}
mConnection.FreeRxMessage();
}
exit:
return;
}
otError PlatTcp::GetSockAddr(Arg aArgs[], SockAddr &aSockAddr)
{
otError error = OT_ERROR_NONE;
uint16_t port;
uint32_t ifIndex;
aSockAddr.Clear();
VerifyOrExit(!aArgs[0].IsEmpty());
SuccessOrExit(error = aArgs[0].ParseAsIp6Address(aSockAddr.GetAddress()));
VerifyOrExit(!aArgs[1].IsEmpty());
SuccessOrExit(error = aArgs[1].ParseAsUint16(port));
aSockAddr.SetPort(port);
VerifyOrExit(!aArgs[2].IsEmpty());
SuccessOrExit(error = aArgs[2].ParseAsUint32(ifIndex));
aSockAddr.SetIfIndex(ifIndex);
exit:
return error;
}
template <> otError PlatTcp::Process<Cmd("listener")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
if (aArgs[0].IsEmpty())
{
OutputEnabledDisabledStatus(mListener.GetState() == Listener::kStateEnabled);
}
else if (aArgs[0] == "enable")
{
SockAddr sockAddr;
SuccessOrExit(error = GetSockAddr(&aArgs[1], sockAddr));
OutputLine("Enabling listener on %s", sockAddr.ToString().AsCString());
error = mListener.Enable(sockAddr);
}
else if (aArgs[0] == "disable")
{
VerifyOrExit(aArgs[1].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
mListener.Disable();
}
else
{
error = OT_ERROR_INVALID_COMMAND;
}
exit:
return error;
}
template <> otError PlatTcp::Process<Cmd("bind")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
SockAddr newSockAddr;
VerifyOrExit(mConnection.GetState() == Connection::kStateUnused, error = OT_ERROR_INVALID_STATE);
if (aArgs[0].IsEmpty())
{
mIsBound = false;
mLocalSockAddr.Clear();
ExitNow();
}
SuccessOrExit(error = GetSockAddr(aArgs, newSockAddr));
mLocalSockAddr = newSockAddr;
mIsBound = true;
OutputLine("LocalSockAddr: %s", mLocalSockAddr.ToString().AsCString());
exit:
return error;
}
template <> otError PlatTcp::Process<Cmd("connect")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
SockAddr peerSockAddr;
SuccessOrExit(error = GetSockAddr(aArgs, peerSockAddr));
if (mIsBound)
{
OutputLine("Binding to %s, connecting to %s", mLocalSockAddr.ToString().AsCString(),
peerSockAddr.ToString().AsCString());
error = mConnection.BindAndConnect(mLocalSockAddr, peerSockAddr);
}
else
{
OutputLine("Connecting to %s", peerSockAddr.ToString().AsCString());
error = mConnection.Connect(peerSockAddr);
}
exit:
return error;
}
template <> otError PlatTcp::Process<Cmd("send")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
OwnedPtr<Message> message;
uint16_t length;
SuccessOrExit(error = aArgs[0].ParseAsUint16(length));
VerifyOrExit(aArgs[1].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
message.Reset(AsCoreType(GetInstancePtr()).Get<MessagePool>().Allocate(Message::kTypeOther));
VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS);
for (uint16_t i = 0; i < length; i++)
{
SuccessOrExit(error = message->Append<uint8_t>(static_cast<uint8_t>(i & 0xff) ^ (i >> 8)));
}
error = mConnection.Send(message.PassOwnership());
exit:
return error;
}
template <> otError PlatTcp::Process<Cmd("close")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
VerifyOrExit(aArgs[0].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
mConnection.Close();
exit:
return error;
}
template <> otError PlatTcp::Process<Cmd("abort")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
VerifyOrExit(aArgs[0].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
mConnection.Abort();
exit:
return error;
}
otError PlatTcp::Process(Arg aArgs[])
{
#define CmdEntry(aCommandString) {aCommandString, &PlatTcp::Process<Cmd(aCommandString)>}
static constexpr Command kCommands[] = {CmdEntry("abort"), CmdEntry("bind"), CmdEntry("close"),
CmdEntry("connect"), CmdEntry("listener"), CmdEntry("send")};
static_assert(BinarySearch::IsSorted(kCommands), "kCommands is not sorted");
otError error = OT_ERROR_INVALID_COMMAND;
const Command *command;
if (aArgs[0].IsEmpty() || (aArgs[0] == "help"))
{
OutputCommandTable(kCommands);
ExitNow(error = aArgs[0].IsEmpty() ? error : OT_ERROR_NONE);
}
command = BinarySearch::Find(aArgs[0].GetCString(), kCommands);
VerifyOrExit(command != nullptr);
error = (this->*command->mHandler)(aArgs + 1);
exit:
return error;
}
} // namespace Cli
} // namespace ot
#endif // OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
+122
View File
@@ -0,0 +1,122 @@
/*
* Copyright (c) 2026, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file contains definitions for a plat-TCP CLI tool.
*/
#ifndef OT_CLI_CLI_PLAT_TCP_HPP_
#define OT_CLI_CLI_PLAT_TCP_HPP_
#include "openthread-core-config.h"
#if OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
#include "cli/cli_config.h"
#include "cli/cli_utils.hpp"
#include "net/plat_tcp.hpp"
namespace ot {
namespace Cli {
/**
* Implements a CLI-based plat-TCP example.
*
* These CLI commands are intended primarily for testing and evaluation of the `otPlatTcp` API implementations.
*/
class PlatTcp : private Utils
{
public:
/**
* Constructor
*
* @param[in] aInstance The OpenThread Instance.
* @param[in] aOutputImplementer An `OutputImplementer`.
*/
PlatTcp(otInstance *aInstance, OutputImplementer &aOutputImplementer);
/**
* Processes a CLI sub-command.
*
* @param[in] aArgs An array of command line arguments.
*
* @retval OT_ERROR_NONE Successfully executed the CLI command.
* @retval OT_ERROR_PENDING The CLI command was successfully started but final result is pending.
* @retval OT_ERROR_INVALID_COMMAND Invalid or unknown CLI command.
* @retval OT_ERROR_INVALID_ARGS Invalid arguments.
* @retval ... Error during execution of the CLI command.
*/
otError Process(Arg aArgs[]);
private:
using Command = CommandEntry<PlatTcp>;
using SockAddr = Ip6::PlatTcp::SockAddr;
class Listener : public Ip6::PlatTcp::Listener
{
public:
Listener(Instance &aInstance, PlatTcp &aOwner);
private:
static Ip6::PlatTcp::Connection *Accept(Ip6::PlatTcp::Listener &aListener, const SockAddr &aPeerSockAddr);
PlatTcp &mOwner;
};
class Connection : public Ip6::PlatTcp::Connection
{
public:
Connection(Instance &aInstance, PlatTcp &aOwner);
private:
static void HandleEvent(Ip6::PlatTcp::Connection &aConnection, Event aEvent);
PlatTcp &mOwner;
};
template <CommandId kCommandId> otError Process(Arg aArgs[]);
otError GetSockAddr(Arg aArgs[], SockAddr &aSockAddr);
Connection *Accept(const SockAddr &aPeerSockAddr);
void HandleEvent(Connection::Event aEvent);
Listener mListener;
Connection mConnection;
SockAddr mLocalSockAddr;
bool mIsBound;
};
} // namespace Cli
} // namespace ot
#endif // OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE && OPENTHREAD_CONFIG_CLI_PLAT_TCP_ENABLE
#endif // OT_CLI_CLI_PLAT_TCP_HPP_
+1 -1
View File
@@ -400,7 +400,7 @@ template <> otError TcpExample::Process<Cmd("connect")>(Arg aArgs[])
VerifyOrExit(mInitialized, error = OT_ERROR_INVALID_STATE);
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], sockaddr.mAddress, nat64Synth));
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], sockaddr.mAddress, nat64Synth));
if (nat64Synth)
{
+2 -2
View File
@@ -144,7 +144,7 @@ template <> otError UdpExample::Process<Cmd("connect")>(Arg aArgs[])
otSockAddr sockaddr;
bool nat64Synth;
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], sockaddr.mAddress, nat64Synth));
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], sockaddr.mAddress, nat64Synth));
if (nat64Synth)
{
@@ -281,7 +281,7 @@ template <> otError UdpExample::Process<Cmd("send")>(Arg aArgs[])
{
bool nat64Synth;
SuccessOrExit(error = ParseToIp6Address(GetInstancePtr(), aArgs[0], messageInfo.mPeerAddr, nat64Synth));
SuccessOrExit(error = ParseOrSynthesizeIp6Address(aArgs[0], messageInfo.mPeerAddr, nat64Synth));
if (nat64Synth)
{
+29 -18
View File
@@ -231,6 +231,20 @@ void Utils::OutputSockAddrLine(const otSockAddr &aSockAddr)
OutputNewLine();
}
void Utils::OutputVendorOui(const otThreadVendorOui &aOui)
{
char string[OT_THREAD_VENDOR_OUI_STRING_SIZE];
otThreadVendorOuiToString(&aOui, string, sizeof(string));
OutputFormat("%s", string);
}
void Utils::OutputVendorOuiLine(const otThreadVendorOui &aOui)
{
OutputVendorOui(aOui);
OutputNewLine();
}
void Utils::OutputDnsTxtData(const uint8_t *aTxtData, uint16_t aTxtDataLength)
{
OutputDnsTxtData(/* aKeyValuePerLine */ false, 0, aTxtData, aTxtDataLength);
@@ -629,25 +643,27 @@ const char *Utils::PreferenceToString(signed int aPreference)
}
#if OPENTHREAD_FTD || OPENTHREAD_MTD
otError Utils::ParseToIp6Address(otInstance *aInstance, const Arg &aArg, otIp6Address &aAddress, bool &aSynthesized)
{
Error error = OT_ERROR_NONE;
VerifyOrExit(!aArg.IsEmpty(), error = OT_ERROR_INVALID_ARGS);
error = aArg.ParseAsIp6Address(aAddress);
otError Utils::ParseOrSynthesizeIp6Address(const Arg &aArg, otIp6Address &aAddress, bool &aSynthesized)
{
Error error;
otIp4Address ip4Address;
aSynthesized = false;
if (error != OT_ERROR_NONE)
{
// It might be an IPv4 address, let's have a try.
otIp4Address ip4Address;
error = aArg.ParseAsIp6Address(aAddress);
// Do not touch the error value if we failed to parse it as an IPv4 address.
SuccessOrExit(aArg.ParseAsIp4Address(ip4Address));
SuccessOrExit(error = otNat64SynthesizeIp6Address(aInstance, &ip4Address, &aAddress));
aSynthesized = true;
if (error == OT_ERROR_NONE)
{
ExitNow();
}
// Try to parse it as an IPv4 address and synthesize.
SuccessOrExit(error = aArg.ParseAsIp4Address(ip4Address));
SuccessOrExit(error = otNat64SynthesizeIp6Address(GetInstancePtr(), &ip4Address, &aAddress));
aSynthesized = true;
exit:
return error;
}
@@ -708,11 +724,6 @@ otError Utils::ParsePrefix(Arg aArgs[], otBorderRouterConfig &aConfig)
aConfig.mNdDns = true;
break;
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
case 'D':
aConfig.mDp = true;
break;
#endif
case '-':
break;
+19 -8
View File
@@ -42,6 +42,7 @@
#include <openthread/border_routing.h>
#include <openthread/cli.h>
#include <openthread/joiner.h>
#include <openthread/netdiag.h>
#include <openthread/thread.h>
#include "cli_config.h"
@@ -431,6 +432,20 @@ public:
*/
void OutputSockAddrLine(const otSockAddr &aSockAddr);
/**
* Outputs the Vendor OUI to the CLI console.
*
* @param[in] aOui A reference to the Vendor OUI.
*/
void OutputVendorOui(const otThreadVendorOui &aOui);
/**
* Outputs the Vendor OUI to the CLI console and appends a newline.
*
* @param[in] aOui A reference to the Vendor OUI.
*/
void OutputVendorOuiLine(const otThreadVendorOui &aOui);
/**
* Outputs DNS TXT data to the CLI console.
*
@@ -674,24 +689,20 @@ public:
static const char *PreferenceToString(signed int aPreference);
/**
* Parses the argument as an IP address.
* Parses the argument as an IPv6 address or synthesizes it from an IPv4 address.
*
* If the argument string is an IPv4 address, this method will try to synthesize an IPv6 address using preferred
* NAT64 prefix in the network data.
*
* @param[in] aInstance A pointer to OpenThread instance.
* @param[in] aArg The argument string to parse.
* @param[out] aAddress A reference to an `otIp6Address` to output the parsed IPv6 address.
* @param[out] aAddress A reference to an `otIp6Address` to output the parsed/synthesized IPv6 address.
* @param[out] aSynthesized Whether @p aAddress is synthesized from an IPv4 address.
*
* @retval OT_ERROR_NONE The argument was parsed successfully.
* @retval OT_ERROR_NONE The argument was parsed/synthesized successfully.
* @retval OT_ERROR_INVALID_ARGS The argument is empty or does not contain a valid IP address.
* @retval OT_ERROR_INVALID_STATE No valid NAT64 prefix in the network data.
*/
static otError ParseToIp6Address(otInstance *aInstance,
const Arg &aArg,
otIp6Address &aAddress,
bool &aSynthesized);
otError ParseOrSynthesizeIp6Address(const Arg &aArg, otIp6Address &aAddress, bool &aSynthesized);
/**
* Parses the argument as a Joiner Discerner.
+2 -6
View File
@@ -103,10 +103,6 @@ if (openthread_enable_core_config_args) {
macro = "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE"
value = openthread_config_dns_client_enable
},
{
macro = "OPENTHREAD_CONFIG_DUA_ENABLE"
value = openthread_config_dua_enable
},
{
macro = "OPENTHREAD_CONFIG_ECDSA_ENABLE"
value = openthread_config_ecdsa_enable
@@ -640,6 +636,8 @@ openthread_core_files = [
"net/nd_agent.hpp",
"net/netif.cpp",
"net/netif.hpp",
"net/plat_tcp.cpp",
"net/plat_tcp.hpp",
"net/slaac_address.cpp",
"net/slaac_address.hpp",
"net/sntp_client.cpp",
@@ -694,8 +692,6 @@ openthread_core_files = [
"thread/csl_tx_scheduler.hpp",
"thread/discover_scanner.cpp",
"thread/discover_scanner.hpp",
"thread/dua_manager.cpp",
"thread/dua_manager.hpp",
"thread/energy_scan_server.cpp",
"thread/energy_scan_server.hpp",
"thread/indirect_sender.cpp",
+1 -1
View File
@@ -210,6 +210,7 @@ set(COMMON_SOURCES
net/nd6.cpp
net/nd_agent.cpp
net/netif.cpp
net/plat_tcp.cpp
net/slaac_address.cpp
net/sntp_client.cpp
net/socket.cpp
@@ -237,7 +238,6 @@ set(COMMON_SOURCES
thread/child_table.cpp
thread/csl_tx_scheduler.cpp
thread/discover_scanner.cpp
thread/dua_manager.cpp
thread/energy_scan_server.cpp
thread/indirect_sender.cpp
thread/key_manager.cpp
-12
View File
@@ -82,18 +82,6 @@ void otBackboneRouterSetRegistrationJitter(otInstance *aInstance, uint8_t aJitte
return AsCoreType(aInstance).Get<BackboneRouter::Local>().SetRegistrationJitter(aJitter);
}
otError otBackboneRouterGetDomainPrefix(otInstance *aInstance, otBorderRouterConfig *aConfig)
{
return AsCoreType(aInstance).Get<BackboneRouter::Local>().GetDomainPrefix(AsCoreType(aConfig));
}
void otBackboneRouterSetDomainPrefixCallback(otInstance *aInstance,
otBackboneRouterDomainPrefixCallback aCallback,
void *aContext)
{
return AsCoreType(aInstance).Get<BackboneRouter::Local>().SetDomainPrefixCallback(aCallback, aContext);
}
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE
void otBackboneRouterSetMulticastListenerCallback(otInstance *aInstance,
otBackboneRouterMulticastListenerCallback aCallback,
+2 -26
View File
@@ -49,36 +49,12 @@ otError otBorderRouterGetNetData(otInstance *aInstance, bool aStable, uint8_t *a
otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRouterConfig *aConfig)
{
Error error = kErrorNone;
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
if (aConfig->mDp)
{
error = AsCoreType(aInstance).Get<BackboneRouter::Local>().SetDomainPrefix(AsCoreType(aConfig));
}
else
#endif
{
error = AsCoreType(aInstance).Get<NetworkData::Local>().AddOnMeshPrefix(AsCoreType(aConfig));
}
return error;
return AsCoreType(aInstance).Get<NetworkData::Local>().AddOnMeshPrefix(AsCoreType(aConfig));
}
otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefix *aPrefix)
{
Error error = kErrorNone;
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
error = AsCoreType(aInstance).Get<BackboneRouter::Local>().RemoveDomainPrefix(AsCoreType(aPrefix));
if (error == kErrorNotFound)
#endif
{
error = AsCoreType(aInstance).Get<NetworkData::Local>().RemoveOnMeshPrefix(AsCoreType(aPrefix));
}
return error;
return AsCoreType(aInstance).Get<NetworkData::Local>().RemoveOnMeshPrefix(AsCoreType(aPrefix));
}
otError otBorderRouterGetNextOnMeshPrefix(otInstance *aInstance,
+2 -13
View File
@@ -64,22 +64,11 @@ void otCryptoAesCcm(const otCryptoKey *aKey,
bool aEncrypt,
void *aTag)
{
AesCcm aesCcm;
AssertPointerIsNotNull(aNonce);
AssertPointerIsNotNull(aPlainText);
AssertPointerIsNotNull(aCipherText);
AssertPointerIsNotNull(aTag);
aesCcm.SetKey(AsCoreType(aKey));
aesCcm.Init(aHeaderLength, aLength, aTagLength, aNonce, aNonceLength);
if (aHeaderLength != 0)
{
OT_ASSERT(aHeader != nullptr);
aesCcm.Header(aHeader, aHeaderLength);
}
aesCcm.Payload(aPlainText, aCipherText, aLength, aEncrypt ? AesCcm::kEncrypt : AesCcm::kDecrypt);
aesCcm.Finalize(aTag);
AesCcm::Perform(aEncrypt ? AesCcm::kEncrypt : AesCcm::kDecrypt, AsCoreType(aKey), aTagLength, aNonce, aNonceLength,
aHeader, aHeaderLength, aPlainText, aCipherText, aLength, aTag);
}
+5
View File
@@ -60,6 +60,11 @@ otError otMeshDiagGetNextChildInfo(otMeshDiagChildIterator *aIterator, otMeshDia
return AsCoreType(aIterator).GetNextChildInfo(AsCoreType(aChildInfo));
}
otError otMeshDiagGetNextTlvInfo(otMeshDiagTlvIterator *aIterator, otMeshDiagTlvInfo *aTlvInfo)
{
return AsCoreType(aIterator).GetNextTlvInfo(*aTlvInfo);
}
otError otMeshDiagQueryChildTable(otInstance *aInstance,
uint16_t aRloc16,
otMeshDiagQueryChildTableCallback aCallback,
+38 -2
View File
@@ -85,7 +85,24 @@ const char *otThreadGetVendorAppUrl(otInstance *aInstance)
return AsCoreType(aInstance).Get<VendorInfo>().GetAppUrl();
}
uint32_t otThreadGetVendorOui(otInstance *aInstance) { return AsCoreType(aInstance).Get<VendorInfo>().GetOui(); }
void otThreadGetVendorOuiInfo(otInstance *aInstance, otThreadVendorOui *aOui)
{
AssertPointerIsNotNull(aOui);
*aOui = AsCoreType(aInstance).Get<VendorInfo>().GetOui();
}
void otThreadVendorOuiToString(const otThreadVendorOui *aOui, char *aBuffer, uint16_t aSize)
{
AsCoreType(aOui).ToString(aBuffer, aSize);
}
uint32_t otThreadGetVendorOui(otInstance *aInstance)
{
// This API is deprecated. Use `otThreadGetVendorOuiInfo()` instead
return AsCoreType(aInstance).Get<VendorInfo>().GetOui().GetAsOui24();
}
#if OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE
@@ -109,9 +126,28 @@ otError otThreadSetVendorAppUrl(otInstance *aInstance, const char *aVendorAppUrl
return AsCoreType(aInstance).Get<VendorInfo>().SetAppUrl(aVendorAppUrl);
}
otError otThreadSetVendorOuiInfo(otInstance *aInstance, const otThreadVendorOui *aOui)
{
return AsCoreType(aInstance).Get<VendorInfo>().SetOui(AsCoreType(aOui));
}
otError otThreadSetVendorOui(otInstance *aInstance, uint32_t aVendorOui)
{
return AsCoreType(aInstance).Get<VendorInfo>().SetOui(aVendorOui);
// This API is deprecated, use `otThreadSetVendorOuiInfo()` instead
Error error;
VendorInfo::Oui oui;
VerifyOrExit(aVendorOui <= 0xffffff, error = kErrorInvalidArgs);
oui.Clear();
oui.mBitLength = 24;
BigEndian::WriteUint24(aVendorOui, oui.mBytes);
error = AsCoreType(aInstance).Get<VendorInfo>().SetOui(oui);
exit:
return error;
}
#endif // OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE
+2 -33
View File
@@ -73,7 +73,7 @@ otError otThreadGetLeaderRloc(otInstance *aInstance, otIp6Address *aLeaderRloc)
Error error = kErrorNone;
VerifyOrExit(!AsCoreType(aInstance).Get<Mle::Mle>().HasRloc16(Mle::kInvalidRloc16), error = kErrorDetached);
AsCoreType(aInstance).Get<Mle::Mle>().GetLeaderRloc(AsCoreType(aLeaderRloc));
AsCoreType(aInstance).Get<Mle::Mle>().ComposeLeaderRloc(AsCoreType(aLeaderRloc));
exit:
return error;
@@ -189,7 +189,7 @@ otError otThreadGetServiceAloc(otInstance *aInstance, uint8_t aServiceId, otIp6A
Error error = kErrorNone;
VerifyOrExit(!AsCoreType(aInstance).Get<Mle::Mle>().HasRloc16(Mle::kInvalidRloc16), error = kErrorDetached);
AsCoreType(aInstance).Get<Mle::Mle>().GetServiceAloc(aServiceId, AsCoreType(aServiceAloc));
AsCoreType(aInstance).Get<Mle::Mle>().ComposeServiceAloc(aServiceId, AsCoreType(aServiceAloc));
exit:
return error;
@@ -238,37 +238,6 @@ exit:
return error;
}
#if OPENTHREAD_CONFIG_DUA_ENABLE
otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid)
{
Error error = kErrorNone;
if (aIid)
{
error = AsCoreType(aInstance).Get<DuaManager>().SetFixedDuaInterfaceIdentifier(AsCoreType(aIid));
}
else
{
AsCoreType(aInstance).Get<DuaManager>().ClearFixedDuaInterfaceIdentifier();
}
return error;
}
const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance)
{
Instance &instance = AsCoreType(aInstance);
const otIp6InterfaceIdentifier *iid = nullptr;
if (instance.Get<DuaManager>().IsFixedDuaInterfaceIdentifierSet())
{
iid = &instance.Get<DuaManager>().GetFixedDuaInterfaceIdentifier();
}
return iid;
}
#endif // OPENTHREAD_CONFIG_DUA_ENABLE
#endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
uint32_t otThreadGetKeySequenceCounter(otInstance *aInstance)
+1
View File
@@ -152,6 +152,7 @@ uint8_t otThreadGetRouterUpgradeThreshold(otInstance *aInstance)
void otThreadSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aThreshold)
{
AsCoreType(aInstance).Get<Mle::Mle>().SetRouterUpgradeThreshold(aThreshold);
AsCoreType(aInstance).Get<Mle::Mle>().SetLeaderUpgradeThreshold(aThreshold);
}
uint8_t otThreadGetChildRouterLinks(otInstance *aInstance)
+2 -4
View File
@@ -116,12 +116,10 @@ bool BackboneTmfAgent::IsBackboneTmfMessage(const Ip6::MessageInfo &aMessageInfo
// A Backbone TMF message must comply with following rules:
// The destination must be one of:
// 1. All Network BBRs (Link-Local scope)
// 2. All Domain BBRs (Link-Local scope)
// 3. A Backbone Link-Local address
// 2. A Backbone Link-Local address
// The source must be a Backbone Link-local address.
return (Get<BackboneRouter::Local>().IsEnabled() && src.IsLinkLocalUnicast() &&
(dst.IsLinkLocalUnicast() || dst == Get<BackboneRouter::Local>().GetAllNetworkBackboneRoutersAddress() ||
dst == Get<BackboneRouter::Local>().GetAllDomainBackboneRoutersAddress()));
(dst.IsLinkLocalUnicast() || dst == Get<BackboneRouter::Local>().GetAllNetworkBackboneRoutersAddress()));
}
void BackboneTmfAgent::SubscribeMulticast(const Ip6::Address &aAddress)
+1 -74
View File
@@ -90,13 +90,7 @@ Leader::Leader(Instance &aInstance)
Reset();
}
void Leader::Reset(void)
{
mConfig.MarkAsAbsent();
// Domain Prefix Length 0 indicates no available Domain Prefix in the Thread network.
mDomainPrefix.SetLength(0);
}
void Leader::Reset(void) { mConfig.MarkAsAbsent(); }
Error Leader::ReadConfig(Config &aConfig) const
{
@@ -136,18 +130,6 @@ const char *Leader::PrimaryEventToString(PrimaryEvent aEvent)
return kStrings[aEvent];
}
const char *Leader::DomainPrefixEventToString(DomainPrefixEvent aEvent)
{
#define DomainPrefixEventMapList(_) \
_(kDomainPrefixAdded, "Added") \
_(kDomainPrefixRemoved, "Removed") \
_(kDomainPrefixRefreshed, "Refreshed")
DefineEnumStringArray(DomainPrefixEventMapList);
return kStrings[aEvent];
}
#endif // OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
void Leader::HandleNotifierEvents(Events aEvents)
@@ -155,7 +137,6 @@ void Leader::HandleNotifierEvents(Events aEvents)
if (aEvents.ContainsAny(kEventThreadNetdataChanged | kEventThreadRoleChanged))
{
UpdateBackboneRouterPrimary();
UpdateDomainPrefixConfig();
}
}
@@ -208,64 +189,10 @@ void Leader::UpdateBackboneRouterPrimary(void)
Get<Mlr::Manager>().HandleBackboneRouterPrimaryUpdate(event);
#endif
#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE)
Get<DuaManager>().HandleBackboneRouterPrimaryUpdate(event);
#endif
exit:
OT_UNUSED_VARIABLE(event);
}
void Leader::UpdateDomainPrefixConfig(void)
{
NetworkData::Iterator iterator = NetworkData::kIteratorInit;
NetworkData::OnMeshPrefixConfig prefixConfig;
DomainPrefixEvent event;
bool found = false;
while (Get<NetworkData::Leader>().GetNext(iterator, prefixConfig) == kErrorNone)
{
if (prefixConfig.mDp)
{
found = true;
break;
}
}
if (!found)
{
VerifyOrExit(HasDomainPrefix());
mDomainPrefix.Clear();
event = kDomainPrefixRemoved;
}
else
{
VerifyOrExit(prefixConfig.GetPrefix() != mDomainPrefix);
event = HasDomainPrefix() ? kDomainPrefixRefreshed : kDomainPrefixAdded;
mDomainPrefix = prefixConfig.GetPrefix();
}
LogInfo("%s domain Prefix: %s", DomainPrefixEventToString(event), mDomainPrefix.ToString().AsCString());
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
Get<Local>().HandleDomainPrefixUpdate(event);
#endif
#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE)
Get<DuaManager>().HandleDomainPrefixUpdate(event);
#endif
exit:
OT_UNUSED_VARIABLE(event);
}
bool Leader::IsDomainUnicast(const Ip6::Address &aAddress) const
{
return HasDomainPrefix() && aAddress.MatchesPrefix(mDomainPrefix);
}
} // namespace BackboneRouter
} // namespace ot
+1 -40
View File
@@ -67,16 +67,6 @@ static_assert(kDefaultMlrTimeout >= kMinMlrTimeout && kDefaultMlrTimeout <= kMax
static_assert(kMaxMlrTimeout * 1000 > kMaxMlrTimeout, "SecToMsec(kMaxMlrTimeout) will overflow");
static_assert(kParentAggregateDelay > 1, "kParentAggregateDelay should be larger than 1 second");
/**
* Represents Domain Prefix changes.
*/
enum DomainPrefixEvent : uint8_t
{
kDomainPrefixAdded = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED, ///< Domain Prefix Added.
kDomainPrefixRemoved = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED, ///< Domain Prefix Removed.
kDomainPrefixRefreshed = OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED, ///< Domain Prefix Changed.
};
/**
* Represents Primary Backbone Router events.
*/
@@ -220,47 +210,18 @@ public:
*/
bool HasPrimary(void) const { return mConfig.IsPresent(); }
/**
* Gets the Domain Prefix in the Thread Network.
*
* @retval A pointer to the Domain Prefix or nullptr if there is no Domain Prefix.
*/
const Ip6::Prefix *GetDomainPrefix(void) const { return HasDomainPrefix() ? &mDomainPrefix : nullptr; }
/**
* Indicates whether or not the Domain Prefix is available in the Thread Network.
*
* @retval TRUE If there is Domain Prefix.
* @retval FALSE If there is no Domain Prefix.
*/
bool HasDomainPrefix(void) const { return (mDomainPrefix.GetLength() > 0); }
/**
* Indicates whether or not the address is a Domain Unicast Address.
*
* @param[in] aAddress A reference to the address.
*
* @retval true @p aAddress is a Domain Unicast Address.
* @retval false @p aAddress is not a Domain Unicast Address.
*/
bool IsDomainUnicast(const Ip6::Address &aAddress) const;
private:
void HandleNotifierEvents(Events aEvents);
void UpdateBackboneRouterPrimary(void);
void UpdateDomainPrefixConfig(void);
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
static const char *PrimaryEventToString(PrimaryEvent aEvent);
static const char *DomainPrefixEventToString(DomainPrefixEvent aEvent);
#endif
Config mConfig;
Ip6::Prefix mDomainPrefix;
Config mConfig;
};
} // namespace BackboneRouter
DefineMapEnum(otBackboneRouterDomainPrefixEvent, BackboneRouter::DomainPrefixEvent);
DefineCoreType(otBackboneRouterConfig, BackboneRouter::Config);
} // namespace ot
+1 -118
View File
@@ -53,11 +53,8 @@ Local::Local(Instance &aInstance)
, mRegistrationTimeout(0)
, mMlrTimeout(kDefaultMlrTimeout)
{
mDomainPrefixConfig.GetPrefix().SetLength(0);
// Primary Backbone Router Aloc
mBbrPrimaryAloc.InitAsThreadOriginMeshLocal();
mBbrPrimaryAloc.GetAddress().GetIid().InitAsLocator(Mle::Aloc16::ForPrimaryBackboneRouter());
// All Network Backbone Routers Multicast Address.
mAllNetworkBackboneRouters.Clear();
@@ -65,13 +62,6 @@ Local::Local(Instance &aInstance)
mAllNetworkBackboneRouters.mFields.m8[0] = 0xff; // Multicast
mAllNetworkBackboneRouters.mFields.m8[1] = 0x32; // Flags = 3, Scope = 2
mAllNetworkBackboneRouters.mFields.m8[15] = 3; // Group ID = 3
// All Domain Backbone Routers Multicast Address.
mAllDomainBackboneRouters.Clear();
mAllDomainBackboneRouters.mFields.m8[0] = 0xff; // Multicast
mAllDomainBackboneRouters.mFields.m8[1] = 0x32; // Flags = 3, Scope = 2
mAllDomainBackboneRouters.mFields.m8[15] = 3; // Group ID = 3
}
void Local::SetEnabled(bool aEnable)
@@ -81,12 +71,10 @@ void Local::SetEnabled(bool aEnable)
if (aEnable)
{
SetState(kStateSecondary);
AddDomainPrefixToNetworkData();
IgnoreError(AddService(kDecideBasedOnState));
}
else
{
RemoveDomainPrefixFromNetworkData();
RemoveService();
SetState(kStateDisabled);
}
@@ -225,7 +213,7 @@ void Local::SetState(State aState)
if (aState == kStatePrimary)
{
// Add Primary Backbone Router ALOC for Primary Backbone Router.
mBbrPrimaryAloc.GetAddress().SetPrefix(Get<Mle::Mle>().GetMeshLocalPrefix());
Get<Mle::Mle>().ComposeAloc(Mle::Aloc16::ForPrimaryBackboneRouter(), mBbrPrimaryAloc.GetAddress());
Get<ThreadNetif>().AddUnicastAddress(mBbrPrimaryAloc);
}
@@ -318,59 +306,6 @@ exit:
}
}
Error Local::GetDomainPrefix(NetworkData::OnMeshPrefixConfig &aConfig)
{
Error error = kErrorNone;
VerifyOrExit(mDomainPrefixConfig.GetPrefix().GetLength() > 0, error = kErrorNotFound);
aConfig = mDomainPrefixConfig;
exit:
return error;
}
Error Local::RemoveDomainPrefix(const Ip6::Prefix &aPrefix)
{
Error error = kErrorNone;
VerifyOrExit(aPrefix.GetLength() > 0, error = kErrorInvalidArgs);
VerifyOrExit(mDomainPrefixConfig.GetPrefix() == aPrefix, error = kErrorNotFound);
if (IsEnabled())
{
RemoveDomainPrefixFromNetworkData();
}
mDomainPrefixConfig.GetPrefix().SetLength(0);
exit:
return error;
}
Error Local::SetDomainPrefix(const NetworkData::OnMeshPrefixConfig &aConfig)
{
Error error = kErrorNone;
VerifyOrExit(aConfig.IsValid(GetInstance()), error = kErrorInvalidArgs);
if (IsEnabled())
{
RemoveDomainPrefixFromNetworkData();
}
mDomainPrefixConfig = aConfig;
LogDomainPrefix(kActionSet, kErrorNone);
if (IsEnabled())
{
AddDomainPrefixToNetworkData();
}
exit:
return error;
}
void Local::ApplyNewMeshLocalPrefix(void)
{
VerifyOrExit(IsEnabled());
@@ -383,40 +318,6 @@ exit:
return;
}
void Local::HandleDomainPrefixUpdate(DomainPrefixEvent aEvent)
{
VerifyOrExit(IsEnabled());
if (aEvent == kDomainPrefixRemoved || aEvent == kDomainPrefixRefreshed)
{
Get<BackboneTmfAgent>().UnsubscribeMulticast(mAllDomainBackboneRouters);
}
if (aEvent == kDomainPrefixAdded || aEvent == kDomainPrefixRefreshed)
{
mAllDomainBackboneRouters.SetMulticastNetworkPrefix(*Get<Leader>().GetDomainPrefix());
Get<BackboneTmfAgent>().SubscribeMulticast(mAllDomainBackboneRouters);
}
mDomainPrefixCallback.InvokeIfSet(static_cast<otBackboneRouterDomainPrefixEvent>(aEvent),
Get<Leader>().GetDomainPrefix());
exit:
return;
}
void Local::RemoveDomainPrefixFromNetworkData(void)
{
Error error = kErrorNotFound; // only used for logging.
if (mDomainPrefixConfig.mPrefix.mLength > 0)
{
error = Get<NetworkData::Local>().RemoveOnMeshPrefix(mDomainPrefixConfig.GetPrefix());
}
LogDomainPrefix(kActionRemove, error);
}
void Local::IncrementSequenceNumber(void)
{
switch (mSequenceNumber)
@@ -435,18 +336,6 @@ void Local::IncrementSequenceNumber(void)
}
}
void Local::AddDomainPrefixToNetworkData(void)
{
Error error = kErrorNotFound; // only used for logging.
if (mDomainPrefixConfig.GetPrefix().GetLength() > 0)
{
error = Get<NetworkData::Local>().AddOnMeshPrefix(mDomainPrefixConfig);
}
LogDomainPrefix(kActionAdd, error);
}
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
const char *Local::ActionToString(Action aAction)
@@ -461,12 +350,6 @@ const char *Local::ActionToString(Action aAction)
return kStrings[aAction];
}
void Local::LogDomainPrefix(Action aAction, Error aError)
{
LogInfo("%s Domain Prefix: %s, %s", ActionToString(aAction), mDomainPrefixConfig.GetPrefix().ToString().AsCString(),
ErrorToString(aError));
}
void Local::LogService(Action aAction, Error aError)
{
LogInfo("%s BBR Service: seqno (%u), delay (%us), timeout (%lus), %s", ActionToString(aAction), mSequenceNumber,
+9 -74
View File
@@ -77,8 +77,6 @@ class Local : public InstanceLocator, private NonCopyable
friend class ot::Notifier;
public:
typedef otBackboneRouterDomainPrefixCallback DomainPrefixCallback; ///< Domain Prefix callback.
/**
* Represents Backbone Router state.
*/
@@ -190,37 +188,6 @@ public:
*/
void HandleBackboneRouterPrimaryUpdate(PrimaryEvent aEvent);
/**
* Gets the Domain Prefix configuration.
*
* @param[out] aConfig A reference to the Domain Prefix configuration.
*
* @retval kErrorNone Successfully got the Domain Prefix configuration.
* @retval kErrorNotFound No Domain Prefix was configured.
*/
Error GetDomainPrefix(NetworkData::OnMeshPrefixConfig &aConfig);
/**
* Removes the local Domain Prefix configuration.
*
* @param[in] aPrefix A reference to the IPv6 Domain Prefix.
*
* @retval kErrorNone Successfully removed the Domain Prefix.
* @retval kErrorInvalidArgs @p aPrefix is invalid.
* @retval kErrorNotFound No Domain Prefix was configured or @p aPrefix doesn't match.
*/
Error RemoveDomainPrefix(const Ip6::Prefix &aPrefix);
/**
* Sets the local Domain Prefix configuration.
*
* @param[in] aConfig A reference to the Domain Prefix configuration.
*
* @returns kErrorNone Successfully set the local Domain Prefix.
* @returns kErrorInvalidArgs @p aConfig is invalid.
*/
Error SetDomainPrefix(const NetworkData::OnMeshPrefixConfig &aConfig);
/**
* Returns a reference to the All Network Backbone Routers Multicast Address.
*
@@ -228,36 +195,11 @@ public:
*/
const Ip6::Address &GetAllNetworkBackboneRoutersAddress(void) const { return mAllNetworkBackboneRouters; }
/**
* Returns a reference to the All Domain Backbone Routers Multicast Address.
*
* @returns A reference to the All Domain Backbone Routers Multicast Address.
*/
const Ip6::Address &GetAllDomainBackboneRoutersAddress(void) const { return mAllDomainBackboneRouters; }
/**
* Applies the Mesh Local Prefix.
*/
void ApplyNewMeshLocalPrefix(void);
/**
* Updates the subscription of All Domain Backbone Routers Multicast Address.
*
* @param[in] aEvent The Domain Prefix event.
*/
void HandleDomainPrefixUpdate(DomainPrefixEvent aEvent);
/**
* Sets the Domain Prefix callback.
*
* @param[in] aCallback The callback function.
* @param[in] aContext A user context pointer.
*/
void SetDomainPrefixCallback(DomainPrefixCallback aCallback, void *aContext)
{
mDomainPrefixCallback.Set(aCallback, aContext);
}
private:
enum Action : uint8_t
{
@@ -271,33 +213,26 @@ private:
void UpdateState(void);
void RemoveService(void);
void HandleTimeTick(void);
void AddDomainPrefixToNetworkData(void);
void RemoveDomainPrefixFromNetworkData(void);
void IncrementSequenceNumber(void);
#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_INFO)
static const char *ActionToString(Action aAction);
void LogService(Action aAction, Error aError);
void LogDomainPrefix(Action aAction, Error aError);
#else
void LogService(Action, Error) {}
void LogDomainPrefix(Action, Error) {}
#endif
// Indicates whether or not already add Backbone Router Service to local server data.
// Used to check whether or not in restore stage after reset or whether to remove
// Backbone Router service for Secondary Backbone Router if it was added by force.
bool mIsServiceAdded;
State mState;
uint8_t mSequenceNumber;
uint8_t mRegistrationJitter;
uint16_t mReregistrationDelay;
uint16_t mRegistrationTimeout;
uint32_t mMlrTimeout;
NetworkData::OnMeshPrefixConfig mDomainPrefixConfig;
Ip6::Netif::UnicastAddress mBbrPrimaryAloc;
Ip6::Address mAllNetworkBackboneRouters;
Ip6::Address mAllDomainBackboneRouters;
Callback<DomainPrefixCallback> mDomainPrefixCallback;
bool mIsServiceAdded;
State mState;
uint8_t mSequenceNumber;
uint8_t mRegistrationJitter;
uint16_t mReregistrationDelay;
uint16_t mRegistrationTimeout;
uint32_t mMlrTimeout;
Ip6::Netif::UnicastAddress mBbrPrimaryAloc;
Ip6::Address mAllNetworkBackboneRouters;
};
} // namespace BackboneRouter
-1
View File
@@ -47,7 +47,6 @@
#include "common/locator.hpp"
#include "common/non_copyable.hpp"
#include "net/netif.hpp"
#include "thread/dua_manager.hpp"
#include "thread/mlr_types.hpp"
#include "thread/network_data.hpp"
#include "thread/tmf.hpp"
+4 -6
View File
@@ -284,16 +284,14 @@ bool FavoredOmrPrefix::IsInfrastructureDerived(void) const
void FavoredOmrPrefix::SetFrom(const NetworkData::OnMeshPrefixConfig &aOnMeshPrefixConfig)
{
mPrefix = aOnMeshPrefixConfig.GetPrefix();
mPreference = aOnMeshPrefixConfig.GetPreference();
mIsDomainPrefix = aOnMeshPrefixConfig.mDp;
mPrefix = aOnMeshPrefixConfig.GetPrefix();
mPreference = aOnMeshPrefixConfig.GetPreference();
}
void FavoredOmrPrefix::SetFrom(const OmrPrefix &aOmrPrefix)
{
mPrefix = aOmrPrefix.GetPrefix();
mPreference = aOmrPrefix.GetPreference();
mIsDomainPrefix = aOmrPrefix.IsDomainPrefix();
mPrefix = aOmrPrefix.GetPrefix();
mPreference = aOmrPrefix.GetPreference();
}
bool FavoredOmrPrefix::IsFavoredOver(const NetworkData::OnMeshPrefixConfig &aOmrPrefixConfig) const
-15
View File
@@ -569,20 +569,6 @@ public:
*/
RoutePreference GetPreference(void) const { return mPreference; }
/**
* Indicates whether the OMR prefix is a domain prefix.
*
* @retval TRUE If the OMR prefix is a domain prefix.
* @retval FALSE If the OMR prefix is not a domain prefix.
*/
bool IsDomainPrefix(void) const { return mIsDomainPrefix; }
/**
* Sets the OMR prefix and its preference.
*
* @param[in] aPrefix The IPv6 prefix to set.
* @param[in] aPreference The preference to set.
*/
void SetPrefix(const Ip6::Prefix &aPrefix, RoutePreference aPreference);
/**
@@ -599,7 +585,6 @@ public:
protected:
Ip6::Prefix mPrefix;
RoutePreference mPreference;
bool mIsDomainPrefix;
};
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+7 -7
View File
@@ -107,25 +107,25 @@ Error InfraIf::Send(const Icmp6Packet &aPacket, const Ip6::Address &aDestination
void InfraIf::HandledReceived(uint32_t aIfIndex, const Ip6::Address &aSource, const Icmp6Packet &aPacket)
{
Error error = kErrorNone;
const Ip6::Icmp::Header *icmp6Header;
Error error = kErrorNone;
const Ip6::Icmp6Header *icmp6Header;
VerifyOrExit(mInitialized && mIsRunning, error = kErrorInvalidState);
VerifyOrExit(aIfIndex == mIfIndex, error = kErrorDrop);
VerifyOrExit(aPacket.GetBytes() != nullptr, error = kErrorInvalidArgs);
VerifyOrExit(aPacket.GetLength() >= sizeof(Ip6::Icmp::Header), error = kErrorParse);
VerifyOrExit(aPacket.GetLength() >= sizeof(Ip6::Icmp6Header), error = kErrorParse);
icmp6Header = reinterpret_cast<const Ip6::Icmp::Header *>(aPacket.GetBytes());
icmp6Header = reinterpret_cast<const Ip6::Icmp6Header *>(aPacket.GetBytes());
switch (icmp6Header->GetType())
{
case Ip6::Icmp::Header::kTypeRouterAdvert:
case Ip6::Icmp6Header::kTypeRouterAdvert:
Get<RxRaTracker>().HandleRouterAdvertisement(aPacket, aSource);
break;
case Ip6::Icmp::Header::kTypeNeighborAdvert:
case Ip6::Icmp6Header::kTypeNeighborAdvert:
Get<RxRaTracker>().HandleNeighborAdvertisement(aPacket);
break;
case Ip6::Icmp::Header::kTypeRouterSolicit:
case Ip6::Icmp6Header::kTypeRouterSolicit:
Get<RoutingManager>().HandleRouterSolicit(aPacket, aSource);
break;
default:
+5 -15
View File
@@ -706,8 +706,8 @@ void RoutingManager::CheckReachabilityToSendIcmpError(const Message &aMessage, c
messageInfo.Clear();
messageInfo.SetPeerAddr(aIp6Header.GetSource());
IgnoreError(Get<Ip6::Icmp>().SendError(Ip6::Icmp::Header::kTypeDstUnreach,
Ip6::Icmp::Header::kCodeDstUnreachProhibited, messageInfo, aMessage));
IgnoreError(Get<Ip6::Icmp>().SendError(Ip6::Icmp6Header::kTypeDstUnreach,
Ip6::Icmp6Header::kCodeDstUnreachProhibited, messageInfo, aMessage));
exit:
return;
@@ -1169,11 +1169,6 @@ RoutingManager::OmrPrefixManager::InfoString RoutingManager::OmrPrefixManager::F
string.Append("%s (prf:%s", aFavoredPrefix.GetPrefix().ToString().AsCString(),
RoutePreferenceToString(aFavoredPrefix.GetPreference()));
if (aFavoredPrefix.IsDomainPrefix())
{
string.Append(", domain");
}
if (aFavoredPrefix.GetPrefix() == mLocalPrefix.GetPrefix())
{
string.Append(", local");
@@ -1909,7 +1904,7 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
// (2) Favored OMR prefix.
if (!omrPrefixManager.GetFavoredPrefix().IsEmpty() && !omrPrefixManager.GetFavoredPrefix().IsDomainPrefix())
if (!omrPrefixManager.GetFavoredPrefix().IsEmpty())
{
mPrefixes.Add(omrPrefixManager.GetFavoredPrefix().GetPrefix());
}
@@ -1928,11 +1923,6 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
// it, while it might still be present in the Network Data due to
// delays in registering changes with the leader.
if (prefixConfig.mDp)
{
continue;
}
if (IsValidOmrPrefix(prefixConfig) &&
(prefixConfig.GetPrefix() != omrPrefixManager.GetLocalPrefix().GetPrefix()))
{
@@ -1940,13 +1930,13 @@ Error RoutingManager::RioAdvertiser::AppendRios(RouterAdvert::TxMessage &aRaMess
}
}
// (4) All other on-mesh prefixes (excluding Domain Prefix).
// (4) All other on-mesh prefixes.
iterator = NetworkData::kIteratorInit;
while (Get<NetworkData::Leader>().GetNext(iterator, prefixConfig) == kErrorNone)
{
if (prefixConfig.mOnMesh && !prefixConfig.mDp && !IsValidOmrPrefix(prefixConfig))
if (prefixConfig.mOnMesh && !IsValidOmrPrefix(prefixConfig))
{
mPrefixes.Add(prefixConfig.GetPrefix());
}
+31 -3
View File
@@ -491,6 +491,34 @@ public:
return FindMatching(aIndicator) != nullptr;
}
/**
* Counts the number of elements in the array matching a given indicator.
*
* The template type `Indicator` specifies the type of @p aIndicator object which is used to match against elements
* in the array. To check that an element matches the given indicator, the `Matches()` method is invoked on each
* `Type` element in the array. The `Matches()` method should be provided by `Type` class accordingly:
*
* bool Type::Matches(const Indicator &aIndicator) const
*
* @param[in] aIndicator An indicator to match with elements in the array.
*
* @returns The number of elements in the array matching @p aIndicator.
*/
template <typename Indicator> SizeType CountMatching(const Indicator &aIndicator) const
{
SizeType count = 0;
for (const Type &element : *this)
{
if (element.Matches(aIndicator))
{
count++;
}
}
return count;
}
/**
* Removes the first element in the array matching a given indicator.
*
@@ -572,17 +600,17 @@ public:
}
/**
* Indicates whether a given entry pointer is from the array buffer.
* Indicates whether a given pointer is from the array buffer.
*
* Does not check the current length of array and only checks that @p aEntry is pointing to an address
* contained within underlying C array buffer.
*
* @param[in] aEntry A pointer to an entry to check.
* @param[in] aEntry A pointer to check.
*
* @retval TRUE The @p aEntry is from the array.
* @retval FALSE The @p aEntry is not from the array.
*/
bool IsInArrayBuffer(const Type *aEntry) const
bool IsInArrayBuffer(const void *aEntry) const
{
return (&mElements[0] <= aEntry) && (aEntry < GetArrayEnd(mElements));
}
+32
View File
@@ -427,6 +427,38 @@ template <> inline void Write(uint64_t aValue, uint8_t *aBuffer) { WriteUint64(a
} // namespace LittleEndian
/**
* Represents the byte ordering (endianness) encoding.
*/
enum Encoding : uint8_t
{
kBigEndian, ///< Big-endian.
kLittleEndian, ///< Little-endian.
};
/**
* Swaps the byte order of a given integer value from the host representation to the specified encoding,
* or vice-versa.
*
* @tparam kEncoding The target encoding (big or little endian).
* @tparam UintType The unsigned integer type.
*
* @param[in] aValue The value to swap.
*
* @returns The swapped value.
*/
template <Encoding kEncoding, typename UintType> UintType HostSwap(UintType aValue);
template <> inline uint8_t HostSwap<kBigEndian>(uint8_t aValue) { return aValue; }
template <> inline uint16_t HostSwap<kBigEndian>(uint16_t aValue) { return BigEndian::HostSwap16(aValue); }
template <> inline uint32_t HostSwap<kBigEndian>(uint32_t aValue) { return BigEndian::HostSwap32(aValue); }
template <> inline uint64_t HostSwap<kBigEndian>(uint64_t aValue) { return BigEndian::HostSwap64(aValue); }
template <> inline uint8_t HostSwap<kLittleEndian>(uint8_t aValue) { return aValue; }
template <> inline uint16_t HostSwap<kLittleEndian>(uint16_t aValue) { return LittleEndian::HostSwap16(aValue); }
template <> inline uint32_t HostSwap<kLittleEndian>(uint32_t aValue) { return LittleEndian::HostSwap32(aValue); }
template <> inline uint64_t HostSwap<kLittleEndian>(uint64_t aValue) { return LittleEndian::HostSwap64(aValue); }
} // namespace ot
#endif // OT_CORE_COMMON_ENCODING_HPP_
+12 -11
View File
@@ -38,6 +38,7 @@
#include "common/code_utils.hpp"
#include "common/debug.hpp"
#include "common/encoding.hpp"
#include "common/type_traits.hpp"
#if OPENTHREAD_FTD || OPENTHREAD_MTD
#include "common/message.hpp"
@@ -54,19 +55,19 @@ void FrameBuilder::Init(void *aBuffer, uint16_t aMaxLength)
Error FrameBuilder::AppendUint8(uint8_t aUint8) { return Append<uint8_t>(aUint8); }
Error FrameBuilder::AppendBigEndianUint16(uint16_t aUint16) { return Append<uint16_t>(BigEndian::HostSwap16(aUint16)); }
Error FrameBuilder::AppendBigEndianUint32(uint32_t aUint32) { return Append<uint32_t>(BigEndian::HostSwap32(aUint32)); }
Error FrameBuilder::AppendLittleEndianUint16(uint16_t aUint16)
template <Encoding kEncoding, typename UintType> Error FrameBuilder::AppendUint(UintType aUint)
{
return Append<uint16_t>(LittleEndian::HostSwap16(aUint16));
static_assert(TypeTraits::IsUint<UintType>::kValue, "UintType is not valid, it must be an unsigned int");
return Append<UintType>(HostSwap<kEncoding>(aUint));
}
Error FrameBuilder::AppendLittleEndianUint32(uint32_t aUint32)
{
return Append<uint32_t>(LittleEndian::HostSwap32(aUint32));
}
template Error FrameBuilder::AppendUint<kBigEndian, uint16_t>(uint16_t aUint);
template Error FrameBuilder::AppendUint<kBigEndian, uint32_t>(uint32_t aUint);
template Error FrameBuilder::AppendUint<kBigEndian, uint64_t>(uint64_t aUint);
template Error FrameBuilder::AppendUint<kLittleEndian, uint16_t>(uint16_t aUint);
template Error FrameBuilder::AppendUint<kLittleEndian, uint32_t>(uint32_t aUint);
template Error FrameBuilder::AppendUint<kLittleEndian, uint64_t>(uint64_t aUint);
Error FrameBuilder::AppendBytes(const void *aBuffer, uint16_t aLength)
{
@@ -90,7 +91,7 @@ Error FrameBuilder::AppendMacAddress(const Mac::Address &aMacAddress)
break;
case Mac::Address::kTypeShort:
error = AppendLittleEndianUint16(aMacAddress.GetShort());
error = AppendUint<kLittleEndian>(aMacAddress.GetShort());
break;
case Mac::Address::kTypeExtended:
+9 -33
View File
@@ -36,6 +36,7 @@
#include "openthread-core-config.h"
#include "common/encoding.hpp"
#include "common/error.hpp"
#include "common/type_traits.hpp"
#include "mac/mac_types.hpp"
@@ -119,44 +120,19 @@ public:
Error AppendUint8(uint8_t aUint8);
/**
* Appends an `uint16_t` value assuming big endian encoding to the `FrameBuilder`.
* Appends an integer value with a specified encoding to the `FrameBuilder`.
*
* @param[in] aUint16 The `uint16_t` value to append.
* The value is converted to the specified @p kEncoding byte order before being appended.
*
* @tparam kEncoding The encoding to use (big or little endian).
* @tparam UintType The unsigned integer type.
*
* @param[in] aUint The integer value to append.
*
* @retval kErrorNone Successfully appended the value.
* @retval kErrorNoBufs Insufficient available buffers.
*/
Error AppendBigEndianUint16(uint16_t aUint16);
/**
* Appends an `uint32_t` value assuming big endian encoding to the `FrameBuilder`.
*
* @param[in] aUint32 The `uint32_t` value to append.
*
* @retval kErrorNone Successfully appended the value.
* @retval kErrorNoBufs Insufficient available buffers.
*/
Error AppendBigEndianUint32(uint32_t aUint32);
/**
* Appends an `uint16_t` value assuming little endian encoding to the `FrameBuilder`.
*
* @param[in] aUint16 The `uint16_t` value to append.
*
* @retval kErrorNone Successfully appended the value.
* @retval kErrorNoBufs Insufficient available buffers.
*/
Error AppendLittleEndianUint16(uint16_t aUint16);
/**
* Appends an `uint32_t` value assuming little endian encoding to the `FrameBuilder`.
*
* @param[in] aUint32 The `uint32_t` value to append.
*
* @retval kErrorNone Successfully appended the value.
* @retval kErrorNoBufs Insufficient available buffers.
*/
Error AppendLittleEndianUint32(uint32_t aUint32);
template <Encoding kEncoding, typename UintType> Error AppendUint(UintType aUint);
/**
* Appends bytes from a given buffer to the `FrameBuilder`.
+11 -35
View File
@@ -40,49 +40,25 @@ namespace ot {
Error FrameData::ReadUint8(uint8_t &aUint8) { return ReadBytes(&aUint8, sizeof(uint8_t)); }
Error FrameData::ReadBigEndianUint16(uint16_t &aUint16)
template <Encoding kEncoding, typename UintType> Error FrameData::ReadUint(UintType &aUint)
{
Error error;
SuccessOrExit(error = ReadBytes(&aUint16, sizeof(uint16_t)));
aUint16 = BigEndian::HostSwap16(aUint16);
static_assert(TypeTraits::IsUint<UintType>::kValue, "UintType is not valid, it must be an unsigned int");
SuccessOrExit(error = ReadBytes(&aUint, sizeof(UintType)));
aUint = HostSwap<kEncoding>(aUint);
exit:
return error;
}
Error FrameData::ReadBigEndianUint32(uint32_t &aUint32)
{
Error error;
SuccessOrExit(error = ReadBytes(&aUint32, sizeof(uint32_t)));
aUint32 = BigEndian::HostSwap32(aUint32);
exit:
return error;
}
Error FrameData::ReadLittleEndianUint16(uint16_t &aUint16)
{
Error error;
SuccessOrExit(error = ReadBytes(&aUint16, sizeof(uint16_t)));
aUint16 = LittleEndian::HostSwap16(aUint16);
exit:
return error;
}
Error FrameData::ReadLittleEndianUint32(uint32_t &aUint32)
{
Error error;
SuccessOrExit(error = ReadBytes(&aUint32, sizeof(uint32_t)));
aUint32 = LittleEndian::HostSwap32(aUint32);
exit:
return error;
}
template Error FrameData::ReadUint<kBigEndian, uint16_t>(uint16_t &aUint);
template Error FrameData::ReadUint<kBigEndian, uint32_t>(uint32_t &aUint);
template Error FrameData::ReadUint<kBigEndian, uint64_t>(uint64_t &aUint);
template Error FrameData::ReadUint<kLittleEndian, uint16_t>(uint16_t &aUint);
template Error FrameData::ReadUint<kLittleEndian, uint32_t>(uint32_t &aUint);
template Error FrameData::ReadUint<kLittleEndian, uint64_t>(uint64_t &aUint);
Error FrameData::ReadBytes(void *aBuffer, uint16_t aLength)
{
+12 -41
View File
@@ -37,6 +37,7 @@
#include "openthread-core-config.h"
#include "common/data.hpp"
#include "common/encoding.hpp"
#include "common/type_traits.hpp"
namespace ot {
@@ -74,52 +75,22 @@ public:
Error ReadUint8(uint8_t &aUint8);
/**
* Reads an `uint16_t` value assuming big endian encoding from the `FrameData`.
* Reads an integer value with a specified encoding from the `FrameData`.
*
* The value is read from the frame data, converted from the specified @p kEncoding byte order to
* host byte order, and returned in @p aUint.
*
* If read successfully, the `FrameData` is updated to skip over the read content.
*
* @param[out] aUint16 A reference to an `uint16_t` to return the read value.
* @tparam kEncoding The encoding of the integer in the frame data (big or little endian).
* @tparam UintType The unsigned integer type.
*
* @retval kErrorNone Successfully read `uint16_t` value and skipped over it.
* @retval kErrorParse Not enough bytes remaining to read.
* @param[out] aUint A reference to the integer to return the read value.
*
* @retval kErrorNone Successfully read the value and skipped over it.
* @retval kErrorParse Not enough bytes remaining to read.
*/
Error ReadBigEndianUint16(uint16_t &aUint16);
/**
* Reads an `uint32_t` value assuming big endian encoding from the `FrameData`.
*
* If read successfully, the `FrameData` is updated to skip over the read content.
*
* @param[out] aUint32 A reference to an `uint32_t` to return the read value.
*
* @retval kErrorNone Successfully read `uint32_t` value and skipped over it.
* @retval kErrorParse Not enough bytes remaining to read.
*/
Error ReadBigEndianUint32(uint32_t &aUint32);
/**
* Reads an `uint16_t` value assuming little endian encoding from the `FrameData`.
*
* If read successfully, the `FrameData` is updated to skip over the read content.
*
* @param[out] aUint16 A reference to an `uint16_t` to return the read value.
*
* @retval kErrorNone Successfully read `uint16_t` value and skipped over it.
* @retval kErrorParse Not enough bytes remaining to read.
*/
Error ReadLittleEndianUint16(uint16_t &aUint16);
/**
* Reads an `uint32_t` value assuming little endian encoding from the `FrameData`.
*
* If read successfully, the `FrameData` is updated to skip over the read content.
*
* @param[out] aUint32 A reference to an `uint32_t` to return the read value.
*
* @retval kErrorNone Successfully read `uint32_t` value and skipped over it.
* @retval kErrorParse Not enough bytes remaining to read.
*/
Error ReadLittleEndianUint32(uint32_t &aUint32);
template <Encoding kEncoding, typename UintType> Error ReadUint(UintType &aUint);
/**
* Reads a given number of bytes from the `FrameData`.
+13
View File
@@ -81,6 +81,10 @@ class HmacSha256;
} // namespace Crypto
namespace Ip6 {
class PlatTcp;
} // namespace Ip6
/**
* @addtogroup core-message
*
@@ -293,6 +297,7 @@ class Message : public otMessage, public Buffer, public GetProvider<Message>
friend class Crypto::HmacSha256;
friend class Crypto::Sha256;
friend class Crypto::AesCcm;
friend class Ip6::PlatTcp;
friend class MessagePool;
friend class MessageQueue;
friend class PriorityQueue;
@@ -1714,6 +1719,14 @@ public:
~MessageQueue(void) { DequeueAndFreeAll(); }
#endif
/**
* Indicates whether the message queue is empty.
*
* @retval TRUE The message queue is empty.
* @retval FALSE The message queue is not empty.
*/
bool IsEmpty(void) const { return GetHead() == nullptr; }
/**
* Returns a pointer to the first message.
*
+4 -6
View File
@@ -140,12 +140,13 @@ void Notifier::EmitEvents(void)
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE && OPENTHREAD_CONFIG_BORDER_AGENT_ADMITTER_ENABLE
Get<MeshCoP::BorderAgent::Admitter>().HandleNotifierEvents(events);
#endif
#if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
Get<Ble::BleSecure>().HandleNotifierEvents(events);
Get<MeshCoP::TcatAgent>().HandleNotifierEvents(events);
#endif
#if OPENTHREAD_CONFIG_MLR_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE)
Get<Mlr::Manager>().HandleNotifierEvents(events);
#endif
#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE)
Get<DuaManager>().HandleNotifierEvents(events);
#endif
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
Get<Trel::Link>().HandleNotifierEvents(events);
#endif
@@ -193,9 +194,6 @@ void Notifier::EmitEvents(void)
#if OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE
Get<Utils::LinkMetricsManager>().HandleNotifierEvents(events);
#endif
#if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
Get<MeshCoP::TcatAgent>().HandleNotifierEvents(events);
#endif
for (ExternalCallback &callback : mExternalCallbacks)
{
+1 -14
View File
@@ -71,13 +71,6 @@ void SettingsBase::ChildInfo::Log(Action aAction) const
}
#endif
#if OPENTHREAD_CONFIG_DUA_ENABLE
void SettingsBase::DadInfo::Log(Action aAction) const
{
LogInfo("%s DadInfo {DadCounter:%2d}", ActionToString(aAction), GetDadCounter());
}
#endif
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
void SettingsBase::LogPrefix(Action aAction, Key aKey, const Ip6::Prefix &aPrefix)
{
@@ -151,7 +144,7 @@ const char *SettingsBase::KeyToString(Key aKey)
_(kKeyChildInfo, "ChildInfo") \
_(6, "") \
_(kKeySlaacIidSecretKey, "SlaacIidSecretKey") \
_(kKeyDadInfo, "DadInfo") \
_(8, "") \
_(9, "") \
_(10, "") \
_(kKeySrpEcdsaKey, "SrpEcdsaKey") \
@@ -487,12 +480,6 @@ void Settings::Log(Action aAction, Error aError, Key aKey, const void *aValue)
break;
#endif
#if OPENTHREAD_CONFIG_DUA_ENABLE
case kKeyDadInfo:
reinterpret_cast<const DadInfo *>(aValue)->Log(aAction);
break;
#endif
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
case kKeyBrUlaPrefix:
LogPrefix(aAction, aKey, *reinterpret_cast<const Ip6::Prefix *>(aValue));
-40
View File
@@ -112,7 +112,6 @@ public:
kKeyParentInfo = OT_SETTINGS_KEY_PARENT_INFO,
kKeyChildInfo = OT_SETTINGS_KEY_CHILD_INFO,
kKeySlaacIidSecretKey = OT_SETTINGS_KEY_SLAAC_IID_SECRET_KEY,
kKeyDadInfo = OT_SETTINGS_KEY_DAD_INFO,
kKeySrpEcdsaKey = OT_SETTINGS_KEY_SRP_ECDSA_KEY,
kKeySrpClientInfo = OT_SETTINGS_KEY_SRP_CLIENT_INFO,
kKeySrpServerInfo = OT_SETTINGS_KEY_SRP_SERVER_INFO,
@@ -486,45 +485,6 @@ public:
};
#endif
#if OPENTHREAD_CONFIG_DUA_ENABLE
/**
* Represents the duplicate address detection information for settings storage.
*/
OT_TOOL_PACKED_BEGIN
class DadInfo : private Clearable<DadInfo>
{
friend class Settings;
friend class Clearable<DadInfo>;
public:
static constexpr Key kKey = kKeyDadInfo; ///< The associated key.
/**
* Initializes the `DadInfo` object.
*/
void Init(void) { Clear(); }
/**
* Returns the Dad Counter.
*
* @returns The Dad Counter value.
*/
uint8_t GetDadCounter(void) const { return mDadCounter; }
/**
* Sets the Dad Counter.
*
* @param[in] aDadCounter The Dad Counter value.
*/
void SetDadCounter(uint8_t aDadCounter) { mDadCounter = aDadCounter; }
private:
void Log(Action aAction) const;
uint8_t mDadCounter; ///< Dad Counter used to resolve address conflict in Thread 1.2 DUA feature.
} OT_TOOL_PACKED_END;
#endif // OPENTHREAD_CONFIG_DUA_ENABLE
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
/**
* Defines constants and types for BR ULA prefix settings.
-7
View File
@@ -104,13 +104,6 @@ void TimeTicker::HandleTimer(void)
}
#endif
#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE)
if (mReceivers & Mask(kDuaManager))
{
Get<DuaManager>().HandleTimeTick();
}
#endif
if (mReceivers & Mask(kIp6Mpl))
{
Get<Ip6::Mpl>().HandleTimeTick();
-1
View File
@@ -66,7 +66,6 @@ public:
kAddressResolver, ///< `AddressResolver`
kChildSupervisor, ///< `ChildSupervisor`
kIp6FragmentReassembler, ///< `Ip6::Ip6` (handling of fragmented messages)
kDuaManager, ///< `DuaManager`
kNetworkDataNotifier, ///< `NetworkData::Notifier`
kIp6Mpl, ///< `Ip6::Mpl`
kBbrLocal, ///< `BackboneRouter::Local`
-1
View File
@@ -66,7 +66,6 @@
*
* - It has added at least one external route entry.
* - It has added at least one prefix entry with default-route and on-mesh flags set.
* - It has added at least one domain prefix (domain and on-mesh flags set).
*
* A Border Router which provides IP connectivity and is acting as a REED is eligible to request a router role upgrade
* by sending an "Address Solicit" request to leader with status reason `BorderRouterRequest`. This reason is used when
+9
View File
@@ -198,6 +198,15 @@
#define OPENTHREAD_CONFIG_MPL_DYNAMIC_INTERVAL_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE
*
* Define as 1 to enable TCP support via platform `otPlatTcp*` APIs and `Ip6::PlatTcp`.
*/
#ifndef OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE
#define OPENTHREAD_CONFIG_PLATFORM_TCP_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_TCP_ENABLE
*
-9
View File
@@ -524,15 +524,6 @@
#define OPENTHREAD_CONFIG_OTNS_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_DUA_ENABLE
*
* Define as 1 to support Thread 1.2 Domain Unicast Address feature.
*/
#ifndef OPENTHREAD_CONFIG_DUA_ENABLE
#define OPENTHREAD_CONFIG_DUA_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_MLR_ENABLE
*

Some files were not shown because too many files have changed in this diff Show More