Rev Author Line No. Line
3328 povik 1 /**
2 * \addtogroup telnetd
3 * @{
4 */
5  
6 /**
7 * \file
8 * Header file for the telnet server.
9 * \author Adam Dunkels <adam@dunkels.com>
10 */
11  
12 /*
13 * Copyright (c) 2002, Adam Dunkels.
14 * All rights reserved.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. The name of the author may not be used to endorse or promote
25 * products derived from this software without specific prior
26 * written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
29 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
32 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
34 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * This file is part of the uIP TCP/IP stack.
41 *
42 * $Id: telnetd.h,v 1.1.2.2 2003/10/07 13:22:27 adam Exp $
43 *
44 */
45 #ifndef __TELNETD_H__
46 #define __TELNETD_H__
47  
48 #include "uip.h"
49  
50 /**
51 * The maximum length of a telnet line.
52 *
53 * \hideinitializer
54 */
55 #define TELNETD_LINELEN 36
56  
57 /**
58 * The number of output lines being buffered for all telnet
59 * connections.
60 *
61 * \hideinitializer
62 */
63 #define TELNETD_NUMLINES 2
64  
65 /**
66 * A telnet connection structure.
67 */
68 struct telnetd_state {
69 char *lines[TELNETD_NUMLINES];
70 char buf[TELNETD_LINELEN];
71 char bufptr;
72 u8_t state;
73 };
74  
75  
76 /**
77 * Callback function that is called when a telnet connection has been
78 * established.
79 *
80 * \param s The telnet connection.
81 */
82 void telnetd_connected(struct telnetd_state *s);
83  
84 /**
85 * Callback function that is called when a line of text has arrived on
86 * a telnet connection.
87 *
88 * \param s The telnet connection.
89 *
90 * \param cmd The line of text.
91 */
92 void telnetd_input(struct telnetd_state *s, char *cmd);
93  
94  
95 void telnetd_close(struct telnetd_state *s);
96 void telnetd_output(struct telnetd_state *s, char *s1, char *s2);
97 void telnetd_prompt(struct telnetd_state *s, char *str);
98  
99 void telnetd_app(void);
100  
101 #ifndef UIP_APPCALL
102 #define UIP_APPCALL telnetd_app
103 #endif
104  
105 #ifndef UIP_APPSTATE_SIZE
106 #define UIP_APPSTATE_SIZE (sizeof(struct telnetd_state))
107 #endif
108  
109 void telnetd_init(void);
110  
111  
112 #endif /* __TELNET_H__ */
113  
114 /** @} */