Commit Graph

7 Commits

Author SHA1 Message Date
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 9d585edc46 [types] move types into specific headers (#2946) 2018-08-08 11:19:41 -07:00
Abtin Keshavarzian 2abd7a2822 [code-utils] adding helper macro OT_ARRAY_LENGTH() (#2743)
This commit adds helper macro `OT_ARRAY_LENGTH()` to get the number
of elements in an array.
2018-05-29 15:53:53 -07:00
Jonathan Hui 69d98d4a53 [code-style] apply clang-format 2018-02-09 21:43:42 +00:00
Abtin Keshavarzian 98491461e3 [child] adding Child::GetMeshLocalIp6Address() (#2511)
This commit adds a new method `Child::GetMeshLocalIp6Address()`
to get the mesh-local IPv6 address registered by a child. The
unit test `test_child` is also updated to verify the new method.
2018-01-26 17:16:46 +00:00
Abtin Keshavarzian 130936579e [child] enhance how mesh-local IPv6 address is stored in a child entry (#2504)
This commit changes how a mesh-local IPv6 address is stored in
`Child` class. Instead of storing the entire IPv6 addresses (16
bytes), only the Interface Identifier (8 bytes) is saved.  The full
address is derived (when needed) using the mesh-local prefix from
`Mle`. This reduces the memory required for storing registered IPv6
addresses in the child table.

This commit also updates the unit test `test_child` to use mesh-local
IPv6 address as part of the test and verify the behavior of new
implementation.
2018-01-25 18:05:45 +00:00
Abtin Keshavarzian 5e6e262dfb [child] update how IPv6 addresses of a child are managed (#2485)
This commit updates/enhances the `Child` class methods related to
managing of the list of IPv6 addresses associated with a child. The
new model provides APIs to add or remove an IPv6 address, check if the
list contains an address, and a method to iterate through all IPv6
addresses of a child. The `mle_router` and `address_resolver` and NCP
implementations are updated to use the new APIs.

This commit also adds a unit test `test_child` to verify  the newly
added methods.
2018-01-22 16:52:14 +00:00