This commit refines Coap::Header into Coap::Message to avoid declaring
the big Coap::Header in stack which was causing problems in low-memory
systems such as CC2538.
A UDP reserves 56 bytes by default, which will not be used before an
outbound message goes down to transport layer and after an inbound
message is delievered to CoAP agent. To get better performance, this commit
utilizes these reserved bytes of cache basic header of CoAP message
including CoAP version, code, message ID and token. These cached data
are parsed when CoAP agent receives a CoAP message and are dumped into
the correct place of a CoAP Message before sending by lower layer.
To make sure there is enough reserved bytes for an inbound message, This
commit removes headers in UDP layer before delivering a ot::Message to
handlers.
This commit introduces sub-MAC layer (class `Mac::SubMac`) in
OpenThread implementing a subset of IEEE802.15.4 MAC primitives which
are shared by both MAC layer (in FTD/MTD modes) and Raw Link (Radio
only mode).
The sub-MAC layer handles the following (if not provided by radio
platform):
- Ack timeout for frame transmission,
- CSMA backoff logic,
- Frame re-transmissions,
- Energy scan on a single channel and RSSI sampling.
It also act as the interface (to radio platform) for setting/getting
radio configurations such as short or extended addresses and PAN Id.
In addition, this commit contains following improvements in `Mac`:
- The implementation of `STAY_AWAKE_BETWEEN_FRAGMENTS` (delay sleep)
feature is simplified by adding a new state variable tracking if
sleep is being delayed and canceling sleep delay on start of any
operation.
- Member variables in `Mac` class are re-ordered to avoid alignment
gaps.
- `Mac` timers are combined into one which is used for Active Scan,
Data Poll timeout, and delaying sleep.
This commit adds a new template class `ot::String<size>` which
implements a fixed-length character string. This class is then used as
return value of `ToString()` methods from different classes. This
simplifies the `ToString()` implementation and its use. This commit
also adds a unit test for `String`.
This commit adds a new feature/class namely `AnnounceSender` which
enables periodic transmission of MLE Announce messages on all
channels. The feature can be enabled using the config option
`OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER` (disabled by default).
This commit also adds some new helper methods in `Mac::ChannelMask`
to get number of channels in a given mask, and operator overloads
to compare two masks.
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.
This commit introduces a new class `ChildTable` as part of OpenThread
core. This class provides methods for iterating through the child
table and searching for a specific child (based on short/extended
address and/or child state). This commit also adds a unit test for the
newly added `ChildTable class.
This commit makes the following changes to (platform) makefiles:
- Removes conditional source file inclusions in Makefiles and
adopts the model where the source files themselves would add
`#if` check for the config option (this is the model adopted
in OpenThread core).
- Defines `PLATFORM_SOURCES` to include all the sources files
- Adds `PRETTY_FILES` to specify files for "make pretty-check"
This commit also adds `PRETTY_FILES` in unit test makefile.
This commit contains the following changes: (a) It adds a new class
`Notifer` which can be used to register callbacks to be notified of
state or configuration changes within OpenThread. This is used both
internally (by other core OpenThread classes) or externally by
registering `otStateChangedCallback` handlers. (b) This commit also
adds a set of new `OT_CHANGED` flag definitions corresponding to
fields in the Thread Operational Dataset (e.g., the Thread network
channel changes map to `OT_CHANGED_THREAD_CHANNEL`). This ensures that
user is notified of changes to Active Operational Dataset. (c) Finally,
this commit adds support in `NcpBase` for the newly added `OT_CHANGED`
flags by emitting asynchronous spinel property updates corresponding
to the changed configuration properties.
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).
This commit adds a new class `SpinelDecoder` which provides a set of
methods/APIs to help in decoding/reading content using Spinel formating
(it is practically a C++ wrapper over Spinel C APIs). A unit test
`test_spinel_decoder` is also added in this commit.
This commit also updates the `NcpBase` implementation to adopt the new
`SpinelDecoder` class mainly in set, insert, and remove handlers
for different Spinel properties. The new class provides similar advantage
as `SpinelEncoder` by simplifying the handler implementations and adding
type-check safety when parsing/reading the spinel frame.
This commit adds a new class `SpinelEncoder` which provides a set of
methods/APIs to help in encoding/writing content using Spinel formating
(it is practically a C++ wrapper over Spinel C APIs). A unit test
`test_spinel_encoder` is also added in this commit.
This commit also updates the `NcpBase` implementation to adopt the new
`SpinelEncoder` class mainly in implementation of get, insert, and
remove handlers for different Spinel properties. The new class
provides the following advantages: (a) it simplifies the
implementation of handers, particularly get-handlers for properties
with a single type output; (b) it adds type-checking and type-safety
when frames are being created, e.g., if the Spinel format expects a
`SPINEL_DATATYPE_UINT8` but a `uint16_t` value is provided, the new
model will cause a compile-time error (few instances in code where the
types did not match are fixed in this commit).
This commit applies the patch directly to checked-in source files rather
than at build time. This commit helps to simplify the build process.
This commit also introduces a shell script that allows anyone to reproduce
the patched mbedtls source.
* [mac filter] add rssfilter support and integrate whitelist/blacklist
- provide RssIn filter function to fix the received signal strength for test purpose.
- provide Address filter function which integrates whitelist and blacklist, save (~300B) RAM.
- update cli and spinel-cli to reflect new otLinkFilterX() APIs.
- keep whitelist/blacklist spinel properties the same as before while implemented with new otLinkFilterX() APIs.
- THCI: add setOutBoundLinkQuality() API for DEV-1530
- THCI: update Allow/Block relative APIs
- update some test scripts due to new OT_ERROR_ALEADY when adding duplicate address to whitelist
* update for comments
* add MAC_FIXED_RSS spinel property
* rebase and apply new OutboundFrameBegin(aHeader)
* update OpenThread.py
The local Active and Pending Operational Datsets are stored in non-volatile
memory. This commit dynamically retrieves those datasets from non-volatile
memory when they are needed.
This commit also simplifies the use of the Operational Datasets by having the
RAM buffer store the local Operational Dataset when in the detached state.
This commit new configuration option `enable-multiple-instances` and
its corresponding option `OPENTHREAD_ENABLE_MULTIPLE_INSTANCES`. When
enabled OpenThread supports handling of multiple instances. By default
this is disabled.
This commit also adds two optimizations for single instance case to
simplify the code and also help reduce memory/RAM usage:
(1) OpenThread objects/classes typically keep a reference to a higher
level object (e.g., many classes keep track of owning `ThreadNetif`)
to be able to access other objects/methods within OpenThread class
hierarchy. In single instance mode, the reference member variables are
removed and instead global functions are used to access the singleton
objects from one class to the other. To implement this, a group of
`<Object>Locator` classes are defined (e.g., `ThreadNetifLocator`,
etc.) which are then used as base class of other OpenThread classes.
(2) OpenThread objects which provide a callback/handler (e.g.,
`Timer`, `Tasklet`, etc.) have `void *mContext` member variable which
is used to keep track of the owner of the object. In single instance
mode the `mConext` member variables are removed since the owner is
expected to be a singleton and can be uniquely determined from the
callback function.
To implement this, two changes are made: First the handler methods are
modified to provide a reference to the object (e.g., `Timer` handler
will provide a `Timer &aTimer` as a parameter of its handler
callback). Second, a new base class `Context` is introduced which
hides the implementation providing an arbitrary context information. A
new static method `GetOwner(aContext)` is added to classes which own a
callback providing objects. This method help convert a `Context` to
the reference of the owner class object.
Child supervision feature provides a mechanism for parent to ensure
that a message is sent to each sleepy child within a fixed interval,
namely the supervision interval. If there is no transmission to the
child within the supervision interval, child supervisor enqueues and
sends a supervision message (a data message with empty payload) to the
child.
On the child side, this is used to check the connectivity to the
parent. If the child does not hear from its parent for a supervision
check timeout interval it assumes that it may be disconnected and
tries to re-attach to the parent.
Enable OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB to be able to set
steering data out of band on FFDs.
On joining device, enable filtering MLE discovery responses based on Factory assigned EUI64.