1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.net.telnet;
19
20
21
22
23
24
25
26
27
28
29 public class TelnetOption {
30
31 public static final int MAX_OPTION_VALUE = 255;
32
33 public static final int BINARY = 0;
34
35 public static final int ECHO = 1;
36
37 public static final int PREPARE_TO_RECONNECT = 2;
38
39 public static final int SUPPRESS_GO_AHEAD = 3;
40
41 public static final int APPROXIMATE_MESSAGE_SIZE = 4;
42
43 public static final int STATUS = 5;
44
45 public static final int TIMING_MARK = 6;
46
47 public static final int REMOTE_CONTROLLED_TRANSMISSION = 7;
48
49 public static final int NEGOTIATE_OUTPUT_LINE_WIDTH = 8;
50
51 public static final int NEGOTIATE_OUTPUT_PAGE_SIZE = 9;
52
53 public static final int NEGOTIATE_CARRIAGE_RETURN = 10;
54
55 public static final int NEGOTIATE_HORIZONTAL_TAB_STOP = 11;
56
57 public static final int NEGOTIATE_HORIZONTAL_TAB = 12;
58
59 public static final int NEGOTIATE_FORMFEED = 13;
60
61 public static final int NEGOTIATE_VERTICAL_TAB_STOP = 14;
62
63 public static final int NEGOTIATE_VERTICAL_TAB = 15;
64
65 public static final int NEGOTIATE_LINEFEED = 16;
66
67 public static final int EXTENDED_ASCII = 17;
68
69 public static final int FORCE_LOGOUT = 18;
70
71 public static final int BYTE_MACRO = 19;
72
73 public static final int DATA_ENTRY_TERMINAL = 20;
74
75 public static final int SUPDUP = 21;
76
77 public static final int SUPDUP_OUTPUT = 22;
78
79 public static final int SEND_LOCATION = 23;
80
81 public static final int TERMINAL_TYPE = 24;
82
83 public static final int END_OF_RECORD = 25;
84
85 public static final int TACACS_USER_IDENTIFICATION = 26;
86
87 public static final int OUTPUT_MARKING = 27;
88
89 public static final int TERMINAL_LOCATION_NUMBER = 28;
90
91 public static final int REGIME_3270 = 29;
92
93 public static final int X3_PAD = 30;
94
95 public static final int WINDOW_SIZE = 31;
96
97 public static final int TERMINAL_SPEED = 32;
98
99 public static final int REMOTE_FLOW_CONTROL = 33;
100
101 public static final int LINEMODE = 34;
102
103 public static final int X_DISPLAY_LOCATION = 35;
104
105 public static final int OLD_ENVIRONMENT_VARIABLES = 36;
106
107 public static final int AUTHENTICATION = 37;
108
109 public static final int ENCRYPTION = 38;
110
111 public static final int NEW_ENVIRONMENT_VARIABLES = 39;
112
113 public static final int EXTENDED_OPTIONS_LIST = 255;
114
115 @SuppressWarnings("unused")
116 private static final int FIRST_OPTION = BINARY;
117 private static final int LAST_OPTION = EXTENDED_OPTIONS_LIST;
118
119 private static final String[] optionString = { "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
120 "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", "DATA ENTRY TERMINAL", "SUPDUP",
121 "SUPDUP OUTPUT", "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", "NAWS",
122 "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON", "TN3270E", "XAUTH", "CHARSET", "RSP",
123 "Com Port Control", "Suppress Local Echo", "Start TLS", "KERMIT", "SEND-URL", "FORWARD_X", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
124 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
125 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
126 "TELOPT PRAGMA LOGON", "TELOPT SSPI LOGON", "TELOPT PRAGMA HEARTBEAT", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
127 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
128 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
129 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Extended-Options-List" };
130
131
132
133
134
135
136
137 public static final String getOption(final int code) {
138 if (optionString[code].isEmpty()) {
139 return "UNASSIGNED";
140 }
141 return optionString[code];
142 }
143
144
145
146
147
148
149
150 public static final boolean isValidOption(final int code) {
151 return code <= LAST_OPTION;
152 }
153
154
155 private TelnetOption() {
156 }
157 }