mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
[srp-server] add support for service subtypes (#6760)
This commit adds support for service subtypes in SRP server. It updates the internal data model to store services in `Srp::Server`. Every `Host` now has a list of `Service` entries along with a list of `Service::Description` entries. These types mirror the SRP update message format and the set of instructions that form the SRP message. The `Service` entries represent the "Service Discovery Instructions", i.e., the PTR records mapping a service name or a subtype name to a service instance. A `Service::Description` entry represents the the SRV and TXT records. A `Service` entry is always associated with a `Service::Description` and the subtypes of the same service instance all share the same `Service::Description` entry. This commit also adds a new method `Host::FindNextService()` and the public API `otSrpServerHostFindNextService()` which is very flexible and can be used in different ways. It can be used to iterate over the full list of services, or over a specific subset of services matching certain conditions, e.g., iterate over all base services excluding subtypes, or over all subtypes of an instance, or over all deleted services, etc. It can also be used to find a specific service with a given instance and service names. This commit also simplifies and enhances the logging in `Srp::Server`. In particular, when a new host is added, we now also log the list of services being added along with it. Also a change to a `Service` is only logged if the `Service` is marked as committed. This ensures that temporary `Service` entries associated with a newly received SRP update message are not logged (e.g., when an associated temporary `Host` object is being freed after its content is merged with an existing `Host` entry). Finally, this commit adds a test `test_srp_sub_type.py` to cover the subtype service registration on SRP client and server.
This commit is contained in:
committed by
GitHub
parent
fbe3ffce87
commit
0faa3fd4fe
@@ -918,6 +918,8 @@ class OTCI(object):
|
||||
|
||||
v = v[1:-1]
|
||||
info['addresses'] = list(map(Ip6Addr, v.split(', ')))
|
||||
elif k == 'subtypes':
|
||||
info[k] = list() if v == '(null)' else list(v.split(','))
|
||||
elif k in ('port', 'weight', 'priority'):
|
||||
info[k] = int(v)
|
||||
elif k in ('host',):
|
||||
|
||||
Reference in New Issue
Block a user