1 | /* |
---|
2 | * Original Author: Fernando RUIZ CASAS (fernando.ruiz@ctv.es) |
---|
3 | * May 2001 |
---|
4 | * Reworked by Till Straumann and .h overhauled by Joel Sherrill. |
---|
5 | * |
---|
6 | * Copyright (c) 2009 embedded brains GmbH and others. |
---|
7 | * |
---|
8 | * embedded brains GmbH |
---|
9 | * Obere Lagerstr. 30 |
---|
10 | * D-82178 Puchheim |
---|
11 | * Germany |
---|
12 | * <rtems@embedded-brains.de> |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_TELNETD_H |
---|
20 | #define _RTEMS_TELNETD_H |
---|
21 | |
---|
22 | #include <rtems.h> |
---|
23 | #include <rtems/shell.h> |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif |
---|
28 | |
---|
29 | bool rtems_telnetd_login_check( |
---|
30 | const char *user, |
---|
31 | const char *passphrase |
---|
32 | ); |
---|
33 | |
---|
34 | /** |
---|
35 | * @brief Telnet command type. |
---|
36 | */ |
---|
37 | typedef void (*rtems_telnetd_command)( |
---|
38 | char * /* device name */, |
---|
39 | void * /* arg */ |
---|
40 | ); |
---|
41 | |
---|
42 | /** |
---|
43 | * @brief Telnet configuration structure. |
---|
44 | */ |
---|
45 | typedef struct { |
---|
46 | /** |
---|
47 | * @brief Function invoked for each Telnet connection. |
---|
48 | * |
---|
49 | * The first parameter contains the device name. The second parameter |
---|
50 | * contains the argument pointer of this configuration table. |
---|
51 | */ |
---|
52 | rtems_telnetd_command command; |
---|
53 | |
---|
54 | /** |
---|
55 | * @brief Argument for command function. |
---|
56 | */ |
---|
57 | void *arg; |
---|
58 | |
---|
59 | /** |
---|
60 | * @brief Task priority. |
---|
61 | * |
---|
62 | * Use 0 for the default value. |
---|
63 | */ |
---|
64 | rtems_task_priority priority; |
---|
65 | |
---|
66 | /** |
---|
67 | * @brief Task stack size. |
---|
68 | * |
---|
69 | * Use 0 for the default value. |
---|
70 | */ |
---|
71 | size_t stack_size; |
---|
72 | |
---|
73 | /** |
---|
74 | * @brief Login check function. |
---|
75 | * |
---|
76 | * Method used for login checks. Use @c NULL to disable a login check. |
---|
77 | */ |
---|
78 | rtems_shell_login_check_t login_check; |
---|
79 | |
---|
80 | /** |
---|
81 | * @brief This is an obsolete configuration option. |
---|
82 | * |
---|
83 | * It must be set to false, otherwise rtems_telnetd_start() will do nothing |
---|
84 | * and returns with a status of RTEMS_NOT_IMPLEMENTED. |
---|
85 | */ |
---|
86 | bool keep_stdio; |
---|
87 | |
---|
88 | /** |
---|
89 | * @brief Maximum number of clients which can connect to the system at a |
---|
90 | * time. |
---|
91 | * |
---|
92 | * Use 0 for the default value. |
---|
93 | */ |
---|
94 | uint16_t client_maximum; |
---|
95 | |
---|
96 | /** |
---|
97 | * @brief Server port number in host byte order. |
---|
98 | * |
---|
99 | * Use 0 for the default value. |
---|
100 | */ |
---|
101 | uint16_t port; |
---|
102 | } rtems_telnetd_config_table; |
---|
103 | |
---|
104 | /** |
---|
105 | * @brief Starts the Telnet server using the provided configuration. |
---|
106 | * |
---|
107 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
108 | * @retval RTEMS_INVALID_ADDRESS The command function in the configuration is |
---|
109 | * @c NULL. |
---|
110 | * @retval RTEMS_RESOURCE_IN_USE The server port is already in use. |
---|
111 | * @retval RTEMS_NOT_IMPLEMENTED The keep stdio configuration option is true. |
---|
112 | * @retval RTEMS_UNSATISFIED Not enough resources to start the Telnet server or |
---|
113 | * task priority in configuration is invalid. |
---|
114 | */ |
---|
115 | rtems_status_code rtems_telnetd_start(const rtems_telnetd_config_table *config); |
---|
116 | |
---|
117 | /** |
---|
118 | * @brief Telnet configuration. |
---|
119 | * |
---|
120 | * The application must provide this configuration table. It is used by |
---|
121 | * rtems_telnetd_initialize() to configure the Telnet subsystem. Do not modify |
---|
122 | * the entries after the intialization since it is used internally. |
---|
123 | */ |
---|
124 | extern rtems_telnetd_config_table rtems_telnetd_config; |
---|
125 | |
---|
126 | /** |
---|
127 | * @brief Initializes the Telnet subsystem. |
---|
128 | * |
---|
129 | * Uses the application provided @ref rtems_telnetd_config configuration table. |
---|
130 | */ |
---|
131 | rtems_status_code rtems_telnetd_initialize(void); |
---|
132 | |
---|
133 | #ifdef __cplusplus |
---|
134 | } |
---|
135 | #endif |
---|
136 | |
---|
137 | #endif |
---|