mirror of
https://github.com/espressif/openthread.git
synced 2026-09-09 10:40:09 +00:00
[border-agent] manage mDNS MeshCoP service registrations (#11455)
This commit updates `BorderAgent` modules to directly manage the registration of mDNS MeshCoP services. Previously, this was the responsibility of the platform or higher-level code. This behavior is enabled using `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_ENABLE` configuration option. When enabled, the `BorderAgent` module itself will register the `_meshcop._udp` service name with properly formatted TXT data. As the state changes, the service registration is updated accordingly. If the ephemeral key feature is enabled and used, the `BorderAgent` will also manage the registration of the `_meshcop-e._udp` service. The implementation allows the service instance name to be configured in different ways. The Thread specification recommends using a user-friendly name, such as "<VendorName> <ProductName>". The name can be set using a newly added configuration option, or alternatively, using a newly added public API for projects where the name needs to be set at run-time after device initialization. This commit also updates `test_border_agent`, validating all the newly added behaviors related to MeshCoP service registrations.
This commit is contained in:
@@ -1849,6 +1849,14 @@ Core *InitTest(void)
|
||||
|
||||
VerifyOrQuit(sInstance != nullptr);
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
|
||||
// Disable the Border Agent to prevent its attempt to
|
||||
// register the `_meshcop._udp` service from
|
||||
// interfering with this test.
|
||||
|
||||
sInstance->Get<MeshCoP::BorderAgent>().SetEnabled(false);
|
||||
#endif
|
||||
|
||||
return &sInstance->Get<Core>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user