Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

Telnet server
[Example applications]


Detailed Description

The uIP telnet server provides a command based interface to uIP. It allows using the "telnet" application to access uIP, and implements the required telnet option negotiation.

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.


Function Documentation

void telnetd_close struct telnetd_state s  ) 
 

Close a telnet session.

This function can be called from a telnet command in order to close the connection.

Parameters:
s The connection which is to be closed.

void telnetd_connected struct telnetd_state s  ) 
 

Callback function that is called when a telnet connection has been established.

Parameters:
s The telnet connection.

Here is the call graph for this function:

void telnetd_init void   ) 
 

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:

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.

Parameters:
s The telnet connection.
cmd The line of text.

Here is the call graph for this function:

void telnetd_output struct telnetd_state s,
char *  str1,
char *  str2
 

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.

Parameters:
s The telnet connection.
str1 The first string.
str2 The second string.

void telnetd_prompt struct telnetd_state s,
char *  str
 

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.

Parameters:
s A telnet connection.
str The command prompt.


Generated on Tue Oct 7 15:51:49 2003 for uIP 0.9 by doxygen 1.3.3