[border-agent] return Counters as reference (#11070)

This commit is contained in:
Abtin Keshavarzian
2024-12-19 12:29:29 -08:00
committed by GitHub
parent a71c1cee6c
commit 89979bd39b
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ void otBorderAgentSetEphemeralKeyCallback(otInstance *aIns
const otBorderAgentCounters *otBorderAgentGetCounters(otInstance *aInstance) const otBorderAgentCounters *otBorderAgentGetCounters(otInstance *aInstance)
{ {
return AsCoreType(aInstance).Get<MeshCoP::BorderAgent>().GetCounters(); return &AsCoreType(aInstance).Get<MeshCoP::BorderAgent>().GetCounters();
} }
void otBorderAgentDisconnect(otInstance *aInstance) { AsCoreType(aInstance).Get<MeshCoP::BorderAgent>().Disconnect(); } void otBorderAgentDisconnect(otInstance *aInstance) { AsCoreType(aInstance).Get<MeshCoP::BorderAgent>().Disconnect(); }
+4 -3
View File
@@ -83,7 +83,8 @@ public:
*/ */
static constexpr uint32_t kMaxEphemeralKeyTimeout = OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT; static constexpr uint32_t kMaxEphemeralKeyTimeout = OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT;
typedef otBorderAgentId Id; ///< Border Agent ID. typedef otBorderAgentId Id; ///< Border Agent ID.
typedef otBorderAgentCounters Counters; ///< Border Agent Counters.
/** /**
* Defines the Border Agent state. * Defines the Border Agent state.
@@ -240,7 +241,7 @@ public:
* *
* @returns The border agent counters. * @returns The border agent counters.
*/ */
const otBorderAgentCounters *GetCounters(void) { return &mCounters; } const Counters &GetCounters(void) { return mCounters; }
/** /**
* Returns the UDP Proxy port to which the commissioner is currently * Returns the UDP Proxy port to which the commissioner is currently
@@ -335,7 +336,7 @@ private:
EphemeralKeyTask mEphemeralKeyTask; EphemeralKeyTask mEphemeralKeyTask;
Callback<EphemeralKeyCallback> mEphemeralKeyCallback; Callback<EphemeralKeyCallback> mEphemeralKeyCallback;
#endif #endif
otBorderAgentCounters mCounters; Counters mCounters;
}; };
DeclareTmfHandler(BorderAgent, kUriRelayRx); DeclareTmfHandler(BorderAgent, kUriRelayRx);