1
0

arpa_telnet.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef __ARPA_TELNET_H
  2. #define __ARPA_TELNET_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2002, Daniel Stenberg, <[email protected]>, 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$
  24. ***************************************************************************/
  25. #ifndef CURL_DISABLE_TELNET
  26. /*
  27. * Telnet option defines. Add more here if in need.
  28. */
  29. #define TELOPT_BINARY 0 /* binary 8bit data */
  30. #define TELOPT_SGA 3 /* Supress Go Ahead */
  31. #define TELOPT_EXOPL 255 /* EXtended OPtions List */
  32. #define TELOPT_TTYPE 24 /* Terminal TYPE */
  33. #define TELOPT_XDISPLOC 35 /* X DISPlay LOCation */
  34. #define TELOPT_NEW_ENVIRON 39 /* NEW ENVIRONment variables */
  35. #define NEW_ENV_VAR 0
  36. #define NEW_ENV_VALUE 1
  37. /*
  38. * The telnet options represented as strings
  39. */
  40. static const char *telnetoptions[]=
  41. {
  42. "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD",
  43. "NAME", "STATUS", "TIMING MARK", "RCTE",
  44. "NAOL", "NAOP", "NAOCRD", "NAOHTS",
  45. "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD",
  46. "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
  47. "DE TERMINAL", "SUPDUP", "SUPDUP OUTPUT", "SEND LOCATION",
  48. "TERM TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING",
  49. "TTYLOC", "3270 REGIME", "X3 PAD", "NAWS",
  50. "TERM SPEED", "LFLOW", "LINEMODE", "XDISPLOC",
  51. "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON"
  52. };
  53. #define TELOPT_MAXIMUM TELOPT_NEW_ENVIRON
  54. #define TELOPT_OK(x) ((x) <= TELOPT_MAXIMUM)
  55. #define TELOPT(x) telnetoptions[x]
  56. #define NTELOPTS 40
  57. /*
  58. * First some defines
  59. */
  60. #define xEOF 236 /* End Of File */
  61. #define SE 240 /* Sub negotiation End */
  62. #define NOP 241 /* No OPeration */
  63. #define DM 242 /* Data Mark */
  64. #define GA 249 /* Go Ahead, reverse the line */
  65. #define SB 250 /* SuBnegotiation */
  66. #define WILL 251 /* Our side WILL use this option */
  67. #define WONT 252 /* Our side WON'T use this option */
  68. #define DO 253 /* DO use this option! */
  69. #define DONT 254 /* DON'T use this option! */
  70. #define IAC 255 /* Interpret As Command */
  71. /*
  72. * Then those numbers represented as strings:
  73. */
  74. static const char *telnetcmds[]=
  75. {
  76. "EOF", "SUSP", "ABORT", "EOR", "SE",
  77. "NOP", "DMARK", "BRK", "IP", "AO",
  78. "AYT", "EC", "EL", "GA", "SB",
  79. "WILL", "WONT", "DO", "DONT", "IAC"
  80. };
  81. #define TELCMD_MINIMUM xEOF /* the first one */
  82. #define TELCMD_MAXIMUM IAC /* surprise, 255 is the last one! ;-) */
  83. #define TELQUAL_IS 0
  84. #define TELQUAL_SEND 1
  85. #define TELQUAL_INFO 2
  86. #define TELQUAL_NAME 3
  87. #define TELCMD_OK(x) ( ((unsigned int)(x) >= TELCMD_MINIMUM) && \
  88. ((unsigned int)(x) <= TELCMD_MAXIMUM) )
  89. #define TELCMD(x) telnetcmds[(x)-TELCMD_MINIMUM]
  90. #endif
  91. #endif