Commit Graph

85 Commits

Author SHA1 Message Date
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
Jonathan Hui ac89fd5496 [style] return void where code always returns OT_ERROR_NONE (#3543) 2019-02-01 09:03:24 -08:00
Abtin Keshavarzian 5e50914f1f [mle] simplify Start() (#3472)
This commit simplifies the `Mle::Start()` by combining its parameters.
With the new definition `Start()` would always try to reattach using
any saved active/pending dataset unless it is asked to attach on an
announced network (i.e., `aAnnounceAttach` is `true`).
2019-01-22 09:05:50 -08:00
Jonathan Hui f6afc5599a [style] apply OT_UNUSED_VARIABLE (#3299) 2018-11-17 12:04:41 -08:00
Yakun Xu 8533ee3936 [mle] add address outside of constructor (#3251)
This commit adds link local address when MLE is enabled. Adding address in
constructor gives no chance to notify address change with address
callback.
2018-11-05 20:46:08 -08:00
Jonathan Hui 5a489836cd [naming] rename FFD to FTD (#3102) 2018-09-27 09:33:03 -07:00
Biswajit 06bff96310 [mle] API to provide MLE Parent Response information (#3027) 2018-09-21 18:28:41 -10:00
Abtin Keshavarzian 144a4e3e06 [mle] add MLE counters (#2982)
This commit adds support for a set of MLE counters (e.g., counters to
track number of times device entered different roles, or counters
tracking number of attach attempts, partition ID or parent changes).
2018-09-06 21:01:31 -10:00
Jonathan Hui c116441212 [api] change type from uint8_t * to otMeshLocalPrefix (#2966) 2018-08-17 08:59:37 -07:00
Jonathan Hui 920197398b [api] change type from uint8_t* to otExtendedPanId (#2960) 2018-08-15 10:12:49 -07:00
Jonathan Hui 585080e3a0 [router-table] reduce router allocation from 63 to 32 (#2678)
The existing router table allocated a router entry for every possible router
id value (63).  Beacuse Thread only allows at most 32 active routers in a
given network, allocating 63 router entries is wasteful.  This commit
allocates only 32 router entries and dynamically manages the pool of router
entries.
2018-05-10 15:47:36 -07:00
Yakun Xu 96ed7ccd24 [ncp] add radio only mode NCP app (#2085) 2018-04-16 09:28:00 -07:00
Abtin Keshavarzian ad4b597262 [settings] adding Settings class (#2606) 2018-03-19 22:45:04 +00:00
Jonathan Hui 69d98d4a53 [code-style] apply clang-format 2018-02-09 21:43:42 +00:00
Abtin Keshavarzian f366e4f987 [logging] remove otLogFunc<Entry/Exit> macros (#2438) 2017-12-22 16:41:05 +00:00
Jonathan Hui 0606b0aefa [mac] clean up extended address usage (#2413)
- Replace `memcmp` with `==` and `!=` operators.
- Replace `memcpy` with `=` assignment.
- Change pointers to reference where applicable.
2017-12-13 07:12:23 +00:00
Abtin Keshavarzian 02c876ef62 [instance] define ot::Instance class (#2307)
This commit makes the following changes: It defines the public
`otInstance` as an empty opaque structure which is used by all public
C OpenThread APIs. It defines a new class `ot::Instance` (inheriting
from `otInstance) which is then used in core source files. The
functionality related to the instance is also moved/added into the
newly added `Instance` class (as class/static or member methods).
2017-11-13 08:27:57 -08:00