[border-agent] add support for vo key in TXT data parser (#12858)

This commit adds support for the Vendor OUI (`vo`) key in the Border
Agent MeshCoP service TXT data parser.

The `otBorderAgentTxtDataInfo` structure and its internal counterpart
`TxtData::Info` are updated to include a boolean flag `mHasVendorOui`
and a 3-byte array `mVendorOui` to store the 24-bit vendor OUI.

The parsing logic in `TxtData::Info::ProcessTxtEntry()` is updated to
recognize the `vo` key and extract its value. Additionally, the CLI
`Interpreter` is updated to output the vendor OUI in hexadecimal
format when it is present in the parsed information.
This commit is contained in:
Abtin Keshavarzian
2026-04-08 23:40:23 -07:00
committed by GitHub
parent 0e8bb15545
commit 51353c41d5
5 changed files with 16 additions and 1 deletions
@@ -61,6 +61,7 @@ extern "C" {
#define OT_BORDER_AGENT_THREAD_VERSION_SIZE (16) ///< Max size of Thread Version string in `otBorderAgentTxtDataInfo`.
#define OT_BORDER_AGENT_VENDOR_NAME_SIZE (32) ///< Max size of Vendor Name string in `otBorderAgentTxtDataInfo`.
#define OT_BORDER_AGENT_MODEL_NAME_SIZE (32) ///< Max size of Model Name string in `otBorderAgentTxtDataInfo`.
#define OT_BORDER_AGENT_VENDOR_OUI_SIZE (3) ///< Size of Vendor OUI (in bytes) in `otBorderAgentTxtDataInfo`.
/**
* Represents the Connection Mode in a Border Agent State Bitmap.
@@ -152,6 +153,7 @@ typedef struct otBorderAgentTxtDataInfo
bool mHasExtAddress : 1; ///< Indicates whether Extended Address is present.
bool mHasVendorName : 1; ///< Indicates whether Vendor Name is present.
bool mHasModelName : 1; ///< Indicates whether Model Name is present.
bool mHasVendorOui : 1; ///< Indicates whether Vendor OUI is present.
char mRecordVersion[OT_BORDER_AGENT_RECORD_VERSION_SIZE]; ///< Record Version string.
otBorderAgentId mAgentId; ///< Agent ID.
char mThreadVersion[OT_BORDER_AGENT_THREAD_VERSION_SIZE]; ///< Thread Version string.
@@ -167,6 +169,7 @@ typedef struct otBorderAgentTxtDataInfo
otExtAddress mExtAddress; ///< Extended Address.
char mVendorName[OT_BORDER_AGENT_VENDOR_NAME_SIZE]; ///< Vendor Name string.
char mModelName[OT_BORDER_AGENT_MODEL_NAME_SIZE]; ///< Model Name string.
uint8_t mVendorOui[OT_BORDER_AGENT_VENDOR_OUI_SIZE]; ///< Vendor OUI (24-bit).
} otBorderAgentTxtDataInfo;
/**
+1 -1
View File
@@ -52,7 +52,7 @@ extern "C" {
*
* @note This number versions both OpenThread platform and user APIs.
*/
#define OPENTHREAD_API_VERSION (589)
#define OPENTHREAD_API_VERSION (590)
/**
* @addtogroup api-instance
+6
View File
@@ -740,6 +740,12 @@ void Interpreter::OutputBorderAgentTxtDataInfo(uint8_t aIndentSize, const otBord
OutputLine(aIndentSize, "ModelName: %s", aInfo.mModelName);
}
if (aInfo.mHasVendorOui)
{
OutputLine(aIndentSize, "VendorOui: %02X-%02X-%02X", aInfo.mVendorOui[0], aInfo.mVendorOui[1],
aInfo.mVendorOui[2]);
}
if (aInfo.mHasStateBitmap)
{
uint8_t indent = aIndentSize + kIndentSize;
@@ -59,6 +59,7 @@ const char TxtData::Key::kOmrPrefix[] = "omr";
const char TxtData::Key::kExtAddress[] = "xa";
const char TxtData::Key::kVendorName[] = "vn";
const char TxtData::Key::kModelName[] = "mn";
const char TxtData::Key::kVendorOui[] = "vo";
TxtData::TxtData(Instance &aInstance)
: InstanceLocator(aInstance)
@@ -478,6 +479,10 @@ void TxtData::Info::ProcessTxtEntry(const Dns::TxtEntry &aEntry)
ReadStringValue(aEntry, mModelName);
mHasModelName = true;
}
else if (aEntry.MatchesKey(Key::kVendorOui))
{
mHasVendorOui = ReadValue(aEntry, mVendorOui);
}
}
bool TxtData::Info::ReadValue(const Dns::TxtEntry &aEntry, void *aBuffer, uint16_t aSize)
@@ -300,6 +300,7 @@ private:
static const char kExtAddress[];
static const char kVendorName[];
static const char kModelName[];
static const char kVendorOui[];
};
struct StateBitmap