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