telnet.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /******************************************************************************
  2. * This file is part of TinTin++ *
  3. * *
  4. * Copyright 2004-2020 Igor van den Hoven *
  5. * *
  6. * TinTin++ is free software; you can redistribute it and/or modify *
  7. * it under the terms of the GNU General Public License as published by *
  8. * the Free Software Foundation; either version 3 of the License, or *
  9. * (at your option) any later version. *
  10. * *
  11. * This program is distributed in the hope that it will be useful, *
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  14. * GNU General Public License for more details. *
  15. * *
  16. * You should have received a copy of the GNU General Public License *
  17. * along with TinTin++. If not, see https://www.gnu.org/licenses. *
  18. ******************************************************************************/
  19. /******************************************************************************
  20. * T I N T I N + + *
  21. * *
  22. * coded by Igor van den Hoven 2004 *
  23. ******************************************************************************/
  24. #include "tintin.h"
  25. /*
  26. telnet protocol.
  27. */
  28. #define IAC 255
  29. #define DONT 254
  30. #define DO 253
  31. #define WONT 252
  32. #define WILL 251
  33. #define SB 250
  34. #define GA 249 /* Used for prompt marking */
  35. #define EL 248
  36. #define EC 247
  37. #define AYT 246
  38. #define AO 245
  39. #define IP 244
  40. #define BREAK 243
  41. #define DM 242
  42. #define NOP 241
  43. #define SE 240
  44. #define EOR 239 /* Used for prompt marking */
  45. #define ABORT 238
  46. #define SUSP 237
  47. #define xEOF 236
  48. /*
  49. telnet options
  50. */
  51. #define TELOPT_BINARY 0
  52. #define TELOPT_ECHO 1 /* Echo */
  53. #define TELOPT_RCP 2
  54. #define TELOPT_SGA 3 /* Supress Go Ahead */
  55. #define TELOPT_NAMS 4
  56. #define TELOPT_STATUS 5
  57. #define TELOPT_TIMINGMARK 6
  58. #define TELOPT_RCTE 7
  59. #define TELOPT_NAOL 8
  60. #define TELOPT_NAOP 9
  61. #define TELOPT_NAOCRD 10
  62. #define TELOPT_NAOHTS 11
  63. #define TELOPT_NAOHTD 12
  64. #define TELOPT_NAOFFD 13
  65. #define TELOPT_NAOVTS 14
  66. #define TELOPT_NAOVTD 15
  67. #define TELOPT_NAOLFD 16
  68. #define TELOPT_XASCII 17
  69. #define TELOPT_LOGOUT 18
  70. #define TELOPT_BM 19
  71. #define TELOPT_DET 20
  72. #define TELOPT_SUPDUP 21
  73. #define TELOPT_SUPDUPOUTPUT 22
  74. #define TELOPT_SNDLOC 23
  75. #define TELOPT_TTYPE 24 /* Terminal Type */
  76. #define TELOPT_EOR 25 /* End of Record */
  77. #define TELOPT_TUID 26
  78. #define TELOPT_OUTMRK 27
  79. #define TELOPT_TTYLOC 28
  80. #define TELOPT_3270REGIME 29
  81. #define TELOPT_X3PAD 30
  82. #define TELOPT_NAWS 31 /* Negotiate About Window Size */
  83. #define TELOPT_TSPEED 32
  84. #define TELOPT_LFLOW 33
  85. #define TELOPT_LINEMODE 34
  86. #define TELOPT_XDISPLOC 35
  87. #define TELOPT_OLD_ENVIRON 36
  88. #define TELOPT_AUTH 37
  89. #define TELOPT_ENCRYPT 38
  90. #define TELOPT_NEW_ENVIRON 39
  91. #define TELOPT_CHARSET 42 /* Charset */
  92. #define TELOPT_STARTTLS 46
  93. #define TELOPT_MSDP 69 /* Mud Server Data Protocol */
  94. #define TELOPT_MSSP 70 /* Mud Server Status Protocol */
  95. #define TELOPT_MCCP1 85
  96. #define TELOPT_MCCP2 86 /* Mud Client Compression Protocol v2 */
  97. #define TELOPT_MCCP3 87 /* Mud Client Compression Protocol v3 */
  98. #define TELOPT_MSP 90 /* Mud Sound Protocol */
  99. #define TELOPT_MXP 91 /* Mud eXtention Protocol */
  100. #define TELOPT_ZMP 93 /* Zenith Mud Protocol */
  101. #define TELOPT_GMCP 201 /* Generic Mud Communication Protocol */
  102. #define TELOPT_EXOPL 255
  103. #define TELCMD_OK(c) ((c) >= xEOF)
  104. #define TELCMD(c) telcmds[(c)-xEOF]
  105. #define TELOPT(c) (telopt_table[(unsigned char) (c)].name)
  106. /*
  107. Sub negotiation
  108. */
  109. #define ENV_IS 0
  110. #define ENV_SEND 1
  111. #define ENV_INFO 2
  112. #define ENV_VAR 0
  113. #define ENV_VAL 1
  114. #define ENV_ESC 2 /* Not implemented in tintin */
  115. #define ENV_USR 3
  116. #define CHARSET_REQUEST 1
  117. #define CHARSET_ACCEPTED 2
  118. #define CHARSET_REJECTED 3
  119. /*
  120. TTABLE-IS ..................04
  121. TTABLE-REJECTED ............05
  122. TTABLE-ACK .................06
  123. TTABLE-NAK .................07
  124. */
  125. #define MSSP_VAR 1
  126. #define MSSP_VAL 2
  127. #define MSDP_VAR 1
  128. #define MSDP_VAL 2
  129. #define MSDP_TABLE_OPEN 3
  130. #define MSDP_TABLE_CLOSE 4
  131. #define MSDP_ARRAY_OPEN 5
  132. #define MSDP_ARRAY_CLOSE 6
  133. #define ANNOUNCE_NONE 0
  134. #define ANNOUNCE_WILL 1
  135. #define ANNOUNCE_DO 2