mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 13:20:25 +00:00
[netdata] add api to check if joiner is in steering data (#5392)
This commit is contained in:
@@ -186,6 +186,7 @@ const struct Command Interpreter::sCommands[] = {
|
||||
#if OPENTHREAD_FTD
|
||||
{"neighbor", &Interpreter::ProcessNeighbor},
|
||||
#endif
|
||||
{"netdata", &Interpreter::ProcessNetworkData},
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
|
||||
{"netdataregister", &Interpreter::ProcessNetworkDataRegister},
|
||||
#endif
|
||||
@@ -2236,6 +2237,48 @@ exit:
|
||||
}
|
||||
#endif
|
||||
|
||||
void Interpreter::ProcessNetworkData(uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
otError error;
|
||||
|
||||
if (aArgsLength > 2 && strcmp(aArgs[0], "steeringdata") == 0)
|
||||
{
|
||||
if (strcmp(aArgs[1], "check") == 0)
|
||||
{
|
||||
otExtAddress addr;
|
||||
otJoinerDiscerner discerner;
|
||||
|
||||
discerner.mLength = 0;
|
||||
|
||||
error = Interpreter::ParseJoinerDiscerner(aArgs[2], discerner);
|
||||
|
||||
if (error == OT_ERROR_NOT_FOUND)
|
||||
{
|
||||
VerifyOrExit(Interpreter::Hex2Bin(aArgs[2], addr.m8, sizeof(addr)) == sizeof(addr),
|
||||
error = OT_ERROR_INVALID_ARGS);
|
||||
}
|
||||
else if (error != OT_ERROR_NONE)
|
||||
{
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
if (discerner.mLength)
|
||||
{
|
||||
ExitNow(error = otNetDataSteeringDataCheckJoinerWithDiscerner(mInstance, &discerner));
|
||||
}
|
||||
else
|
||||
{
|
||||
ExitNow(error = otNetDataSteeringDataCheckJoiner(mInstance, &addr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error = OT_ERROR_INVALID_COMMAND;
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
|
||||
void Interpreter::ProcessNetworkDataRegister(uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user