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
32 public static final int MAX_OPTION_VALUE = 255;
33
34
35
36
37 public static final int BINARY = 0;
38
39
40
41
42 public static final int ECHO = 1;
43
44
45
46
47 public static final int PREPARE_TO_RECONNECT = 2;
48
49
50
51
52 public static final int SUPPRESS_GO_AHEAD = 3;
53
54
55
56
57 public static final int APPROXIMATE_MESSAGE_SIZE = 4;
58
59
60
61
62 public static final int STATUS = 5;
63
64
65
66
67 public static final int TIMING_MARK = 6;
68
69
70
71
72 public static final int REMOTE_CONTROLLED_TRANSMISSION = 7;
73
74
75
76
77 public static final int NEGOTIATE_OUTPUT_LINE_WIDTH = 8;
78
79
80
81
82 public static final int NEGOTIATE_OUTPUT_PAGE_SIZE = 9;
83
84
85
86
87 public static final int NEGOTIATE_CARRIAGE_RETURN = 10;
88
89
90
91
92 public static final int NEGOTIATE_HORIZONTAL_TAB_STOP = 11;
93
94
95
96
97 public static final int NEGOTIATE_HORIZONTAL_TAB = 12;
98
99
100
101
102 public static final int NEGOTIATE_FORMFEED = 13;
103
104
105
106
107 public static final int NEGOTIATE_VERTICAL_TAB_STOP = 14;
108
109
110
111
112 public static final int NEGOTIATE_VERTICAL_TAB = 15;
113
114
115
116
117 public static final int NEGOTIATE_LINEFEED = 16;
118
119
120
121
122 public static final int EXTENDED_ASCII = 17;
123
124
125
126
127 public static final int FORCE_LOGOUT = 18;
128
129
130
131
132 public static final int BYTE_MACRO = 19;
133
134
135
136
137 public static final int DATA_ENTRY_TERMINAL = 20;
138
139
140
141
142 public static final int SUPDUP = 21;
143
144
145
146
147 public static final int SUPDUP_OUTPUT = 22;
148
149
150
151
152 public static final int SEND_LOCATION = 23;
153
154
155
156
157 public static final int TERMINAL_TYPE = 24;
158
159
160
161
162 public static final int END_OF_RECORD = 25;
163
164
165
166
167 public static final int TACACS_USER_IDENTIFICATION = 26;
168
169
170
171
172 public static final int OUTPUT_MARKING = 27;
173
174
175
176
177 public static final int TERMINAL_LOCATION_NUMBER = 28;
178
179
180
181
182 public static final int REGIME_3270 = 29;
183
184
185
186
187 public static final int X3_PAD = 30;
188
189
190
191
192 public static final int WINDOW_SIZE = 31;
193
194
195
196
197 public static final int TERMINAL_SPEED = 32;
198
199
200
201
202 public static final int REMOTE_FLOW_CONTROL = 33;
203
204
205
206
207 public static final int LINEMODE = 34;
208
209
210
211
212 public static final int X_DISPLAY_LOCATION = 35;
213
214
215
216
217 public static final int OLD_ENVIRONMENT_VARIABLES = 36;
218
219
220
221
222 public static final int AUTHENTICATION = 37;
223
224
225
226
227 public static final int ENCRYPTION = 38;
228
229
230
231
232 public static final int NEW_ENVIRONMENT_VARIABLES = 39;
233
234
235
236
237 public static final int EXTENDED_OPTIONS_LIST = 255;
238
239
240
241
242 @SuppressWarnings("unused")
243 private static final int FIRST_OPTION = BINARY;
244
245
246
247
248 private static final int LAST_OPTION = EXTENDED_OPTIONS_LIST;
249
250
251
252
253 private static final String[] optionString = { "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
254 "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", "DATA ENTRY TERMINAL", "SUPDUP",
255 "SUPDUP OUTPUT", "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", "NAWS",
256 "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON", "TN3270E", "XAUTH", "CHARSET", "RSP",
257 "Com Port Control", "Suppress Local Echo", "Start TLS", "KERMIT", "SEND-URL", "FORWARD_X", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
258 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
259 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
260 "TELOPT PRAGMA LOGON", "TELOPT SSPI LOGON", "TELOPT PRAGMA HEARTBEAT", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
261 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
262 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
263 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Extended-Options-List" };
264
265
266
267
268
269
270
271 public static final String getOption(final int code) {
272 if (optionString[code].isEmpty()) {
273 return "UNASSIGNED";
274 }
275 return optionString[code];
276 }
277
278
279
280
281
282
283
284 public static final boolean isValidOption(final int code) {
285 return code <= LAST_OPTION;
286 }
287
288
289 private TelnetOption() {
290 }
291 }