The code is structured in a way which makes it possible to add commands without having to rewrite the main telnet code. The main telnet code calls two callback functions, telnetd_connected() and telnetd_input(), when a telnet connection has been established and when a line of text arrives on a telnet connection. These two functions can be implemented in a way which suits the particular application or environment in which the uIP system is intended to be run.
The uIP distribution contains an example telnet shell implementation that provides a basic set of commands.
Files | |
file | telnetd-shell.c |
An example telnet server shell. | |
file | telnetd.c |
Implementation of the Telnet server. | |
file | telnetd.h |
Header file for the telnet server. | |
Data Structures | |
struct | telnetd_state |
A telnet connection structure. More... | |
Defines | |
#define | TELNETD_LINELEN |
The maximum length of a telnet line. | |
#define | TELNETD_NUMLINES |
The number of output lines being buffered for all telnet connections. | |
Functions | |
void | telnetd_connected (struct telnetd_state *s) |
Callback function that is called when a telnet connection has been established. | |
void | telnetd_input (struct telnetd_state *s, char *cmd) |
Callback function that is called when a line of text has arrived on a telnet connection. | |
void | telnetd_close (struct telnetd_state *s) |
Close a telnet session. | |
void | telnetd_output (struct telnetd_state *s, char *s1, char *s2) |
Print out a string on a telnet connection. | |
void | telnetd_prompt (struct telnetd_state *s, char *str) |
Print a prompt on a telnet connection. | |
void | telnetd_init (void) |
Initialize the telnet server. |
|
Close a telnet session. This function can be called from a telnet command in order to close the connection.
|
|
Callback function that is called when a telnet connection has been established.
|
Here is the call graph for this function:
|
Initialize the telnet server. This function will perform the necessary initializations and start listening on TCP port 23. |
Here is the call graph for this function:
|
Callback function that is called when a line of text has arrived on a telnet connection.
|
Here is the call graph for this function:
|
Print out a string on a telnet connection. This function can be called from a telnet command parser in order to print out a string of text on the connection. The two strings given as arguments to the function will be concatenated, a carrige return and a new line character will be added, and the line is sent.
|
|
Print a prompt on a telnet connection. This function can be called by the telnet command shell in order to print out a command prompt.
|