doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
arpa_telnet.h
Go to the documentation of this file.
1 #ifndef __ARPA_TELNET_H
2 #define __ARPA_TELNET_H
3 /***************************************************************************
4  * _ _ ____ _
5  * Project ___| | | | _ \| |
6  * / __| | | | |_) | |
7  * | (__| |_| | _ <| |___
8  * \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  * $Id: arpa_telnet.h,v 1.11 2004/01/07 09:19:35 bagder Exp $
24  ***************************************************************************/
25 #ifndef CURL_DISABLE_TELNET
26 /*
27  * Telnet option defines. Add more here if in need.
28  */
29 #define CURL_TELOPT_BINARY 0 /* binary 8bit data */
30 #define CURL_TELOPT_SGA 3 /* Supress Go Ahead */
31 #define CURL_TELOPT_EXOPL 255 /* EXtended OPtions List */
32 #define CURL_TELOPT_TTYPE 24 /* Terminal TYPE */
33 #define CURL_TELOPT_XDISPLOC 35 /* X DISPlay LOCation */
34 
35 #define CURL_TELOPT_NEW_ENVIRON 39 /* NEW ENVIRONment variables */
36 #define CURL_NEW_ENV_VAR 0
37 #define CURL_NEW_ENV_VALUE 1
38 
39 /*
40  * The telnet options represented as strings
41  */
42 static const char *telnetoptions[]=
43 {
44  "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD",
45  "NAME", "STATUS", "TIMING MARK", "RCTE",
46  "NAOL", "NAOP", "NAOCRD", "NAOHTS",
47  "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD",
48  "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
49  "DE TERMINAL", "SUPDUP", "SUPDUP OUTPUT", "SEND LOCATION",
50  "TERM TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING",
51  "TTYLOC", "3270 REGIME", "X3 PAD", "NAWS",
52  "TERM SPEED", "LFLOW", "LINEMODE", "XDISPLOC",
53  "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON"
54 };
55 
56 #define CURL_TELOPT_MAXIMUM CURL_TELOPT_NEW_ENVIRON
57 
58 #define CURL_TELOPT_OK(x) ((x) <= CURL_TELOPT_MAXIMUM)
59 #define CURL_TELOPT(x) telnetoptions[x]
60 
61 #define CURL_NTELOPTS 40
62 
63 /*
64  * First some defines
65  */
66 #define CURL_xEOF 236 /* End Of File */
67 #define CURL_SE 240 /* Sub negotiation End */
68 #define CURL_NOP 241 /* No OPeration */
69 #define CURL_DM 242 /* Data Mark */
70 #define CURL_GA 249 /* Go Ahead, reverse the line */
71 #define CURL_SB 250 /* SuBnegotiation */
72 #define CURL_WILL 251 /* Our side WILL use this option */
73 #define CURL_WONT 252 /* Our side WON'T use this option */
74 #define CURL_DO 253 /* DO use this option! */
75 #define CURL_DONT 254 /* DON'T use this option! */
76 #define CURL_IAC 255 /* Interpret As Command */
77 
78 /*
79  * Then those numbers represented as strings:
80  */
81 static const char *telnetcmds[]=
82 {
83  "EOF", "SUSP", "ABORT", "EOR", "SE",
84  "NOP", "DMARK", "BRK", "IP", "AO",
85  "AYT", "EC", "EL", "GA", "SB",
86  "WILL", "WONT", "DO", "DONT", "IAC"
87 };
88 
89 #define CURL_TELCMD_MINIMUM CURL_xEOF /* the first one */
90 #define CURL_TELCMD_MAXIMUM CURL_IAC /* surprise, 255 is the last one! ;-) */
91 
92 #define CURL_TELQUAL_IS 0
93 #define CURL_TELQUAL_SEND 1
94 #define CURL_TELQUAL_INFO 2
95 #define CURL_TELQUAL_NAME 3
96 
97 #define CURL_TELCMD_OK(x) ( ((unsigned int)(x) >= CURL_TELCMD_MINIMUM) && \
98  ((unsigned int)(x) <= CURL_TELCMD_MAXIMUM) )
99 #define CURL_TELCMD(x) telnetcmds[(x)-CURL_TELCMD_MINIMUM]
100 #endif
101 #endif