Commit Graph

101 Commits

Author SHA1 Message Date
Jonathan Hui c2dd7eb66d [mesh-local-prefix] remove coupling to Extended PAN ID (#7686)
Deriving the Mesh Local Prefix from the Extended PAN ID was carried
forward from legacy implementations. Removing this coupling to conform
to the existing Thread Specification.
2022-05-11 18:21:09 -07:00
Yakun Xu 9a2d84a4b7 [meshcop] rename dataset managers (#7630)
This commit renames dataset managers ActiveDataset and PendingDataset
to ActiveDatasetManager and PendingDatasetManager for readability.
2022-04-25 12:49:08 -07:00
Jonathan Hui 9b6ac4b5ac [meshcop] separate Network Name from Mac (#7609) (#7616)
With the removal of Thread payload from IEEE 802.15.4 Beacons, the MAC
layer no longer needs to maintain the Network Name.
2022-04-22 10:13:17 -07:00
Jonathan Hui 515c3d3d80 [meshcop] separate Extended PAN ID from Mac (#7609)
With the removal of Thread payload from IEEE 802.15.4 Beacons, the MAC
layer no longer needs to maintain the Extended PAN ID.
2022-04-20 12:20:50 -07:00
Abtin Keshavarzian 018f54f71b [mle] renames and smaller changes (#7515)
This commit contains small changes in `Mle`:

- Renames `mParentRequestMode` to `mAttachMode` (to match its type).
- Shortens `ParentRequestType` enumerator names.
- Changes `SendParentRequest()` to return `void`.
- Adds a protected method `Mle::Attach()` (which replaces
  the `BecomeChild()`).
- Moves `AttachMode` enum as a protected definition in `Mle`
  class itself and renames the `AttachMode` constants.
2022-03-25 12:10:06 -07:00
Abtin Keshavarzian 95fa6220d7 [tmf] add AnycastLocator module (#6513)
This commit adds a new class `AnycastLocator` which can be used to
locate the closest destination of an anycast IPv6 address (i.e., find
the related mesh local EID and RLOC16). The closest destination is
determined based on the the current routing table and path costs
within the Thread mesh.

The implementation uses a CoAP confirmable post request to a newly
added URI path ("a/yl"). The destination IPv6 address of such as
request message is set to the anycast address to be located. The
receiver of the request message sends a CoAP response which includes
the "Mesh Local EID"  and "Thread RLOC16" TLVs.

This commit also adds support this new feature in CLI (adding a new
`locate <anycast-addr>` command).

Finally this commit adds `test_anycast_locator.py` to test behavior of
the new feature.
2021-09-17 08:04:44 -07:00
Abtin Keshavarzian 961fd9ae95 [common] adding AsCoreType() to covert from public to core types (#6993)
This commit adds header file `common/as_core_type.hpp` which adds
helper functions `AsCoreType()` which help convert from a
public C OpenThread type to its corresponding C++ core type (e.g.,
`otIp6Address` to `Ip6::Address`). This commit also adds `MapEnum()`
function to convert between public and core `enum` definitions (e.g.,
`otMacFilterAddressMode` and `Mac::Filter::Mode`). These helper
function act as syntactic sugar helping simplify the implementations
of OT API functions (in `api/{module}_api.cpp` files).
2021-09-16 21:15:37 -07:00
Abtin Keshavarzian 9e631d816e [mle] simplify Start(), Stop(), and SendAnnounce() (#6986)
This commit updates `Start()`, `Stop()` and `SendAnnounce()` in `Mle`
to remove the extra parameters from the `public` versions of these
methods (adding a `private` version with extra parameter for use by
`Mle` class itself). It also adds `StartMode`, `StopMode`, and
`AnnounceMode` enumerations to use as parameter type (instead of
`bool`) in these methods which helps with code readability.
2021-09-09 20:32:03 -07:00
hemanth-silabs cf452fbf7c [crypto] adding ARM PSA (Platform Security Architecture) support (#6862)
- New format for MAC keys, as a union between literal key and keyrefs.
- Modified key_manager to handle both literal keys or keyrefs.
- Modified MAC and sub_mac modules to handle both Literal Keys or keyrefs.
- Updated Crypto Modules to use abstracted APIs.
- New CLIs to handle networkkey and pskc references.
2021-09-08 14:47:46 -07:00
Abtin Keshavarzian 2798cc9c05 [utils] adding HistoryTracker module (#6807)
This commit adds History Tracker feature and its CLI support. This
feature records history of different events as the Thread network
operates (e.g., history of RX and TX IPv6 messages or network info
changes).

Recorded entries are timestamped. When the history list is read, the
timestamps are given as the entry age relative to the time the list
is being read. For example in CLI a timestamp can be shown as
`02:31:50.628 ago` indicating the entry was recorded 2 hours, 31 min,
50 sec, and 628 msec ago. Number of days is added for events that are
older than 24 hours, e.g., `31 days 03:00:23.931 ago`. Timestamps use
millisecond accuracy and are tacked up to 49 days. If an event is
older than 49 days, the entry is still tracked in the list but the
timestamp is shown as old or `more than 49 days ago`.

The `HistoryTracker` currently maintains 3 lists. The Network Info
history tracks changes to Device Role, Mode, RLOC16 and Partition ID.
The RX/TX history list records information about the received/sent
IPv6 messages:
- Message type (UDP, TCP, ICMP6 (and its subtype), etc.)
- Source and destination IPv6 addresses and port numbers
- IPv6 payload length
- The message checksum (for UDP, TCP, or ICMP6).
- Whether or not the link-layer security was used
- Message priority: low, norm, high, net (for control messages)
- Short address (RLOC16) of neighbor who send/received the msg
- Received Signal Strength (in dBm) for RX only
- Radio link info (15.4/TREL) on which msg was sent/received
  (useful when `OPENTHREAD_CONFIG_MULTI_RADIO` is enabled)

Config `HISTORY_TRACKER_EXCLUDE_THREAD_CONTROL_MESSAGES` can be used
to configure `HistoryTracker` to exclude Thread Control message
(e.g., MLE, TMF) from TX and RX history.

The number of entries recorded for each history list is configurable
through a set of OpenThread config options, e.g., number of entries
in Network Info history list is specified by OpenThread config option
`OPENTHREAD_CONFIG_HISTORY_TRACKER_NET_INFO_LIST_SIZE`. The
`HistoryTracker` will keep the most recent entries overwriting oldest
ones when the list gets full.

This commit also adds support for `HistoryTracker` in CLI. The CLI
commands provide two style for printing the history information: A
table format (more human-readable) and list style (better suited for
parsing by machine/code). `README_HISTORY.md` is added to document
the commands and the info provided by each history list entry.

This commit also adds `test_history_tracker.py` test-case which
covers the behavior of `HistoryTracker`.
2021-08-12 15:47:26 -07:00
Jonathan Hui aaabf25ff2 [network-key] change name from master to network (#6721) 2021-06-16 23:07:23 -07:00
Pieter De Gendt 84876d7f56 [api] expose API to obtain service ALOC for given service ID (#6519) 2021-04-29 09:27:02 -07:00
Li Cao d4d81c39c9 [cli] add cli to get All Thread Nodes multicast address (#6500)
This commit adds APIs to get Link/Realm Local All Thread Nodes
multicast addresses. This commit also adds cli command to get
meshlocal prefix alone for writing tests.
2021-04-22 19:14:56 -07:00
Abtin Keshavarzian f7802d60a1 [style] rename header file to locator_getters.hpp (#6422)
This commit renames the `Locator` header file to follow the same style
used by other core modules (i.e., use underscore between words in a
file name).
2021-04-10 10:16:01 -07:00
Abtin Keshavarzian 743e91361c [style] harmonize feature check and header includes (#6399)
This commit harmonizes how the feature config checks are done within
OT core modules. In header `.hpp` files, any related `#if` config
check is done immediately after the `"openthread-core-config.h"` is
included. This way the rest of definitions are skipped over if the
feature is not being used. In `cpp` source files the `#if` check is
done immediately after including the related header file.
2021-04-05 14:13:24 -07:00
Abtin Keshavarzian 7dca56e982 [error] add 'ot::Error' and 'kError{Name}' for use by core modules (#6237)
This commit adds a new core header files `common/error.hpp` which
defines `ot::Error` (mirroring `otError`) and `kError{Name}` constants
(mirroring the public `OT_ERROR_{NAME}` definitions). The new (C++
style) definitions are used by core modules. This commit also moves
`otThreadErrorToString()` (from `logging.hpp` to `error.hpp`) and
renames it to `ErrorToString()` which is used as the internal (to
core) function to covert an `Error` to a string.
2021-03-15 21:07:07 -07:00
Abtin Keshavarzian 36b9ecbf11 [neighbor-table] add 'NeighborTable' class (#5354)
This commit adds a `NeighborTable` class which provides helper methods
dealing with neighbor, e.g., finding a `Neighbor` (i.e., a `Child`
from `ChildTable`, a `Router` from `RouterTable`, or parent or parent
candidate entries), or iterating through all neighbors.  These methods
use the newly added `Neighbor::AddressMacther` to simplify the
implementation. The `NeighborTable` methods replace the similar ones
in `Mle` and `MleRouter`.
2020-08-10 09:07:52 -07:00
Abtin Keshavarzian 481f69703b [topology] define 'Neighbor::Info', 'Child::Info', and 'Router::Info' (#5328)
This commit adds new class definitions in `topology` to represent
neighbor/child/router info.
2020-08-03 21:33:34 -07:00
Yuwen Lan addb1936c3 [joiner-adv] initial implementation of Joiner Advertisement (#5299)
This commit implements Thread based Joiner Advertisement from Joiner
side, including:

- A new MeshCop TLV: Joiner Advertisement TLV which includes IEEE OUI
  and the Advertisement Data.

- New APIs to set Joiner Advertisement which will be sent along with
  Discovery Request messages.
2020-08-03 08:38:58 -07:00
Jonathan Hui 1326d64a64 [style] replace NULL with nullptr (#5109) 2020-06-17 22:44:54 -07:00
Abtin Keshavarzian 55785040c9 [discover-scanner] allow filtering based on a user given bloom filter indexes (#5075)
This commit enhances the filtering behavior of Discover Scan. When
filtering is enabled, MLE Discovery Responses with steering data
(bloom filter) not containing a set of bloom filter indexes are
filtered. This commit updates the `DiscoverScanner::Discover()` to
allow filter indexes used for filtering to be optionally specified by
the caller. It can be set to NULL (for default behavior) where the
hash of factory-assigned EUI64 of the device would be used to derive
the bloom filter indexes
2020-06-17 10:38:03 -07:00
Abtin Keshavarzian 54ad5a3960 [discover-scanner] adding Mle::DiscoverScanner (#5075)
This commit adds new class `DiscoverScanner` which implements the MLE
Discover Scan process (moving and simplifying all the code related to
this from `Mle` and `MeshForwarder` into same file/class).
2020-06-17 10:38:03 -07:00
Rongli Sun b51d9100e6 [dua] support to specify iid for domain unicast address (#4900) 2020-06-09 10:38:13 -07:00
Rongli Sun 854a2309bd [domain] add domain name (#4815) 2020-04-14 09:08:42 -07:00
Abtin Keshavarzian 91111c6237 [mle] add DeviceRole type, and IsChild, IsRouter, etc method (#4794)
This commit defines a new enum type `Mle::DeviceRole` mirroring the
public `otDeviceRole` enumeration. The enumerator in the new type
follow `kRole{Value}` style and intended for use in the core modules.
It also adds helper method in `Mle`, `IsChild()`, `IsRouter()`,
`IsLeader()`, etc to check the current device role.
2020-04-06 23:56:31 -07:00
kangping e28608cd0b [network-diagnostic] improve usability of Network Diagnostic API (#4619)
This commit improves usability of Network Diagnostic API by:

- Define native structures to represent various Network Diagnostic TLV
  values.

- Add facility function otThreadGetNextDiagnosticTlv to parse plain
  otMessage into structured data.

- Dump parsed DIAG_GET.ans/.rsp message in readable format for
  networkdiagnostic CLI command.
2020-03-26 13:43:40 -07:00
Abtin Keshavarzian ab81a256e4 [mle-types] add MeshLocalPrefix class (#4679) 2020-03-13 22:06:04 -07:00
Abtin Keshavarzian 052047a15f [mle] adding LeaderData class (#4679)
This commit adds `LeaderData` (subclass of `otLeaderData`) to store
the info from Leader Data TLV. It also adds `ReadLeaderData()` to
read Leader Data TLV from a message.
2020-03-13 22:06:04 -07:00
Abtin Keshavarzian 5903117da5 [debug] adding OT_ASSERT() macro (#4665)
This commit adds a new OpenThread specific `OT_ASSERT()` macro along
with a new config OPENTHREAD_CONFIG_ASSERT_ENABLE option which allows
the assert to be enabled or disabled. This allows a release build to
consider disabling the assert reducing code size. This commit also
adds a new travis (simulation platform) build with asserts disabled.
2020-03-11 17:30:41 -07:00
Yakun Xu b01754cabf [mle] add enhanced keep-alive (#4325)
This commit introduces the first Thread 1.2 feature - enhanced keep
alive.

This commit also introduces the build config
OPENTHREAD_CONFIG_THREAD_VERSION to include/exclude Thread 1.2 code.
2020-02-24 21:03:19 -08:00
Abtin Keshavarzian e2403f6066 [mle] rename static method to RouterIdFromRloc16() from GetRouterId() (#4486) 2020-01-22 20:52:09 -08:00
Abtin Keshavarzian 1996d42d9d [mle] update Mle::GetParent() to return reference (#4419) 2019-12-19 13:27:15 -08:00
Abtin Keshavarzian bf03f40bd7 [mesh-forwarder] add method ResetCounters to clear IP counter (#4286)
This commit also adds a public API `otThreadResetIp6Counters()`.
2019-10-31 15:23:22 -07:00
Jonathan Hui fd57343641 [neighbor] add methods to check neighbor state (#4280) 2019-10-29 09:05:36 -07:00
wgtdkp ff789e4ded [api] add API to get Thread Version (#4225) 2019-10-14 10:24:30 -07:00
Abtin Keshavarzian 4feadec950 [time] adding Time class (#4195)
This commit adds `Time` class which represents an instance of time
(it is a simple wrapper over a `uint32_t` corresponding to a
numerical time value). The `Time` class provides helpful operator
overloads:
- Operators `+` and `-` with a `Time` instance and a `Duration` to
  get a `Time` instance after or before.
- Operator `-` with two `Time` instances to calculate the `Duration`
  duration between two time instances.
- Operators `<`, `<=`, `>`,'>=', '==' and `!=` to compare two `Time`
  instances. They correctly handle the wrapping of numeric time value.

The core modules are updated to use the new `Time` and `Duration`
types which help make the code simpler. This commit also updates the
 unit test `test_timer` to add test cases for newly added types.
2019-10-04 15:35:53 -07:00
Abtin Keshavarzian 4916f1c0c5 [mac] add Mac::NetworkName class (#4169)
This commit adds `Mac::NetworkName` class as C++ wrapper over the
`otNetworkName`. It also adds `NetworkName::Data` to represent the
network name as a pointer to a char array buffer (not necessarily null
terminated) with a given length. This representation is used by
`Mac::BeaconPlayload` and `MeshCop::NetworkNameTlv`. This commit also
adds a unit test for `Mac::NetworkName` class.
2019-09-20 14:39:28 +08:00
Yakun Xu 957d79d786 [api] force linker failures when using disabled features (#4127) 2019-09-10 08:42:02 -07:00
Abtin Keshavarzian 0b220613ab [key-manager] add MasterKey class (wrapper over otMasterKey) (#4150)
The `MasterKey` class mainly provides overloads of operators `==`
and `!=` which help simplfy the code comparing keys.
2019-09-09 18:07:41 -07:00
Abtin Keshavarzian 276d866935 [mac] add Mac::ExtendedPanId type (wrapping otExtendedPanId) (#4149) 2019-09-09 17:03:06 -07:00
Jonathan Hui af573f5e72 [dataset] only master key is needed to attach (#4051) 2019-08-05 09:02:25 -07:00
Jonathan Hui 149640da49 [config] tmf (#4020) 2019-07-31 14:16:30 -07:00
Abtin Keshavarzian 0546a2f972 [mle] adding DeviceMode class (#4035)
This commit adds a `Mle::DeviceMode` class which is warpper over
a device mode bitmask (`uint8_t`) and provides the common helper
functions like `IsRxOnWhenIdle()`, `IsFullThreadDevice()`, etc.
2019-07-30 15:13:37 -07:00
Jonathan Hui 6dfd716da1 [auto-start] remove auto-start feature (#3920) 2019-06-14 12:40:30 -07:00
Kamil Sroka c14cc60962 [windows] remove unsupported platform (#3878) 2019-06-06 11:55:18 -07:00
Łukasz Duda 9e7162253c [api] expose API to obtain RLOC (#3854) 2019-05-22 10:57:58 -07:00
Yakun Xu ae4ef9eb3e [timer] fix elapsed overflow (#3789)
This commit fixes a bug in the commissioner when a joiner's expiration
time has alerady elapsed.

This commit also introduces convenience methods for computing time
elapsed and diffs.
2019-05-02 08:44:37 -07:00
Abtin Keshavarzian 8f112eeb5a [locator] adding Get<Type> to InstanceLocator (#3714)
This commit changes how the objects in OpenThread access each other.
It adds a template `Get<Type>()` method in `InstanceLocator`. This
method returns a reference to a given `Type` object belonging to the
OpenThread instance (e.g. `Get<MeshForwarder>()` returns a reference
to `MeshForwarder` object on the OpenThread instance). The
`InstanceLocator` is used as base class of all OpenThread classes so
every class can easily access any other object. This commit also
changes how the main instance is retrieved in `InstanceLocator` for
the single-instance case. The method `GetInstance()` directly uses the
raw buffer `gInstanceRaw`. This change helps make the `GetInstance()`
and in turn all `Get<Type>()` methods in-line. This commit also
removes the existing getters across all classes to use the new
`Get<Type>()` model.
2019-04-02 09:07:25 -07:00
Jonathan Hui 49c4b63491 [style] make parameter names consistent across decls and defs (#3705) 2019-03-22 08:12:26 -07:00
Jonathan Hui e00114b3f1 [style] mark single-arg constructors as explicit (#3705)
Avoids unintentional implicit conversions.
2019-03-22 08:12:26 -07:00