From bdc73dc193654fed93d91db0a017f052808e03d9 Mon Sep 17 00:00:00 2001 From: Biswajit <37125570+bisdash@users.noreply.github.com> Date: Mon, 4 Jun 2018 09:28:13 -0700 Subject: [PATCH] [diags] make diag output & cmd line buffer params configurable (#2728) --- src/core/openthread-core-default-config.h | 30 +++++++++++++++++++++++ src/diag/diag_process.hpp | 2 +- src/diag/openthread-diag.cpp | 4 +-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/core/openthread-core-default-config.h b/src/core/openthread-core-default-config.h index 4970f374b..07a893d99 100644 --- a/src/core/openthread-core-default-config.h +++ b/src/core/openthread-core-default-config.h @@ -1602,4 +1602,34 @@ #define OPENTHREAD_CONFIG_DISABLE_CCA_ON_LAST_ATTEMPT 0 #endif +/** + * @def OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE + * + * Define OpenThread diagnostic mode output buffer size in bytes + * + */ +#ifndef OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE +#define OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE 256 +#endif + +/** + * @def OPENTHREAD_CONFIG_DIAG_CMD_LINE_ARGS_MAX + * + * Define OpenThread diagnostic mode max command line arguments. + * + */ +#ifndef OPENTHREAD_CONFIG_DIAG_CMD_LINE_ARGS_MAX +#define OPENTHREAD_CONFIG_DIAG_CMD_LINE_ARGS_MAX 32 +#endif + +/** + * @def OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE + * + * Define OpenThread diagnostic mode command line buffer size in bytes. + * + */ +#ifndef OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE +#define OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE 256 +#endif + #endif // OPENTHREAD_CORE_DEFAULT_CONFIG_H_ diff --git a/src/diag/diag_process.hpp b/src/diag/diag_process.hpp index cf7d671cd..361c5f7d9 100644 --- a/src/diag/diag_process.hpp +++ b/src/diag/diag_process.hpp @@ -62,7 +62,7 @@ private: enum { - kMaxOutputSize = 256, + kMaxOutputSize = OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE, }; struct DiagStats diff --git a/src/diag/openthread-diag.cpp b/src/diag/openthread-diag.cpp index 741d86b5c..3f4350ac6 100644 --- a/src/diag/openthread-diag.cpp +++ b/src/diag/openthread-diag.cpp @@ -68,8 +68,8 @@ const char *otDiagProcessCmdLine(const char *aInput) { enum { - kMaxArgs = 32, - kMaxCommandBuffer = 256, + kMaxArgs = OPENTHREAD_CONFIG_DIAG_CMD_LINE_ARGS_MAX, + kMaxCommandBuffer = OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE, }; otError error = OT_ERROR_NONE;