Contiki 3.x
telnet.h
1 /*
2  * Copyright (c) 2002, Adam Dunkels.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote
14  * products derived from this software without specific prior
15  * written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * This file is part of the uIP TCP/IP stack.
30  *
31  *
32  */
33 #ifndef TELNET_H_
34 #define TELNET_H_
35 
36 #include "contiki-net.h"
37 
38 struct telnet_state {
39  unsigned char flags;
40  char *text;
41  uint16_t textlen;
42  uint16_t sentlen;
43 };
44 
45 /*DISPATCHER_UIPCALL(telnet_app, s);*/
46 void telnet_app(void *s);
47 unsigned char telnet_send(struct telnet_state *s, char *text, uint16_t len);
48 unsigned char telnet_close(struct telnet_state *s);
49 unsigned char telnet_abort(struct telnet_state *s);
50 struct telnet_state *telnet_connect(struct telnet_state *s, uip_ipaddr_t *addr, uint16_t port);
51 
52 
53 /* Callbacks, implemented by the caller. */
54 void telnet_connected(struct telnet_state *s);
55 void telnet_closed(struct telnet_state *s);
56 void telnet_sent(struct telnet_state *s);
57 void telnet_aborted(struct telnet_state *s);
58 void telnet_timedout(struct telnet_state *s);
59 void telnet_newdata(struct telnet_state *s, char *data, uint16_t len);
60 #endif /* TELNET_H_ */