Commit Graph

14 Commits

Author SHA1 Message Date
Jonathan Hui 9d585edc46 [types] move types into specific headers (#2946) 2018-08-08 11:19:41 -07:00
Jonathan Hui 69d98d4a53 [code-style] apply clang-format 2018-02-09 21:43:42 +00: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
Jonathan Hui fbfd76a990 Apply #include code style. (#1723) 2017-05-05 11:28:29 -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
Jonathan Hui a5c3fb6aaf Add accessor methods to neighbor/child/router objects. (#1577) 2017-04-11 13:25:11 -07:00
Jonathan Hui e919576978 Move include/platform to include/openthread/platform. 2017-03-02 10:24:55 -08:00
Nick Banks 55e17533b9 Fix otNetifAddress declaration to work between C & C++ (#1037)
* Fix otNetifAddress declaration to work between C & C++
2016-12-05 16:23:30 -08:00
Nick Banks 25cea9414b Windows Unit Test Support (#629)
Window Unit Test Support
2016-09-20 18:11:19 -07:00
Nick Banks 9a2beff1e9 Windows Core Build Support (#582)
* Support #define to overwrite what openthread-config file to use, since Windows does support autoconf.
2016-09-19 12:00:30 -07:00
Jonathan Hui 44350178ad Change copyright to The OpenThread Authors. (#583)
- Add a top-level file named AUTHORS which identifies the copyright
holders of the project.
2016-09-13 15:57:11 -07:00
Marcin K Szczodrak 318fe4b415 turn on warnings and errors (#280) 2016-07-25 21:19:07 -07:00
turon 3576322262 Added platform/toolchain.h toolchain abstraction layer via macros. (#107)
* Added platform/toolchain.h toolchain abstraction layer via macros:
   OT_TOOL_PACKED_BEGIN
   OT_TOOL_PACKED_END
   OT_TOOL_DEPRECATED(symbol)

* Make pretty.  Rekick travis-ci.

* Added doxygen.  Resolved review comments.

* Fixed doxygen sample for OT_TOOL_PACKED to include type name.

* Renamed OT_TOOL_PACKED_FIELD to simplify code searches for usage. Fixed all nested instances to use new naming.

* Fixed OT_TOOL_PACKED_FIELD renaming in doxygen.

* Make pretty.

* Documentation clarifications.

* Moved example into overview section.

* Fixed sdcc comment.

* Revised sdcc comment.

* Fix code style in toolchain packed doxygen example.

* Fixed example.  Moved toolchain test to better match code style.

* Added test for OT_TOOL_PACKED_FIELD.

* Added support for clang.  Just routes to gcc __attributes__.  Verified by running unit test through clang on macos.
2016-06-11 21:35:52 -07:00