[border-agent] fix BorderAgentId compile and enable it in CI tests (#9030)

This commit is contained in:
Kangping
2023-05-08 09:09:46 -07:00
committed by GitHub
parent 9eb22897ea
commit 874b6beca8
4 changed files with 6 additions and 9 deletions
+1
View File
@@ -73,6 +73,7 @@ readonly OT_PLATFORMS
OT_POSIX_SIM_COMMON_OPTIONS=(
"-DOT_ANYCAST_LOCATOR=ON"
"-DOT_BORDER_AGENT=ON"
"-DOT_BORDER_AGENT_ID=ON"
"-DOT_BORDER_ROUTER=ON"
"-DOT_CHANNEL_MANAGER=ON"
"-DOT_CHANNEL_MONITOR=ON"
+4 -3
View File
@@ -36,6 +36,7 @@
#include "openthread-core-config.h"
#include <openthread/border_agent.h>
#include <openthread/platform/settings.h>
#include "common/clearable.hpp"
@@ -47,7 +48,6 @@
#include "common/settings_driver.hpp"
#include "crypto/ecdsa.hpp"
#include "mac/mac_types.hpp"
#include "meshcop/border_agent.hpp"
#include "meshcop/dataset.hpp"
#include "net/ip6_address.hpp"
#include "thread/version.hpp"
@@ -779,7 +779,8 @@ public:
friend class Clearable<BorderAgentId>;
public:
static constexpr Key kKey = kKeyBorderAgentId; ///< The associated key.
static constexpr Key kKey = kKeyBorderAgentId; ///< The associated key.
static constexpr uint8_t kLength = OT_BORDER_AGENT_ID_LENGTH;
/**
* This method initializes the `BorderAgentId` object.
@@ -815,7 +816,7 @@ public:
private:
void Log(Action aAction) const;
uint8_t mId[MeshCoP::BorderAgent::kIdLength];
uint8_t mId[kLength];
} OT_TOOL_PACKED_END;
#endif // OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE
-2
View File
@@ -237,8 +237,6 @@ Error BorderAgent::GetId(uint8_t *aId, uint16_t &aLength)
{
Error error = kErrorNone;
static_assert(sizeof(mId) == kIdLength, "Invalid Border Agent ID size");
VerifyOrExit(aLength >= sizeof(mId), error = kErrorInvalidArgs);
VerifyOrExit(!mIdInitialized, error = kErrorNone);
+1 -4
View File
@@ -44,6 +44,7 @@
#include "common/locator.hpp"
#include "common/non_copyable.hpp"
#include "common/notifier.hpp"
#include "common/settings.hpp"
#include "net/udp6.hpp"
#include "thread/tmf.hpp"
#include "thread/uri_paths.hpp"
@@ -59,10 +60,6 @@ class BorderAgent : public InstanceLocator, private NonCopyable
friend class Tmf::SecureAgent;
public:
#if OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE
static constexpr uint8_t kIdLength = OT_BORDER_AGENT_ID_LENGTH;
#endif
/**
* This enumeration defines the Border Agent state.
*