shell_telnet_protocol.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright (c) 2017 Intel Corporation
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief Telnet console protocol specific defines
  9. *
  10. *
  11. * This defines the Telnet codes, all prefixed as NVT_
  12. * (NVT: Network Virtual Terminal, see rfc854)
  13. */
  14. #ifndef SHELL_TELNET_PROTOCOL_H__
  15. #define SHELL_TELNET_PROTOCOL_H__
  16. /** Printer/Keyboard codes */
  17. /* Mandatory ones */
  18. #define NVT_NUL 0
  19. #define NVT_LF 10
  20. #define NVT_CR 13
  21. /* Optional ones */
  22. #define NVT_BEL 7
  23. #define NVT_BS 8
  24. #define NVT_HT 9
  25. #define NVT_VT 11
  26. #define NVT_FF 12
  27. /* Telnet commands */
  28. #define NVT_CMD_SE 240
  29. #define NVT_CMD_NOP 241
  30. #define NVT_CMD_DM 242
  31. #define NVT_CMD_BRK 243
  32. #define NVT_CMD_IP 244
  33. #define NVT_CMD_AO 245
  34. #define NVT_CMD_AYT 246
  35. #define NVT_CMD_EC 247
  36. #define NVT_CMD_EL 248
  37. #define NVT_CMD_GA 249
  38. #define NVT_CMD_SB 250
  39. #define NVT_CMD_WILL 251
  40. #define NVT_CMD_WONT 252
  41. #define NVT_CMD_DO 253
  42. #define NVT_CMD_DONT 254
  43. #define NVT_CMD_IAC 255
  44. /* Telnet options */
  45. #define NVT_OPT_TX_BIN 0
  46. #define NVT_OPT_ECHO 1
  47. #define NVT_OPT_RECONNECT 2
  48. #define NVT_OPT_SUPR_GA 3
  49. #define NVT_OPT_MSG_SZ_NEG 4
  50. #define NVT_OPT_STATUS 5
  51. #define NVT_OPT_TIMING_MARK 6
  52. #define NVT_OPT_REMOTE_CTRL_TRANS_ECHO 7
  53. #define NVT_OPT_OUT_LINE_WIDTH 8
  54. #define NVT_OPT_OUT_PAGE_SZ 9
  55. #define NVT_OPT_NEG_CR 10
  56. #define NVT_OPT_NEG_HT 11
  57. #define NVT_OPT_NAOHTD 12
  58. #define NVT_OPT_NEG_OUT_FF 13
  59. #define NVT_OPT_NEG_VT 14
  60. #define NVT_OPT_NEG_OUT_VT 15
  61. #define NVT_OPT_NET_OUT_LF 16
  62. #define NVT_OPT_EXT_ASCII 17
  63. #define NVT_OPT_LOGOUT 18
  64. #define NVT_OPT_BYTE_MACRO 19
  65. #define NVT_OPT_DATA_ENTRY 20
  66. #define NVT_OPT_SUPDUP 21
  67. #define NVT_OPT_SUPDUP_OUT 22
  68. #define NVT_OPT_SEND_LOC 23
  69. #define NVT_OPT_TERM_TYPE 24
  70. #define NVT_OPT_EOR 25
  71. #define NVT_OPT_TACACS_UID 26
  72. #define NVT_OPT_OUT_MARK 27
  73. #define NVT_OPT_TTYLOC 28
  74. #define NVT_OPT_3270 29
  75. #define NVT_OPT_X_3_PAD 30
  76. #define NVT_OPT_NAWS 31
  77. #define NVT_OPT_TERM_SPEED 32
  78. #define NVT_OPT_REMOTE_FC 33
  79. #define NVT_OPT_LINEMODE 34
  80. #define NVT_OPT_X_LOC 35
  81. #define NVT_OPT_ENV 36
  82. #define NVT_OPT_AUTH 37
  83. #define NVT_OPT_ENCRYPT_OPT 38
  84. #define NVT_OPT_NEW_ENV 39
  85. #define NVT_OPT_TN3270E 40
  86. #define NVT_OPT_XAUTH 41
  87. #define NVT_OPT_CHARSET 42
  88. #define NVT_OPT_RSP 43
  89. #define NVT_OPT_COM_PORT_CTRL 44
  90. #define NVT_OPT_SUPR_LOCAL_ECHO 45
  91. #define NVT_OPT_START_TLS 46
  92. #define NVT_OPT_KERMIT 47
  93. #define NVT_OPT_SEND_URL 48
  94. #define NVT_OPT_FORWARD_X 49
  95. #define NVT_OPT_PRAGMA_LOGON 138
  96. #define NVT_OPT_SSPI_LOGON 139
  97. #define NVT_OPT_PRAGMA_HB 140
  98. #define NVT_OPT_EXT_OPT_LIST 255
  99. /** Describes a telnet command */
  100. struct telnet_simple_command {
  101. /** Mandatory IAC code */
  102. uint8_t iac;
  103. /** Type of operation (see Telnet commands above) */
  104. uint8_t op;
  105. /** Option code */
  106. uint8_t opt;
  107. };
  108. static inline void telnet_command_cpy(struct telnet_simple_command *dst,
  109. struct telnet_simple_command *src)
  110. {
  111. dst->iac = src->iac;
  112. dst->op = src->op;
  113. dst->opt = src->opt;
  114. }
  115. #endif /* SHELL_TELNET_PROTOCOL_H__ */