Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layered Architecture #798

Open
LukasWoodtli opened this issue Jul 29, 2024 · 1 comment
Open

Layered Architecture #798

LukasWoodtli opened this issue Jul 29, 2024 · 1 comment
Assignees

Comments

@LukasWoodtli
Copy link
Contributor

This is a proposal of a cleaner architecture for Wakaama. This ensures that the library is modular and easier to maintain and extend.

Layered Architecture

wakaama_layers

Each layer is allowed to access code from itself and all layers below it (the layers are open). But it is not allowed to access code from higher layers.

Support Layer

This forms the basis for the library and supports an abstraction to the environment. They are necessary for the functionality of the library, but cannot be implemented in a generic way.

Abstractions in this layer include:

  • OS (Platform)
  • Transport (TLS, dTLS, ...)
  • Event Loop (select, epoll, ...)

Customization in this layer is mainly achieved by link-time polymorphism:
For example, a POSIX platform module implements the set of functions declared in platform.h and is linked to the library. Another module for and embedded system would implement the same functions. But only one of these modules are linked to the final library.

Base Layer

This layer contains the core LwM2M functionality.

Customization in this layer is done with conditional compilation (#ifdefs).

Add On's Layer

This layer includes additional functionality, that might be useful for some application, but that can be omitted for others. This might include modules for:

  • Command Line Interface (CLI)
  • IPSO Object Registry

Modules from this layer can be added with the build system (CMake).

Folder Structure

The folder structure should reflect the architecture layers.

wakaama_folders

With a nice folder structure and a correct build system, some architectual rules can be enfored (i.e. no circular dependencies, accessing only lower layers).

@LukasWoodtli
Copy link
Contributor Author

The images are created with PlantUML:

@startditaa (--no-shadows)
+------------------------------------------------+
| Add Ons (optional)                             |
|  +=----+ +=---------+                          |
|  | CLI | | Registry | ...                      |
|  +-----+ +----------+                          |
+------------------------------------------------+
| Base                                           |
|  +------+ +------+ +------+ +------+           |
|  | Core | | Data | | CoAP | | Util |           |
|  +------+ +------+ +------+ +------+           |
+------------------------------------------------+
| Support                                        |
|  +----------+ +-----------+ +------------+     |
|  | Platform | | Transport | | Event Loop | ... |
|  +----------+ +-----------+ +------------+     |
+------------------------------------------------+
@endditaa
@startsalt
{
{T
 + eclipse-wakaama
 ++ base
 +++ core
 +++ data
 +++ coap
 +++ util
 ++ support
 +++ platform
 +++ transport
 +++ event_loop
 +++ ...
 ++ addon
 +++ cli
 +++ registry
 +++ ...
}
}
@endsalt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants