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 <<<<<<< HEAD
63  * @def OPENTHREAD_CONFIG_CLI_TCP_ENABLE
64  *
65  * Indicates whether TCP should be enabled in the CLI tool.
66  *
67  */
68 #ifndef OPENTHREAD_CONFIG_CLI_TCP_ENABLE
69 #define OPENTHREAD_CONFIG_CLI_TCP_ENABLE 1
70 #endif
71 
72 /**
73  * @def OPENTHREAD_CONFIG_CLI_TCP_DEFAULT_BENCHMARK_SIZE
74  *
75  * The number of bytes to transfer for the TCP benchmark in the CLI.
76  *
77  */
78 #ifndef OPENTHREAD_CONFIG_CLI_TCP_DEFAULT_BENCHMARK_SIZE
79 #define OPENTHREAD_CONFIG_CLI_TCP_DEFAULT_BENCHMARK_SIZE (72 << 10)
80 #endif
81 
82 /**
83  * @def OPENTHREAD_CONFIG_CLI_TCP_RECEIVE_BUFFER_SIZE
84  *
85  * The size of memory used for the TCP receive buffer, in bytes.
86  */
87 #ifndef OPENTHREAD_CONFIG_CLI_TCP_RECEIVE_BUFFER_SIZE
88 #define OPENTHREAD_CONFIG_CLI_TCP_RECEIVE_BUFFER_SIZE OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS
89 #endif
90 
91 /**
92  * @def OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE
93  *
94  * Define as 1 for CLI to emit its command input string and the resulting output to the logs.
95  *
96  * By default this is enabled on any POSIX based platform (`OPENTHREAD_POSIX`) and only when CLI itself is not being
97  * used for logging.
98  *
99  */
100 #ifndef OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE
101 #define OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE \
102     (OPENTHREAD_POSIX && (OPENTHREAD_CONFIG_LOG_OUTPUT != OPENTHREAD_CONFIG_LOG_OUTPUT_APP))
103 #endif
104 
105 /**
106  * @def OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LOG_STRING_SIZE
107  *
108  * The log string buffer size (in bytes).
109  *
110  * This is only used when `OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE` is enabled.
111  *
112  */
113 #ifndef OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LOG_STRING_SIZE
114 #define OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LOG_STRING_SIZE OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
115 #endif
116 
117 #endif // CONFIG_CLI_H_
118