[srp-server] simplify sub-type services (#9208)

This commit updates and simplifies how `Srp::Server` stores the
sub-type services. The earlier implementation treated each sub-type
as its own service, which was tracked by a `Service` object. This
design allowed sub-type services to be registered and deleted
individually. However, the latest SRP RFC draft requires SRP servers
to treat updates to a service and all its sub-types as atomic. This
means that when a service and its sub-types are being updated, the
SRP Update message must contain the entirety of information about
that service and its sub-types. As a result of this change, we can
simplify the server implementation by tracking sub-types as an array
of sub-type names in the `Service` object.

This commit also updates the way the server commits a received SRP
update info into its existing data. Previously, the server would try
to merge the new information into existing `Host` and `Service`
objects. However, this could be inefficient, as it would require
moving heap-allocated items like "txt data" and/or array of host IPv6
addresses from one object to another. The new `CommitSrpUpdate()`
implementation now starts from the new `Host` object that is
constructed as the received SRP Update message from the client is
parsed. Any previously registered services that are not present in
the new `Host` object are then moved into it.

This commit adds new public OT APIs for retrieving the sub-types
associated with a service and making it easier to iterate over the
list of registered services by a host. Due to fundamental changes in
how services are stored by the `Srp::Server` class, some existing
public `otSrpServer` APIs for filtering and iterating over services
are being removed.
8 files changed
tree: 1e74afdf5e1ea8e0accb153b4eecc37f3d6c883a
  1. .github/
  2. doc/
  3. etc/
  4. examples/
  5. include/
  6. script/
  7. src/
  8. tests/
  9. third_party/
  10. tools/
  11. zephyr/
  12. .clang-format
  13. .code-spell-ignore
  14. .codecov.yml
  15. .default-version
  16. .gitattributes
  17. .gitignore
  18. .gn
  19. .prettierrc
  20. AUTHORS
  21. BUILD.gn
  22. CMakeLists.txt
  23. CODE_OF_CONDUCT.md
  24. CONTRIBUTING.md
  25. LICENSE
  26. NOTICE
  27. README.md
  28. SECURITY.md
  29. STYLE_GUIDE.md
README.md

OpenThread Build Simulation Docker Coverage Status


What is OpenThread?

OpenThread released by Google is...

...an open-source implementation of the Thread networking protocol. Google Nest has released OpenThread to make the technology used in Nest products more broadly available to developers to accelerate the development of products for the connected home.

...OS and platform agnostic, with a narrow platform abstraction layer and a small memory footprint, making it highly portable. It supports both system-on-chip (SoC) and network co-processor (NCP) designs.

...a Thread Certified Component, implementing all features defined in the Thread 1.3.0 specification, including all Thread networking layers (IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment, Mesh Routing) and device roles, as well as Border Router support.

More information about Thread can be found at threadgroup.org. Thread is a registered trademark of the Thread Group, Inc.

Who supports OpenThread?

Getting started

All end-user documentation and guides are located at openthread.io. If you're looking to do things like...

  • Learn more about OpenThread features and enhancements
  • Use OpenThread in your products
  • Learn how to build and configure a Thread network
  • Port OpenThread to a new platform
  • Build an application on top of OpenThread
  • Certify a product using OpenThread

...then openthread.io is the place for you.

Note: For users in China, end-user documentation is available at openthread.google.cn.

If you're interested in contributing to OpenThread, read on.

Contributing

We would love for you to contribute to OpenThread and help make it even better than it is today! See our Contributing Guidelines for more information.

Contributors are required to abide by our Code of Conduct and Coding Conventions and Style Guide.

License

OpenThread is released under the BSD 3-Clause license. See the LICENSE file for more information.

Please only use the OpenThread name and marks when accurately referencing this software distribution. Do not use the marks in a way that suggests you are endorsed by or otherwise affiliated with Nest, Google, or The Thread Group.

Need help?

OpenThread support is available on GitHub: