From 8eeb1e83eb54084349e91b181d22bf829577e5be Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Thu, 19 Mar 2020 14:31:02 -0700 Subject: [PATCH] [cli] change aArgsLength type from int to uint8_t (#4718) --- examples/platforms/jn5189/diag.c | 2 +- examples/platforms/nrf528xx/src/diag.c | 32 +++-- include/openthread/cli.h | 4 +- include/openthread/diag.h | 6 +- include/openthread/platform/diag.h | 6 +- src/cli/cli.cpp | 178 ++++++++++++------------- src/cli/cli.hpp | 172 ++++++++++++------------ src/cli/cli_coap.cpp | 18 +-- src/cli/cli_coap.hpp | 20 +-- src/cli/cli_coap_secure.cpp | 20 +-- src/cli/cli_coap_secure.hpp | 22 +-- src/cli/cli_commissioner.cpp | 24 ++-- src/cli/cli_commissioner.hpp | 26 ++-- src/cli/cli_dataset.cpp | 42 +++--- src/cli/cli_dataset.hpp | 44 +++--- src/cli/cli_joiner.cpp | 10 +- src/cli/cli_joiner.hpp | 12 +- src/cli/cli_udp.cpp | 18 +-- src/cli/cli_udp.hpp | 16 +-- src/core/api/diags_api.cpp | 2 +- src/core/diags/factory_diags.cpp | 32 +++-- src/core/diags/factory_diags.hpp | 20 +-- src/posix/platform/radio_spinel.cpp | 9 +- tests/fuzz/fuzzer_platform.cpp | 8 +- tests/unit/test_platform.cpp | 2 +- 25 files changed, 391 insertions(+), 354 deletions(-) diff --git a/examples/platforms/jn5189/diag.c b/examples/platforms/jn5189/diag.c index 6b01e3071..bc11f24c7 100755 --- a/examples/platforms/jn5189/diag.c +++ b/examples/platforms/jn5189/diag.c @@ -45,7 +45,7 @@ */ static bool sDiagMode = false; -void otPlatDiagProcess(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +void otPlatDiagProcess(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); OT_UNUSED_VARIABLE(aArgsLength); diff --git a/examples/platforms/nrf528xx/src/diag.c b/examples/platforms/nrf528xx/src/diag.c index 2e399295a..32c78cbd9 100644 --- a/examples/platforms/nrf528xx/src/diag.c +++ b/examples/platforms/nrf528xx/src/diag.c @@ -59,7 +59,7 @@ typedef enum struct PlatformDiagCommand { const char *mName; - otError (*mCommand)(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError (*mCommand)(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); }; struct PlatformDiagMessage @@ -111,7 +111,11 @@ static bool startCarrierTransmision(void) return nrf_802154_continuous_carrier(); } -static otError processListen(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +static otError processListen(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); @@ -139,7 +143,7 @@ exit: return error; } -static otError processID(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +static otError processID(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); @@ -168,7 +172,7 @@ exit: } static otError processTransmit(otInstance *aInstance, - int aArgsLength, + uint8_t aArgsLength, char * aArgs[], char * aOutput, size_t aOutputMaxLen) @@ -252,7 +256,11 @@ exit: return error; } -static otError processGpio(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +static otError processGpio(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); @@ -332,7 +340,11 @@ exit: return error; } -static otError processTemp(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +static otError processTemp(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); OT_UNUSED_VARIABLE(aArgs); @@ -355,7 +367,7 @@ exit: } static otError processCcaThreshold(otInstance *aInstance, - int aArgsLength, + uint8_t aArgsLength, char * aArgs[], char * aOutput, size_t aOutputMaxLen) @@ -402,7 +414,11 @@ const struct PlatformDiagCommand sCommands[] = { {"transmit", &processTransmit}, }; -otError otPlatDiagProcess(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError otPlatDiagProcess(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen) { otError error = OT_ERROR_INVALID_COMMAND; size_t i; diff --git a/include/openthread/cli.h b/include/openthread/cli.h index 2eba04383..1683c238a 100644 --- a/include/openthread/cli.h +++ b/include/openthread/cli.h @@ -51,8 +51,8 @@ extern "C" { */ typedef struct otCliCommand { - const char *mName; ///< A pointer to the command string. - void (*mCommand)(int aArgsLength, char *aArgs[]); ///< A function pointer to process the command. + const char *mName; ///< A pointer to the command string. + void (*mCommand)(uint8_t aArgsLength, char *aArgs[]); ///< A function pointer to process the command. } otCliCommand; /** diff --git a/include/openthread/diag.h b/include/openthread/diag.h index d8ada6e42..869400a23 100644 --- a/include/openthread/diag.h +++ b/include/openthread/diag.h @@ -65,7 +65,11 @@ extern "C" { * @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported. * */ -otError otDiagProcessCmd(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); +otError otDiagProcessCmd(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen); /** * This function processes a factory diagnostics command line. diff --git a/include/openthread/platform/diag.h b/include/openthread/platform/diag.h index 3eba39b3e..d8dcc9d77 100644 --- a/include/openthread/platform/diag.h +++ b/include/openthread/platform/diag.h @@ -70,7 +70,11 @@ extern "C" { * @retval OT_ERROR_INVALID_COMMAND The command is not valid or not supported. * */ -otError otPlatDiagProcess(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); +otError otPlatDiagProcess(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen); /** * This function enables/disables the factory diagnostics mode. diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index c49ff5f92..3a33b15c0 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -417,7 +417,7 @@ exit: return error; } -void Interpreter::ProcessHelp(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessHelp(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -427,7 +427,7 @@ void Interpreter::ProcessHelp(int aArgsLength, char *aArgs[]) mServer->OutputFormat("%s\r\n", sCommands[i].mName); } - for (unsigned int i = 0; i < mUserCommandsLength; i++) + for (uint8_t i = 0; i < mUserCommandsLength; i++) { mServer->OutputFormat("%s\r\n", mUserCommands[i].mName); } @@ -435,7 +435,7 @@ void Interpreter::ProcessHelp(int aArgsLength, char *aArgs[]) AppendResult(OT_ERROR_NONE); } -void Interpreter::ProcessBufferInfo(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessBufferInfo(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -460,7 +460,7 @@ void Interpreter::ProcessBufferInfo(int aArgsLength, char *aArgs[]) AppendResult(OT_ERROR_NONE); } -void Interpreter::ProcessChannel(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessChannel(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -606,7 +606,7 @@ exit: } #if OPENTHREAD_FTD -void Interpreter::ProcessChild(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessChild(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otChildInfo childInfo; @@ -716,7 +716,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessChildIp(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessChildIp(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; uint16_t maxChildren; @@ -752,7 +752,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessChildMax(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessChildMax(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -772,7 +772,7 @@ exit: } #endif // OPENTHREAD_FTD -void Interpreter::ProcessChildTimeout(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessChildTimeout(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -793,7 +793,7 @@ exit: #if OPENTHREAD_CONFIG_COAP_API_ENABLE -void Interpreter::ProcessCoap(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessCoap(uint8_t aArgsLength, char *aArgs[]) { otError error; error = mCoap.Process(aArgsLength, aArgs); @@ -804,7 +804,7 @@ void Interpreter::ProcessCoap(int aArgsLength, char *aArgs[]) #if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE -void Interpreter::ProcessCoapSecure(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessCoapSecure(uint8_t aArgsLength, char *aArgs[]) { otError error; error = mCoapSecure.Process(aArgsLength, aArgs); @@ -814,7 +814,7 @@ void Interpreter::ProcessCoapSecure(int aArgsLength, char *aArgs[]) #endif // OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE #if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE -void Interpreter::ProcessCoexMetrics(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessCoexMetrics(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -871,7 +871,7 @@ exit: #endif // OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE #if OPENTHREAD_FTD -void Interpreter::ProcessContextIdReuseDelay(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessContextIdReuseDelay(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -891,7 +891,7 @@ exit: } #endif // OPENTHREAD_FTD -void Interpreter::ProcessCounters(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessCounters(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -983,7 +983,7 @@ exit: } #if OPENTHREAD_FTD -void Interpreter::ProcessDelayTimerMin(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessDelayTimerMin(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1007,7 +1007,7 @@ exit: } #endif -void Interpreter::ProcessDiscover(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessDiscover(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; uint32_t scanChannels = 0; @@ -1034,7 +1034,7 @@ exit: } #if OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE -void Interpreter::ProcessDns(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessDns(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long port = OT_DNS_DEFAULT_SERVER_PORT; @@ -1118,7 +1118,7 @@ void Interpreter::HandleDnsResponse(const char *aHostname, const Ip6::Address *a #endif #if OPENTHREAD_FTD -void Interpreter::ProcessEidCache(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessEidCache(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -1143,7 +1143,7 @@ exit: } #endif // OPENTHREAD_FTD -void Interpreter::ProcessEui64(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessEui64(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgs); @@ -1160,7 +1160,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessExtAddress(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessExtAddress(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1184,7 +1184,7 @@ exit: } #if OPENTHREAD_POSIX -void Interpreter::ProcessExit(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessExit(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -1195,7 +1195,7 @@ void Interpreter::ProcessExit(int aArgsLength, char *aArgs[]) #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART) && OPENTHREAD_POSIX -void Interpreter::ProcessLogFilename(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessLogFilename(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1208,7 +1208,7 @@ exit: } #endif -void Interpreter::ProcessExtPanId(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessExtPanId(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1231,7 +1231,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessFactoryReset(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessFactoryReset(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -1239,7 +1239,7 @@ void Interpreter::ProcessFactoryReset(int aArgsLength, char *aArgs[]) otInstanceFactoryReset(mInstance); } -void Interpreter::ProcessIfconfig(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessIfconfig(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1271,7 +1271,7 @@ exit: AppendResult(error); } -otError Interpreter::ProcessIpAddrAdd(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessIpAddrAdd(uint8_t aArgsLength, char *aArgs[]) { otError error; otNetifAddress aAddress; @@ -1288,7 +1288,7 @@ exit: return error; } -otError Interpreter::ProcessIpAddrDel(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessIpAddrDel(uint8_t aArgsLength, char *aArgs[]) { otError error; struct otIp6Address address; @@ -1302,7 +1302,7 @@ exit: return error; } -void Interpreter::ProcessIpAddr(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessIpAddr(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1351,7 +1351,7 @@ exit: AppendResult(error); } -otError Interpreter::ProcessIpMulticastAddrAdd(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessIpMulticastAddrAdd(uint8_t aArgsLength, char *aArgs[]) { otError error; struct otIp6Address address; @@ -1365,7 +1365,7 @@ exit: return error; } -otError Interpreter::ProcessIpMulticastAddrDel(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessIpMulticastAddrDel(uint8_t aArgsLength, char *aArgs[]) { otError error; struct otIp6Address address; @@ -1379,7 +1379,7 @@ exit: return error; } -otError Interpreter::ProcessMulticastPromiscuous(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessMulticastPromiscuous(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1414,7 +1414,7 @@ exit: return error; } -void Interpreter::ProcessIpMulticastAddr(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessIpMulticastAddr(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1450,7 +1450,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessKeySequence(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessKeySequence(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -1490,7 +1490,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessLeaderData(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessLeaderData(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -1511,7 +1511,7 @@ exit: } #if OPENTHREAD_FTD -void Interpreter::ProcessLeaderPartitionId(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessLeaderPartitionId(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; unsigned long value; @@ -1530,7 +1530,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessLeaderWeight(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessLeaderWeight(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -1551,7 +1551,7 @@ exit: #endif // OPENTHREAD_FTD #if OPENTHREAD_FTD -void Interpreter::ProcessPskc(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessPskc(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1579,7 +1579,7 @@ exit: } #endif -void Interpreter::ProcessMasterKey(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessMasterKey(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1606,7 +1606,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessMode(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessMode(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otLinkModeConfig linkMode; @@ -1674,7 +1674,7 @@ exit: } #if OPENTHREAD_FTD -void Interpreter::ProcessNeighbor(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessNeighbor(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otNeighborInfo neighborInfo; @@ -1733,7 +1733,7 @@ exit: } #endif -void Interpreter::ProcessNetworkDataShow(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessNetworkDataShow(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -1752,7 +1752,7 @@ exit: } #if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE -void Interpreter::ProcessService(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessService(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1806,7 +1806,7 @@ exit: #endif #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE -void Interpreter::ProcessNetworkDataRegister(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessNetworkDataRegister(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -1824,7 +1824,7 @@ exit: #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE #if OPENTHREAD_FTD -void Interpreter::ProcessNetworkIdTimeout(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessNetworkIdTimeout(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -1844,7 +1844,7 @@ exit: } #endif // OPENTHREAD_FTD -void Interpreter::ProcessNetworkName(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessNetworkName(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -1863,7 +1863,7 @@ exit: } #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE -void Interpreter::ProcessNetworkTime(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessNetworkTime(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -1916,7 +1916,7 @@ exit: } #endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE -void Interpreter::ProcessPanId(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessPanId(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -1935,7 +1935,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessParent(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessParent(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -1963,7 +1963,7 @@ exit: } #if OPENTHREAD_FTD -void Interpreter::ProcessParentPriority(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessParentPriority(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -2018,7 +2018,7 @@ exit: return; } -void Interpreter::ProcessPing(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessPing(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; uint8_t index = 1; @@ -2129,7 +2129,7 @@ exit: } } -void Interpreter::ProcessPollPeriod(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessPollPeriod(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -2148,7 +2148,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessPromiscuous(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessPromiscuous(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -2259,11 +2259,11 @@ void Interpreter::HandleLinkPcapReceive(const otRadioFrame *aFrame, bool aIsTx) } #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE -otError Interpreter::ProcessPrefixAdd(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessPrefixAdd(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otBorderRouterConfig config; - int argcur = 0; + uint8_t argcur = 0; char * prefixLengthStr; VerifyOrExit(aArgsLength > 0, error = OT_ERROR_INVALID_ARGS); @@ -2349,13 +2349,13 @@ exit: return error; } -otError Interpreter::ProcessPrefixRemove(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessPrefixRemove(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); otError error = OT_ERROR_NONE; struct otIp6Prefix prefix; - int argcur = 0; + uint8_t argcur = 0; char * prefixLengthStr; VerifyOrExit(aArgsLength > 0, error = OT_ERROR_INVALID_ARGS); @@ -2450,7 +2450,7 @@ otError Interpreter::ProcessPrefixList(void) return OT_ERROR_NONE; } -void Interpreter::ProcessPrefix(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessPrefix(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -2477,7 +2477,7 @@ exit: #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE #if OPENTHREAD_FTD -void Interpreter::ProcessPreferRouterId(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessPreferRouterId(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; unsigned long value; @@ -2490,7 +2490,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessReleaseRouterId(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessReleaseRouterId(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -2505,7 +2505,7 @@ exit: } #endif // OPENTHREAD_FTD -void Interpreter::ProcessReset(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessReset(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -2513,7 +2513,7 @@ void Interpreter::ProcessReset(int aArgsLength, char *aArgs[]) otInstanceReset(mInstance); } -void Interpreter::ProcessRloc16(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessRloc16(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -2523,11 +2523,11 @@ void Interpreter::ProcessRloc16(int aArgsLength, char *aArgs[]) } #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE -otError Interpreter::ProcessRouteAdd(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessRouteAdd(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otExternalRouteConfig config; - int argcur = 0; + uint8_t argcur = 0; char * prefixLengthStr; memset(&config, 0, sizeof(otExternalRouteConfig)); @@ -2582,11 +2582,11 @@ exit: return error; } -otError Interpreter::ProcessRouteRemove(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessRouteRemove(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; struct otIp6Prefix prefix; - int argcur = 0; + uint8_t argcur = 0; char * prefixLengthStr; memset(&prefix, 0, sizeof(struct otIp6Prefix)); @@ -2651,7 +2651,7 @@ otError Interpreter::ProcessRouteList(void) return OT_ERROR_NONE; } -void Interpreter::ProcessRoute(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessRoute(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -2678,7 +2678,7 @@ exit: #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE #if OPENTHREAD_FTD -void Interpreter::ProcessRouter(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessRouter(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otRouterInfo routerInfo; @@ -2771,7 +2771,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessRouterDowngradeThreshold(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessRouterDowngradeThreshold(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -2790,7 +2790,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessRouterEligible(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessRouterEligible(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -2822,7 +2822,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessRouterSelectionJitter(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessRouterSelectionJitter(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -2842,7 +2842,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessRouterUpgradeThreshold(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessRouterUpgradeThreshold(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -2862,7 +2862,7 @@ exit: } #endif // OPENTHREAD_FTD -void Interpreter::ProcessScan(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessScan(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; uint32_t scanChannels = 0; @@ -2965,7 +2965,7 @@ exit: return; } -void Interpreter::ProcessSingleton(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessSingleton(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -2985,7 +2985,7 @@ void Interpreter::ProcessSingleton(int aArgsLength, char *aArgs[]) } #if OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE -void Interpreter::ProcessSntp(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessSntp(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long port = OT_SNTP_DEFAULT_SERVER_PORT; @@ -3058,7 +3058,7 @@ void Interpreter::HandleSntpResponse(uint64_t aTime, otError aResult) } #endif -void Interpreter::ProcessState(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessState(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -3126,7 +3126,7 @@ exit: AppendResult(error); } -void Interpreter::ProcessThread(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessThread(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -3156,14 +3156,14 @@ exit: AppendResult(error); } -void Interpreter::ProcessDataset(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessDataset(uint8_t aArgsLength, char *aArgs[]) { otError error; error = mDataset.Process(aArgsLength, aArgs); AppendResult(error); } -void Interpreter::ProcessTxPower(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessTxPower(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -3186,14 +3186,14 @@ exit: AppendResult(error); } -void Interpreter::ProcessUdp(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessUdp(uint8_t aArgsLength, char *aArgs[]) { otError error; error = mUdp.Process(aArgsLength, aArgs); AppendResult(error); } -void Interpreter::ProcessVersion(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessVersion(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -3205,7 +3205,7 @@ void Interpreter::ProcessVersion(int aArgsLength, char *aArgs[]) #if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE && OPENTHREAD_FTD -void Interpreter::ProcessCommissioner(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessCommissioner(uint8_t aArgsLength, char *aArgs[]) { otError error; error = mCommissioner.Process(aArgsLength, aArgs); @@ -3216,7 +3216,7 @@ void Interpreter::ProcessCommissioner(int aArgsLength, char *aArgs[]) #if OPENTHREAD_CONFIG_JOINER_ENABLE -void Interpreter::ProcessJoiner(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessJoiner(uint8_t aArgsLength, char *aArgs[]) { otError error; error = mJoiner.Process(aArgsLength, aArgs); @@ -3226,7 +3226,7 @@ void Interpreter::ProcessJoiner(int aArgsLength, char *aArgs[]) #endif #if OPENTHREAD_FTD -void Interpreter::ProcessJoinerPort(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessJoinerPort(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -3247,7 +3247,7 @@ exit: #endif #if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE -void Interpreter::ProcessMacFilter(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessMacFilter(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -3335,7 +3335,7 @@ void Interpreter::PrintMacFilter(void) } } -otError Interpreter::ProcessMacFilterAddress(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessMacFilterAddress(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otExtAddress extAddr; @@ -3430,7 +3430,7 @@ exit: return error; } -otError Interpreter::ProcessMacFilterRss(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessMacFilterRss(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otMacFilterEntry entry; @@ -3539,7 +3539,7 @@ exit: #endif // OPENTHREAD_CONFIG_MAC_FILTER_ENABLE -void Interpreter::ProcessMac(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessMac(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -3558,7 +3558,7 @@ exit: AppendResult(error); } -otError Interpreter::ProcessMacRetries(int aArgsLength, char *aArgs[]) +otError Interpreter::ProcessMacRetries(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -3608,7 +3608,7 @@ exit: } #if OPENTHREAD_CONFIG_DIAG_ENABLE -void Interpreter::ProcessDiag(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessDiag(uint8_t aArgsLength, char *aArgs[]) { otError error; char output[OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE]; @@ -3678,7 +3678,7 @@ exit: } #if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE -void Interpreter::ProcessNetworkDiagnostic(int aArgsLength, char *aArgs[]) +void Interpreter::ProcessNetworkDiagnostic(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; struct otIp6Address address; diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index 153589fa7..34f00f8bc 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -85,8 +85,8 @@ class Server; */ struct Command { - const char *mName; ///< A pointer to the command string. - void (Interpreter::*mCommand)(int aArgsLength, char *aArgs[]); ///< A function pointer to process the command. + const char *mName; ///< A pointer to the command string. + void (Interpreter::*mCommand)(uint8_t aArgsLength, char *aArgs[]); ///< A function pointer to process the command. }; /** @@ -200,149 +200,149 @@ private: }; otError ParsePingInterval(const char *aString, uint32_t &aInterval); - void ProcessHelp(int aArgsLength, char *aArgs[]); - void ProcessBufferInfo(int aArgsLength, char *aArgs[]); - void ProcessChannel(int aArgsLength, char *aArgs[]); + void ProcessHelp(uint8_t aArgsLength, char *aArgs[]); + void ProcessBufferInfo(uint8_t aArgsLength, char *aArgs[]); + void ProcessChannel(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_FTD - void ProcessChild(int aArgsLength, char *aArgs[]); - void ProcessChildIp(int aArgsLength, char *aArgs[]); - void ProcessChildMax(int aArgsLength, char *aArgs[]); + void ProcessChild(uint8_t aArgsLength, char *aArgs[]); + void ProcessChildIp(uint8_t aArgsLength, char *aArgs[]); + void ProcessChildMax(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessChildTimeout(int aArgsLength, char *aArgs[]); + void ProcessChildTimeout(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_COAP_API_ENABLE - void ProcessCoap(int aArgsLength, char *aArgs[]); + void ProcessCoap(uint8_t aArgsLength, char *aArgs[]); #endif // OPENTHREAD_CONFIG_COAP_API_ENABLE #if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE - void ProcessCoapSecure(int aArgsLength, char *aArgs[]); + void ProcessCoapSecure(uint8_t aArgsLength, char *aArgs[]); #endif // OPENTHREAD_CONFIG_COAP_API_ENABLE #if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE - void ProcessCoexMetrics(int aArgsLength, char *aArgs[]); + void ProcessCoexMetrics(uint8_t aArgsLength, char *aArgs[]); #endif #if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE && OPENTHREAD_FTD - void ProcessCommissioner(int aArgsLength, char *aArgs[]); + void ProcessCommissioner(uint8_t aArgsLength, char *aArgs[]); #endif #if OPENTHREAD_FTD - void ProcessContextIdReuseDelay(int aArgsLength, char *aArgs[]); + void ProcessContextIdReuseDelay(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessCounters(int aArgsLength, char *aArgs[]); + void ProcessCounters(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_FTD - void ProcessDelayTimerMin(int aArgsLength, char *aArgs[]); + void ProcessDelayTimerMin(uint8_t aArgsLength, char *aArgs[]); #endif #if OPENTHREAD_CONFIG_DIAG_ENABLE - void ProcessDiag(int aArgsLength, char *aArgs[]); + void ProcessDiag(uint8_t aArgsLength, char *aArgs[]); #endif // OPENTHREAD_CONFIG_DIAG_ENABLE - void ProcessDiscover(int aArgsLength, char *aArgs[]); + void ProcessDiscover(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE - void ProcessDns(int aArgsLength, char *aArgs[]); + void ProcessDns(uint8_t aArgsLength, char *aArgs[]); #endif #if OPENTHREAD_FTD - void ProcessEidCache(int aArgsLength, char *aArgs[]); + void ProcessEidCache(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessEui64(int aArgsLength, char *aArgs[]); + void ProcessEui64(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_POSIX - void ProcessExit(int aArgsLength, char *aArgs[]); + void ProcessExit(uint8_t aArgsLength, char *aArgs[]); #endif #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART) && OPENTHREAD_POSIX - void ProcessLogFilename(int aArgsLength, char *aArgs[]); + void ProcessLogFilename(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessExtAddress(int aArgsLength, char *aArgs[]); - void ProcessExtPanId(int aArgsLength, char *aArgs[]); - void ProcessFactoryReset(int aArgsLength, char *aArgs[]); - void ProcessIfconfig(int aArgsLength, char *aArgs[]); - void ProcessIpAddr(int aArgsLength, char *aArgs[]); - otError ProcessIpAddrAdd(int aArgsLength, char *aArgs[]); - otError ProcessIpAddrDel(int aArgsLength, char *aArgs[]); - void ProcessIpMulticastAddr(int aArgsLength, char *aArgs[]); - otError ProcessIpMulticastAddrAdd(int aArgsLength, char *aArgs[]); - otError ProcessIpMulticastAddrDel(int aArgsLength, char *aArgs[]); - otError ProcessMulticastPromiscuous(int aArgsLength, char *aArgs[]); + void ProcessExtAddress(uint8_t aArgsLength, char *aArgs[]); + void ProcessExtPanId(uint8_t aArgsLength, char *aArgs[]); + void ProcessFactoryReset(uint8_t aArgsLength, char *aArgs[]); + void ProcessIfconfig(uint8_t aArgsLength, char *aArgs[]); + void ProcessIpAddr(uint8_t aArgsLength, char *aArgs[]); + otError ProcessIpAddrAdd(uint8_t aArgsLength, char *aArgs[]); + otError ProcessIpAddrDel(uint8_t aArgsLength, char *aArgs[]); + void ProcessIpMulticastAddr(uint8_t aArgsLength, char *aArgs[]); + otError ProcessIpMulticastAddrAdd(uint8_t aArgsLength, char *aArgs[]); + otError ProcessIpMulticastAddrDel(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMulticastPromiscuous(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_JOINER_ENABLE - void ProcessJoiner(int aArgsLength, char *aArgs[]); + void ProcessJoiner(uint8_t aArgsLength, char *aArgs[]); #endif #if OPENTHREAD_FTD - void ProcessJoinerPort(int aArgsLength, char *aArgs[]); + void ProcessJoinerPort(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessKeySequence(int aArgsLength, char *aArgs[]); - void ProcessLeaderData(int aArgsLength, char *aArgs[]); + void ProcessKeySequence(uint8_t aArgsLength, char *aArgs[]); + void ProcessLeaderData(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_FTD - void ProcessLeaderPartitionId(int aArgsLength, char *aArgs[]); - void ProcessLeaderWeight(int aArgsLength, char *aArgs[]); + void ProcessLeaderPartitionId(uint8_t aArgsLength, char *aArgs[]); + void ProcessLeaderWeight(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessMasterKey(int aArgsLength, char *aArgs[]); - void ProcessMode(int aArgsLength, char *aArgs[]); + void ProcessMasterKey(uint8_t aArgsLength, char *aArgs[]); + void ProcessMode(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_FTD - void ProcessNeighbor(int aArgsLength, char *aArgs[]); + void ProcessNeighbor(uint8_t aArgsLength, char *aArgs[]); #endif #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE || OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE - void ProcessNetworkDataRegister(int aArgsLength, char *aArgs[]); + void ProcessNetworkDataRegister(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessNetworkDataShow(int aArgsLength, char *aArgs[]); + void ProcessNetworkDataShow(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE - void ProcessService(int aArgsLength, char *aArgs[]); + void ProcessService(uint8_t aArgsLength, char *aArgs[]); #endif #if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE - void ProcessNetworkDiagnostic(int aArgsLength, char *aArgs[]); + void ProcessNetworkDiagnostic(uint8_t aArgsLength, char *aArgs[]); #endif // OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE #if OPENTHREAD_FTD - void ProcessNetworkIdTimeout(int aArgsLength, char *aArgs[]); + void ProcessNetworkIdTimeout(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessNetworkName(int aArgsLength, char *aArgs[]); + void ProcessNetworkName(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE - void ProcessNetworkTime(int aArgsLength, char *aArgs[]); + void ProcessNetworkTime(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessPanId(int aArgsLength, char *aArgs[]); - void ProcessParent(int aArgsLength, char *aArgs[]); + void ProcessPanId(uint8_t aArgsLength, char *aArgs[]); + void ProcessParent(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_FTD - void ProcessParentPriority(int aArgsLength, char *aArgs[]); + void ProcessParentPriority(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessPing(int aArgsLength, char *aArgs[]); - void ProcessPollPeriod(int aArgsLength, char *aArgs[]); + void ProcessPing(uint8_t aArgsLength, char *aArgs[]); + void ProcessPollPeriod(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE - void ProcessPrefix(int aArgsLength, char *aArgs[]); - otError ProcessPrefixAdd(int aArgsLength, char *aArgs[]); - otError ProcessPrefixRemove(int aArgsLength, char *aArgs[]); + void ProcessPrefix(uint8_t aArgsLength, char *aArgs[]); + otError ProcessPrefixAdd(uint8_t aArgsLength, char *aArgs[]); + otError ProcessPrefixRemove(uint8_t aArgsLength, char *aArgs[]); otError ProcessPrefixList(void); #endif - void ProcessPromiscuous(int aArgsLength, char *aArgs[]); + void ProcessPromiscuous(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_FTD - void ProcessPreferRouterId(int aArgsLength, char *aArgs[]); - void ProcessPskc(int aArgsLength, char *aArgs[]); - void ProcessReleaseRouterId(int aArgsLength, char *aArgs[]); + void ProcessPreferRouterId(uint8_t aArgsLength, char *aArgs[]); + void ProcessPskc(uint8_t aArgsLength, char *aArgs[]); + void ProcessReleaseRouterId(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessReset(int aArgsLength, char *aArgs[]); + void ProcessReset(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE - void ProcessRoute(int aArgsLength, char *aArgs[]); - otError ProcessRouteAdd(int aArgsLength, char *aArgs[]); - otError ProcessRouteRemove(int aArgsLength, char *aArgs[]); + void ProcessRoute(uint8_t aArgsLength, char *aArgs[]); + otError ProcessRouteAdd(uint8_t aArgsLength, char *aArgs[]); + otError ProcessRouteRemove(uint8_t aArgsLength, char *aArgs[]); otError ProcessRouteList(void); #endif #if OPENTHREAD_FTD - void ProcessRouter(int aArgsLength, char *aArgs[]); - void ProcessRouterDowngradeThreshold(int aArgsLength, char *aArgs[]); - void ProcessRouterEligible(int aArgsLength, char *aArgs[]); - void ProcessRouterSelectionJitter(int aArgsLength, char *aArgs[]); - void ProcessRouterUpgradeThreshold(int aArgsLength, char *aArgs[]); + void ProcessRouter(uint8_t aArgsLength, char *aArgs[]); + void ProcessRouterDowngradeThreshold(uint8_t aArgsLength, char *aArgs[]); + void ProcessRouterEligible(uint8_t aArgsLength, char *aArgs[]); + void ProcessRouterSelectionJitter(uint8_t aArgsLength, char *aArgs[]); + void ProcessRouterUpgradeThreshold(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessRloc16(int aArgsLength, char *aArgs[]); - void ProcessScan(int aArgsLength, char *aArgs[]); - void ProcessSingleton(int aArgsLength, char *aArgs[]); + void ProcessRloc16(uint8_t aArgsLength, char *aArgs[]); + void ProcessScan(uint8_t aArgsLength, char *aArgs[]); + void ProcessSingleton(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE - void ProcessSntp(int aArgsLength, char *aArgs[]); + void ProcessSntp(uint8_t aArgsLength, char *aArgs[]); #endif - void ProcessState(int aArgsLength, char *aArgs[]); - void ProcessThread(int aArgsLength, char *aArgs[]); - void ProcessDataset(int aArgsLength, char *aArgs[]); - void ProcessTxPower(int aArgsLength, char *aArgs[]); - void ProcessUdp(int aArgsLength, char *aArgs[]); - void ProcessVersion(int aArgsLength, char *aArgs[]); + void ProcessState(uint8_t aArgsLength, char *aArgs[]); + void ProcessThread(uint8_t aArgsLength, char *aArgs[]); + void ProcessDataset(uint8_t aArgsLength, char *aArgs[]); + void ProcessTxPower(uint8_t aArgsLength, char *aArgs[]); + void ProcessUdp(uint8_t aArgsLength, char *aArgs[]); + void ProcessVersion(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE - void ProcessMacFilter(int aArgsLength, char *aArgs[]); + void ProcessMacFilter(uint8_t aArgsLength, char *aArgs[]); void PrintMacFilter(void); - otError ProcessMacFilterAddress(int aArgsLength, char *aArgs[]); - otError ProcessMacFilterRss(int aArgsLength, char *aArgs[]); + otError ProcessMacFilterAddress(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMacFilterRss(uint8_t aArgsLength, char *aArgs[]); #endif // OPENTHREAD_CONFIG_MAC_FILTER_ENABLE - void ProcessMac(int aArgsLength, char *aArgs[]); - otError ProcessMacRetries(int aArgsLength, char *aArgs[]); + void ProcessMac(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMacRetries(uint8_t aArgsLength, char *aArgs[]); static void HandleIcmpReceive(void * aContext, otMessage * aMessage, diff --git a/src/cli/cli_coap.cpp b/src/cli/cli_coap.cpp index 5b0e8863b..33830d579 100644 --- a/src/cli/cli_coap.cpp +++ b/src/cli/cli_coap.cpp @@ -158,7 +158,7 @@ void Coap::PrintPayload(otMessage *aMessage) const } #if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE -otError Coap::ProcessCancel(int aArgsLength, char *aArgs[]) +otError Coap::ProcessCancel(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -167,7 +167,7 @@ otError Coap::ProcessCancel(int aArgsLength, char *aArgs[]) } #endif -otError Coap::ProcessHelp(int aArgsLength, char *aArgs[]) +otError Coap::ProcessHelp(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -180,7 +180,7 @@ otError Coap::ProcessHelp(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError Coap::ProcessResource(int aArgsLength, char *aArgs[]) +otError Coap::ProcessResource(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -204,7 +204,7 @@ exit: return OT_ERROR_NONE; } -otError Coap::ProcessSet(int aArgsLength, char *aArgs[]) +otError Coap::ProcessSet(uint8_t aArgsLength, char *aArgs[]) { #if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE otMessage * notificationMessage = NULL; @@ -265,7 +265,7 @@ exit: return error; } -otError Coap::ProcessStart(int aArgsLength, char *aArgs[]) +otError Coap::ProcessStart(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -273,7 +273,7 @@ otError Coap::ProcessStart(int aArgsLength, char *aArgs[]) return otCoapStart(mInterpreter.mInstance, OT_DEFAULT_COAP_PORT); } -otError Coap::ProcessStop(int aArgsLength, char *aArgs[]) +otError Coap::ProcessStop(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -283,7 +283,7 @@ otError Coap::ProcessStop(int aArgsLength, char *aArgs[]) return otCoapStop(mInterpreter.mInstance); } -otError Coap::ProcessParameters(int aArgsLength, char *aArgs[]) +otError Coap::ProcessParameters(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; bool * defaultTxParameters; @@ -356,7 +356,7 @@ exit: return error; } -otError Coap::ProcessRequest(int aArgsLength, char *aArgs[]) +otError Coap::ProcessRequest(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otMessage * message = NULL; @@ -510,7 +510,7 @@ exit: return error; } -otError Coap::Process(int aArgsLength, char *aArgs[]) +otError Coap::Process(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_INVALID_COMMAND; diff --git a/src/cli/cli_coap.hpp b/src/cli/cli_coap.hpp index 88afe839e..e9b39acfa 100644 --- a/src/cli/cli_coap.hpp +++ b/src/cli/cli_coap.hpp @@ -67,7 +67,7 @@ public: * @param[in] aArgs An array of command line arguments. * */ - otError Process(int aArgsLength, char *aArgs[]); + otError Process(uint8_t aArgsLength, char *aArgs[]); private: enum @@ -79,7 +79,7 @@ private: struct Command { const char *mName; - otError (Coap::*mCommand)(int aArgsLength, char *aArgs[]); + otError (Coap::*mCommand)(uint8_t aArgsLength, char *aArgs[]); }; #if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE @@ -89,16 +89,16 @@ private: void PrintPayload(otMessage *aMessage) const; - otError ProcessHelp(int aArgsLength, char *aArgs[]); + otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]); #if OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE - otError ProcessCancel(int aArgsLength, char *aArgs[]); + otError ProcessCancel(uint8_t aArgsLength, char *aArgs[]); #endif - otError ProcessParameters(int aArgsLength, char *aArgs[]); - otError ProcessRequest(int aArgsLength, char *aArgs[]); - otError ProcessResource(int aArgsLength, char *aArgs[]); - otError ProcessSet(int aArgsLength, char *aArgs[]); - otError ProcessStart(int aArgsLength, char *aArgs[]); - otError ProcessStop(int aArgsLength, char *aArgs[]); + otError ProcessParameters(uint8_t aArgsLength, char *aArgs[]); + otError ProcessRequest(uint8_t aArgsLength, char *aArgs[]); + otError ProcessResource(uint8_t aArgsLength, char *aArgs[]); + otError ProcessSet(uint8_t aArgsLength, char *aArgs[]); + otError ProcessStart(uint8_t aArgsLength, char *aArgs[]); + otError ProcessStop(uint8_t aArgsLength, char *aArgs[]); static void HandleRequest(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo); void HandleRequest(otMessage *aMessage, const otMessageInfo *aMessageInfo); diff --git a/src/cli/cli_coap_secure.cpp b/src/cli/cli_coap_secure.cpp index d8e2c2d4a..17cf24b23 100644 --- a/src/cli/cli_coap_secure.cpp +++ b/src/cli/cli_coap_secure.cpp @@ -98,7 +98,7 @@ void CoapSecure::PrintPayload(otMessage *aMessage) const mInterpreter.mServer->OutputFormat("\r\n"); } -otError CoapSecure::ProcessHelp(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessHelp(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -111,7 +111,7 @@ otError CoapSecure::ProcessHelp(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError CoapSecure::ProcessResource(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessResource(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -135,7 +135,7 @@ exit: return OT_ERROR_NONE; } -otError CoapSecure::ProcessStart(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessStart(uint8_t aArgsLength, char *aArgs[]) { otError error; bool verifyPeerCert = true; @@ -165,7 +165,7 @@ exit: return error; } -otError CoapSecure::ProcessStop(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessStop(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -185,7 +185,7 @@ otError CoapSecure::ProcessStop(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError CoapSecure::ProcessRequest(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessRequest(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otMessage * message = NULL; @@ -305,7 +305,7 @@ exit: return error; } -otError CoapSecure::ProcessConnect(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessConnect(uint8_t aArgsLength, char *aArgs[]) { otError error; otSockAddr sockaddr; @@ -333,7 +333,7 @@ exit: return error; } -otError CoapSecure::ProcessDisconnect(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessDisconnect(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -344,7 +344,7 @@ otError CoapSecure::ProcessDisconnect(int aArgsLength, char *aArgs[]) } #ifdef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED -otError CoapSecure::ProcessPsk(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessPsk(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; size_t length; @@ -370,7 +370,7 @@ exit: #endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED #ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -otError CoapSecure::ProcessX509(int aArgsLength, char *aArgs[]) +otError CoapSecure::ProcessX509(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -387,7 +387,7 @@ otError CoapSecure::ProcessX509(int aArgsLength, char *aArgs[]) } #endif -otError CoapSecure::Process(int aArgsLength, char *aArgs[]) +otError CoapSecure::Process(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_INVALID_COMMAND; diff --git a/src/cli/cli_coap_secure.hpp b/src/cli/cli_coap_secure.hpp index e68a9799a..660c79f21 100644 --- a/src/cli/cli_coap_secure.hpp +++ b/src/cli/cli_coap_secure.hpp @@ -72,7 +72,7 @@ public: * @param[in] aArgs An array of command line arguments. * */ - otError Process(int aArgsLength, char *aArgs[]); + otError Process(uint8_t aArgsLength, char *aArgs[]); private: enum @@ -86,20 +86,20 @@ private: struct Command { const char *mName; - otError (CoapSecure::*mCommand)(int aArgsLength, char *aArgs[]); + otError (CoapSecure::*mCommand)(uint8_t aArgsLength, char *aArgs[]); }; void PrintPayload(otMessage *aMessage) const; - otError ProcessHelp(int aArgsLength, char *aArgs[]); - otError ProcessConnect(int aArgsLength, char *aArgs[]); - otError ProcessDisconnect(int aArgsLength, char *aArgs[]); - otError ProcessPsk(int aArgsLength, char *aArgs[]); - otError ProcessRequest(int aArgsLength, char *aArgs[]); - otError ProcessResource(int aArgsLength, char *aArgs[]); - otError ProcessStart(int aArgsLength, char *aArgs[]); - otError ProcessStop(int aArgsLength, char *aArgs[]); - otError ProcessX509(int aArgsLength, char *aArgs[]); + otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]); + otError ProcessConnect(uint8_t aArgsLength, char *aArgs[]); + otError ProcessDisconnect(uint8_t aArgsLength, char *aArgs[]); + otError ProcessPsk(uint8_t aArgsLength, char *aArgs[]); + otError ProcessRequest(uint8_t aArgsLength, char *aArgs[]); + otError ProcessResource(uint8_t aArgsLength, char *aArgs[]); + otError ProcessStart(uint8_t aArgsLength, char *aArgs[]); + otError ProcessStop(uint8_t aArgsLength, char *aArgs[]); + otError ProcessX509(uint8_t aArgsLength, char *aArgs[]); void Stop(void); diff --git a/src/cli/cli_commissioner.cpp b/src/cli/cli_commissioner.cpp index c0648830b..065c62066 100644 --- a/src/cli/cli_commissioner.cpp +++ b/src/cli/cli_commissioner.cpp @@ -50,7 +50,7 @@ const struct Commissioner::Command Commissioner::sCommands[] = { {"stop", &Commissioner::ProcessStop}, }; -otError Commissioner::ProcessHelp(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessHelp(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -63,7 +63,7 @@ otError Commissioner::ProcessHelp(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError Commissioner::ProcessAnnounce(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessAnnounce(uint8_t aArgsLength, char *aArgs[]) { otError error; long mask; @@ -86,7 +86,7 @@ exit: return error; } -otError Commissioner::ProcessEnergy(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessEnergy(uint8_t aArgsLength, char *aArgs[]) { otError error; long mask; @@ -112,7 +112,7 @@ exit: return error; } -otError Commissioner::ProcessJoiner(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessJoiner(uint8_t aArgsLength, char *aArgs[]) { otError error; otExtAddress addr; @@ -158,7 +158,7 @@ exit: return error; } -otError Commissioner::ProcessMgmtGet(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessMgmtGet(uint8_t aArgsLength, char *aArgs[]) { otError error; uint8_t tlvs[32]; @@ -207,7 +207,7 @@ exit: return error; } -otError Commissioner::ProcessMgmtSet(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessMgmtSet(uint8_t aArgsLength, char *aArgs[]) { otError error; otCommissioningDataset dataset; @@ -277,7 +277,7 @@ exit: return error; } -otError Commissioner::ProcessPanId(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessPanId(uint8_t aArgsLength, char *aArgs[]) { otError error; long panid; @@ -298,12 +298,12 @@ exit: return error; } -otError Commissioner::ProcessProvisioningUrl(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessProvisioningUrl(uint8_t aArgsLength, char *aArgs[]) { return otCommissionerSetProvisioningUrl(mInterpreter.mInstance, (aArgsLength > 1) ? aArgs[1] : NULL); } -otError Commissioner::ProcessSessionId(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessSessionId(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -313,7 +313,7 @@ otError Commissioner::ProcessSessionId(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError Commissioner::ProcessStart(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessStart(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -378,7 +378,7 @@ void Commissioner::HandleJoinerEvent(otCommissionerJoinerEvent aEvent, const otE mInterpreter.mServer->OutputFormat("\r\n"); } -otError Commissioner::ProcessStop(int aArgsLength, char *aArgs[]) +otError Commissioner::ProcessStop(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -386,7 +386,7 @@ otError Commissioner::ProcessStop(int aArgsLength, char *aArgs[]) return otCommissionerStop(mInterpreter.mInstance); } -otError Commissioner::Process(int aArgsLength, char *aArgs[]) +otError Commissioner::Process(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_INVALID_COMMAND; diff --git a/src/cli/cli_commissioner.hpp b/src/cli/cli_commissioner.hpp index 54d9ce7c3..92ff28236 100644 --- a/src/cli/cli_commissioner.hpp +++ b/src/cli/cli_commissioner.hpp @@ -70,7 +70,7 @@ public: * @param[in] aArgs An array of command line arguments. * */ - otError Process(int aArgsLength, char *aArgs[]); + otError Process(uint8_t aArgsLength, char *aArgs[]); private: enum @@ -81,20 +81,20 @@ private: struct Command { const char *mName; - otError (Commissioner::*mCommand)(int aArgsLength, char *aArgs[]); + otError (Commissioner::*mCommand)(uint8_t aArgsLength, char *aArgs[]); }; - otError ProcessHelp(int aArgsLength, char *aArgs[]); - otError ProcessAnnounce(int aArgsLength, char *aArgs[]); - otError ProcessEnergy(int aArgsLength, char *aArgs[]); - otError ProcessJoiner(int aArgsLength, char *aArgs[]); - otError ProcessMgmtGet(int aArgsLength, char *aArgs[]); - otError ProcessMgmtSet(int aArgsLength, char *aArgs[]); - otError ProcessPanId(int aArgsLength, char *aArgs[]); - otError ProcessProvisioningUrl(int aArgsLength, char *aArgs[]); - otError ProcessSessionId(int aArgsLength, char *aArgs[]); - otError ProcessStart(int aArgsLength, char *aArgs[]); - otError ProcessStop(int aArgsLength, char *aArgs[]); + otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]); + otError ProcessAnnounce(uint8_t aArgsLength, char *aArgs[]); + otError ProcessEnergy(uint8_t aArgsLength, char *aArgs[]); + otError ProcessJoiner(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMgmtGet(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMgmtSet(uint8_t aArgsLength, char *aArgs[]); + otError ProcessPanId(uint8_t aArgsLength, char *aArgs[]); + otError ProcessProvisioningUrl(uint8_t aArgsLength, char *aArgs[]); + otError ProcessSessionId(uint8_t aArgsLength, char *aArgs[]); + otError ProcessStart(uint8_t aArgsLength, char *aArgs[]); + otError ProcessStop(uint8_t aArgsLength, char *aArgs[]); static void HandleStateChanged(otCommissionerState aState, void *aContext); void HandleStateChanged(otCommissionerState aState); diff --git a/src/cli/cli_dataset.cpp b/src/cli/cli_dataset.cpp index 6bf995b2a..35614280c 100644 --- a/src/cli/cli_dataset.cpp +++ b/src/cli/cli_dataset.cpp @@ -182,7 +182,7 @@ otError Dataset::Print(otOperationalDataset &aDataset) return OT_ERROR_NONE; } -otError Dataset::Process(int aArgsLength, char *aArgs[]) +otError Dataset::Process(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_INVALID_COMMAND; @@ -204,7 +204,7 @@ exit: return error; } -otError Dataset::ProcessHelp(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessHelp(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -217,7 +217,7 @@ otError Dataset::ProcessHelp(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError Dataset::ProcessInit(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessInit(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -246,7 +246,7 @@ exit: return error; } -otError Dataset::ProcessActive(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessActive(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -261,7 +261,7 @@ exit: return error; } -otError Dataset::ProcessPending(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessPending(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -276,7 +276,7 @@ exit: return error; } -otError Dataset::ProcessActiveTimestamp(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessActiveTimestamp(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -290,7 +290,7 @@ exit: return error; } -otError Dataset::ProcessChannel(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessChannel(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -304,7 +304,7 @@ exit: return error; } -otError Dataset::ProcessChannelMask(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessChannelMask(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -318,7 +318,7 @@ exit: return error; } -otError Dataset::ProcessClear(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessClear(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -327,7 +327,7 @@ otError Dataset::ProcessClear(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError Dataset::ProcessCommit(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessCommit(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; @@ -350,7 +350,7 @@ exit: return error; } -otError Dataset::ProcessDelay(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessDelay(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -364,7 +364,7 @@ exit: return error; } -otError Dataset::ProcessExtPanId(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessExtPanId(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; uint8_t extPanId[OT_EXT_PAN_ID_SIZE]; @@ -379,7 +379,7 @@ exit: return error; } -otError Dataset::ProcessMasterKey(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessMasterKey(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; uint8_t key[OT_MASTER_KEY_SIZE]; @@ -395,7 +395,7 @@ exit: return error; } -otError Dataset::ProcessMeshLocalPrefix(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessMeshLocalPrefix(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otIp6Address prefix; @@ -410,7 +410,7 @@ exit: return error; } -otError Dataset::ProcessNetworkName(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessNetworkName(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; size_t length; @@ -426,7 +426,7 @@ exit: return error; } -otError Dataset::ProcessPanId(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessPanId(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -440,7 +440,7 @@ exit: return error; } -otError Dataset::ProcessPendingTimestamp(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessPendingTimestamp(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; @@ -454,7 +454,7 @@ exit: return error; } -otError Dataset::ProcessMgmtSetCommand(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessMgmtSetCommand(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otOperationalDataset dataset; @@ -578,7 +578,7 @@ exit: return error; } -otError Dataset::ProcessMgmtGetCommand(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessMgmtGetCommand(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otOperationalDatasetComponents datasetComponents; @@ -675,7 +675,7 @@ exit: return error; } -otError Dataset::ProcessPskc(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessPskc(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; uint16_t length; @@ -692,7 +692,7 @@ exit: return error; } -otError Dataset::ProcessSecurityPolicy(int aArgsLength, char *aArgs[]) +otError Dataset::ProcessSecurityPolicy(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; long value; diff --git a/src/cli/cli_dataset.hpp b/src/cli/cli_dataset.hpp index 1c9fdc426..80f23da1e 100644 --- a/src/cli/cli_dataset.hpp +++ b/src/cli/cli_dataset.hpp @@ -64,38 +64,38 @@ public: * @param[in] aArgs An array of command line arguments. * */ - otError Process(int aArgsLength, char *aArgs[]); + otError Process(uint8_t aArgsLength, char *aArgs[]); private: struct Command { const char *mName; - otError (Dataset::*mCommand)(int aArgsLength, char *aArgs[]); + otError (Dataset::*mCommand)(uint8_t aArgsLength, char *aArgs[]); }; void OutputBytes(const uint8_t *aBytes, uint8_t aLength); otError Print(otOperationalDataset &aDataset); - otError ProcessHelp(int aArgsLength, char *aArgs[]); - otError ProcessActive(int aArgsLength, char *aArgs[]); - otError ProcessActiveTimestamp(int aArgsLength, char *aArgs[]); - otError ProcessChannel(int aArgsLength, char *aArgs[]); - otError ProcessChannelMask(int aArgsLength, char *aArgs[]); - otError ProcessClear(int aArgsLength, char *aArgs[]); - otError ProcessCommit(int aArgsLength, char *aArgs[]); - otError ProcessDelay(int aArgsLength, char *aArgs[]); - otError ProcessExtPanId(int aArgsLength, char *aArgs[]); - otError ProcessInit(int aArgsLength, char *aArgs[]); - otError ProcessMasterKey(int aArgsLength, char *aArgs[]); - otError ProcessMeshLocalPrefix(int aArgsLength, char *aArgs[]); - otError ProcessNetworkName(int aArgsLength, char *aArgs[]); - otError ProcessPanId(int aArgsLength, char *aArgs[]); - otError ProcessPending(int aArgsLength, char *aArgs[]); - otError ProcessPendingTimestamp(int aArgsLength, char *aArgs[]); - otError ProcessMgmtSetCommand(int aArgsLength, char *aArgs[]); - otError ProcessMgmtGetCommand(int aArgsLength, char *aArgs[]); - otError ProcessPskc(int aArgsLength, char *aArgs[]); - otError ProcessSecurityPolicy(int aArgsLength, char *aArgs[]); + otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]); + otError ProcessActive(uint8_t aArgsLength, char *aArgs[]); + otError ProcessActiveTimestamp(uint8_t aArgsLength, char *aArgs[]); + otError ProcessChannel(uint8_t aArgsLength, char *aArgs[]); + otError ProcessChannelMask(uint8_t aArgsLength, char *aArgs[]); + otError ProcessClear(uint8_t aArgsLength, char *aArgs[]); + otError ProcessCommit(uint8_t aArgsLength, char *aArgs[]); + otError ProcessDelay(uint8_t aArgsLength, char *aArgs[]); + otError ProcessExtPanId(uint8_t aArgsLength, char *aArgs[]); + otError ProcessInit(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMasterKey(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMeshLocalPrefix(uint8_t aArgsLength, char *aArgs[]); + otError ProcessNetworkName(uint8_t aArgsLength, char *aArgs[]); + otError ProcessPanId(uint8_t aArgsLength, char *aArgs[]); + otError ProcessPending(uint8_t aArgsLength, char *aArgs[]); + otError ProcessPendingTimestamp(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMgmtSetCommand(uint8_t aArgsLength, char *aArgs[]); + otError ProcessMgmtGetCommand(uint8_t aArgsLength, char *aArgs[]); + otError ProcessPskc(uint8_t aArgsLength, char *aArgs[]); + otError ProcessSecurityPolicy(uint8_t aArgsLength, char *aArgs[]); Interpreter &mInterpreter; diff --git a/src/cli/cli_joiner.cpp b/src/cli/cli_joiner.cpp index 5fe79cc45..ff6e52b8f 100644 --- a/src/cli/cli_joiner.cpp +++ b/src/cli/cli_joiner.cpp @@ -48,7 +48,7 @@ const struct Joiner::Command Joiner::sCommands[] = { {"stop", &Joiner::ProcessStop}, }; -otError Joiner::ProcessHelp(int aArgsLength, char *aArgs[]) +otError Joiner::ProcessHelp(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -61,7 +61,7 @@ otError Joiner::ProcessHelp(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError Joiner::ProcessId(int aArgsLength, char *aArgs[]) +otError Joiner::ProcessId(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -76,7 +76,7 @@ otError Joiner::ProcessId(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError Joiner::ProcessStart(int aArgsLength, char *aArgs[]) +otError Joiner::ProcessStart(uint8_t aArgsLength, char *aArgs[]) { otError error; const char *provisioningUrl = NULL; @@ -95,7 +95,7 @@ exit: return error; } -otError Joiner::ProcessStop(int aArgsLength, char *aArgs[]) +otError Joiner::ProcessStop(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -105,7 +105,7 @@ otError Joiner::ProcessStop(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError Joiner::Process(int aArgsLength, char *aArgs[]) +otError Joiner::Process(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_INVALID_COMMAND; diff --git a/src/cli/cli_joiner.hpp b/src/cli/cli_joiner.hpp index 2ffdc403d..802de29bb 100644 --- a/src/cli/cli_joiner.hpp +++ b/src/cli/cli_joiner.hpp @@ -70,19 +70,19 @@ public: * @param[in] aArgs A pointer to an array of command line arguments. * */ - otError Process(int aArgsLength, char *aArgs[]); + otError Process(uint8_t aArgsLength, char *aArgs[]); private: struct Command { const char *mName; - otError (Joiner::*mCommand)(int aArgsLength, char *aArgs[]); + otError (Joiner::*mCommand)(uint8_t aArgsLength, char *aArgs[]); }; - otError ProcessHelp(int aArgsLength, char *aArgs[]); - otError ProcessId(int aArgsLength, char *aArgs[]); - otError ProcessStart(int aArgsLength, char *aArgs[]); - otError ProcessStop(int aArgsLength, char *aArgs[]); + otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]); + otError ProcessId(uint8_t aArgsLength, char *aArgs[]); + otError ProcessStart(uint8_t aArgsLength, char *aArgs[]); + otError ProcessStop(uint8_t aArgsLength, char *aArgs[]); static void HandleCallback(otError aError, void *aContext); void HandleCallback(otError aError); diff --git a/src/cli/cli_udp.cpp b/src/cli/cli_udp.cpp index f121a1dea..fb20b3efd 100644 --- a/src/cli/cli_udp.cpp +++ b/src/cli/cli_udp.cpp @@ -55,7 +55,7 @@ UdpExample::UdpExample(Interpreter &aInterpreter) memset(&mSocket, 0, sizeof(mSocket)); } -otError UdpExample::ProcessHelp(int aArgsLength, char *aArgs[]) +otError UdpExample::ProcessHelp(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -68,7 +68,7 @@ otError UdpExample::ProcessHelp(int aArgsLength, char *aArgs[]) return OT_ERROR_NONE; } -otError UdpExample::ProcessBind(int aArgsLength, char *aArgs[]) +otError UdpExample::ProcessBind(uint8_t aArgsLength, char *aArgs[]) { otError error; otSockAddr sockaddr; @@ -92,7 +92,7 @@ exit: return error; } -otError UdpExample::ProcessConnect(int aArgsLength, char *aArgs[]) +otError UdpExample::ProcessConnect(uint8_t aArgsLength, char *aArgs[]) { otError error; otSockAddr sockaddr; @@ -116,7 +116,7 @@ exit: return error; } -otError UdpExample::ProcessClose(int aArgsLength, char *aArgs[]) +otError UdpExample::ProcessClose(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -124,7 +124,7 @@ otError UdpExample::ProcessClose(int aArgsLength, char *aArgs[]) return otUdpClose(&mSocket); } -otError UdpExample::ProcessOpen(int aArgsLength, char *aArgs[]) +otError UdpExample::ProcessOpen(uint8_t aArgsLength, char *aArgs[]) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -132,12 +132,12 @@ otError UdpExample::ProcessOpen(int aArgsLength, char *aArgs[]) return otUdpOpen(mInterpreter.mInstance, &mSocket, HandleUdpReceive, this); } -otError UdpExample::ProcessSend(int aArgsLength, char *aArgs[]) +otError UdpExample::ProcessSend(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_NONE; otMessageInfo messageInfo; otMessage * message = NULL; - int curArg = 0; + uint8_t curArg = 0; uint16_t payloadLength = 0; PayloadType payloadType = kTypeText; @@ -159,7 +159,7 @@ otError UdpExample::ProcessSend(int aArgsLength, char *aArgs[]) if (aArgsLength == 2 || aArgsLength == 4) { - int typePos = curArg++; + uint8_t typePos = curArg++; if (strcmp(aArgs[typePos], "-s") == 0) { @@ -258,7 +258,7 @@ exit: return error; } -otError UdpExample::Process(int aArgsLength, char *aArgs[]) +otError UdpExample::Process(uint8_t aArgsLength, char *aArgs[]) { otError error = OT_ERROR_INVALID_COMMAND; diff --git a/src/cli/cli_udp.hpp b/src/cli/cli_udp.hpp index f94d8e2a7..201b10cee 100644 --- a/src/cli/cli_udp.hpp +++ b/src/cli/cli_udp.hpp @@ -65,13 +65,13 @@ public: * @param[in] aArgs An array of command line arguments. * */ - otError Process(int aArgsLength, char *aArgs[]); + otError Process(uint8_t aArgsLength, char *aArgs[]); private: struct Command { const char *mName; - otError (UdpExample::*mCommand)(int aArgsLength, char *aArgs[]); + otError (UdpExample::*mCommand)(uint8_t aArgsLength, char *aArgs[]); }; enum PayloadType @@ -81,12 +81,12 @@ private: kTypeHexString = 2, }; - otError ProcessHelp(int aArgsLength, char *aArgs[]); - otError ProcessBind(int aArgsLength, char *aArgs[]); - otError ProcessClose(int aArgsLength, char *aArgs[]); - otError ProcessConnect(int aArgsLength, char *aArgs[]); - otError ProcessOpen(int aArgsLength, char *aArgs[]); - otError ProcessSend(int aArgsLength, char *aArgs[]); + otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]); + otError ProcessBind(uint8_t aArgsLength, char *aArgs[]); + otError ProcessClose(uint8_t aArgsLength, char *aArgs[]); + otError ProcessConnect(uint8_t aArgsLength, char *aArgs[]); + otError ProcessOpen(uint8_t aArgsLength, char *aArgs[]); + otError ProcessSend(uint8_t aArgsLength, char *aArgs[]); otError WriteCharToBuffer(otMessage *aMessage, uint16_t aSize); static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo); diff --git a/src/core/api/diags_api.cpp b/src/core/api/diags_api.cpp index 66fe3778e..77f8a898e 100644 --- a/src/core/api/diags_api.cpp +++ b/src/core/api/diags_api.cpp @@ -49,7 +49,7 @@ void otDiagProcessCmdLine(otInstance *aInstance, const char *aString, char *aOut instance.Get().ProcessLine(aString, aOutput, aOutputMaxLen); } -otError otDiagProcessCmd(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError otDiagProcessCmd(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { Instance &instance = *static_cast(aInstance); diff --git a/src/core/diags/factory_diags.cpp b/src/core/diags/factory_diags.cpp index 988f29b4c..00fd28cd9 100644 --- a/src/core/diags/factory_diags.cpp +++ b/src/core/diags/factory_diags.cpp @@ -46,7 +46,11 @@ #include "utils/parse_cmdline.hpp" OT_TOOL_WEAK -otError otPlatDiagProcess(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError otPlatDiagProcess(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -75,7 +79,7 @@ Diags::Diags(Instance &aInstance) { } -otError Diags::ProcessChannel(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessChannel(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_NONE; long value; @@ -92,7 +96,7 @@ exit: return error; } -otError Diags::ProcessPower(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessPower(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_NONE; long value; @@ -108,7 +112,7 @@ exit: return error; } -otError Diags::ProcessStart(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessStart(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -120,7 +124,7 @@ otError Diags::ProcessStart(int aArgsLength, char *aArgs[], char *aOutput, size_ return OT_ERROR_NONE; } -otError Diags::ProcessStop(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessStop(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -161,7 +165,7 @@ Diags::Diags(Instance &aInstance) otPlatDiagTxPowerSet(mTxPower); } -otError Diags::ProcessChannel(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessChannel(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_NONE; @@ -190,7 +194,7 @@ exit: return error; } -otError Diags::ProcessPower(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessPower(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_NONE; @@ -218,7 +222,7 @@ exit: return error; } -otError Diags::ProcessRepeat(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessRepeat(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_NONE; @@ -256,7 +260,7 @@ exit: return error; } -otError Diags::ProcessSend(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessSend(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_NONE; long value; @@ -280,7 +284,7 @@ exit: return error; } -otError Diags::ProcessStart(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessStart(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -301,7 +305,7 @@ exit: return error; } -otError Diags::ProcessStats(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessStats(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_NONE; @@ -329,7 +333,7 @@ exit: return error; } -otError Diags::ProcessStop(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessStop(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aArgsLength); OT_UNUSED_VARIABLE(aArgs); @@ -369,7 +373,7 @@ void Diags::TransmitPacket(void) Get().Transmit(*static_cast(mTxPacket)); } -otError Diags::ProcessRadio(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessRadio(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_INVALID_ARGS; @@ -549,7 +553,7 @@ exit: } } -otError Diags::ProcessCmd(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError Diags::ProcessCmd(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { otError error = OT_ERROR_NONE; diff --git a/src/core/diags/factory_diags.hpp b/src/core/diags/factory_diags.hpp index 90209f345..45a1b83e7 100644 --- a/src/core/diags/factory_diags.hpp +++ b/src/core/diags/factory_diags.hpp @@ -81,7 +81,7 @@ public: * @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported. * */ - otError ProcessCmd(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessCmd(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); /** * This method indicates whether or not the factory diagnostics mode is enabled. @@ -123,7 +123,7 @@ private: struct Command { const char *mName; - otError (Diags::*mCommand)(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError (Diags::*mCommand)(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); }; struct Stats @@ -138,14 +138,14 @@ private: uint8_t mLastLqi; }; - otError ProcessChannel(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); - otError ProcessPower(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); - otError ProcessRadio(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); - otError ProcessRepeat(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); - otError ProcessSend(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); - otError ProcessStart(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); - otError ProcessStats(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); - otError ProcessStop(int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessChannel(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessPower(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessRadio(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessRepeat(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessSend(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessStart(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessStats(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); + otError ProcessStop(uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen); void TransmitPacket(void); diff --git a/src/posix/platform/radio_spinel.cpp b/src/posix/platform/radio_spinel.cpp index bda0afe1c..63ce01e64 100644 --- a/src/posix/platform/radio_spinel.cpp +++ b/src/posix/platform/radio_spinel.cpp @@ -1889,15 +1889,20 @@ void virtualTimeRadioSpinelProcess(otInstance *aInstance, const struct Event *aE #endif // OPENTHREAD_POSIX_VIRTUAL_TIME #if OPENTHREAD_CONFIG_DIAG_ENABLE -otError otPlatDiagProcess(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError otPlatDiagProcess(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen) { // deliver the platform specific diags commands to radio only ncp. OT_UNUSED_VARIABLE(aInstance); + char cmd[OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE] = {'\0'}; char *cur = cmd; char *end = cmd + sizeof(cmd); - for (int index = 0; index < aArgsLength; index++) + for (uint8_t index = 0; index < aArgsLength; index++) { cur += snprintf(cur, static_cast(end - cur), "%s ", aArgs[index]); } diff --git a/tests/fuzz/fuzzer_platform.cpp b/tests/fuzz/fuzzer_platform.cpp index dcb3a195d..1e29011c2 100644 --- a/tests/fuzz/fuzzer_platform.cpp +++ b/tests/fuzz/fuzzer_platform.cpp @@ -194,7 +194,7 @@ bool otDiagIsEnabled(otInstance *aInstance) return false; } -otError otDiagProcessCmd(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError otDiagProcessCmd(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); OT_UNUSED_VARIABLE(aArgsLength); @@ -512,7 +512,11 @@ otError otPlatUartFlush(void) return OT_ERROR_NOT_IMPLEMENTED; } -otError otPlatDiagProcess(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +otError otPlatDiagProcess(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); OT_UNUSED_VARIABLE(aArgsLength); diff --git a/tests/unit/test_platform.cpp b/tests/unit/test_platform.cpp index 087abff94..5beb3163a 100644 --- a/tests/unit/test_platform.cpp +++ b/tests/unit/test_platform.cpp @@ -425,7 +425,7 @@ exit: // Diag // -void otPlatDiagProcess(otInstance *aInstance, int aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) +void otPlatDiagProcess(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen) { OT_UNUSED_VARIABLE(aInstance); OT_UNUSED_VARIABLE(aArgsLength);