• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2019, The OpenThread Authors.
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /**
30  * @file
31  *   This file includes compile-time configurations for the CLI service.
32  *
33  */
34 
35 #ifndef CONFIG_CLI_H_
36 #define CONFIG_CLI_H_
37 
38 #include "openthread-core-config.h"
39 
40 #include <openthread/tcp.h>
41 
42 #ifndef OPENTHREAD_POSIX
43 #if defined(__ANDROID__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__) || defined(__NetBSD__) || \
44     defined(__unix__)
45 #define OPENTHREAD_POSIX 1
46 #else
47 #define OPENTHREAD_POSIX 0
48 #endif
49 #endif
50 
51 /**
52  * @def OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
53  *
54  * The maximum size of the CLI line in bytes including the null terminator.
55  *
56  */
57 #ifndef OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
58 #define OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH 384
59 #endif
60 
61 /**
62  * @def OPENTHREAD_CONFIG_CLI_TCP_ENABLE
63  *
64  * Indicates whether TCP should be enabled in the CLI tool.
65  *
66  */
67 #ifndef OPENTHREAD_CONFIG_CLI_TCP_ENABLE
68 #define OPENTHREAD_CONFIG_CLI_TCP_ENABLE 1
69 #endif
70 
71 /**
72  * @def OPENTHREAD_CONFIG_CLI_TCP_DEFAULT_BENCHMARK_SIZE
73  *
74  * The number of bytes to transfer for the TCP benchmark in the CLI.
75  *
76  */
77 #ifndef OPENTHREAD_CONFIG_CLI_TCP_DEFAULT_BENCHMARK_SIZE
78 #define OPENTHREAD_CONFIG_CLI_TCP_DEFAULT_BENCHMARK_SIZE (72 << 10)
79 #endif
80 
81 /**
82  * @def OPENTHREAD_CONFIG_CLI_TCP_RECEIVE_BUFFER_SIZE
83  *
84  * The size of memory used for the TCP receive buffer, in bytes.
85  */
86 #ifndef OPENTHREAD_CONFIG_CLI_TCP_RECEIVE_BUFFER_SIZE
87 #define OPENTHREAD_CONFIG_CLI_TCP_RECEIVE_BUFFER_SIZE OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS
88 #endif
89 
90 /**
91  * @def OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE
92  *
93  * Define as 1 for CLI to emit its command input string and the resulting output to the logs.
94  *
95  * By default this is enabled on any POSIX based platform (`OPENTHREAD_POSIX`) and only when CLI itself is not being
96  * used for logging.
97  *
98  */
99 #ifndef OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE
100 #define OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE \
101     (OPENTHREAD_POSIX && (OPENTHREAD_CONFIG_LOG_OUTPUT != OPENTHREAD_CONFIG_LOG_OUTPUT_APP))
102 #endif
103 
104 /**
105  * @def OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LOG_STRING_SIZE
106  *
107  * The log string buffer size (in bytes).
108  *
109  * This is only used when `OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE` is enabled.
110  *
111  */
112 #ifndef OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LOG_STRING_SIZE
113 #define OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LOG_STRING_SIZE OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
114 #endif
115 
116 /**
117  * @def OPENTHREAD_CONFIG_CLI_PROMPT_ENABLE
118  *
119  * Enable CLI prompt.
120  *
121  * When enabled, the CLI will print prompt on the output after processing a command.
122  * Otherwise, no prompt is added to the output.
123  *
124  */
125 #ifndef OPENTHREAD_CONFIG_CLI_PROMPT_ENABLE
126 #define OPENTHREAD_CONFIG_CLI_PROMPT_ENABLE 1
127 #endif
128 
129 #endif // CONFIG_CLI_H_
130