| 1 | #ifndef HEADER_CURL_ARPA_TELNET_H |
| 2 | #define |
| 3 | /*************************************************************************** |
| 4 | * _ _ ____ _ |
| 5 | * Project ___| | | | _ \| | |
| 6 | * / __| | | | |_) | | |
| 7 | * | (__| |_| | _ <| |___ |
| 8 | * \___|\___/|_| \_\_____| |
| 9 | * |
| 10 | * Copyright (C) 1998 - 2018, 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 https://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 | ***************************************************************************/ |
| 24 | #ifndef CURL_DISABLE_TELNET |
| 25 | /* |
| 26 | * Telnet option defines. Add more here if in need. |
| 27 | */ |
| 28 | #define CURL_TELOPT_BINARY 0 /* binary 8bit data */ |
| 29 | #define CURL_TELOPT_ECHO 1 /* just echo! */ |
| 30 | #define CURL_TELOPT_SGA 3 /* Suppress Go Ahead */ |
| 31 | #define CURL_TELOPT_EXOPL 255 /* EXtended OPtions List */ |
| 32 | #define CURL_TELOPT_TTYPE 24 /* Terminal TYPE */ |
| 33 | #define CURL_TELOPT_NAWS 31 /* Negotiate About Window Size */ |
| 34 | #define CURL_TELOPT_XDISPLOC 35 /* X DISPlay LOCation */ |
| 35 | |
| 36 | #define CURL_TELOPT_NEW_ENVIRON 39 /* NEW ENVIRONment variables */ |
| 37 | #define CURL_NEW_ENV_VAR 0 |
| 38 | #define CURL_NEW_ENV_VALUE 1 |
| 39 | |
| 40 | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| 41 | /* |
| 42 | * The telnet options represented as strings |
| 43 | */ |
| 44 | static const char * const telnetoptions[]= |
| 45 | { |
| 46 | "BINARY" , "ECHO" , "RCP" , "SUPPRESS GO AHEAD" , |
| 47 | "NAME" , "STATUS" , "TIMING MARK" , "RCTE" , |
| 48 | "NAOL" , "NAOP" , "NAOCRD" , "NAOHTS" , |
| 49 | "NAOHTD" , "NAOFFD" , "NAOVTS" , "NAOVTD" , |
| 50 | "NAOLFD" , "EXTEND ASCII" , "LOGOUT" , "BYTE MACRO" , |
| 51 | "DE TERMINAL" , "SUPDUP" , "SUPDUP OUTPUT" , "SEND LOCATION" , |
| 52 | "TERM TYPE" , "END OF RECORD" , "TACACS UID" , "OUTPUT MARKING" , |
| 53 | "TTYLOC" , "3270 REGIME" , "X3 PAD" , "NAWS" , |
| 54 | "TERM SPEED" , "LFLOW" , "LINEMODE" , "XDISPLOC" , |
| 55 | "OLD-ENVIRON" , "AUTHENTICATION" , "ENCRYPT" , "NEW-ENVIRON" |
| 56 | }; |
| 57 | #endif |
| 58 | |
| 59 | #define CURL_TELOPT_MAXIMUM CURL_TELOPT_NEW_ENVIRON |
| 60 | |
| 61 | #define CURL_TELOPT_OK(x) ((x) <= CURL_TELOPT_MAXIMUM) |
| 62 | #define CURL_TELOPT(x) telnetoptions[x] |
| 63 | |
| 64 | #define CURL_NTELOPTS 40 |
| 65 | |
| 66 | /* |
| 67 | * First some defines |
| 68 | */ |
| 69 | #define CURL_xEOF 236 /* End Of File */ |
| 70 | #define CURL_SE 240 /* Sub negotiation End */ |
| 71 | #define CURL_NOP 241 /* No OPeration */ |
| 72 | #define CURL_DM 242 /* Data Mark */ |
| 73 | #define CURL_GA 249 /* Go Ahead, reverse the line */ |
| 74 | #define CURL_SB 250 /* SuBnegotiation */ |
| 75 | #define CURL_WILL 251 /* Our side WILL use this option */ |
| 76 | #define CURL_WONT 252 /* Our side WON'T use this option */ |
| 77 | #define CURL_DO 253 /* DO use this option! */ |
| 78 | #define CURL_DONT 254 /* DON'T use this option! */ |
| 79 | #define CURL_IAC 255 /* Interpret As Command */ |
| 80 | |
| 81 | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| 82 | /* |
| 83 | * Then those numbers represented as strings: |
| 84 | */ |
| 85 | static const char * const telnetcmds[]= |
| 86 | { |
| 87 | "EOF" , "SUSP" , "ABORT" , "EOR" , "SE" , |
| 88 | "NOP" , "DMARK" , "BRK" , "IP" , "AO" , |
| 89 | "AYT" , "EC" , "EL" , "GA" , "SB" , |
| 90 | "WILL" , "WONT" , "DO" , "DONT" , "IAC" |
| 91 | }; |
| 92 | #endif |
| 93 | |
| 94 | #define CURL_TELCMD_MINIMUM CURL_xEOF /* the first one */ |
| 95 | #define CURL_TELCMD_MAXIMUM CURL_IAC /* surprise, 255 is the last one! ;-) */ |
| 96 | |
| 97 | #define CURL_TELQUAL_IS 0 |
| 98 | #define CURL_TELQUAL_SEND 1 |
| 99 | #define CURL_TELQUAL_INFO 2 |
| 100 | #define CURL_TELQUAL_NAME 3 |
| 101 | |
| 102 | #define CURL_TELCMD_OK(x) ( ((unsigned int)(x) >= CURL_TELCMD_MINIMUM) && \ |
| 103 | ((unsigned int)(x) <= CURL_TELCMD_MAXIMUM) ) |
| 104 | #define CURL_TELCMD(x) telnetcmds[(x)-CURL_TELCMD_MINIMUM] |
| 105 | |
| 106 | #endif /* CURL_DISABLE_TELNET */ |
| 107 | |
| 108 | #endif /* HEADER_CURL_ARPA_TELNET_H */ |
| 109 | |