Zephyr API Documentation 4.4.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 uint8_t cmd_buf[SHELL_TELNET_MAX_CMD_SIZE];
61 uint8_t cmd_len;
62
67 struct k_work_delayable send_work;
68 struct k_work_sync work_sync;
69
71 bool output_lock;
72};
74
81
87#define SHELL_TELNET_DEFINE(_name) \
88 static struct shell_telnet _name##_shell_telnet; \
89 struct shell_transport _name = { \
90 .api = &shell_telnet_transport_api, \
91 .ctx = (struct shell_telnet *)&_name##_shell_telnet \
92 }
93
103
105
106#ifdef __cplusplus
107}
108#endif
109
110#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.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Unified shell transport interface.
Definition shell.h:863
Shell instance internals.
Definition shell.h:1128