320 Commits

Author SHA1 Message Date
Yakun Xu f40f49ff32 [dhcp] remove dhcp server api (#3476) 2019-01-18 11:34:40 -08:00
Jonathan Hui 107a4a2b43 [docker] add wpantund and toranj support (#3454) 2019-01-16 00:16:38 -08:00
Yakun Xu 5eee323b8d [coap] process CoAP header in message (#3419)
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.
2019-01-15 05:00:21 -08:00
Jonathan Hui 2a75d30684 [docker] move dev environment setup to "Script to rule them all" (#3383) 2018-12-17 09:29:23 -08:00
Jeff Bumgardner b61be18e37 [docs] added new Dockerfiles (#3347) 2018-12-04 13:19:38 -08:00
Abtin Keshavarzian 8d12513591 [mac] adding sub-MAC layer (#3262)
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.
2018-11-28 10:09:35 -08:00
Jonathan Hui 8d02956c36 [mbedtls] fix build 2018-11-02 15:37:01 -07:00
Abtin Keshavarzian 9a7fc691b1 [mac] move "Mac::ChannelMask" to its own files "mac/channel_mask.hpp|cpp" (#3244) 2018-11-01 09:04:46 -07:00
Abtin Keshavarzian 309bd09d75 [logging] remove aInstance as input parameter to logging macros (#3184) 2018-10-25 09:14:43 -07:00
Abtin Keshavarzian d640d4a7f9 [link-raw] move the LinkRaw implementation to core from api folder (#3114) 2018-10-03 23:21:12 -07:00
Shu Chen 3174c590c3 [utils] implement a common method for command line parsing (#3001) 2018-09-05 00:40:02 -07:00
Jonathan Hui 9d585edc46 [types] move types into specific headers (#2946) 2018-08-08 11:19:41 -07:00
Jonathan Hui f0bb0982ee [examples] change example platform namespacing (#2927) 2018-08-03 14:13:47 -05:00
Jonathan Hui d3b5b8fa60 [flash] move example flash driver from c++ to c (#2919) 2018-07-30 10:45:50 -05:00
Yakun Xu 8ccf1386de [ncp] adjust defining NCP handlers (#2829) 2018-06-28 11:26:31 -05:00
Marcin K Szczodrak 8d21f72cf0 [docker] dockerfiles for openthread sim and wpantund (#2760) 2018-06-12 09:18:39 -07:00
Abtin Keshavarzian 4b918f85f0 [string] adding ot::String<size> class (#2764)
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`.
2018-06-11 09:10:52 -07:00
Jonathan Hui 78a98fa38f [mbedtls] do not treat visual studio build warnings as errors (#2756) 2018-06-07 11:08:37 -07:00
Jonathan Hui 5e94a2d485 [mbedtls] update path from 'repo.patched' to 'repo' (#2756) 2018-06-07 11:08:37 -07:00
Abtin Keshavarzian 7f901cf9c7 [announce-sender] feature to enable periodic tx of MLE Announce (#2693)
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.
2018-05-15 19:32:01 -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
Abtin Keshavarzian 8e6be519da [child-table] introducing ChildTable class (#2642)
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.
2018-04-16 10:18:59 -07:00
Abtin Keshavarzian ad4b597262 [settings] adding Settings class (#2606) 2018-03-19 22:45:04 +00:00
Abtin Keshavarzian 4207f41f91 [makefile] update example platform makefiles
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.
2018-02-14 17:04:07 +00:00
Jonathan Hui 6159e3a646 [tests] remove test-fuzz - superceded by OSS-Fuzz (#2551) 2018-02-09 16:55:54 +00:00
Jonathan Hui 5028d2f71b [mesh-forwarder] MTD code size optimizations (#2469) 2018-01-17 20:18:09 +00:00
Jonathan Hui 5841410c72 [appveyor] remove OpenThread project due to expired certificate (#2448)
Visual Studio does not like commented lines in sln files.  This PR simply
removes the commented lines.
2018-01-08 21:22:25 +00:00
Jonathan Hui 9f49148e7e [mbedtls] configure max entropy sources to 1 to save RAM (#2441)
- Reduces the number of maximum entropy sources from 20 to 1 to save RAM.
- Explicitly add platform-specific entropy source.
2018-01-04 17:01:30 +00:00
Abtin Keshavarzian 5b25a57db7 [notifier] Notifier class and new OT_CHANGED flags (#2403)
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.
2017-12-14 05:50:30 +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
Jonathan Hui c46b75d0cf [appveyor] remove OpenThread project due to expired certificate (#2329) 2017-11-09 12:17:11 -08:00
Jonathan Hui 74b3160f9d [meshcop] use IEEE EUI-64 rather than Joiner ID on user input (#2311) 2017-11-07 09:41:46 -08:00
Abtin Keshavarzian 92ba27a1fa [ncp] adding SpinelDecoder class and updating NCP implementation (#2258)
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.
2017-10-13 09:18:37 -07:00
Abtin Keshavarzian 192df6cf00 [ncp] adding SpinelEncoder class and updating NCP implementation (#2221)
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).
2017-09-27 23:04:53 -07:00
DuaneEllis-TI e937542990 [debug] add debug uart (#2082) 2017-08-24 10:28:01 -07:00
Jonathan Hui e875f5e86f [mbedtls] apply patch to check-in source (#2074)
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.
2017-08-09 11:01:09 -07:00
Jonathan Hui e98ccb8986 [ip6] validate IPv6 headers received via otIp6Send() (#2059) 2017-08-03 22:43:43 -07:00
Buke Po 818998e609 [ncp] split ncp_base and rearrange declarations (#2045)
* split handlers into general, mtd, ftd and radio-only.
* move ChangedPropsSet into separate file.
* add Ncp namespace.
2017-08-03 10:19:07 -07:00
Jonathan Hui f88c537c6c [udp] add cli-based example for UDP APIs (#2027) 2017-07-26 12:14:44 -07:00
rongli 502c6ca5d6 [mac filter] add rssfilter support and integrate whitelist/blacklist to AddressFilter (#1967)
* [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
2017-07-11 22:38:49 -07:00
Jonathan Hui 0d27c3e00b Remove RAM buffers for local operational datasets. (#1929)
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.
2017-07-05 09:41:08 -07:00
Abtin Keshavarzian bbab3074ed [instance] single OpenThread instance optimizations (#1926)
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.
2017-06-30 11:48:26 -07:00
Shu Chen 473b83b02f Add --enable-border-router configure option (#1834)
* Use `OPENTHREAD_ENABLE_BORDER_ROUTER` feature flag to wrap Border Router related features

* MTD devices could also act as a Border Router
2017-06-02 21:49:07 -07:00
Shu Chen 180493b86d Fix a typo in visual-studio project file (#1835) 2017-05-26 08:35:34 -07:00
Jonathan Hui a0ff24d0ac Use OT_URI_PATH_* names for paths. (#1767) 2017-05-22 09:40:31 -07:00
Jonathan Hui 39b1162b1e Combine CoAP Client and Server into a single CoAP agent. (#1745) 2017-05-12 11:51:19 -07:00
Abtin Keshavarzian bb4ffe373c Adding "Child Supervision" feature (#1608)
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.
2017-05-04 20:20:05 -07:00
Vaas Krishnamurthy 8d5a701adb Set steering data and enable MLE discovery response filtering. (#1685)
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.
2017-05-03 13:24:02 -07:00
Jonathan Hui 1eabda6a08 Change top-level namespace from 'Thread' to 'ot'. (#1664) 2017-04-27 22:29:05 -07:00
DuaneEllis-TI d65418c12f Add support for wrap_string.h and others (#1642) 2017-04-27 10:17:09 -07:00