Skip to content

Commit

Permalink
[dbus] add retain_active_session option for deactivate API (#2537)
Browse files Browse the repository at this point in the history
  • Loading branch information
mia1yang authored Oct 22, 2024
1 parent 580cafc commit 9506b2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
16 changes: 6 additions & 10 deletions src/dbus/server/dbus_thread_object_rcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2009,21 +2009,17 @@ void DBusThreadObjectRcp::DeactivateEphemeralKeyModeHandler(DBusRequest &aReques
{
otError error = OT_ERROR_NONE;
auto threadHelper = mHost.GetThreadHelper();
bool retain_active_session;
auto args = std::tie(retain_active_session);

VerifyOrExit(mBorderAgent.GetEphemeralKeyEnabled(), error = OT_ERROR_NOT_CAPABLE);

switch (otBorderAgentGetState(threadHelper->GetInstance()))
SuccessOrExit(DBusMessageToTuple(*aRequest.GetMessage(), args), error = OT_ERROR_INVALID_ARGS);
if (!retain_active_session)
{
case OT_BORDER_AGENT_STATE_STOPPED:
error = OT_ERROR_FAILED;
break;
case OT_BORDER_AGENT_STATE_ACTIVE:
error = OT_ERROR_INVALID_STATE;
break;
case OT_BORDER_AGENT_STATE_STARTED:
otBorderAgentClearEphemeralKey(threadHelper->GetInstance());
break;
otBorderAgentDisconnect(threadHelper->GetInstance());
}
otBorderAgentClearEphemeralKey(threadHelper->GetInstance());

exit:
aRequest.ReplyOtResult(error);
Expand Down
9 changes: 8 additions & 1 deletion src/dbus/server/introspect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,15 @@
<arg name="epskc" type="s" direction="out"/>
</method>

<!-- DeactivateEphemeralKeyMode: Deactivate ePSKc mode. -->
<!-- DeactivateEphemeralKeyMode: Deactivate ePSKc mode.
@retain_active_session:
"false" - Disconnects the Border Agent from any active secure sessions.
Ephemeral key would be cleared after the session is disconnected.
"true" - Deactivate ephemeral key mode softly. If there is already an active commissioner
connection, the session will be retained and the ephemeral key mode is still active.
-->
<method name="DeactivateEphemeralKeyMode">
<arg name="retain_active_session" type="b" direction="in"/>
</method>

<!-- MeshLocalPrefix: The /64 mesh-local prefix. -->
Expand Down

0 comments on commit 9506b2e

Please sign in to comment.