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) 2001, Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * In order to be useful for every potential user, curl and libcurl are
  13. * dual-licensed under the MPL and the MIT/X-derivate licenses.
  14. *
  15. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. * copies of the Software, and permit persons to whom the Software is
  17. * furnished to do so, under the terms of the MPL or the MIT/X-derivate
  18. * licenses. You may pick one of these licenses.
  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. /*
  26. * Telnet option defines. Add more here if in need.
  27. */
  28. #define TELOPT_BINARY 0 /* binary 8bit data */
  29. #define TELOPT_SGA 3 /* Supress Go Ahead */
  30. #define TELOPT_EXOPL 255 /* EXtended OPtions List */
  31. #define TELOPT_TTYPE 24 /* Terminal TYPE */
  32. #define TELOPT_XDISPLOC 35 /* X DISPlay LOCation */
  33. #define TELOPT_NEW_ENVIRON 39 /* NEW ENVIRONment variables */
  34. #define NEW_ENV_VAR 0
  35. #define NEW_ENV_VALUE 1
  36. /*
  37. * The telnet options represented as strings
  38. */
  39. static const char *telnetoptions[]=
  40. {
  41. "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD",
  42. "NAME", "STATUS", "TIMING MARK", "RCTE",
  43. "NAOL", "NAOP", "NAOCRD", "NAOHTS",
  44. "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD",
  45. "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
  46. "DE TERMINAL", "SUPDUP", "SUPDUP OUTPUT", "SEND LOCATION",
  47. "TERM TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING",
  48. "TTYLOC", "3270 REGIME", "X3 PAD", "NAWS",
  49. "TERM SPEED", "LFLOW", "LINEMODE", "XDISPLOC",
  50. "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON"
  51. };
  52. #define TELOPT_MAXIMUM TELOPT_NEW_ENVIRON
  53. #define TELOPT_OK(x) ((x) <= TELOPT_MAXIMUM)
  54. #define TELOPT(x) telnetoptions[x]
  55. #define NTELOPTS 40
  56. /*
  57. * First some defines
  58. */
  59. #define xEOF 236 /* End Of File */
  60. #define SE 240 /* Sub negotiation End */
  61. #define NOP 241 /* No OPeration */
  62. #define DM 242 /* Data Mark */
  63. #define GA 249 /* Go Ahead, reverse the line */
  64. #define SB 250 /* SuBnegotiation */
  65. #define WILL 251 /* Our side WILL use this option */
  66. #define WONT 252 /* Our side WON'T use this option */
  67. #define DO 253 /* DO use this option! */
  68. #define DONT 254 /* DON'T use this option! */
  69. #define IAC 255 /* Interpret As Command */
  70. /*
  71. * Then those numbers represented as strings:
  72. */
  73. static const char *telnetcmds[]=
  74. {
  75. "EOF", "SUSP", "ABORT", "EOR", "SE",
  76. "NOP", "DMARK", "BRK", "IP", "AO",
  77. "AYT", "EC", "EL", "GA", "SB",
  78. "WILL", "WONT", "DO", "DONT", "IAC"
  79. };
  80. #define TELCMD_MINIMUM xEOF /* the first one */
  81. #define TELCMD_MAXIMUM IAC /* surprise, 255 is the last one! ;-) */
  82. #define TELQUAL_IS 0
  83. #define TELQUAL_SEND 1
  84. #define TELQUAL_INFO 2
  85. #define TELQUAL_NAME 3
  86. #define TELCMD_OK(x) ( ((unsigned int)(x) >= TELCMD_MINIMUM) && \
  87. ((unsigned int)(x) <= TELCMD_MAXIMUM) )
  88. #define TELCMD(x) telnetcmds[(x)-TELCMD_MINIMUM]
  89. #endif