[border-agent] add APIs to enable/disable ephemeral key feature (#11119)

This commit adds OT APIs to enable/disable the ephemeral key feature
and get IsEnabled state of it.

Currently a dbus method is provided to enable/disable the Ephemeral
Key feature and it is implemented with the module `BorderAgent` in
ot-br-posix. After we move the MeshCoP Service Publisher into OT core,
we won't use the `BorderAgent` module anymore. So we put the get/set
methods into OT core first. In addition, the MeshCoP service published
has a state bitmap which has a bit to indicate if Ephemeral Key
feature is supported. So we have to put this data into OT core.
This commit is contained in:
Li Cao
2025-01-15 10:39:50 -08:00
committed by GitHub
parent 84e80c6708
commit b8c4545656
11 changed files with 158 additions and 2 deletions
+11
View File
@@ -211,6 +211,17 @@ void TestBorderAgentEphemeralKey(void)
node1.Get<Mac::Mac>().SetPanId(node0.Get<Mac::Mac>().GetPanId());
node1.Get<ThreadNetif>().Up();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Log("Check Border Agent ephemeral key feature enabled");
node0.Get<MeshCoP::BorderAgent>().SetEphemeralKeyFeatureEnabled(false);
VerifyOrQuit(!node0.Get<MeshCoP::BorderAgent>().IsEphemeralKeyFeatureEnabled());
VerifyOrQuit(node0.Get<MeshCoP::BorderAgent>().SetEphemeralKey(kEphemeralKey, /* aTimeout */ 0, kUdpPort) ==
kErrorNotCapable);
node0.Get<MeshCoP::BorderAgent>().SetEphemeralKeyFeatureEnabled(true);
VerifyOrQuit(node0.Get<MeshCoP::BorderAgent>().IsEphemeralKeyFeatureEnabled());
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Log("Check Border Agent ephemeral key initial state");