Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
shell_telnet.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_SHELL_SHELL_TELNET_H_
14#define ZEPHYR_INCLUDE_SHELL_SHELL_TELNET_H_
15
16#include <zephyr/net/socket.h>
17#include <zephyr/shell/shell.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
24extern const struct shell_transport_api shell_telnet_transport_api;
25
26#define SHELL_TELNET_POLLFD_COUNT 3
27#define SHELL_TELNET_MAX_CMD_SIZE 3
28
30struct shell_telnet_line_buf {
32 char buf[CONFIG_SHELL_TELNET_LINE_BUF_SIZE];
33
35 uint16_t len;
36};
37
39struct shell_telnet {
41 shell_transport_handler_t shell_handler;
42
44 void *shell_context;
45
47 struct shell_telnet_line_buf line_out;
48
50 struct zsock_pollfd fds[SHELL_TELNET_POLLFD_COUNT];
51
53 uint8_t rx_buf[CONFIG_SHELL_CMD_BUFF_SIZE];
54
56 size_t rx_len;
57
59 struct k_mutex rx_lock;
60
62 struct k_mutex tx_lock;
63
67 uint32_t session;
68
72 bool tx_active;
73 uint8_t cmd_buf[SHELL_TELNET_MAX_CMD_SIZE];
74 uint8_t cmd_len;
75
80 struct k_work_delayable send_work;
81
83 bool output_lock;
84};
86
93
99#define SHELL_TELNET_DEFINE(_name) \
100 static struct shell_telnet _name##_shell_telnet; \
101 struct shell_transport _name = { \
102 .api = &shell_telnet_transport_api, \
103 .ctx = (struct shell_telnet *)&_name##_shell_telnet \
104 }
105
115
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif /* ZEPHYR_INCLUDE_SHELL_SHELL_TELNET_H_ */
void(* shell_transport_handler_t)(enum shell_transport_evt evt, void *context)
Shell transport event handler callback.
Definition shell.h:831
const struct shell * shell_backend_telnet_get_ptr(void)
This function provides pointer to shell telnet backend instance.
BSD Sockets compatible API definitions.
Header file for the shell subsystem.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Unified shell transport interface.
Definition shell.h:864
Shell instance internals.
Definition shell.h:1129