[docs] add Doxygen support for CLI comments (#7749)

This commit is contained in:
Sarah
2022-06-28 16:44:39 -07:00
committed by GitHub
parent f561b44586
commit 4747a9c776
9 changed files with 463 additions and 33 deletions
+3 -3
View File
@@ -63,17 +63,17 @@ typedef enum otBorderAgentState
} otBorderAgentState;
/**
* This function gets the state of Thread Border Agent role.
* Gets the #otBorderAgentState of the Thread Border Agent role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @returns State of the Border Agent.
* @returns The current #otBorderAgentState of the Border Agent.
*
*/
otBorderAgentState otBorderAgentGetState(otInstance *aInstance);
/**
* This function gets the UDP port of Thread Border Agent service.
* Gets the UDP port of the Thread Border Agent service.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
+11 -12
View File
@@ -73,7 +73,7 @@ extern "C" {
otError otBorderRoutingInit(otInstance *aInstance, uint32_t aInfraIfIndex, bool aInfraIfIsRunning);
/**
* This method enables/disables the Border Routing Manager.
* Enables or disables the Border Routing Manager.
*
* @note The Border Routing Manager is disabled by default.
*
@@ -87,10 +87,11 @@ otError otBorderRoutingInit(otInstance *aInstance, uint32_t aInfraIfIndex, bool
otError otBorderRoutingSetEnabled(otInstance *aInstance, bool aEnabled);
/**
* This method returns the off-mesh-routable (OMR) prefix.
* Gets the Off-Mesh-Routable (OMR) Prefix, for example `fdfc:1ff5:1512:5622::/64`.
*
* The randomly generated 64-bit prefix will be published
* in the Thread network if there isn't already an OMR prefix.
* An OMR Prefix is a randomly generated 64-bit prefix that's published in the
* Thread network if there isn't already an OMR prefix. This prefix can be reached
* from the local Wi-Fi or Ethernet network.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aPrefix A pointer to where the prefix will be output to.
@@ -102,11 +103,10 @@ otError otBorderRoutingSetEnabled(otInstance *aInstance, bool aEnabled);
otError otBorderRoutingGetOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix);
/**
* This method returns the on-link prefix for the adjacent infrastructure link.
* Gets the On-Link Prefix for the adjacent infrastructure link, for example `fd41:2650:a6f5:0::/64`.
*
* The randomly generated 64-bit prefix will be advertised
* on the infrastructure link if there isn't already a usable
* on-link prefix being advertised on the link.
* An On-Link Prefix is a randomly generated 64-bit prefix that's advertised on the infrastructure
* link if there isn't already a usable on-link prefix being advertised on the link.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aPrefix A pointer to where the prefix will be output to.
@@ -118,12 +118,11 @@ otError otBorderRoutingGetOmrPrefix(otInstance *aInstance, otIp6Prefix *aPrefix)
otError otBorderRoutingGetOnLinkPrefix(otInstance *aInstance, otIp6Prefix *aPrefix);
/**
* This function returns the local NAT64 prefix.
* Gets the local NAT64 Prefix of the Border Router.
*
* This prefix might not be advertised in the Thread network.
* NAT64 Prefix might not be advertised in the Thread network.
*
* This function is only available when `OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE`
* is enabled.
* `OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE` must be enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aPrefix A pointer to where the prefix will be output to.
+1 -1
View File
@@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (221)
#define OPENTHREAD_API_VERSION (222)
/**
* @addtogroup api-instance
+10 -12
View File
@@ -94,7 +94,7 @@ typedef struct otJoinerDiscerner
typedef void (*otJoinerCallback)(otError aError, void *aContext);
/**
* This function enables the Thread Joiner role.
* Enables the Thread Joiner role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aPskd A pointer to the PSKd.
@@ -123,7 +123,7 @@ otError otJoinerStart(otInstance * aInstance,
void * aContext);
/**
* This function disables the Thread Joiner role.
* Disables the Thread Joiner role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -131,7 +131,7 @@ otError otJoinerStart(otInstance * aInstance,
void otJoinerStop(otInstance *aInstance);
/**
* This function returns the Joiner State.
* Gets the Joiner State.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -146,12 +146,12 @@ void otJoinerStop(otInstance *aInstance);
otJoinerState otJoinerGetState(otInstance *aInstance);
/**
* This function gets the Joiner ID.
* Gets the Joiner ID.
*
* If a Joiner Discerner is not set, Joiner ID is the first 64 bits of the result of computing SHA-256 over
* factory-assigned IEEE EUI-64. Otherwise the Joiner ID is calculated from the Joiner Discerner value.
*
* The Joiner ID is also used as the device's IEEE 802.15.4 Extended Address during commissioning process.
* The Joiner ID is also used as the device's IEEE 802.15.4 Extended Address during the commissioning process.
*
* @param[in] aInstance A pointer to the OpenThread instance.
*
@@ -161,13 +161,11 @@ otJoinerState otJoinerGetState(otInstance *aInstance);
const otExtAddress *otJoinerGetId(otInstance *aInstance);
/**
* This function sets the Joiner Discerner.
* Sets the Joiner Discerner.
*
* The Joiner Discerner is used to calculate the Joiner ID used during commissioning/joining process.
*
* By default (when a discerner is not provided or set to NULL), Joiner ID is derived as first 64 bits of the result
* of computing SHA-256 over factory-assigned IEEE EUI-64. Note that this is the main behavior expected by Thread
* specification.
* The Joiner Discerner is used to calculate the Joiner ID during the Thread Commissioning process. For more
* information, refer to #otJoinerGetId.
* @note The Joiner Discerner takes the place of the Joiner EUI-64 during the joiner session of Thread Commissioning.
*
* @param[in] aInstance A pointer to the OpenThread instance.
* @param[in] aDiscerner A pointer to a Joiner Discerner. If NULL clears any previously set discerner.
@@ -180,7 +178,7 @@ const otExtAddress *otJoinerGetId(otInstance *aInstance);
otError otJoinerSetDiscerner(otInstance *aInstance, otJoinerDiscerner *aDiscerner);
/**
* This function gets the Joiner Discerner.
* Gets the Joiner Discerner. For more information, refer to #otJoinerSetDiscerner.
*
* @param[in] aInstance A pointer to the OpenThread instance.
*
+4 -4
View File
@@ -175,10 +175,10 @@ void otNetDataSetDnsSrpServicePublisherCallback(otInstance *
void * aContext);
/**
* This function unpublishes any previously added "DNS/SRP (Anycast or Unicast) Service" entry from the Thread Network
* Unpublishes any previously added DNS/SRP (Anycast or Unicast) Service entry from the Thread Network
* Data.
*
* This function requires the feature `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` to be enabled.
* `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` must be enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -270,9 +270,9 @@ void otNetDataSetPrefixPublisherCallback(otInstance * aInsta
void * aContext);
/**
* This function unpublishes a previously published prefix (on-mesh or external route).
* Unpublishes a previously published On-Mesh or External Route Prefix.
*
* This function requires the feature `OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE` to be enabled.
* `OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE` must be enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aPrefix The prefix to unpublish (MUST NOT be NULL).
+1 -1
View File
@@ -442,7 +442,7 @@ const char *otPlatRadioGetVersionString(otInstance *aInstance);
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance);
/**
* Get the factory-assigned IEEE EUI-64 for this interface.
* Gets the factory-assigned IEEE EUI-64 for this interface.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[out] aIeeeEui64 A pointer to the factory-assigned IEEE EUI-64.
+125
View File
@@ -413,10 +413,30 @@ template <> otError Interpreter::Process<Cmd("ba")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
/**
* @cli ba port
* @code
* ba port
* 49153
* Done
* @endcode
* @par api_copy
* #otBorderAgentGetUdpPort
*/
if (aArgs[0] == "port")
{
OutputLine("%hu", otBorderAgentGetUdpPort(GetInstancePtr()));
}
/**
* @cli ba state
* @code
* ba state
* Started
* Done
* @endcode
* @par api_copy
* #otBorderAgentGetState
*/
else if (aArgs[0] == "state")
{
static const char *const kStateStrings[] = {
@@ -446,10 +466,33 @@ template <> otError Interpreter::Process<Cmd("br")>(Arg aArgs[])
otError error = OT_ERROR_NONE;
bool enable;
/**
* @cli br (enable,disable)
* @code
* br enable
* Done
* @endcode
* @code
* br disable
* Done
* @endcode
* @par api_copy
* #otBorderRoutingSetEnabled
*/
if (ParseEnableOrDisable(aArgs[0], enable) == OT_ERROR_NONE)
{
SuccessOrExit(error = otBorderRoutingSetEnabled(GetInstancePtr(), enable));
}
/**
* @cli br omrprefix
* @code
* br omrprefix
* fdfc:1ff5:1512:5622::/64
* Done
* @endcode
* @par api_copy
* #otBorderRoutingGetOmrPrefix
*/
else if (aArgs[0] == "omrprefix")
{
otIp6Prefix omrPrefix;
@@ -457,6 +500,16 @@ template <> otError Interpreter::Process<Cmd("br")>(Arg aArgs[])
SuccessOrExit(error = otBorderRoutingGetOmrPrefix(GetInstancePtr(), &omrPrefix));
OutputIp6PrefixLine(omrPrefix);
}
/**
* @cli br onlinkprefix
* @code
* br onlinkprefix
* fd41:2650:a6f5:0::/64
* Done
* @endcode
* @par api_copy
* #otBorderRoutingGetOnLinkPrefix
*/
else if (aArgs[0] == "onlinkprefix")
{
otIp6Prefix onLinkPrefix;
@@ -465,6 +518,16 @@ template <> otError Interpreter::Process<Cmd("br")>(Arg aArgs[])
OutputIp6PrefixLine(onLinkPrefix);
}
#if OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE
/**
* @cli br nat64prefix
* @code
* br nat64prefix
* fd14:1078:b3d5:b0b0:0:0::/96
* Done
* @endcode
* @par api_copy
* #otBorderRoutingGetNat64Prefix
*/
else if (aArgs[0] == "nat64prefix")
{
otIp6Prefix nat64Prefix;
@@ -1820,6 +1883,16 @@ exit:
}
#endif
/**
* @cli eui64
* @code
* eui64
* 0615aae900124b00
* Done
* @endcode
* @par api_copy
* #otPlatRadioGetIeeeEui64
*/
template <> otError Interpreter::Process<Cmd("eui64")>(Arg aArgs[])
{
OT_UNUSED_VARIABLE(aArgs);
@@ -3548,6 +3621,23 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
/**
* @cli prefix
* @code
* prefix
* 2001:dead:beef:cafe::/64 paros med
* - fd00:7d03:7d03:7d03::/64 prosD med
* Done
* @endcode
* @par
* Get the prefix list in the local Network Data.
* @note For the Thread 1.2 border router with backbone capability, the local Domain Prefix
* is listed as well and includes the `D` flag. If backbone functionality is disabled, a dash
* `-` is printed before the local Domain Prefix.
* @par
* For more information about #otBorderRouterConfig flags, refer to @overview.
* @sa otBorderRouterGetNextOnMeshPrefix
*/
if (aArgs[0].IsEmpty())
{
otNetworkDataIterator iterator = OT_NETWORK_DATA_ITERATOR_INIT;
@@ -3567,6 +3657,22 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
}
#endif
}
/**
* @cli prefix add
* @code
* prefix add 2001:dead:beef:cafe::/64 paros med
* Done
* @endcode
* @code
* prefix add fd00:7d03:7d03:7d03::/64 prosD low
* Done
* @endcode
* @cparam prefix add @ca{prefix} [@ca{padcrosnD}] [@ca{high}|@ca{med}|@ca{low}]
* OT CLI uses mapped arguments to configure #otBorderRouterConfig values. @moreinfo{the @overview}.
* @par
* Adds a valid prefix to the Network Data.
* @sa otBorderRouterAddOnMeshPrefix
*/
else if (aArgs[0] == "add")
{
otBorderRouterConfig config;
@@ -3574,6 +3680,15 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
SuccessOrExit(error = ParsePrefix(aArgs + 1, config));
error = otBorderRouterAddOnMeshPrefix(GetInstancePtr(), &config);
}
/**
* @cli prefix remove
* @code
* prefix remove 2001:dead:beef:cafe::/64
* Done
* @endcode
* @par api_copy
* #otBorderRouterRemoveOnMeshPrefix
*/
else if (aArgs[0] == "remove")
{
otIp6Prefix prefix;
@@ -3581,6 +3696,16 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
SuccessOrExit(error = aArgs[1].ParseAsIp6Prefix(prefix));
error = otBorderRouterRemoveOnMeshPrefix(GetInstancePtr(), &prefix);
}
/**
* @cli prefix meshlocal
* @code
* prefix meshlocal
* fdde:ad00:beef:0::/64
* Done
* @endcode
* @par
* Get the mesh local prefix.
*/
else if (aArgs[0] == "meshlocal")
{
if (aArgs[1].IsEmpty())
+96
View File
@@ -46,6 +46,16 @@ template <> otError Joiner::Process<Cmd("discerner")>(Arg aArgs[])
{
otError error = OT_ERROR_INVALID_ARGS;
/**
* @cli joiner discerner
* @code
* joiner discerner
* 0xabc/12
* Done
* @endcode
* @par api_copy
* #otJoinerGetDiscerner
*/
if (aArgs[0].IsEmpty())
{
const otJoinerDiscerner *discerner = otJoinerGetDiscerner(GetInstancePtr());
@@ -61,10 +71,31 @@ template <> otError Joiner::Process<Cmd("discerner")>(Arg aArgs[])
memset(&discerner, 0, sizeof(discerner));
/**
* @cli joiner discerner clear
* @code
* joiner discerner clear
* Done
* @endcode
* @par
* Clear the %Joiner discerner.
*/
if (aArgs[0] == "clear")
{
error = otJoinerSetDiscerner(GetInstancePtr(), nullptr);
}
/**
* @cli joiner discerner (set)
* @code
* joiner discerner 0xabc/12
* Done
* @endcode
* @cparam joiner discerner @ca{discerner}
* * Use `{number}/{length}` to set the `discerner`.
* * `joiner discerner clear` sets `aDiscerner` to `nullptr`.
* @par api_copy
* #otJoinerSetDiscerner
*/
else
{
VerifyOrExit(aArgs[1].IsEmpty());
@@ -77,6 +108,16 @@ exit:
return error;
}
/**
* @cli joiner id
* @code
* joiner id
* d65e64fa83f81cf7
* Done
* @endcode
* @par api_copy
* #otJoinerGetId
*/
template <> otError Joiner::Process<Cmd("id")>(Arg aArgs[])
{
OT_UNUSED_VARIABLE(aArgs);
@@ -86,6 +127,20 @@ template <> otError Joiner::Process<Cmd("id")>(Arg aArgs[])
return OT_ERROR_NONE;
}
/**
* @cli joiner start
* @code
* joiner start J01NM3
* Done
* @endcode
* @cparam joiner start @ca{joining-device-credential} [@ca{provisioning-url}]
* * `joining-device-credential`: %Joiner Passphrase. Must be a string of all uppercase alphanumeric
* characters (0-9 and A-Y, excluding I, O, Q, and Z for readability), with a length between 6 and
* 32 characters.
* * `provisioning-url`: Provisioning URL for the %Joiner (optional).
* @par api_copy
* #otJoinerStart
*/
template <> otError Joiner::Process<Cmd("start")>(Arg aArgs[])
{
otError error;
@@ -105,6 +160,15 @@ exit:
return error;
}
/**
* @cli joiner stop
* @code
* joiner stop
* Done
* @endcode
* @par api_copy
* #otJoinerStop
*/
template <> otError Joiner::Process<Cmd("stop")>(Arg aArgs[])
{
OT_UNUSED_VARIABLE(aArgs);
@@ -114,6 +178,24 @@ template <> otError Joiner::Process<Cmd("stop")>(Arg aArgs[])
return OT_ERROR_NONE;
}
/**
* @cli joiner state
* @code
* joiner state
* Idle
* Done
* @endcode
* @par api_copy
* #otJoinerGetState
* @par
* Returns one of the following states:
* * `Idle`
* * `Discover`
* * `Connecting`
* * `Connected`
* * `Entrust`
* * `Joined`
*/
template <> otError Joiner::Process<Cmd("state")>(Arg aArgs[])
{
OT_UNUSED_VARIABLE(aArgs);
@@ -141,6 +223,20 @@ otError Joiner::Process(Arg aArgs[])
otError error = OT_ERROR_INVALID_COMMAND;
const Command *command;
/**
* @cli joiner help
* @code
* joiner help
* help
* id
* start
* state
* stop
* Done
* @endcode
* @par
* Print the `joiner` help menu.
*/
if (aArgs[0].IsEmpty() || (aArgs[0] == "help"))
{
OutputCommandTable(kCommands);
+212
View File
@@ -192,6 +192,24 @@ template <> otError NetworkData::Process<Cmd("publish")>(Arg aArgs[])
#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
if (aArgs[0] == "dnssrp")
{
/**
* @cli netdata publish dnssrp anycast
* @code
* netdata publish dnssrp anycast 1
* Done
* @endcode
* @cparam netdata publish dnssrp anycast @ca{seq-num}
* @par
* Publishes a DNS/SRP Service Anycast Address with a sequence number. Any current
* DNS/SRP Service entry being published from a previous `publish dnssrp{anycast|unicast}`
* command is removed and replaced with the new arguments.
* @par
* `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` must be enabled.
* @csa{netdata publish dnssrp unicast (addr,port)}
* @csa{netdata publish dnssrp unicast (mle)}
* @sa otNetDataPublishDnsSrpServiceAnycast
* @endcli
*/
if (aArgs[1] == "anycast")
{
uint8_t sequenceNumber;
@@ -206,6 +224,26 @@ template <> otError NetworkData::Process<Cmd("publish")>(Arg aArgs[])
otIp6Address address;
uint16_t port;
/**
* @cli netdata publish dnssrp unicast (mle)
* @code
* netdata publish dnssrp unicast 50152
* Done
* @endcode
* @cparam netdata publish dnssrp unicast @ca{port}
* @par
* Publishes the device's Mesh-Local EID with a port number. MLE and port information is
* included in the Server TLV data. To use a different Unicast address, use the
* `netdata publish dnssrp unicast (addr,port)` command.
* @par
* Any current DNS/SRP Service entry being published from a previous
* `publish dnssrp{anycast|unicast}` command is removed and replaced with the new arguments.
* @par
* `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` must be enabled.
* @csa{netdata publish dnssrp unicast (addr,port)}
* @csa{netdata publish dnssrp anycast}
* @sa otNetDataPublishDnsSrpServiceUnicastMeshLocalEid
*/
if (aArgs[3].IsEmpty())
{
SuccessOrExit(error = aArgs[2].ParseAsUint16(port));
@@ -213,6 +251,24 @@ template <> otError NetworkData::Process<Cmd("publish")>(Arg aArgs[])
ExitNow();
}
/**
* @cli netdata publish dnssrp unicast (addr,port)
* @code
* netdata publish dnssrp unicast fd00::1234 51525
* Done
* @endcode
* @cparam netdata publish dnssrp unicast @ca{address} @ca{port}
* @par
* Publishes a DNS/SRP Service Unicast Address with an address and port number. The address
* and port information is included in Service TLV data. Any current DNS/SRP Service entry being
* published from a previous `publish dnssrp{anycast|unicast}` command is removed and replaced
* with the new arguments.
* @par
* `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` must be enabled.
* @csa{netdata publish dnssrp unicast (mle)}
* @csa{netdata publish dnssrp anycast}
* @sa otNetDataPublishDnsSrpServiceUnicast
*/
SuccessOrExit(error = aArgs[2].ParseAsIp6Address(address));
SuccessOrExit(error = aArgs[3].ParseAsUint16(port));
otNetDataPublishDnsSrpServiceUnicast(GetInstancePtr(), &address, port);
@@ -222,6 +278,18 @@ template <> otError NetworkData::Process<Cmd("publish")>(Arg aArgs[])
#endif // OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
/**
* @cli netdata publish prefix
* @code
* netdata publish prefix fd00:1234:5678::/64 paos med
* Done
* @endcode
* @cparam netdata publish prefix @ca{prefix} [@ca{padcrosnD}] [@ca{high}|@ca{med}|@ca{low}]
* OT CLI uses mapped arguments to configure #otBorderRouterConfig values. @moreinfo{the @overview}.
* @par
* Publish an on-mesh prefix entry. @moreinfo{@netdata}.
* @sa otNetDataPublishOnMeshPrefix
*/
if (aArgs[0] == "prefix")
{
otBorderRouterConfig config;
@@ -231,6 +299,18 @@ template <> otError NetworkData::Process<Cmd("publish")>(Arg aArgs[])
ExitNow();
}
/**
* @cli netdata publish route
* @code
* netdata publish route fd00:1234:5678::/64 s high
* Done
* @endcode
* @cparam publish route @ca{prefix} [@ca{sn}] [@ca{high}|@ca{med}|@ca{low}]
* OT CLI uses mapped arguments to configure #otExternalRouteConfig values. @moreinfo{the @overview}.
* @par
* Publish an external route entry. @moreinfo{@netdata}.
* @sa otNetDataPublishExternalRoute
*/
if (aArgs[0] == "route")
{
otExternalRouteConfig config;
@@ -251,6 +331,15 @@ template <> otError NetworkData::Process<Cmd("unpublish")>(Arg aArgs[])
{
otError error = OT_ERROR_NONE;
/**
* @cli netdata unpublish dnssrp
* @code
* netdata unpublish dnssrp
* Done
* @endcode
* @par api_copy
* #otNetDataUnpublishDnsSrpService
*/
#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
if (aArgs[0] == "dnssrp")
{
@@ -259,6 +348,18 @@ template <> otError NetworkData::Process<Cmd("unpublish")>(Arg aArgs[])
}
#endif
/**
* @cli netdata unpublish (prefix)
* @code
* netdata unpublish fd00:1234:5678::/64
* Done
* @endcode
* @cparam netdata unpublish @ca{prefix}
* @par api_copy
* #otNetDataUnpublishPrefix
* @par
* @moreinfo{@netdata}.
*/
#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
{
otIp6Prefix prefix;
@@ -279,6 +380,22 @@ exit:
#endif // OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE
#if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
/**
* @cli netdata register
* @code
* netdata register
* Done
* @endcode
* @par
* Register configured prefixes, routes, and services with the Leader.
* @par
* OT CLI checks for `OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE`. If OTBR is enabled, it
* registers local Network Data with the Leader. Otherwise, it calls the CLI function `otServerRegister`.
* @moreinfo{@netdata}.
* @csa{prefix add}
* @sa otBorderRouterRegister
* @sa otServerAddService
*/
template <> otError NetworkData::Process<Cmd("register")>(Arg aArgs[])
{
OT_UNUSED_VARIABLE(aArgs);
@@ -314,10 +431,38 @@ template <> otError NetworkData::Process<Cmd("steeringdata")>(Arg aArgs[])
SuccessOrExit(error);
/**
* @cli netdata steeringdata check (discerner)
* @code
* netdata steeringdata check 0xabc/12
* Done
* @endcode
* @code
* netdata steeringdata check 0xdef/12
* Error 23: NotFound
* @endcode
* @cparam netdata steeringdata check @ca{discerner}
* * `discerner`: The %Joiner discerner in format `{number}/{length}`.
* @par api_copy
* #otNetDataSteeringDataCheckJoinerWithDiscerner
* @csa{joiner discerner}
*/
if (discerner.mLength)
{
error = otNetDataSteeringDataCheckJoinerWithDiscerner(GetInstancePtr(), &discerner);
}
/**
* @cli netdata steeringdata check (eui64)
* @code
* netdata steeringdata check d45e64fa83f81cf7
* Done
* @endcode
* @cparam netdata steeringdata check @ca{eui64}
* * `eui64`: The IEEE EUI-64 of the %Joiner.
* @par api_copy
* #otNetDataSteeringDataCheckJoiner
* @csa{eui64}
*/
else
{
error = otNetDataSteeringDataCheckJoiner(GetInstancePtr(), &addr);
@@ -452,6 +597,36 @@ exit:
return error;
}
/**
* @cli netdata show
* @code
* netdata show
* Prefixes:
* fd00:dead:beef:cafe::/64 paros med dc00
* Routes:
* fd49:7770:7fc5:0::/64 s med 4000
* Services:
* 44970 5d c000 s 4000
* 44970 01 9a04b000000e10 s 4000
* Done
* @endcode
* @code
* netdata show -x
* 08040b02174703140040fd00deadbeefcafe0504dc00330007021140
* Done
* @endcode
* @cparam netdata show [@ca{-x}]
* * The optional `-x` argument gets Network Data as hex-encoded TLVs.
* @par
* `netdata show` from OT CLI gets full Network Data received from the Leader. This command uses several
* API functions to combine prefixes, routes, and services, including #otNetDataGetNextOnMeshPrefix,
* #otNetDataGetNextRoute, and #otNetDataGetNextService.
* @par
* @moreinfo{@netdata}.
* @csa{br omrprefix}
* @csa{br onlinkprefix}
* @sa otBorderRouterGetNetData
*/
template <> otError NetworkData::Process<Cmd("show")>(Arg aArgs[])
{
otError error = OT_ERROR_INVALID_ARGS;
@@ -460,6 +635,27 @@ template <> otError NetworkData::Process<Cmd("show")>(Arg aArgs[])
for (uint8_t i = 0; !aArgs[i].IsEmpty(); i++)
{
/**
* @cli netdata show local
* @code
* netdata show local
* Prefixes:
* fd00:dead:beef:cafe::/64 paros med dc00
* Routes:
* Services:
* Done
* @endcode
* @code
* netdata show local -x
* 08040b02174703140040fd00deadbeefcafe0504dc00330007021140
* Done
* @endcode
* @cparam netdata show local [@ca{-x}]
* * The optional `-x` argument gets local Network Data as hex-encoded TLVs.
* @par
* Print local Network Data to sync with the Leader.
* @csa{netdata show}
*/
if (aArgs[i] == "local")
{
local = true;
@@ -518,6 +714,22 @@ otError NetworkData::Process(Arg aArgs[])
otError error = OT_ERROR_INVALID_COMMAND;
const Command *command;
/**
* @cli netdata help
* @code
* netdata help
* help
* publish
* register
* show
* steeringdata
* unpublish
* Done
* @endcode
* @par
* Gets a list of `netdata` CLI commands.
* @sa @netdata
*/
if (aArgs[0].IsEmpty() || (aArgs[0] == "help"))
{
OutputCommandTable(kCommands);