Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-tn3270.c
blob8c8f8da65c608c7b1ed36bcfaf47c088720378d7
1 /* packet-tn3270.c
2 * Routines for tn3270.packet dissection
4 * References:
5 * 3270 Information Display System: Data Stream Programmer's Reference
6 * GA23-0059-07
7 * http://publib.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CN7P4000
8 * (dead, not archived on the Wayback Machine)
9 * http://bitsavers.trailing-edge.com/pdf/ibm/3174/GA23-0059-07_3270_Data_Stream_Programmers_Reference_199206.pdf
10 * (some weird format)
11 * http://bitsavers.trailing-edge.com/pdf/ibm/3270/GA23-0059-07_3270_Data_Stream_Programmers_Reference_199206.pdf
12 * (straightforward scanned PDF, with OCR so searching might work)
13 * (Paragraph references in the comments in this file (e.g., 6.15) are to the above document)
15 * 3174 Establishment Controller Functional Description
16 * GA23-0218-11
17 * http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/cn7a7003
19 * RFC 1041: Telnet 3270 Regime Option
20 * https://tools.ietf.org/html/rfc1041
22 * RFC 1576: TN3270 Current Practices
23 * https://tools.ietf.org/html/rfc1576
25 * RFC 2355: TN3270 Enhancements
26 * https://tools.ietf.org/html/rfc2355
29 * Copyright 2009, Robert Hogan <robert@roberthogan.net>
31 * Wireshark - Network traffic analyzer
32 * By Gerald Combs <gerald@wireshark.org>
33 * Copyright 1998 Gerald Combs
35 * SPDX-License-Identifier: GPL-2.0-or-later
38 #include "config.h"
41 #include <epan/packet.h>
42 #include <epan/conversation.h>
43 #include <epan/expert.h>
44 #include <epan/tfs.h>
45 #include <wsutil/array.h>
47 #include "packet-tn3270.h"
49 void proto_register_tn3270(void);
51 /* Note well:
52 * In the IBM "3270 Information Display System: Data Stream Programmer's Reference"
53 * document, the references to bit numbers in the text and tables
54 * are based upon the "MSB 0" bit numbering scheme.
55 * That is: bits are numbered in a byte from left-to-right:
56 * "Bit 0" is the MSB of the byte
57 * "Bit 7" is the LSB of the byte
61 ToDo:
62 - better tree display: e.g., separate tree for each order code ....
63 - review 'structured field grouping: 5.2
64 - Telnet uses 0xFF as IAC ["interpret as command"] and thus for
65 telnet: any actual 0xFF bytes in a 3270 data stream will be prefixed with
66 a 0xFF escape. The escapes should be removed from the TVB before the
67 buffer is passed to this dissector. See packet-telnet.c
68 - Show the 'as a fraction" display as xx/yy ?
71 /* Dissection is for EBCDIC 3270 */
73 /* OUTBOUND DATA STREAM (MAINFRAME PROGRAM -> DISPLAY)
75 ________________ _____ __________________
76 | Command Code |WCC | Orders and Data |
77 |________________|_____|__________________|
80 ______ ______________________
81 | WSF | Structured Field(s) |
82 |______|______________________|
86 /*--- 3270 Command Codes - "Local Attachment" ----- */
87 #define CC_LCL_W 0x01
88 #define CC_LCL_EW 0x05
89 #define CC_LCL_EWA 0x0D
90 #define CC_LCL_EAU 0x0F
91 #define CC_LCL_WSF 0x11
93 #define CC_LCL_RB 0x02
94 #define CC_LCL_RM 0x06
95 #define CC_LCL_RMA 0x0E /* XXX Not valid ?? See 3174 Function Description 2.1.4 */
97 #if 0 /* ??? */
98 #define CC_NOP 0x03
99 #endif
102 /*--- 3.3 3270 Command Codes - "Remote Attachment" ----- */
103 #define CC_RMT_W 0xF1
104 #define CC_RMT_EW 0xF5
105 #define CC_RMT_EWA 0x7E
106 #define CC_RMT_EAU 0x6F
107 #define CC_RMT_WSF 0xF3
109 #define CC_RMT_RB 0xF2
110 #define CC_RMT_RM 0xF6
111 #define CC_RMT_RMA 0x6E
113 #define CC_SNA_BSC 0xF7 /* local copy in a BSC environment */
115 static const value_string vals_command_codes[] = {
117 { CC_LCL_W, "Write (Local)" },
118 { CC_LCL_EW, "Erase/Write (Local)" },
119 { CC_LCL_EWA, "Erase/Write Alternate (Local)" },
120 { CC_LCL_EAU, "Erase All Unprotected (Local)" },
121 { CC_LCL_WSF, "Write Structured Field (Local)" },
122 { CC_LCL_RB, "Read Buffer (Local)" },
123 { CC_LCL_RM, "Read Modified (Local)" },
124 { CC_LCL_RMA, "Read Modified All (Local)" },
125 { CC_RMT_W, "Write" },
126 { CC_RMT_EW, "Erase/Write" },
127 { CC_RMT_EWA, "Erase/Write Alternate" },
128 { CC_RMT_EAU, "Erase All Unprotected" },
129 { CC_RMT_WSF, "Write Structured Field" },
130 { CC_RMT_RB, "Read Buffer" },
131 { CC_RMT_RM, "Read Modified" },
132 { CC_RMT_RMA, "Read Modified All" },
133 { CC_SNA_BSC, "BSC Copy" },
134 { 0x00, NULL }
137 /*--- 3.4 WCC (Write Control Characters) ----- */
138 #define WCC_NOP 0x80 /* "Bit 0" */
139 #define WCC_RESET 0x40 /* "Bit 1" */
140 #define WCC_PRINTER1 0x20 /* "Bit 2" */
141 #define WCC_PRINTER2 0x10 /* "Bit 3" */
142 #define WCC_START_PRINTER 0x08 /* "Bit 4" */
143 #define WCC_SOUND_ALARM 0x04 /* "Bit 5" */
144 #define WCC_KEYBOARD_RESTORE 0x02 /* "Bit 6" */
145 #define WCC_RESET_MDT 0x01 /* "Bit 7" */
147 /*--- 4.3 Order Codes ----- */
148 #define OC_MAX 0x3F
150 #define OC_SF 0x1D
151 #define OC_SFE 0x29
152 #define OC_SBA 0x11
153 #define OC_SA 0x28
154 #define OC_MF 0x2C
155 #define OC_IC 0x13
156 #define OC_PT 0x05
157 #define OC_RA 0x3C
158 #define OC_EUA 0x12
159 #define OC_GE 0x08
161 static const value_string vals_order_codes[] = {
162 { OC_SF, "Start Field (SF)" },
163 { OC_SFE, "Start Field Extended (SFE)" },
164 { OC_SBA, "Set Buffer Address (SBA)" },
165 { OC_SA, "Set Attribute (SA)" },
166 { OC_MF, "Modify Field (MF)" },
167 { OC_IC, "Insert Cursor (IC)" },
168 { OC_PT, "Program Tab (PT)" },
169 { OC_RA, "Repeat to Address (RA)" },
170 { OC_EUA, "Erase Unprotected to Address (EUA)" },
171 { OC_GE, "Graphic Escape (GE)" },
172 { 0x00, NULL }
175 #if 0 /* Not used */
176 /*--- 4.3.11 Format Control Orders ----- */
177 /* Special treatment for display */
178 #define FCO_NUL 0x00
179 #define FCO_SUB 0x3F
180 #define FCO_DUP 0x1C
181 #define FCO_FM 0x1E
182 #define FCO_FF 0x0C
183 #define FCO_CR 0x0D
184 #define FCO_NL 0x15
185 #define FCO_EM 0x19
186 #define FCO_EO 0xFF
188 static const value_string vals_format_control_orders[] = {
189 { FCO_NUL, "Null" },
190 { FCO_SUB, "Substitute" },
191 { FCO_DUP, "Duplicate" },
192 { FCO_FM, "Field Mark" },
193 { FCO_FF, "Form Feed" },
194 { FCO_CR, "Carriage Return" },
195 { FCO_NL, "New Line" },
196 { FCO_EM, "End of Medium" },
197 { FCO_EO, "Eight Ones" },
198 { 0x00, NULL }
200 #endif
202 /*--- 8.7 Copy Control Code ----- */
203 /* Use for "local Copy" in a "BSC [BiSync] Environment" */
205 /* "Coding Bits" are those required such that the */
206 /* complete 8 bit CCC is a valid EBCDIC character */
207 #define CCC_GRAPHIC_CONVERT_MASK 0xC0
209 #define CCC_PRINT_BITS_MASK 0x30
210 #define CCC_PRINT_BITS_POINT_LINE_LENGTH 0x00
211 #define CCC_PRINT_BITS_PRINT_LINE_40 0x01
212 #define CCC_PRINT_BITS_PRINT_LINE_64 0x02
213 #define CCC_PRINT_BITS_PRINT_LINE_80 0x03
215 static const value_string ccc_vals_printout_format[] = {
216 { CCC_PRINT_BITS_POINT_LINE_LENGTH,
217 "The NL, EM, and CR orders in the data stream determine pointline length. "
218 "Provides a 132-print position line when the orders are not present." },
219 { CCC_PRINT_BITS_PRINT_LINE_40,
220 "Specifies a 40-character print line." },
221 { CCC_PRINT_BITS_PRINT_LINE_64,
222 "Specifies a 64-character print line." },
223 { CCC_PRINT_BITS_PRINT_LINE_80,
224 "Specifies an 80-character print line." },
225 { 0x00, NULL }
228 #define CCC_START_PRINT 0x08
229 #define CCC_SOUND_ALARM 0x04
231 #define CCC_ATTRIBUTE_BITS_MASK 0x03
232 #define CCC_ATTRIBUTE_BITS_ONLY_ATTRIBUTE_CHARACTERS 0x00
233 #define CCC_ATTRIBUTE_BITS_ATTRIBUTE_CHARACTERS_UNPROTECTED_AN 0x01
234 #define CCC_ATTRIBUTE_BITS_ALL_ATTRIBUTE_PROTECTED 0x02
235 #define CCC_ATTRIBUTE_BITS_ENTIRE_CONTENTS 0x03
237 static const value_string ccc_vals_copytype[] = {
238 { CCC_ATTRIBUTE_BITS_ONLY_ATTRIBUTE_CHARACTERS,
239 "Only attribute characters are copied." },
240 { CCC_ATTRIBUTE_BITS_ATTRIBUTE_CHARACTERS_UNPROTECTED_AN,
241 "Attribute characters and unprotected alphanumeric fields"
242 " (including nulls) are copied. Nulls are transferred for"
243 " the alphanumeric characters not copied from the"
244 " protected fields." },
245 { CCC_ATTRIBUTE_BITS_ALL_ATTRIBUTE_PROTECTED,
246 "All attribute characters and protected alphanumeric fields"
247 " (including nulls) are copied. Nulls are transferred for the alphanumeric characters not"
248 " copied from the unprotected fields." },
249 { CCC_ATTRIBUTE_BITS_ENTIRE_CONTENTS,
250 "The entire contents of the storage buffer (including nulls) are copied." },
251 { 0x00, NULL }
254 /*--- 4.4.1 Field Attributes ----- */
255 #define FA_GRAPHIC_CONVERT_MASK 0xC0
257 #define FA_PROTECTED 0x20 /* "Bit 2" */
258 #define FA_NUMERIC 0x10 /* "Bit 3" */
260 #define FA_RESERVED 0x02 /* "Bit 6" */
261 #define FA_MODIFIED 0x01 /* "Bit 7" */
263 #define FA_DISPLAY_BITS_MASK 0x0C /* "Bits 4,5" */
264 #define FA_DISPLAY_BITS_DISPLAY_NOT_SELECTOR_PEN_DETECTABLE 0x00
265 #define FA_DISPLAY_BITS_DISPLAY_SELECTOR_PEN_DETECTABLE 0x01
266 #define FA_DISPLAY_BITS_INTENSIFIED_DISPLAY_SELECTOR_PEN_DETECTABLE 0x02
267 #define FA_DISPLAY_BITS_NON_DISPLAY_NON_DETECTABLE 0x03
269 static const value_string vals_fa_display[] = {
270 { FA_DISPLAY_BITS_DISPLAY_NOT_SELECTOR_PEN_DETECTABLE, "Display/Not Selector Pen Detectable" },
271 { FA_DISPLAY_BITS_DISPLAY_SELECTOR_PEN_DETECTABLE, "Display/Selector Pen Detectable" },
272 { FA_DISPLAY_BITS_INTENSIFIED_DISPLAY_SELECTOR_PEN_DETECTABLE, "Intensified Display/Selector Pen Detectable" },
273 { FA_DISPLAY_BITS_NON_DISPLAY_NON_DETECTABLE, "Non Display, Non Detectable (not printable)" },
274 { 0x00, NULL }
277 /*--- 4.4.5 Attribute Types ----- */
278 #define AT_ALL_CHARACTER_ATTRIBUTES 0x00
279 #define AT_T3270_FIELD_ATTRIBUTE 0xC0
280 #define AT_FIELD_VALIDATION 0xC1
281 #define AT_FIELD_OUTLINING 0xC2
282 #define AT_EXTENDED_HIGHLIGHTING 0x41
283 #define AT_FOREGROUND_COLOR 0x42
284 #define AT_CHARACTER_SET 0x43
285 #define AT_BACKGROUND_COLOR 0x45
286 #define AT_TRANSPARENCY 0x46
289 static const value_string vals_attribute_types[] = {
290 { AT_ALL_CHARACTER_ATTRIBUTES, "All character attributes" },
291 { AT_T3270_FIELD_ATTRIBUTE, "3270 Field attribute" },
292 { AT_FIELD_VALIDATION, "Field validation" },
293 { AT_FIELD_OUTLINING, "Field outlining" },
294 { AT_EXTENDED_HIGHLIGHTING, "Extended highlighting" },
295 { AT_FOREGROUND_COLOR, "Foreground color" },
296 { AT_CHARACTER_SET, "Character set" },
297 { AT_BACKGROUND_COLOR, "Background color" },
298 { AT_TRANSPARENCY, "Transparency" },
299 { 0x00, NULL }
302 /*--- 4.4.6.3 Extended Highlighting ----- */
303 #define AT_EH_DEFAULT_HIGHLIGHTING 0x00
304 #define AT_EH_NORMAL 0xF0
305 #define AT_EH_BLINK 0xF1
306 #define AT_EH_REVERSE_VIDEO 0xF2
307 #define AT_EH_UNDERSCORE 0xF4
309 static const value_string vals_at_extended_highlighting[] = {
310 { AT_EH_DEFAULT_HIGHLIGHTING, "Default" },
311 { AT_EH_NORMAL, "Normal (as determined by the 3270 field attribute)" },
312 { AT_EH_BLINK, "Blink" },
313 { AT_EH_REVERSE_VIDEO, "Reverse video" },
314 { AT_EH_UNDERSCORE, "Underscore." },
315 { 0x00, NULL }
318 /*--- 4.4.6.4 Color Identifications ----- */
319 #define AT_CI_ALL_PLANES 0x00
320 #define AT_CI_BLUE_PLANE 0x01
321 #define AT_CI_RED_PLANE 0x02
322 #define AT_CI_GREEN_PLANE 0x04
323 #define AT_CI_NEUTRAL1 0xF0
324 #define AT_CI_BLUE 0xF1
325 #define AT_CI_RED 0xF2
326 #define AT_CI_PINK 0xF3
327 #define AT_CI_GREEN 0xF4
328 #define AT_CI_TURQUOISE 0xF5
329 #define AT_CI_YELLOW 0xF6
330 #define AT_CI_NEUTRAL2 0xF7
331 #define AT_CI_BLACK 0xF8
332 #define AT_CI_DEEP_BLUE 0xF9
333 #define AT_CI_ORANGE 0xFA
334 #define AT_CI_PURPLE 0xFB
335 #define AT_CI_PALE_GREEN 0xFC
336 #define AT_CI_PALE_TURQUOISE 0xFD
337 #define AT_CI_GREY 0xFE
338 #define AT_CI_WHITE 0xFF
341 static const value_string vals_at_color_identifications[] = {
342 { AT_CI_ALL_PLANES, "ALL PLANES" },
343 { AT_CI_BLUE_PLANE, "BLUE PLANE" },
344 { AT_CI_RED_PLANE, "RED PLANE" },
345 { AT_CI_GREEN_PLANE, "GREEN PLANE" },
346 { AT_CI_NEUTRAL1, "Neutral" },
347 { AT_CI_BLUE, "Blue" },
348 { AT_CI_RED, "Red" },
349 { AT_CI_PINK, "Pink" },
350 { AT_CI_GREEN, "Green" },
351 { AT_CI_TURQUOISE, "Turquoise" },
352 { AT_CI_YELLOW, "Yellow" },
353 { AT_CI_NEUTRAL2, "Neutral" },
354 { AT_CI_BLACK, "Black" },
355 { AT_CI_DEEP_BLUE, "Deep Blue" },
356 { AT_CI_ORANGE, "Orange" },
357 { AT_CI_PURPLE, "Purple" },
358 { AT_CI_PALE_GREEN, "Pale Green" },
359 { AT_CI_PALE_TURQUOISE, "Pale Turquoise" },
360 { AT_CI_GREY, "Grey" },
361 { AT_CI_WHITE, "White" },
362 { 0x00, NULL }
365 /*--- 4.4.6.5 Character Set ----- */
366 #define AT_CS_DEFAULT_CHARACTER_SET 0x00
367 #define AT_CS_MIN_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS 0x40
368 #define AT_CS_MAX_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS 0xEF
369 #define AT_CS_MIN_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS 0xF0
370 #define AT_CS_MAX_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS 0xF7
371 #define AT_CS_MIN_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS 0xF8
372 #define AT_CS_MAX_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS 0xFE
374 static const range_string rvals_at_character_set[] = {
375 { AT_CS_DEFAULT_CHARACTER_SET,
376 AT_CS_DEFAULT_CHARACTER_SET,
377 "Default Character Set" },
378 { AT_CS_MIN_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS,
379 AT_CS_MAX_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS,
380 "Local Id For Loadable Character Sets" },
381 { AT_CS_MIN_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS,
382 AT_CS_MAX_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS,
383 "Local Id For Nonloadable Character Sets" },
384 { AT_CS_MIN_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS,
385 AT_CS_MAX_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS,
386 "Local Id For Two Byte Coded Character Sets" },
387 { 0, 0, NULL }
390 /*--- 4.4.6.6 Field Outlining ----- */
391 #define AT_FO_NO_OUTLINING_LINES 0X00
392 #define AT_FO_UNDERLINE_ONLY 0X01
393 #define AT_FO_RIGHT_VERTICAL_LINE_ONLY 0X02
394 #define AT_FO_OVERLINE_ONLY 0X04
395 #define AT_FO_LEFT_VERTICAL_LINE_ONLY 0X08
396 #define AT_FO_UNDERLINE_AND_RIGHT_VERTICAL_LINE 0X03
397 #define AT_FO_UNDERLINE_AND_OVERLINE 0X05
398 #define AT_FO_UNDERLINE_AND_LEFT_VERTICAL_LINE 0X09
399 #define AT_FO_RIGHT_VERTICAL_LINE_AND_OVERLINE 0X06
400 #define AT_FO_RIGHT_AND_LEFT_VERTICAL_LINES 0X0A
401 #define AT_FO_OVERLINE_AND_LEFT_VERTICAL_LINE 0X0C
402 #define AT_FO_RECTANGLE_MINUS_LEFT_VERTICAL_LINE 0X07
403 #define AT_FO_RECTANGLE_MINUS_OVERLINE 0X0B
404 #define AT_FO_RECTANGLE_MINUS_RIGHT_VERTICAL_LINE 0X0D
405 #define AT_FO_RECTANGLE_MINUS_UNDERLINE 0X0E
406 #define AT_FO_RECTANGLE 0X0F
408 static const value_string vals_at_field_outlining[] = {
409 { AT_FO_NO_OUTLINING_LINES, "No outlining lines" },
410 { AT_FO_UNDERLINE_ONLY, "Underline only" },
411 { AT_FO_RIGHT_VERTICAL_LINE_ONLY, "Right vertical line only" },
412 { AT_FO_OVERLINE_ONLY, "Overline only" },
413 { AT_FO_LEFT_VERTICAL_LINE_ONLY, "Left vertical line only" },
414 { AT_FO_UNDERLINE_AND_RIGHT_VERTICAL_LINE, "Underline and right vertical line" },
415 { AT_FO_UNDERLINE_AND_OVERLINE, "Underline and overline" },
416 { AT_FO_UNDERLINE_AND_LEFT_VERTICAL_LINE, "Underline and left vertical line" },
417 { AT_FO_RIGHT_VERTICAL_LINE_AND_OVERLINE, "Right vertical line and overline" },
418 { AT_FO_RIGHT_AND_LEFT_VERTICAL_LINES, "Right and left vertical lines" },
419 { AT_FO_OVERLINE_AND_LEFT_VERTICAL_LINE, "Overline and left vertical line" },
420 { AT_FO_RECTANGLE_MINUS_LEFT_VERTICAL_LINE, "Rectangle minus left vertical line" },
421 { AT_FO_RECTANGLE_MINUS_OVERLINE, "Rectangle minus overline" },
422 { AT_FO_RECTANGLE_MINUS_RIGHT_VERTICAL_LINE, "Rectangle minus right vertical line" },
423 { AT_FO_RECTANGLE_MINUS_UNDERLINE, "Rectangle minus underline" },
424 { AT_FO_RECTANGLE, "Rectangle" },
425 { 0x00, NULL }
428 /*--- 4.4.6.7 Transparency ----- */
429 #define AT_TR_DEFAULT_TRANSPARENCY 0X00
430 #define AT_TR_BACKGROUND_IS_TRANSPARENT_OR 0XF0
431 #define AT_TR_BACKGROUND_IS_TRANSPARENT_XOR 0XF1
432 #define AT_TR_BACKGROUND_IS_OPAQUE 0XFF
434 static const value_string vals_at_transparency[] = {
435 { AT_TR_DEFAULT_TRANSPARENCY, "Default" },
436 { AT_TR_BACKGROUND_IS_TRANSPARENT_OR, "Background is transparent (OR)" },
437 { AT_TR_BACKGROUND_IS_TRANSPARENT_XOR, "Background is transparent (XOR)" },
438 { AT_TR_BACKGROUND_IS_OPAQUE, "Background is opaque (non-transparent)" },
439 { 0x00, NULL }
442 /*--- 4.4.6.8 Field Validation ----- */
443 #define AT_FV_MANDATORY_FILL 0x04 /* "Bit 5" */
444 #define AT_FV_MANDATORY_ENTRY 0x02 /* "Bit 6" */
445 #define AT_FV_TRIGGER 0x01 /* "Bit 7" */
447 static const struct true_false_string tn3270_field_validation_mandatory_fill = {
448 "Mandatory fill",
452 static const struct true_false_string tn3270_field_validation_mandatory_entry = {
453 "Mandatory entry",
457 static const struct true_false_string tn3270_field_validation_trigger = {
458 "Trigger",
462 /*--- 5.1 Outbound Structured Fields ----- */
463 #define SF_OB_ACTIVATE_PARTITION 0x0E
464 #define SF_OB_BEGIN_OR_END_OF_FILE 0x0F85
465 #define SF_OB_CREATE_PARTITION 0x0C
466 #define SF_OB_DESTROY_PARTITION 0x0D
467 #define SF_OB_ERASE_OR_RESET 0x03
468 #define SF_OB_LOAD_COLOR_TABLE 0x0F05
469 #define SF_OB_LOAD_FORMAT_STORAGE 0x0F24
470 #define SF_OB_LOAD_LINE_TYPE 0x0F07
471 #define SF_OB_LOAD_PROGRAMMED_SYMBOLS 0x06
472 #define SF_OB_MODIFY_PARTITION 0x0F0A
473 #define SF_OB_OUTBOUND_TEXT_HEADER 0x0F71
474 #define SF_OB_OUTBOUND_3270DS 0x40
475 #define SF_OB_PRESENT_ABSOLUTE_FORMAT 0x4B
476 #define SF_OB_PRESENT_RELATIVE_FORMAT 0x4C
477 #define SF_OB_SET_PARTITION_CHARACTERISTICS 0x0F08
478 #define SF_OB_SET_REPLY_MODE 0x09
479 #define SF_OB_TYPE_1_TEXT_OUTBOUND 0x0FC1
480 #define SF_OB_READ_PARTITION 0x01
481 #define SF_OB_REQUEST_RECOVERY_DATA 0x1030
482 #define SF_OB_RESET_PARTITION 0x00
483 #define SF_OB_RESTART 0x1033
484 #define SF_OB_SCS_DATA 0x41
485 #define SF_OB_SELECT_COLOR_TABLE 0x0F04
486 #define SF_OB_SELECT_FORMAT_GROUP 0x4A
487 #define SF_OB_SET_CHECKPOINT_INTERVAL 0x1032
488 #define SF_OB_SET_MSR_CONTROL 0x0F01
489 #define SF_OB_SET_PRINTER_CHARACTERISTICS 0x0F84
490 #define SF_OB_SET_WINDOW_ORIGIN 0x0B
493 static const value_string vals_outbound_structured_fields[] = {
494 { SF_OB_ACTIVATE_PARTITION, "Activate Partition" },
495 { SF_OB_BEGIN_OR_END_OF_FILE, "Begin Or End Of File" },
496 { SF_OB_CREATE_PARTITION, "Create Partition" },
497 { SF_OB_DESTROY_PARTITION, "Destroy Partition" },
498 { SF_OB_ERASE_OR_RESET, "Erase Or Reset" },
499 { SF_OB_LOAD_COLOR_TABLE, "Load Color Table" },
500 { SF_OB_LOAD_FORMAT_STORAGE, "Load Format Storage" },
501 { SF_OB_LOAD_LINE_TYPE, "Load Line Type" },
502 { SF_OB_LOAD_PROGRAMMED_SYMBOLS, "Load Programmed Symbols" },
503 { SF_OB_MODIFY_PARTITION, "Modify Partition" },
504 { SF_OB_OUTBOUND_TEXT_HEADER, "Outbound Text Header" },
505 { SF_OB_OUTBOUND_3270DS, "Outbound 3270ds" },
506 { SF_OB_PRESENT_ABSOLUTE_FORMAT, "Present Absolute Format" },
507 { SF_OB_PRESENT_RELATIVE_FORMAT, "Present Relative Format" },
508 { SF_OB_SET_PARTITION_CHARACTERISTICS, "Set Partition Characteristics" },
509 { SF_OB_SET_REPLY_MODE, "Set Reply Mode" },
510 { SF_OB_TYPE_1_TEXT_OUTBOUND, "Type 1 Text Outbound" },
511 { SF_OB_READ_PARTITION, "Read Partition" },
512 { SF_OB_REQUEST_RECOVERY_DATA, "Request Recovery Data" },
513 { SF_OB_RESET_PARTITION, "Reset Partition" },
514 { SF_OB_RESTART, "Restart" },
515 { SF_OB_SCS_DATA, "Scs Data" },
516 { SF_OB_SELECT_COLOR_TABLE, "Select Color Table" },
517 { SF_OB_SELECT_FORMAT_GROUP, "Select Format Group" },
518 { SF_OB_SET_CHECKPOINT_INTERVAL, "Set Checkpoint Interval" },
519 { SF_OB_SET_MSR_CONTROL, "Set Msr Control" },
520 { SF_OB_SET_PRINTER_CHARACTERISTICS, "Set Printer Characteristics" },
521 { SF_OB_SET_WINDOW_ORIGIN, "Set Window Origin" },
522 { 0x00, NULL }
525 /*--- 5.1 Outbound/Inbound Structured Fields ----- */
526 #define SF_OB_IB_DATA_CHAIN 0x0F21
527 #define SF_OB_IB_DESTINATION_OR_ORIGIN 0x0F02
528 #define SF_OB_IB_OBJECT_CONTROL 0x0F11
529 #define SF_OB_IB_OBJECT_DATA 0x0F0F
530 #define SF_OB_IB_OBJECT_PICTURE 0x0F10
531 #define SF_OB_IB_OEM_DATA 0x0F1F
532 #define SF_OB_IB_SAVE_OR_RESTORE_FORMAT 0x1034
533 #define SF_OB_IB_SELECT_IPDS_MODE 0x0F83
535 static const value_string vals_outbound_inbound_structured_fields[] = {
536 { SF_OB_IB_DATA_CHAIN, "Data Chain" },
537 { SF_OB_IB_DESTINATION_OR_ORIGIN, "Destination/Origin" },
538 { SF_OB_IB_OBJECT_CONTROL, "Object Control" },
539 { SF_OB_IB_OBJECT_DATA, "Object Data" },
540 { SF_OB_IB_OBJECT_PICTURE, "Object Picture" },
541 { SF_OB_IB_OEM_DATA, "OEM Data" },
542 { SF_OB_IB_SAVE_OR_RESTORE_FORMAT, "Save/Restore Format" },
543 { SF_OB_IB_SELECT_IPDS_MODE, "Select IPDS Mode." },
544 { 0x00, NULL }
547 /*--- 5.11 Load Format Storage ----- */
548 #define LOAD_FORMAT_STORAGE_OPERAND_ADD 0x01
549 #define LOAD_FORMAT_STORAGE_OPERAND_DELETE_FORMAT 0x02
550 #define LOAD_FORMAT_STORAGE_OPERAND_DELETE_GROUP 0x03
551 #define LOAD_FORMAT_STORAGE_OPERAND_RESET_ALL 0x04
552 #define LOAD_FORMAT_STORAGE_OPERAND_REQUEST_SUMMARY_STATUS 0x05
553 #define LOAD_FORMAT_STORAGE_OPERAND_REQUEST_GROUP_STATUS 0x06
555 static const value_string vals_load_storage_format_operand[] = {
556 { LOAD_FORMAT_STORAGE_OPERAND_ADD, "Add" },
557 { LOAD_FORMAT_STORAGE_OPERAND_DELETE_FORMAT, "Delete Format" },
558 { LOAD_FORMAT_STORAGE_OPERAND_DELETE_GROUP, "Delete Group" },
559 { LOAD_FORMAT_STORAGE_OPERAND_RESET_ALL, "Reset All" },
560 { LOAD_FORMAT_STORAGE_OPERAND_REQUEST_SUMMARY_STATUS, "Request Summary Status" },
561 { LOAD_FORMAT_STORAGE_OPERAND_REQUEST_GROUP_STATUS, "Request Group Status" },
562 { 0x00, NULL }
565 /*--- 5.19 Read Partition ----- */
566 #define READ_PARTITION_OPTYPE_QUERY 0x02
567 #define READ_PARTITION_OPTYPE_QUERY_LIST 0x03
568 #define READ_PARTITION_OPTYPE_READ_MODIFIED_ALL 0x6E
569 #define READ_PARTITION_OPTYPE_READ_BUFFER 0xF2
570 #define READ_PARTITION_OPTYPE_READ_MODIFIED 0xF6
572 static const value_string vals_read_partition_operation_type[] = {
573 { READ_PARTITION_OPTYPE_QUERY, "Read Partition Query" },
574 { READ_PARTITION_OPTYPE_QUERY_LIST, "Read Partition Query List" },
575 { READ_PARTITION_OPTYPE_READ_MODIFIED_ALL, "Read Partition Read Modified All" },
576 { READ_PARTITION_OPTYPE_READ_BUFFER, "Read Partition Read Buffer" },
577 { READ_PARTITION_OPTYPE_READ_MODIFIED, "Read Partition Read Modified" },
578 { 0x00, NULL }
581 #define READ_PARTITION_REQTYPE_MASK 0xC0
582 static const value_string vals_read_partition_reqtype[] = {
583 { 0x00, "QCODE List" },
584 { 0x01, "Equivalent + QCODE List" },
585 { 0x02, "All" },
586 { 0x00, NULL }
589 /*--- 5.34 Data Chain ----- */
590 #define DATA_CHAIN_GROUP_MASK 0x60
591 #define DATA_CHAIN_INBOUND_CONTROL_MASK 0x18
593 static const value_string vals_data_chain_group[] = {
594 { 0x00, "Continue" },
595 { 0x01, "End" },
596 { 0x02, "Begin" },
597 { 0x03, "Only" },
598 { 0x00, NULL }
601 static const value_string vals_data_chain_inbound_control[] = {
602 { 0x00, "No Change" },
603 { 0x01, "Enable Inbound Data Chaining" },
604 { 0x02, "Disable Inbound Data Chaining" },
605 { 0x03, "Reserved" },
606 { 0x00, NULL }
609 /*--- 5.35 Destination or Origin ----- */
610 #define DESTINATION_OR_ORIGIN_FLAGS_INPUT_CONTROL_MASK 0xC0
612 static const value_string vals_destination_or_origin_flags_input_control[] = {
613 { 0x00, "Enable input" },
614 { 0x01, "No Change" },
615 { 0x02, "Disable Input" },
616 { 0x03, "Reserved" },
617 { 0x00, NULL }
621 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */
624 ______ _______ ________ _______
625 | | | | |
626 | AID | Cursor address | Data |
627 | | (2 bytes) | |
628 | | | | |
629 |______|_______|________|_______|
631 An inbound data stream can also consist of an AID (X'88') followed by
632 structured fields as follows:
633 ______ __________________ ________ ___________________
634 | | | | |
635 | AID | Structured Field | ...... | Structured Field |
636 | 0x88 | | | |
637 |______|__________________|________|___________________|
642 /*--- 3.5.6 Attention Identification Bytes (AID) ----- */
643 #define AID_NO_AID_GENERATED 0x60
644 #define AID_NO_AID_GENERATED_PRINTER_ONLY 0xE8
645 #define AID_STRUCTURED_FIELD 0x88
646 #define AID_READ_PARTITION_AID 0x61
647 #define AID_TRIGGER_ACTION 0x7F
648 #define AID_TEST_REQ_AND_SYS_REQ 0xF0
649 #define AID_PF1_KEY 0xF1
650 #define AID_PF2_KEY 0xF2
651 #define AID_PF3_KEY 0xF3
652 #define AID_PF4_KEY 0xF4
653 #define AID_PF5_KEY 0xF5
654 #define AID_PF6_KEY 0xF6
655 #define AID_PF7_KEY 0xF7
656 #define AID_PF8_KEY 0xF8
657 #define AID_PF9_KEY 0xF9
658 #define AID_PF10_KEY 0x7A
659 #define AID_PF11_KEY 0x7B
660 #define AID_PF12_KEY 0x7C
661 #define AID_PF13_KEY 0xC1
662 #define AID_PF14_KEY 0xC2
663 #define AID_PF15_KEY 0xC3
664 #define AID_PF16_KEY 0xC4
665 #define AID_PF17_KEY 0xC5
666 #define AID_PF18_KEY 0xC6
667 #define AID_PF19_KEY 0xC7
668 #define AID_PF20_KEY 0xC8
669 #define AID_PF21_KEY 0xC9
670 #define AID_PF22_KEY 0x4A
671 #define AID_PF23_KEY 0x4B
672 #define AID_PF24_KEY 0x4C
673 #define AID_PA1_KEY 0x6C
674 #define AID_PA2_KEY_CNCL 0x6E
675 #define AID_PA3_KEY 0x6B
676 #define AID_CLEAR_KEY 0x6D
677 #define AID_CLEAR_PARTITION_KEY 0x6A
678 #define AID_ENTER_KEY 0x7D
679 #define AID_SELECTOR_PEN_ATTENTION 0x7E
680 #define AID_OPERATOR_ID_READER 0xE6
681 #define AID_MAG_READER_NUMBER 0xE7
683 static const value_string vals_attention_identification_bytes[] = {
684 { AID_NO_AID_GENERATED, "No AID generated" },
685 { AID_NO_AID_GENERATED_PRINTER_ONLY, "No AID generated (printer only)" },
686 { AID_STRUCTURED_FIELD, "Structured field" },
687 { AID_READ_PARTITION_AID, "Read partition" },
688 { AID_TRIGGER_ACTION, "Trigger action" },
689 { AID_TEST_REQ_AND_SYS_REQ, "Test Req and Sys Req" },
690 { AID_PF1_KEY, "PF1 key" },
691 { AID_PF2_KEY, "PF2 key" },
692 { AID_PF3_KEY, "PF3 key" },
693 { AID_PF4_KEY, "PF4 key" },
694 { AID_PF5_KEY, "PF5 key" },
695 { AID_PF6_KEY, "PF6 key" },
696 { AID_PF7_KEY, "PF7 key" },
697 { AID_PF8_KEY, "PF8 key" },
698 { AID_PF9_KEY, "PF9 key" },
699 { AID_PF10_KEY, "PF10 key" },
700 { AID_PF11_KEY, "PF11 key" },
701 { AID_PF12_KEY, "PF12 key" },
702 { AID_PF13_KEY, "PF13 key" },
703 { AID_PF14_KEY, "PF14 key" },
704 { AID_PF15_KEY, "PF15 key" },
705 { AID_PF16_KEY, "PF16 key" },
706 { AID_PF17_KEY, "PF17 key" },
707 { AID_PF18_KEY, "PF18 key" },
708 { AID_PF19_KEY, "PF19 key" },
709 { AID_PF20_KEY, "PF20 key" },
710 { AID_PF21_KEY, "PF21 key" },
711 { AID_PF22_KEY, "PF22 key" },
712 { AID_PF23_KEY, "PF23 key" },
713 { AID_PF24_KEY, "PF24 key" },
714 { AID_PA1_KEY, "PA1 key" },
715 { AID_PA2_KEY_CNCL, "PA2 key (Cncl)" },
716 { AID_PA3_KEY, "PA3 key" },
717 { AID_CLEAR_KEY, "Clear key" },
718 { AID_CLEAR_PARTITION_KEY, "Clear Partition key" },
719 { AID_ENTER_KEY, "Enter key" },
720 { AID_SELECTOR_PEN_ATTENTION, "Selector pen attention" },
721 { AID_OPERATOR_ID_READER, "Operator ID reader" },
722 { AID_MAG_READER_NUMBER, "Mag Reader Number" },
723 { 0x00, NULL }
726 /*--- 5.3.6 Object Control ----- */
727 #define OBJC_GRAPHICS 0x00
728 #define OBJC_IMAGE 0x01
730 static const value_string vals_oc_type[] = {
731 { OBJC_GRAPHICS, "Graphics" },
732 { OBJC_IMAGE, "Image)" },
733 { 0x00, NULL }
736 /*--- 6.1 Inbound Structured Fields ----- */
737 #define SF_IB_EXCEPTION_OR_STATUS 0x0F22
738 #define SF_IB_INBOUND_TEXT_HEADER 0x0FB1
739 #define SF_IB_INBOUND_3270DS 0x0F80 /* TODO: Check */
740 #define SF_IB_RECOVERY_DATA 0x1031
741 #define SF_IB_TYPE_1_TEXT_INBOUND 0x0FC1
742 #define SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS 0x8184
743 #define SF_IB_QUERY_REPLY_AUXILIARY_DEVICE 0x8199
744 #define SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE 0x819F
745 #define SF_IB_QUERY_REPLY_CHARACTER_SETS 0x8185
746 #define SF_IB_QUERY_REPLY_COLOR 0x8186
747 #define SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR 0x81AB
748 #define SF_IB_QUERY_REPLY_DATA_CHAINING 0x8198
749 #define SF_IB_QUERY_REPLY_DATA_STREAMS 0x81A2
750 #define SF_IB_QUERY_REPLY_DBCS_ASIA 0x8191
751 #define SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS 0x81A0
752 #define SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT 0x8195
753 #define SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE 0x8197
754 #define SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE 0x81B5
755 #define SF_IB_QUERY_REPLY_FIELD_OUTLINING 0x818C
756 #define SF_IB_QUERY_REPLY_FIELD_VALIDATION 0x818A
757 #define SF_IB_QUERY_REPLY_FORMAT_PRESENTATION 0x8190
758 #define SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE 0x8194
759 #define SF_IB_QUERY_REPLY_GRAPHIC_COLOR 0x81B4
760 #define SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS 0x81B6
761 #define SF_IB_QUERY_REPLY_HIGHLIGHTING 0x8187
762 #define SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE 0x819E
763 #define SF_IB_QUERY_REPLY_IMAGE 0x8182
764 #define SF_IB_QUERY_REPLY_IMPLICIT_PARTITION 0x81A6
765 #define SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE 0x81AA
766 #define SF_IB_QUERY_REPLY_LINE_TYPE 0x81B2
767 #define SF_IB_QUERY_REPLY_MSR_CONTROL 0x818B
768 #define SF_IB_QUERY_REPLY_NULL 0x81FF
769 #define SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE 0x818F
770 #define SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES 0x81A7
771 #define SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS 0x818E
772 #define SF_IB_QUERY_REPLY_PORT 0x81B3
773 #define SF_IB_QUERY_REPLY_PROCEDURE 0x81B1
774 #define SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM 0x819C
775 #define SF_IB_QUERY_REPLY_REPLY_MODES 0x8188
776 #define SF_IB_QUERY_REPLY_RPQ_NAMES 0x81A1
777 #define SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT 0x8192
778 #define SF_IB_QUERY_REPLY_SEGMENT 0x81B0
779 #define SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS 0x81A9
780 #define SF_IB_QUERY_REPLY_STORAGE_POOLS 0x8196
781 #define SF_IB_QUERY_REPLY_SUMMARY 0x8180
782 #define SF_IB_QUERY_REPLY_TEXT_PARTITIONS 0x8183
783 #define SF_IB_QUERY_REPLY_TRANSPARENCY 0x81A8
784 #define SF_IB_QUERY_REPLY_USABLE_AREA 0x8181
785 #define SF_IB_QUERY_REPLY_3270_IPDS 0x819A
787 static const value_string vals_inbound_structured_fields[] = {
788 { SF_IB_EXCEPTION_OR_STATUS, "Exception/Status" },
789 { SF_IB_INBOUND_TEXT_HEADER, "Inbound Text Header" },
790 { SF_IB_INBOUND_3270DS, "Inbound 3270DS" },
791 { SF_IB_RECOVERY_DATA, "Recovery Data" },
792 { SF_IB_TYPE_1_TEXT_INBOUND, "Type 1 Text Inbound" },
793 { SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS, "Query Reply (Alphanumeric Partitions)" },
794 { SF_IB_QUERY_REPLY_AUXILIARY_DEVICE, "Query Reply (Auxiliary Device)" },
795 { SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE, "Query Reply (Begin/End of File)" },
796 { SF_IB_QUERY_REPLY_CHARACTER_SETS, "Query Reply (Character Sets)" },
797 { SF_IB_QUERY_REPLY_COLOR, "Query Reply (Color)" },
798 { SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR, "Query Reply (Cooperative Processing Requestor)" },
799 { SF_IB_QUERY_REPLY_DATA_CHAINING, "Query Reply (Data Chaining)" },
800 { SF_IB_QUERY_REPLY_DATA_STREAMS, "Query Reply (Data Streams)" },
801 { SF_IB_QUERY_REPLY_DBCS_ASIA, "Query Reply (DBCS-Asia)" },
802 { SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS, "Query Reply (Device Characteristics)" },
803 { SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT, "Query Reply (Distributed Data Management)" },
804 { SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE, "Query Reply (Document Interchange Architecture)" },
805 { SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE, "Query Reply (Extended Drawing Routine)" },
806 { SF_IB_QUERY_REPLY_FIELD_OUTLINING, "Query Reply (Field Outlining)" },
807 { SF_IB_QUERY_REPLY_FIELD_VALIDATION, "Query Reply (Field Validation)" },
808 { SF_IB_QUERY_REPLY_FORMAT_PRESENTATION, "Query Reply (Format Presentation)" },
809 { SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE, "Query Reply (Format Storage Auxiliary Device)" },
810 { SF_IB_QUERY_REPLY_GRAPHIC_COLOR, "Query Reply (Graphic Color)" },
811 { SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS, "Query Reply (Graphic Symbol Sets)" },
812 { SF_IB_QUERY_REPLY_HIGHLIGHTING, "Query Reply (Highlighting)" },
813 { SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE, "Query Reply (IBM Auxiliary Device)" },
814 { SF_IB_QUERY_REPLY_IMAGE, "Query Reply (Image)" },
815 { SF_IB_QUERY_REPLY_IMPLICIT_PARTITION, "Query Reply (Implicit Partition)" },
816 { SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE, "Query Reply (IOCA Auxiliary Device)" },
817 { SF_IB_QUERY_REPLY_LINE_TYPE, "Query Reply (Line Type)" },
818 { SF_IB_QUERY_REPLY_MSR_CONTROL, "Query Reply (MSR Control)" },
819 { SF_IB_QUERY_REPLY_NULL, "Query Reply (Null)" },
820 { SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE, "Query Reply (OEM Auxiliary Device)" },
821 { SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES, "Query Reply (Paper Feed Techniques)" },
822 { SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS, "Query Reply (Partition Characteristics)" },
823 { SF_IB_QUERY_REPLY_PORT, "Query Reply (Port)" },
824 { SF_IB_QUERY_REPLY_PROCEDURE, "Query Reply (Procedure)" },
825 { SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM, "Query Reply (Product Defined Data Stream)" },
826 { SF_IB_QUERY_REPLY_REPLY_MODES, "Query Reply (Reply Modes)" },
827 { SF_IB_QUERY_REPLY_RPQ_NAMES, "Query Reply (RPQ Names)" },
828 { SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT, "Query Reply (Save/Restore Format)" },
829 { SF_IB_QUERY_REPLY_SEGMENT, "Query Reply (Segment)" },
830 { SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS, "Query Reply (Settable Printer Characteristics)" },
831 { SF_IB_QUERY_REPLY_STORAGE_POOLS, "Query Reply (Storage Pools)" },
832 { SF_IB_QUERY_REPLY_SUMMARY, "Query Reply (Summary)" },
833 { SF_IB_QUERY_REPLY_TEXT_PARTITIONS, "Query Reply (Text Partitions)" },
834 { SF_IB_QUERY_REPLY_TRANSPARENCY, "Query Reply (Transparency)" },
835 { SF_IB_QUERY_REPLY_USABLE_AREA, "Query Reply (Usable Area)" },
836 { SF_IB_QUERY_REPLY_3270_IPDS, "Query Reply (3270 IPDS)." },
837 { 0x00, NULL }
840 /*--- 6.2 - Exception/Status ----- */
841 #define SDP_STATCODE_ACKNOWLEDGED 0x0000
842 #define SDP_STATCODE_AUXDEVICEAVAIL 0X0001
844 static const value_string vals_sdp_statcode[] = {
845 { SDP_STATCODE_ACKNOWLEDGED, "Acknowledged. The formats were successfully loaded, and no exception occurred." },
846 { SDP_STATCODE_AUXDEVICEAVAIL, "Auxiliary device available" },
847 { 0x00, NULL }
850 #define SDP_EXCODE_INVALID_DOID 0x0801
851 #define SDP_EXCODE_DEVICENOTAVAIL 0X0802
852 #define SDP_EXCODE_RETIRED 0X0803
853 #define SDP_EXCODE_BUFFER_OVERRUN 0X0804
854 #define SDP_EXCODE_STORAGE 0X0805
855 #define SDP_EXCODE_FORMATNOTSPEC 0X0806
856 #define SDP_EXCODE_DATAERROR 0X0807
857 #define SDP_EXCODE_INSUFFRESOURCE 0X084B
858 #define SDP_EXCODE_EXCEEDSLIMIT 0X084C
859 #define SDP_EXCODE_FUNCTNOTSUPP 0X1003
861 static const value_string vals_sdp_excode[] = {
862 { SDP_EXCODE_INVALID_DOID,
863 "Invalid/unrecognized DOID in the Destination/Origin structured field."
864 " AVAILSTAT must be set to B'0'." },
865 { SDP_EXCODE_DEVICENOTAVAIL,
866 "DOID valid, but the auxiliary device is not available because of an"
867 " intervention required condition (for example, out of paper, power"
868 " off, or processing code not resident). Available status is sent"
869 " when the condition clears. AVAILSTAT must be set to B'1'." },
870 { SDP_EXCODE_RETIRED,
871 "Retired." },
872 { SDP_EXCODE_BUFFER_OVERRUN,
873 "Buffer overrun." },
874 { SDP_EXCODE_STORAGE,
875 "Insufficient storage. The loading of the formats could not be"
876 " completed because storage was exhausted." },
877 { SDP_EXCODE_FORMATNOTSPEC,
878 "The format or group name was not specified in the Load Format"
879 " Storage structured field." },
880 { SDP_EXCODE_DATAERROR,
881 "Data error." },
882 { SDP_EXCODE_INSUFFRESOURCE,
883 "Temporary insufficient resource. The application does not have"
884 " a buffer available or is busy. The device chooses whether to"
885 " set send status when the condition clears and set AVAILSTAT accordingly." },
886 { SDP_EXCODE_EXCEEDSLIMIT,
887 "The auxiliary device data in the transmission exceeds the limit specified"
888 " in the LIMOUT parameter of the Query Reply for the auxiliary device."
889 " AVAILSTAT must be set to B'0'." },
890 { SDP_EXCODE_FUNCTNOTSUPP,
891 "Function not supported." },
892 { 0x00, NULL }
895 /* Query Reply Types */
896 #define SF_QR_ALPHANUMERIC_PARTITIONS 0x84
897 #define SF_QR_AUXILIARY_DEVICE 0x99
898 #define SF_QR_QBEGIN_OR_END_OF_FILE 0x9F
899 #define SF_QR_CHARACTER_SETS 0x85
900 #define SF_QR_COLOR 0x86
901 #define SF_QR_COOPERATIVE_PROCESSING_REQUESTOR 0xAB
902 #define SF_QR_DATA_CHAINING 0x98
903 #define SF_QR_DATA_STREAMS 0xA2
904 #define SF_QR_DBCS_ASIA 0x91
905 #define SF_QR_DEVICE_CHARACTERISTICS 0xA0
906 #define SF_QR_DISTRIBUTED_DATA_MANAGEMENT 0x95
907 #define SF_QR_DOCUMENT_INTERCHANGE_ARCHITECTURE 0x97
908 #define SF_QR_EXTENDED_DRAWING_ROUTINE 0xB5
909 #define SF_QR_QFIELD_OUTLINING 0x8C
910 #define SF_QR_QFIELD_VALIDATION 0x8A
911 #define SF_QR_FORMAT_PRESENTATION 0x90
912 #define SF_QR_FORMAT_STORAGE_AUXILIARY_DEVICE 0x94
913 #define SF_QR_GRAPHIC_COLOR 0xB4
914 #define SF_QR_GRAPHIC_SYMBOL_SETS 0xB6
915 #define SF_QR_HIGHLIGHTING 0x87
916 #define SF_QR_IBM_AUXILIARY_DEVICE 0x9E
917 #define SF_QR_IMAGE 0x82
918 #define SF_QR_IMPLICIT_PARTITION 0xA6
919 #define SF_QR_IOCA_AUXILIARY_DEVICE 0xAA
920 #define SF_QR_LINE_TYPE 0xB2
921 #define SF_QR_MSR_CONTROL 0x8B
922 #define SF_QR_QNULL 0xFF
923 #define SF_QR_OEM_AUXILIARY_DEVICE 0x8F
924 #define SF_QR_PAPER_FEED_TECHNIQUES 0xA7
925 #define SF_QR_PARTITION_CHARACTERISTICS 0x8E
926 #define SF_QR_PORT 0xB3
927 #define SF_QR_PROCEDURE 0xB1
928 #define SF_QR_PRODUCT_DEFINED_DATA_STREAM 0x9C
929 #define SF_QR_REPLY_MODES 0x88
930 #define SF_QR_RPQ_NAMES 0xA1
931 #define SF_QR_QSAVE_OR_RESTORE_FORMAT 0x92
932 #define SF_QR_SEGMENT 0xB0
933 #define SF_QR_SETTABLE_PRINTER_CHARACTERISTICS 0xA9
934 #define SF_QR_STORAGE_POOLS 0x96
935 #define SF_QR_SUMMARY 0x80
936 #define SF_QR_TEXT_PARTITIONS 0x83
937 #define SF_QR_QTRANSPARENCY 0xA8
938 #define SF_QR_USABLE_AREA 0x81
939 #define SF_QR_T3270_IPDS 0x9A
941 static const value_string vals_sf_query_replies[] = {
942 { SF_QR_ALPHANUMERIC_PARTITIONS, "Alphanumeric Partitions" },
943 { SF_QR_AUXILIARY_DEVICE, "Auxiliary Device" },
944 { SF_QR_QBEGIN_OR_END_OF_FILE, "Begin/End of File" },
945 { SF_QR_CHARACTER_SETS, "Character Sets" },
946 { SF_QR_COLOR, "Color" },
947 { SF_QR_COOPERATIVE_PROCESSING_REQUESTOR, "Cooperative Processing Requestor" },
948 { SF_QR_DATA_CHAINING, "Data Chaining" },
949 { SF_QR_DATA_STREAMS, "Data Streams" },
950 { SF_QR_DBCS_ASIA, "DBCS-Asia" },
951 { SF_QR_DEVICE_CHARACTERISTICS, "Device Characteristics" },
952 { SF_QR_DISTRIBUTED_DATA_MANAGEMENT, "Distributed Data Management" },
953 { SF_QR_DOCUMENT_INTERCHANGE_ARCHITECTURE, "Document Interchange Architecture" },
954 { SF_QR_EXTENDED_DRAWING_ROUTINE, "Extended Drawing Routine" },
955 { SF_QR_QFIELD_OUTLINING, "Field Outlining" },
956 { SF_QR_QFIELD_VALIDATION, "Field Validation" },
957 { SF_QR_FORMAT_PRESENTATION, "Format Presentation" },
958 { SF_QR_FORMAT_STORAGE_AUXILIARY_DEVICE, "Format Storage Auxiliary Device" },
959 { SF_QR_GRAPHIC_COLOR, "Graphic Color" },
960 { SF_QR_GRAPHIC_SYMBOL_SETS, "Graphic Symbol Sets" },
961 { SF_QR_HIGHLIGHTING, "Highlighting" },
962 { SF_QR_IBM_AUXILIARY_DEVICE, "IBM Auxiliary Device" },
963 { SF_QR_IMAGE, "Image" },
964 { SF_QR_IMPLICIT_PARTITION, "Implicit Partition" },
965 { SF_QR_IOCA_AUXILIARY_DEVICE, "IOCA Auxiliary Device" },
966 { SF_QR_LINE_TYPE, "Line Type" },
967 { SF_QR_MSR_CONTROL, "MSR Control" },
968 { SF_QR_QNULL, "Null" },
969 { SF_QR_OEM_AUXILIARY_DEVICE, "OEM Auxiliary Device" },
970 { SF_QR_PAPER_FEED_TECHNIQUES, "Paper Feed Techniques" },
971 { SF_QR_PARTITION_CHARACTERISTICS, "Partition Characteristics" },
972 { SF_QR_PORT, "Port" },
973 { SF_QR_PROCEDURE, "Procedure" },
974 { SF_QR_PRODUCT_DEFINED_DATA_STREAM, "Product Defined Data Stream" },
975 { SF_QR_REPLY_MODES, "Reply Modes" },
976 { SF_QR_RPQ_NAMES, "RPQ Names" },
977 { SF_QR_QSAVE_OR_RESTORE_FORMAT, "Save/Restore Format" },
978 { SF_QR_SEGMENT, "Segment" },
979 { SF_QR_SETTABLE_PRINTER_CHARACTERISTICS, "Settable Printer Characteristics" },
980 { SF_QR_STORAGE_POOLS, "Storage Pools" },
981 { SF_QR_SUMMARY, "Summary" },
982 { SF_QR_TEXT_PARTITIONS, "Text Partitions" },
983 { SF_QR_QTRANSPARENCY, "Transparency" },
984 { SF_QR_USABLE_AREA, "Usable Area" },
985 { SF_QR_T3270_IPDS, "3270 IPDS." },
986 { 0x00, NULL }
989 /*--- 6.9 Query Reply Alphanumeric Partitions ----- */
990 #define QR_AP_VERTWIN 0x80
991 #define QR_AP_HORWIN 0x40
992 #define QR_AP_APRES1 0x20
993 #define QR_AP_APA_FLG 0x10
994 #define QR_AP_PROT 0x08
995 #define QR_AP_LCOPY 0x04
996 #define QR_AP_MODPART 0x02
997 #define QR_AP_APRES2 0x01
999 /*--- 6.12 - Query Reply (Character Sets) ----- */
1000 #define QR_CS_ALT 0x80
1001 #define QR_CS_MULTID 0x40
1002 #define QR_CS_LOADABLE 0x20
1003 #define QR_CS_EXT 0x10
1004 #define QR_CS_MS 0x08
1005 #define QR_CS_CH2 0x04
1006 #define QR_CS_GF 0x02
1007 #define QR_CS_CSRES 0x01
1009 #define QR_CS_CSRES2 0x80
1010 #define QR_CS_PSCS 0x40
1011 #define QR_CS_CSRES3 0x20
1012 #define QR_CS_CF 0x10
1013 #define QR_CS_CSRES4 0x08
1014 #define QR_CS_CSRES5 0x04
1015 #define QR_CS_GCSRES6 0x02
1016 #define QR_CS_CSRES7 0x01
1019 /*--- 6.15 Query Reply (Data Chaining) ----- */
1020 static const value_string vals_data_chaining_dir[] = {
1021 { 0x00, "Both" },
1022 { 0x01, "From device only" },
1023 { 0x02, "To device only" },
1024 { 0x00, NULL }
1027 /*--- 6.16 Query Reply (Data Streams) ----- */
1028 #define QR_DS_SCS 0x00
1029 #define QR_DS_DCAL2 0x01
1030 #define QR_DS_IPDS 0x02
1032 static const value_string vals_data_streams[] = {
1033 { QR_DS_SCS,
1034 "SCS Base Data Stream with extensions as specified in the BIND request"
1035 " and Device Characteristics Query Reply structured field" },
1036 { QR_DS_DCAL2,
1037 "Document Content Architecture Level 2" },
1038 { QR_DS_IPDS,
1039 "IPDS as defined in related documentation" },
1040 { 0x00, NULL }
1043 /*--- 6.51 Query Reply Usable Area ----- */
1044 #define QR_UA_RESERVED1 0x80
1045 #define QR_UA_PAGE_PRINTER 0x40
1046 #define QR_UA_RESERVED2 0x20
1047 #define QR_UA_HARD_COPY 0x10
1049 #define QR_UA_ADDR_MODE_MASK 0x0F
1050 #define QR_UA_ADDR_MODE_RESERVED1 0x00
1051 #define QR_UA_ADDR_MODE_TWELVE_FOURTEEN_BIT_OK 0x01
1052 #define QR_UA_ADDR_MODE_RESERVED2 0x02
1053 #define QR_UA_ADDR_MODE_TWELVE_FOURTEEN_SXTN_BIT_OK 0x03
1054 #define QR_UA_ADDR_MODE_UNMAPPED 0x0F
1056 static const value_string vals_usable_area_addr_mode[] = {
1057 { QR_UA_ADDR_MODE_RESERVED1, "Reserved" },
1058 { QR_UA_ADDR_MODE_TWELVE_FOURTEEN_BIT_OK, "Twelve/Fourteen Bit Addressing Allowed" },
1059 { QR_UA_ADDR_MODE_RESERVED2, "Reserved" },
1060 { QR_UA_ADDR_MODE_TWELVE_FOURTEEN_SXTN_BIT_OK , "Twelve/Fourteen/Sixteen Bit Addressing Allowed" },
1061 { QR_UA_ADDR_MODE_UNMAPPED, "Unmapped" },
1062 { 0x00, NULL }
1065 #define QR_UA_VARIABLE_CELLS 0x80
1066 #define QR_UA_CHARACTERS 0x40
1067 #define QR_UA_CELL_UNITS 0x20
1069 static const struct true_false_string tn3270_tfs_ua_variable_cells = {
1070 "Supported",
1071 "Not supported"
1074 static const struct true_false_string tn3270_tfs_ua_characters = {
1075 "Non-matrix character",
1076 "Matrix character"
1079 static const struct true_false_string tn3270_tfs_ua_cell_units = {
1080 "Pels",
1081 "Cells"
1085 #define QR_UA_UOM_INCHES 0x00
1086 #define QR_UA_UOM_MILLIMETERS 0x01
1088 static const value_string vals_usable_area_uom[] = {
1089 { QR_UA_UOM_INCHES, "Inches" },
1090 { QR_UA_UOM_MILLIMETERS, "Millimeters" },
1091 { 0x00, NULL }
1094 /*--- 6.42 - Query reply (Reply Modes) ----- */
1095 /* Also for: 5.30 - Set Reply Mode */
1097 #define RM_REPLY_FIELD_MODE 0x00
1098 #define RM_REPLY_EXTENDED_FIELD_MODE 0x01
1099 #define RM_REPLY_CHARACTER_MODE 0x02
1101 static const value_string vals_reply_modes[] = {
1102 { RM_REPLY_FIELD_MODE, "Field Mode" },
1103 { RM_REPLY_EXTENDED_FIELD_MODE, "Extended Field Mode" },
1104 { RM_REPLY_CHARACTER_MODE, "Character Mode" },
1105 { 0x00, NULL }
1108 /*--- 6.19 - Query Reply (Distributed Data Management) ----- */
1109 #define QR_DDM_COPY_SUBSET_1 0x01
1111 static const value_string vals_qr_ddm[] = {
1112 { QR_DDM_COPY_SUBSET_1, "DDM Copy Subset 1" },
1113 { 0x00, NULL }
1116 /*--- 6.20 - Query Reply (Document Interchange Architecture) ----- */
1117 #define QR_DIA_FILE_SERVER 0x01
1118 #define QR_DIA_FILE_REQ 0x02
1119 #define QR_DIA_FILE_SERVER_REQ 0x03
1121 static const value_string vals_qr_dia[] = {
1122 { QR_DIA_FILE_SERVER, "File Server" },
1123 { QR_DIA_FILE_REQ, "File Requestor" },
1124 { QR_DIA_FILE_SERVER_REQ, "Both File Server and File Requestor" },
1125 { 0x00, NULL }
1128 /*--- 6.31 - Query Reply (Implicit Partitions) ----- */
1129 #define QR_IP_SDP_DISPLAY 0x01
1130 #define QR_IP_SDP_PRINTER 0x02
1131 #define QR_IP_SDP_CHARACTER 0x03
1133 #if 0
1134 static const value_string vals_qr_ip[] = {
1135 { QR_IP_SDP_DISPLAY, "Display Devices" },
1136 { QR_IP_SDP_PRINTER, "Printer Devices" },
1137 { QR_IP_SDP_CHARACTER, "Character Devices" },
1138 { 0x00, NULL }
1140 #endif
1142 /*--- 6.41 - Query Reply (Product Defined Data Streams) ----- */
1143 #define QR_PDDS_REFID_GRAPH5080 0x01
1144 #define QR_PDDS_REFID_WHIPAPI 0x02
1146 static const value_string vals_qr_pdds_refid[] = {
1147 { QR_PDDS_REFID_GRAPH5080, "Supports the 5080 Graphics System" },
1148 { QR_PDDS_REFID_WHIPAPI, "Supports the WHIP API data stream" },
1149 { 0x00, NULL }
1152 #define QR_PDDS_SSID_HFGD 0x01
1153 #define QR_PDDS_SSID_RS232 0x02
1155 static const value_string vals_qr_pdds_ssid[] = {
1156 { QR_PDDS_SSID_HFGD , "5080 HFGD Graphics Subset" },
1157 { QR_PDDS_SSID_RS232, "5080 RS232 Ports Subset" },
1158 { 0x00, NULL }
1161 /*--- 6.47 - Query Reply (Storage Pools) ----- */
1162 #define QR_SP_OBJ_SEGMENT1 0x0001
1163 #define QR_SP_OBJ_PROCEDURE1 0x0002
1164 #define QR_SP_OBJ_EXTENDED_DRAWING 0x0003
1165 #define QR_SP_OBJ_DATA_UNIT 0x0004
1166 #define QR_SP_OBJ_TEMPORARY 0x0005
1167 #define QR_SP_OBJ_LINE_TYPE1 0x0006
1168 #define QR_SP_OBJ_SYMBOL_SET 0x0007
1170 static const value_string vals_sp_objlist[] = {
1171 { QR_SP_OBJ_SEGMENT1, "Segment" },
1172 { QR_SP_OBJ_PROCEDURE1, "Procedure" },
1173 { QR_SP_OBJ_EXTENDED_DRAWING, "Extended drawing routine" },
1174 { QR_SP_OBJ_DATA_UNIT, "Data unit" },
1175 { QR_SP_OBJ_TEMPORARY, "Temporary" },
1176 { QR_SP_OBJ_LINE_TYPE1, "Line type" },
1177 { QR_SP_OBJ_SYMBOL_SET, "Symbol set" },
1178 { 0x00, NULL }
1181 /* TN3270E Header - Data Type */
1182 #define TN3270E_3270_DATA 0x00
1183 #define TN3270E_BIND_IMAGE 0x03
1184 #define TN3270E_NVT_DATA 0x05
1185 #define TN3270E_REQUEST 0x06
1186 #define TN3270E_RESPONSE 0x02
1187 #define TN3270E_SCS_DATA 0x01
1188 #define TN3270E_SSCP_LU_DATA 0x07
1189 #define TN3270E_UNBIND 0x04
1191 static const value_string vals_tn3270_header_data_types[] = {
1192 { TN3270E_3270_DATA, "3270_DATA" },
1193 { TN3270E_BIND_IMAGE, "BIND_IMAGE" },
1194 { TN3270E_NVT_DATA, "NVT_DATA" },
1195 { TN3270E_REQUEST, "REQUEST" },
1196 { TN3270E_RESPONSE, "RESPONSE" },
1197 { TN3270E_SCS_DATA, "SCS_DATA" },
1198 { TN3270E_SSCP_LU_DATA, "SSCP_LU_DATA" },
1199 { TN3270E_UNBIND, "UNBIND" },
1200 { 0x00, NULL }
1204 /* TN3270E Header - Request Flags */
1205 #define TN3270E_COND_CLEARED 0x00
1207 static const value_string vals_tn3270_header_request_flags[] = {
1208 { TN3270E_COND_CLEARED, "Condition Cleared" },
1209 { 0x00, NULL }
1212 /* TN3270E Header - Response Flags - Data Type 3270 and SCS */
1213 #define TN3270E_NO_RESPONSE 0x00
1214 #define TN3270E_ERROR_RESPONSE 0x01
1215 #define TN3270E_ALWAYS_RESPONSE 0x02
1217 static const value_string vals_tn3270_header_response_flags_3270_SCS[] = {
1218 { TN3270E_NO_RESPONSE, "No-Response" },
1219 { TN3270E_ERROR_RESPONSE, "Error-Response" },
1220 { TN3270E_ALWAYS_RESPONSE, "Always-Response" },
1221 { 0x00, NULL }
1224 /* TN3270E Header _ Response Flags - Data Type Response */
1225 #define TN3270E_POSITIVE_RESPONSE 0x00
1226 #define TN3270E_NEGATIVE_RESPONSE 0x01
1228 static const value_string vals_tn3270_header_response_flags_response[] = {
1229 { TN3270E_POSITIVE_RESPONSE, "Positive-Response" },
1230 { TN3270E_NEGATIVE_RESPONSE, "Negative-Response" },
1231 { 0x00, NULL }
1235 * Data structure attached to a conversation, giving session information.
1237 typedef struct tn3270_conv_info_t {
1238 uint32_t outbound_port;
1239 int extended;
1240 uint8_t altrows;
1241 uint8_t altcols;
1242 uint8_t rows;
1243 uint8_t cols;
1244 } tn3270_conv_info_t;
1247 static int proto_tn3270;
1249 static int hf_tn3270_fa_display;
1250 static int hf_tn3270_fa_graphic_convert;
1251 static int hf_tn3270_fa_modified;
1252 static int hf_tn3270_fa_numeric;
1253 static int hf_tn3270_fa_protected;
1254 static int hf_tn3270_fa_reserved;
1255 static int hf_tn3270_field_attribute;
1256 static int hf_tn3270_aid;
1257 static int hf_tn3270_all_character_attributes;
1258 static int hf_tn3270_attribute_type;
1259 static int hf_tn3270_begin_end_flags1;
1260 static int hf_tn3270_begin_end_flags2;
1261 static int hf_tn3270_bsc;
1262 static int hf_tn3270_buffer_address;
1263 static int hf_tn3270_c_cav;
1264 static int hf_tn3270_cc;
1265 static int hf_tn3270_character_code;
1266 static int hf_tn3270_character_set;
1267 static int hf_tn3270_charset;
1268 static int hf_tn3270_checkpoint;
1269 static int hf_tn3270_c_ci;
1270 static int hf_tn3270_c_offset;
1271 static int hf_tn3270_color;
1272 static int hf_tn3270_color_command;
1273 static int hf_tn3270_color_flags;
1274 static int hf_tn3270_command_code;
1275 static int hf_tn3270_cro;
1276 static int hf_tn3270_c_scsoff;
1277 static int hf_tn3270_c_seqoff;
1278 static int hf_tn3270_c_sequence;
1279 static int hf_tn3270_cursor_address;
1280 static int hf_tn3270_cw;
1281 static int hf_tn3270_data_chain_fields;
1282 static int hf_tn3270_data_chain_group;
1283 static int hf_tn3270_data_chain_inbound_control;
1284 static int hf_tn3270_destination_or_origin_flags_input_control;
1285 static int hf_tn3270_destination_or_origin_doid;
1286 static int hf_tn3270_erase_flags;
1287 static int hf_tn3270_exception_or_status_flags;
1288 static int hf_tn3270_extended_highlighting;
1289 static int hf_tn3270_extended_ps_color;
1290 static int hf_tn3270_extended_ps_echar;
1291 static int hf_tn3270_extended_ps_flags;
1292 static int hf_tn3270_extended_ps_length;
1293 static int hf_tn3270_extended_ps_lw;
1294 static int hf_tn3270_extended_ps_lh;
1295 static int hf_tn3270_extended_ps_nh;
1296 static int hf_tn3270_extended_ps_nw;
1297 static int hf_tn3270_extended_ps_res;
1298 static int hf_tn3270_extended_ps_stsubs;
1299 static int hf_tn3270_extended_ps_subsn;
1300 static int hf_tn3270_featl;
1301 static int hf_tn3270_feats;
1302 static int hf_tn3270_field_data;
1303 static int hf_tn3270_field_outlining;
1304 static int hf_tn3270_field_validation_mandatory_entry;
1305 static int hf_tn3270_field_validation_mandatory_fill;
1306 static int hf_tn3270_field_validation_trigger;
1307 static int hf_tn3270_format_group;
1308 static int hf_tn3270_format_name;
1309 static int hf_tn3270_fov;
1310 static int hf_tn3270_fpc;
1311 static int hf_tn3270_hilite;
1312 static int hf_tn3270_h_length;
1313 static int hf_tn3270_h_offset;
1314 static int hf_tn3270_horizon;
1315 static int hf_tn3270_h_sequence;
1316 static int hf_tn3270_hw;
1317 static int hf_tn3270_interval;
1318 static int hf_tn3270_limin;
1319 static int hf_tn3270_limout;
1320 static int hf_tn3270_lines;
1321 static int hf_tn3270_load_color_command;
1322 static int hf_tn3270_load_format_storage_flags1;
1323 static int hf_tn3270_load_format_storage_flags2;
1324 static int hf_tn3270_load_format_storage_format_data;
1325 static int hf_tn3270_load_format_storage_localname;
1326 static int hf_tn3270_load_format_storage_operand;
1327 static int hf_tn3270_load_line_type_command;
1328 static int hf_tn3270_lvl;
1329 static int hf_tn3270_mode;
1330 static int hf_tn3270_msr_ind_mask;
1331 static int hf_tn3270_msr_ind_value;
1332 static int hf_tn3270_msr_state_mask;
1333 static int hf_tn3270_msr_state_value;
1334 static int hf_tn3270_msr_type;
1335 static int hf_tn3270_ap_na;
1336 static int hf_tn3270_ap_m;
1337 static int hf_tn3270_ap_vertical_scrolling;
1338 static int hf_tn3270_ap_horizontal_scrolling;
1339 static int hf_tn3270_ap_apres1;
1340 static int hf_tn3270_ap_apa;
1341 static int hf_tn3270_ap_pp;
1342 static int hf_tn3270_ap_lc;
1343 static int hf_tn3270_ap_mp;
1344 static int hf_tn3270_ap_apres2;
1345 static int hf_tn3270_c_np;
1346 static int hf_tn3270_number_of_attributes;
1347 static int hf_tn3270_object_control_flags;
1348 static int hf_tn3270_object_type;
1349 static int hf_tn3270_order_code;
1350 static int hf_tn3270_outbound_text_header_operation_type;
1351 static int hf_tn3270_outbound_text_header_hdr;
1352 static int hf_tn3270_outbound_text_header_lhdr;
1353 static int hf_tn3270_pages;
1354 static int hf_tn3270_partition_command;
1355 static int hf_tn3270_partition_cv;
1356 static int hf_tn3270_partition_cw;
1357 static int hf_tn3270_partition_flags;
1358 static int hf_tn3270_partition_height;
1359 static int hf_tn3270_partition_hv;
1360 static int hf_tn3270_partition_id;
1361 static int hf_tn3270_partition_ph;
1362 static int hf_tn3270_partition_pw;
1363 static int hf_tn3270_partition_res;
1364 static int hf_tn3270_partition_rs;
1365 static int hf_tn3270_partition_rv;
1366 static int hf_tn3270_partition_rw;
1367 static int hf_tn3270_partition_uom;
1368 static int hf_tn3270_partition_width;
1369 static int hf_tn3270_partition_wv;
1370 static int hf_tn3270_prime;
1371 static int hf_tn3270_printer_flags;
1372 static int hf_tn3270_ps_char;
1373 static int hf_tn3270_ps_flags;
1374 static int hf_tn3270_ps_lcid;
1375 static int hf_tn3270_ps_rws;
1376 static int hf_tn3270_query_reply_alphanumeric_flags;
1377 static int hf_tn3270_recovery_data_flags;
1378 static int hf_tn3270_reply_mode_attr_list;
1379 static int hf_tn3270_read_partition_operation_type;
1380 static int hf_tn3270_read_partition_reqtyp;
1381 static int hf_tn3270_resbyte;
1382 static int hf_tn3270_resbytes;
1383 static int hf_tn3270_res_twobytes;
1384 static int hf_tn3270_rw;
1385 static int hf_tn3270_save_or_restore_format_flags;
1386 static int hf_tn3270_scs_data;
1387 static int hf_tn3270_sf_single_byte_id;
1388 static int hf_tn3270_sf_double_byte_id;
1389 static int hf_tn3270_sf_length;
1390 static int hf_tn3270_sf_query_reply;
1391 static int hf_tn3270_sld;
1392 static int hf_tn3270_spd;
1393 static int hf_tn3270_start_line;
1394 static int hf_tn3270_start_page;
1395 static int hf_tn3270_stop_address;
1396 static int hf_tn3270_transparency;
1397 static int hf_tn3270_type_1_text_outbound_data;
1398 static int hf_tn3270_vertical;
1399 static int hf_tn3270_v_length;
1400 static int hf_tn3270_v_offset;
1401 static int hf_tn3270_v_sequence;
1402 static int hf_tn3270_wcc_nop;
1403 static int hf_tn3270_wcc_reset;
1404 static int hf_tn3270_wcc_printer1;
1405 static int hf_tn3270_wcc_printer2;
1406 static int hf_tn3270_wcc_start_printer;
1407 static int hf_tn3270_wcc_sound_alarm;
1408 static int hf_tn3270_wcc_keyboard_restore;
1409 static int hf_tn3270_wcc_reset_mdt;
1410 static int hf_tn3270_ww;
1411 static int hf_tn3270_tn3270e_data_type;
1412 static int hf_tn3270_tn3270e_request_flag;
1413 static int hf_tn3270_tn3270e_response_flag_3270_SCS;
1414 static int hf_tn3270_tn3270e_response_flag_response;
1415 static int hf_tn3270_tn3270e_response_flag_unused;
1416 static int hf_tn3270_tn3270e_seq_number;
1417 static int hf_tn3270_tn3270e_header_data;
1418 static int hf_tn3270_ua_cell_units;
1419 static int hf_tn3270_ua_characters;
1420 static int hf_tn3270_ua_hard_copy;
1421 static int hf_tn3270_ua_page_printer;
1422 static int hf_tn3270_ua_reserved1;
1423 static int hf_tn3270_ua_reserved2;
1424 static int hf_tn3270_ua_variable_cells;
1425 static int hf_tn3270_usable_area_flags1;
1426 static int hf_tn3270_usable_area_flags2;
1427 static int hf_tn3270_ua_addressing;
1428 static int hf_tn3270_ua_width_cells_pels;
1429 static int hf_tn3270_ua_height_cells_pels;
1430 static int hf_tn3270_ua_uom_cells_pels;
1431 static int hf_tn3270_ua_xr;
1432 static int hf_tn3270_ua_yr;
1433 static int hf_tn3270_ua_aw;
1434 static int hf_tn3270_ua_ah;
1435 static int hf_tn3270_ua_buffsz;
1436 static int hf_tn3270_ua_xmin;
1437 static int hf_tn3270_ua_ymin;
1438 static int hf_tn3270_ua_xmax;
1439 static int hf_tn3270_ua_ymax;
1440 static int hf_tn3270_cs_ge;
1441 static int hf_tn3270_cs_mi;
1442 static int hf_tn3270_cs_lps;
1443 static int hf_tn3270_cs_lpse;
1444 static int hf_tn3270_cs_ms;
1445 static int hf_tn3270_cs_ch2;
1446 static int hf_tn3270_cs_gf;
1447 static int hf_tn3270_cs_res;
1448 static int hf_tn3270_cs_res2;
1449 static int hf_tn3270_cs_pscs;
1450 static int hf_tn3270_cs_res3;
1451 static int hf_tn3270_cs_cf;
1452 static int hf_tn3270_cs_form_type1;
1453 static int hf_tn3270_cs_form_type2;
1454 static int hf_tn3270_cs_form_type3;
1455 static int hf_tn3270_cs_form_type4;
1456 static int hf_tn3270_cs_form_type5;
1457 static int hf_tn3270_cs_form_type6;
1458 static int hf_tn3270_cs_form_type8;
1459 static int hf_tn3270_cs_ds_load;
1460 static int hf_tn3270_cs_ds_triple;
1461 static int hf_tn3270_cs_ds_char;
1462 static int hf_tn3270_cs_ds_cb;
1463 static int hf_tn3270_character_sets_flags1;
1464 static int hf_tn3270_character_sets_flags2;
1465 static int hf_tn3270_sdw;
1466 static int hf_tn3270_sdh;
1467 static int hf_tn3270_form;
1468 static int hf_tn3270_formres;
1469 static int hf_tn3270_cs_dl;
1470 static int hf_tn3270_cs_descriptor_set;
1471 static int hf_tn3270_cs_descriptor_flags;
1472 static int hf_tn3270_lcid;
1473 static int hf_tn3270_sw;
1474 static int hf_tn3270_sh;
1475 static int hf_tn3270_ssubsn;
1476 static int hf_tn3270_esubsn;
1477 static int hf_tn3270_ccsgid;
1478 static int hf_tn3270_ccsid;
1479 static int hf_tn3270_c_prtblk;
1480 static int hf_tn3270_h_np;
1481 static int hf_tn3270_h_vi;
1482 static int hf_tn3270_h_ai;
1483 static int hf_tn3270_ddm_flags;
1484 static int hf_tn3270_ddm_limin;
1485 static int hf_tn3270_ddm_limout;
1486 static int hf_tn3270_ddm_nss;
1487 static int hf_tn3270_ddm_ddmss;
1488 static int hf_tn3270_rpq_device;
1489 static int hf_tn3270_rpq_mid;
1490 static int hf_tn3270_rpq_rpql;
1491 static int hf_tn3270_rpq_name;
1492 static int hf_tn3270_ip_flags;
1493 static int hf_tn3270_ipdd_wd;
1494 static int hf_tn3270_ipdd_hd;
1495 static int hf_tn3270_ipdd_wa;
1496 static int hf_tn3270_ipdd_ha;
1497 static int hf_tn3270_ippd_dpbs;
1498 static int hf_tn3270_ippd_apbs;
1499 static int hf_tn3270_ipccd_wcd;
1500 static int hf_tn3270_ipccd_hcd;
1501 static int hf_tn3270_ipccd_wca;
1502 static int hf_tn3270_ipccd_hca;
1503 static int hf_tn3270_dc_dir;
1504 static int hf_tn3270_oem_dsref;
1505 static int hf_tn3270_oem_dtype;
1506 static int hf_tn3270_oem_uname;
1507 static int hf_tn3270_sdp_daid;
1508 static int hf_tn3270_oem_sdp_ll_limin;
1509 static int hf_tn3270_oem_sdp_ll_limout;
1510 static int hf_tn3270_oem_sdp_pclk_vers;
1511 static int hf_tn3270_null;
1512 static int hf_tn3270_unknown_data;
1513 static int hf_tn3270_ds_default_sfid;
1514 static int hf_tn3270_ds_sfid;
1515 static int hf_tn3270_asia_sdp_sosi_soset;
1516 static int hf_tn3270_asia_sdp_ic_func;
1517 static int hf_tn3270_ccc;
1518 static int hf_tn3270_ccc_coding;
1519 static int hf_tn3270_ccc_printout;
1520 static int hf_tn3270_ccc_start_print;
1521 static int hf_tn3270_ccc_sound_alarm;
1522 static int hf_tn3270_ccc_copytype;
1523 static int hf_tn3270_msr_user;
1524 static int hf_tn3270_msr_locked;
1525 static int hf_tn3270_msr_auto;
1526 static int hf_tn3270_msr_ind1;
1527 static int hf_tn3270_msr_ind2;
1528 static int hf_tn3270_spc_sdp_ot;
1529 static int hf_tn3270_spc_sdp_ob;
1530 static int hf_tn3270_spc_sdp_ol;
1531 static int hf_tn3270_spc_sdp_or;
1532 static int hf_tn3270_spc_sdp_eucflags;
1533 static int hf_tn3270_spc_sdp_srepc;
1534 static int hf_tn3270_srf_fpcb;
1535 static int hf_tn3270_sdp_statcode;
1536 static int hf_tn3270_sdp_excode;
1537 static int hf_tn3270_sdp_ngl;
1538 static int hf_tn3270_sdp_nml;
1539 static int hf_tn3270_sdp_nlml;
1540 static int hf_tn3270_sdp_stor;
1541 static int hf_tn3270_ap_cm;
1542 static int hf_tn3270_ap_ro;
1543 static int hf_tn3270_ap_co;
1544 static int hf_tn3270_ap_fo;
1545 static int hf_tn3270_sdp_ln;
1546 static int hf_tn3270_sdp_id;
1547 static int hf_tn3270_db_cavdef;
1548 static int hf_tn3270_db_cidef;
1549 static int hf_tn3270_dia_flags;
1550 static int hf_tn3270_dia_limin;
1551 static int hf_tn3270_dia_limout;
1552 static int hf_tn3270_dia_nfs;
1553 static int hf_tn3270_dia_diafs;
1554 static int hf_tn3270_dia_diafn;
1555 static int hf_tn3270_fo_flags;
1556 static int hf_tn3270_fo_vpos;
1557 static int hf_tn3270_fo_hpos;
1558 static int hf_tn3270_fo_hpos0;
1559 static int hf_tn3270_fo_hpos1;
1560 static int hf_tn3270_fsad_flags;
1561 static int hf_tn3270_fsad_limin;
1562 static int hf_tn3270_fsad_limout;
1563 static int hf_tn3270_fsad_size;
1564 static int hf_tn3270_ibm_flags;
1565 static int hf_tn3270_ibm_limin;
1566 static int hf_tn3270_ibm_limout;
1567 static int hf_tn3270_ibm_type;
1568 static int hf_tn3270_msr_nd;
1569 static int hf_tn3270_pft_flags;
1570 static int hf_tn3270_pft_tmo;
1571 static int hf_tn3270_pft_bmo;
1572 static int hf_tn3270_ioca_limin;
1573 static int hf_tn3270_ioca_limout;
1574 static int hf_tn3270_ioca_type;
1575 static int hf_tn3270_pc_vo_thickness;
1576 static int hf_tn3270_pdds_ssid;
1577 static int hf_tn3270_pdds_refid;
1578 static int hf_tn3270_srf_fpcbl;
1579 static int hf_tn3270_spc_epc_flags;
1580 static int hf_tn3270_sp_spid;
1581 static int hf_tn3270_sp_size;
1582 static int hf_tn3270_sp_space;
1583 static int hf_tn3270_sp_objlist;
1584 static int hf_tn3270_tp_nt;
1585 static int hf_tn3270_tp_m;
1586 static int hf_tn3270_tp_flags;
1587 static int hf_tn3270_tp_ntt;
1588 static int hf_tn3270_tp_tlist;
1589 static int hf_tn3270_t_np;
1590 static int hf_tn3270_t_vi;
1591 static int hf_tn3270_t_ai;
1592 static int hf_tn3270_3270_tranlim;
1594 static int ett_tn3270;
1595 static int ett_tn3270e_hdr;
1596 static int ett_sf;
1597 static int ett_tn3270_field_attribute;
1598 static int ett_tn3270_field_validation;
1599 static int ett_tn3270_wcc;
1600 static int ett_tn3270_usable_area_flags1;
1601 static int ett_tn3270_usable_area_flags2;
1602 static int ett_tn3270_query_reply_alphanumeric_flags;
1603 static int ett_tn3270_character_sets_flags1;
1604 static int ett_tn3270_character_sets_flags2;
1605 static int ett_tn3270_character_sets_form;
1606 static int ett_tn3270_cs_descriptor_flags;
1607 static int ett_tn3270_color_flags;
1608 static int ett_tn3270_ccc;
1609 static int ett_tn3270_msr_state_mask;
1610 static int ett_tn3270_data_chain_fields;
1611 static int ett_tn3270_query_list;
1613 static expert_field ei_tn3270_order_code;
1614 static expert_field ei_tn3270_command_code;
1615 static expert_field ei_tn3270_aid;
1617 static int dissect_orders_and_data(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, int offset, tn3270_conv_info_t *tn3270_info);
1618 static int dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset, int hf, tn3270_conv_info_t *tn3270_info);
1620 typedef struct hf_items {
1621 int *hf_idx_p;
1622 int *bitmask_ett_idx_p;
1623 int length;
1624 int * const *bitmask;
1625 const int encoding;
1626 } hf_items;
1628 /* Utility Functions */
1630 static int
1631 tn3270_add_hf_items(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
1632 const hf_items *fields)
1634 int start = offset;
1635 int i;
1637 for (i = 0; fields[i].hf_idx_p; i++) {
1638 if (fields[i].bitmask == 0) {
1639 proto_tree_add_item(tn3270_tree,
1640 *fields[i].hf_idx_p,
1641 tvb, offset,
1642 fields[i].length,
1643 fields[i].encoding);
1645 else {
1646 proto_tree_add_bitmask(tn3270_tree, tvb, offset, *fields[i].hf_idx_p,
1647 *fields[i].bitmask_ett_idx_p, fields[i].bitmask, ENC_BIG_ENDIAN);
1649 offset += fields[i].length;
1652 return (offset - start);
1656 * offset; tvb offset of next byte of data (first byte of unprocessed data);
1657 * start: tvb offset of beginning of data;
1658 * data_length: total length of data;
1660 static int
1661 dissect_unknown_data(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset, int start,
1662 int data_length)
1664 int len_left;
1666 len_left = (data_length) - (offset - start);
1668 if (len_left > 0) {
1669 proto_tree_add_item(tn3270_tree, hf_tn3270_unknown_data,
1670 tvb, offset, len_left,
1671 ENC_NA);
1672 return len_left;
1675 return 0;
1678 static int
1679 add_data_until_next_order_code(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
1681 int datalen = 0;
1682 int length_remaining = tvb_reported_length_remaining(tvb, offset);
1684 /* XXX: From 4.3:
1685 * "All order codes have an EBCDIC value in the range of hexadecimal 00
1686 * (X'00') through hexadecimal 3F (X'3F'). Order codes with values in this
1687 * range but not defined in this chapter are rejected."
1688 * However, the code (as originally committed) treats a '0' order code as data.
1691 while (datalen < length_remaining) {
1692 unsigned order_code;
1693 order_code = tvb_get_uint8(tvb, offset + datalen);
1694 if ((order_code > 0) && (order_code <= OC_MAX))
1695 break;
1696 datalen += 1;
1699 if (datalen > 0) {
1700 /* XXX: Need to handle "Format Control Orders" ?? */
1701 proto_tree_add_item(tn3270_tree, hf_tn3270_field_data, tvb, offset,
1702 datalen, ENC_EBCDIC);
1705 return datalen;
1708 static int
1709 dissect_query_reply_resbytes(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
1710 int sf_body_length)
1712 int start = offset;
1714 static const hf_items fields[] = {
1715 { &hf_tn3270_res_twobytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
1716 { NULL, NULL, 0, NULL, 0 }
1720 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1721 fields);
1723 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1725 return (offset - start);
1728 static int
1729 dissect_wcc(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
1732 static int * const wcc_fields[] = {
1733 &hf_tn3270_wcc_nop,
1734 &hf_tn3270_wcc_reset,
1735 &hf_tn3270_wcc_printer1,
1736 &hf_tn3270_wcc_printer2,
1737 &hf_tn3270_wcc_start_printer,
1738 &hf_tn3270_wcc_sound_alarm,
1739 &hf_tn3270_wcc_keyboard_restore,
1740 &hf_tn3270_wcc_reset_mdt,
1741 NULL
1744 /* Qualifier and DeviceType */
1745 proto_tree_add_bitmask_text(tn3270_tree, tvb, offset, 1, "Write Control Character: ", "None",
1746 ett_tn3270_wcc, wcc_fields, ENC_BIG_ENDIAN, 0);
1747 return 1;
1751 static int
1752 dissect_3270_field_validation(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
1754 int start = offset;
1756 static int * const byte[] = {
1757 &hf_tn3270_field_validation_mandatory_fill,
1758 &hf_tn3270_field_validation_mandatory_entry,
1759 &hf_tn3270_field_validation_trigger,
1760 NULL
1763 proto_tree_add_bitmask_text(tn3270_tree, tvb, 1, 1, "Field Validation: ",
1764 "None", ett_tn3270_field_validation, byte, ENC_BIG_ENDIAN, 0);
1766 offset += 1;
1768 return (offset - start);
1772 static int
1773 dissect_3270_field_attribute(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
1775 int start = offset;
1777 static int * const byte[] = {
1778 &hf_tn3270_fa_graphic_convert,
1779 &hf_tn3270_fa_protected,
1780 &hf_tn3270_fa_numeric,
1781 &hf_tn3270_fa_display,
1782 &hf_tn3270_fa_reserved,
1783 &hf_tn3270_fa_modified,
1784 NULL
1788 proto_tree_add_bitmask(tn3270_tree, tvb, offset, hf_tn3270_field_attribute,
1789 ett_tn3270_field_attribute, byte, ENC_BIG_ENDIAN);
1791 offset += 1;
1793 return (offset - start);
1796 /* 8.7 - Copy Control Code */
1797 static int
1798 dissect_ccc(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
1800 int start = offset;
1802 static int * const byte[] = {
1803 &hf_tn3270_ccc_coding,
1804 &hf_tn3270_ccc_printout,
1805 &hf_tn3270_ccc_start_print,
1806 &hf_tn3270_ccc_sound_alarm,
1807 &hf_tn3270_ccc_copytype,
1808 NULL
1811 proto_tree_add_bitmask(tn3270_tree, tvb, offset, hf_tn3270_ccc,
1812 ett_tn3270_ccc, byte, ENC_BIG_ENDIAN);
1814 offset += 1;
1816 return (offset - start);
1819 /* End - Utility Functions */
1821 /* Start: Handle Structured Fields */
1823 /* --------------------------------------------------- */
1824 /* 5.0 Outbound/Inbound and Outbound Structured Fields */
1825 /* --------------------------------------------------- */
1827 /* 5.5 Activate Partition - Search for ACTIVATE_PARTITION */
1828 /* 5.6 Begin/End of File - Search for BEGIN_OR_END_OF_FILE */
1829 /* 5.7 Create Partition */
1830 static int
1831 dissect_create_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset, int sf_body_length)
1833 int start = offset;
1835 static const hf_items fields[] = {
1836 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
1837 { &hf_tn3270_partition_uom, NULL, 1, NULL, ENC_BIG_ENDIAN },
1838 { &hf_tn3270_partition_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1839 { &hf_tn3270_partition_height, NULL, 2, NULL, ENC_BIG_ENDIAN },
1840 { &hf_tn3270_partition_width, NULL, 2, NULL, ENC_BIG_ENDIAN },
1841 { &hf_tn3270_partition_rv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1842 { &hf_tn3270_partition_cv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1843 { &hf_tn3270_partition_hv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1844 { &hf_tn3270_partition_wv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1845 { &hf_tn3270_partition_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1846 { &hf_tn3270_partition_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1847 { &hf_tn3270_partition_rs, NULL, 2, NULL, ENC_BIG_ENDIAN },
1848 { &hf_tn3270_partition_res, NULL, 2, NULL, ENC_BIG_ENDIAN },
1849 { &hf_tn3270_partition_pw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1850 { &hf_tn3270_partition_ph, NULL, 2, NULL, ENC_BIG_ENDIAN },
1851 { NULL, NULL, 0, NULL, 0 }
1855 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1856 fields);
1858 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1860 return (offset - start);
1863 /* 5.7 Create Partition - Search for CREATE_PARTITION */
1864 /* 5.8 Destroy Partition - Search for DESTROY_PARTITION */
1865 /* 5.9 Erase/Reset - Search for ERASE_OR_RESET */
1866 /* 5.10 Load Color Table - Search for LOAD_COLOR_TABLE */
1868 /* 5.11 Load Format Storage */
1869 static int
1870 dissect_load_format_storage(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset, int sf_body_length)
1872 int start = offset;
1873 int operand;
1875 static const hf_items fields[] = {
1876 { &hf_tn3270_load_format_storage_flags1, NULL, 1, NULL, ENC_BIG_ENDIAN },
1877 { &hf_tn3270_load_format_storage_flags2, NULL, 1, NULL, ENC_BIG_ENDIAN },
1878 { &hf_tn3270_load_format_storage_operand, NULL, 1, NULL, ENC_BIG_ENDIAN },
1879 { &hf_tn3270_load_format_storage_localname, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
1880 { &hf_tn3270_format_group, NULL, 6, NULL, ENC_EBCDIC|ENC_NA },
1881 { &hf_tn3270_format_name, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
1882 { NULL, NULL, 0, NULL, 0 }
1885 operand = tvb_get_uint8(tvb, offset+2);
1887 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1888 fields);
1890 if (operand == LOAD_FORMAT_STORAGE_OPERAND_ADD) {
1891 int fmtln = sf_body_length - (offset - start);
1892 proto_tree_add_item(tn3270_tree, hf_tn3270_load_format_storage_format_data,
1893 tvb, offset, fmtln, ENC_EBCDIC);
1894 offset += fmtln;
1897 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1899 return (offset - start);
1902 /* 5.12 Load Line Type - Search for LOAD_LINE_TYPE */
1904 /* 5.13 Load Programmed Symbols (Load PS) */
1905 static int
1906 dissect_load_programmed_symbols(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset, int sf_body_length)
1908 int start = offset, i;
1909 int8_t flags;
1910 int8_t extended_ps_length;
1912 static const hf_items ps_fields[] = {
1913 { &hf_tn3270_ps_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1914 { &hf_tn3270_ps_lcid, NULL, 1, NULL, ENC_BIG_ENDIAN },
1915 { &hf_tn3270_ps_char, NULL, 1, NULL, ENC_BIG_ENDIAN },
1916 { &hf_tn3270_ps_rws, NULL, 1, NULL, ENC_BIG_ENDIAN },
1917 { NULL, NULL, 0, NULL, 0 }
1920 static const hf_items extended_ps_fields[] = {
1921 { &hf_tn3270_extended_ps_lw, NULL, 1, NULL, ENC_BIG_ENDIAN },
1922 { &hf_tn3270_extended_ps_lh, NULL, 1, NULL, ENC_BIG_ENDIAN },
1923 { &hf_tn3270_extended_ps_subsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
1924 { &hf_tn3270_extended_ps_color, NULL, 1, NULL, ENC_BIG_ENDIAN },
1925 { &hf_tn3270_extended_ps_stsubs, NULL, 1, NULL, ENC_BIG_ENDIAN },
1926 { &hf_tn3270_extended_ps_echar, NULL, 1, NULL, ENC_BIG_ENDIAN },
1927 { &hf_tn3270_extended_ps_nw, NULL, 1, NULL, ENC_BIG_ENDIAN },
1928 { &hf_tn3270_extended_ps_nh, NULL, 1, NULL, ENC_BIG_ENDIAN },
1929 { &hf_tn3270_extended_ps_res, NULL, 1, NULL, ENC_BIG_ENDIAN },
1930 { NULL, NULL, 0, NULL, 0 }
1933 flags = tvb_get_uint8(tvb, offset);
1934 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1935 ps_fields);
1937 /*If extended flag not set return */
1938 if (!(flags & 0x80)) {
1939 return (offset - start);
1942 extended_ps_length = tvb_get_uint8(tvb, offset);
1943 proto_tree_add_item(tn3270_tree, hf_tn3270_extended_ps_length,
1944 tvb, offset, 1, ENC_BIG_ENDIAN);
1945 offset += 1;
1946 proto_tree_add_item(tn3270_tree, hf_tn3270_extended_ps_flags,
1947 tvb, offset, 1, ENC_BIG_ENDIAN);
1948 offset += 1;
1950 for (i = 0; i < extended_ps_length; ++i) {
1951 if (extended_ps_fields[i].hf_idx_p == NULL) {
1952 break; /* Malformed (Bad value for extended_ps_length) ! ToDo: 'expert' */
1954 proto_tree_add_item(tn3270_tree, *extended_ps_fields[i].hf_idx_p,
1955 tvb, offset, extended_ps_fields[i].length,
1956 extended_ps_fields[i].encoding);
1957 offset += extended_ps_fields[i].length;
1961 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1963 return (offset - start);
1966 /* 5.14 Modify Partition) */
1967 static int
1968 dissect_modify_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset, int sf_body_length)
1970 int start = offset;
1972 static const hf_items fields[] = {
1973 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1974 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
1975 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1976 { &hf_tn3270_partition_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1977 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1978 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
1979 { &hf_tn3270_partition_rv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1980 { &hf_tn3270_partition_cv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1981 { &hf_tn3270_partition_hv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1982 { &hf_tn3270_partition_wv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1983 { &hf_tn3270_partition_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1984 { &hf_tn3270_partition_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1985 { &hf_tn3270_partition_rs, NULL, 2, NULL, ENC_BIG_ENDIAN },
1986 { &hf_tn3270_partition_res, NULL, 2, NULL, ENC_BIG_ENDIAN },
1987 { &hf_tn3270_partition_pw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1988 { &hf_tn3270_partition_ph, NULL, 2, NULL, ENC_BIG_ENDIAN },
1989 { NULL, NULL, 0, NULL, 0 }
1993 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1994 fields);
1996 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1998 return (offset - start);
2001 /* 5.15 Outbound Text Header */
2002 static int
2003 dissect_outbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2004 int sf_body_length)
2006 int start = offset;
2007 int16_t hdr_length;
2009 static const hf_items outbound_text_header_fields1[] = {
2010 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2011 { &hf_tn3270_outbound_text_header_operation_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2012 { NULL, NULL, 0, NULL, 0 }
2015 static const hf_items outbound_text_header_fields2[] = {
2016 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2017 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2018 { &hf_tn3270_lvl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2019 { &hf_tn3270_cro, NULL, 2, NULL, ENC_BIG_ENDIAN },
2020 { &hf_tn3270_cc, NULL, 2, NULL, ENC_BIG_ENDIAN },
2021 { NULL, NULL, 0, NULL, 0 }
2024 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2025 outbound_text_header_fields1);
2026 offset += dissect_wcc(tn3270_tree, tvb, offset);
2027 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2028 outbound_text_header_fields2);
2030 hdr_length = tvb_get_ntohs(tvb, offset);
2032 proto_tree_add_item(tn3270_tree, hf_tn3270_outbound_text_header_lhdr,
2033 tvb, offset, 2, ENC_BIG_ENDIAN);
2034 offset += 2;
2036 proto_tree_add_item(tn3270_tree, hf_tn3270_outbound_text_header_hdr,
2037 tvb, offset, hdr_length, ENC_NA);
2038 offset += hdr_length;
2040 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2042 return (offset - start);
2045 /* 5.16 Outbound 3270DS */
2046 static int
2047 dissect_outbound_3270ds(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, int offset,
2048 tn3270_conv_info_t *tn3270_info, int sf_body_length )
2050 int start = offset;
2051 int cmd;
2053 proto_tree_add_item(tn3270_tree,
2054 hf_tn3270_partition_id,
2055 tvb, offset,
2057 ENC_BIG_ENDIAN);
2058 offset += 1;
2060 cmd = tvb_get_uint8(tvb, offset);
2061 proto_tree_add_item(tn3270_tree,
2062 hf_tn3270_partition_command,
2063 tvb, offset,
2065 ENC_BIG_ENDIAN);
2066 offset += 1;
2068 switch (cmd) {
2069 case CC_SNA_BSC:
2070 /* FIXME: the spec is ambiguous at best about what to expect here,
2071 need a live sample to validate. */
2072 offset += dissect_ccc(tn3270_tree, tvb, offset);
2073 proto_tree_add_item(tn3270_tree,
2074 hf_tn3270_bsc,
2075 tvb, offset,
2077 ENC_BIG_ENDIAN);
2078 offset += 2;
2079 break;
2080 /* XXX: are "local" commands valid for Outbound 3270DS ? */
2081 case CC_LCL_W:
2082 case CC_LCL_EW:
2083 case CC_LCL_EWA:
2084 case CC_LCL_EAU:
2085 case CC_RMT_W:
2086 case CC_RMT_EW:
2087 case CC_RMT_EWA:
2088 case CC_RMT_EAU:
2089 /* WCC */
2090 if ((offset - start) < sf_body_length)
2091 offset += dissect_wcc(tn3270_tree, tvb, offset);
2092 if ((offset - start) < sf_body_length)
2093 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
2094 break;
2095 default:
2096 break;
2099 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2101 return (offset - start);
2104 /* 5.17 Present Absolute Format */
2105 static int
2106 dissect_present_absolute_format(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2107 int sf_body_length)
2109 int start = offset;
2111 proto_tree_add_item(tn3270_tree,
2112 hf_tn3270_partition_id,
2113 tvb, offset,
2115 ENC_BIG_ENDIAN);
2116 offset += 1;
2118 proto_tree_add_item(tn3270_tree,
2119 hf_tn3270_fpc,
2120 tvb, offset,
2122 ENC_BIG_ENDIAN);
2123 offset += 1;
2125 offset += dissect_wcc(tn3270_tree, tvb, offset);
2127 proto_tree_add_item(tn3270_tree,
2128 hf_tn3270_format_name,
2129 tvb, offset,
2130 sf_body_length - (offset - start),
2131 ENC_EBCDIC);
2132 offset += (sf_body_length - (offset - start));
2134 return (offset - start);
2137 /* 5.18 Present Relative Format */
2138 static int
2139 dissect_present_relative_format(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2140 int sf_body_length)
2142 int start = offset;
2144 proto_tree_add_item(tn3270_tree,
2145 hf_tn3270_partition_id,
2146 tvb, offset,
2148 ENC_BIG_ENDIAN);
2149 offset += 1;
2151 proto_tree_add_item(tn3270_tree,
2152 hf_tn3270_fov,
2153 tvb, offset,
2155 ENC_BIG_ENDIAN);
2156 offset += 2;
2158 proto_tree_add_item(tn3270_tree,
2159 hf_tn3270_fpc,
2160 tvb, offset,
2162 ENC_BIG_ENDIAN);
2163 offset += 1;
2165 offset += dissect_wcc(tn3270_tree, tvb, offset);
2167 proto_tree_add_item(tn3270_tree,
2168 hf_tn3270_format_name,
2169 tvb, offset,
2170 sf_body_length - (offset - start),
2171 ENC_EBCDIC);
2172 offset += (sf_body_length - (offset - start));
2174 return (offset - start);
2177 /* 5.19 Read Partition */
2178 static int
2179 dissect_read_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2180 int sf_body_length)
2182 int start = offset;
2183 int type;
2184 proto_tree *query_list_tree;
2185 int qcode_list_len, i;
2187 proto_tree_add_item(tn3270_tree,
2188 hf_tn3270_partition_id,
2189 tvb, offset,
2191 ENC_BIG_ENDIAN);
2192 offset += 1;
2194 type = tvb_get_uint8(tvb, offset);
2195 if (type == 0xFF) { /* Partition ID of 0xFF is escaped with another 0xFF */
2196 /* XXX: removing tn3270 IAX escapes should be handled in the telnet dissector ! */
2197 offset += 1;
2198 type = tvb_get_uint8(tvb, offset);
2201 proto_tree_add_item(tn3270_tree,
2202 hf_tn3270_read_partition_operation_type,
2203 tvb, offset,
2205 ENC_BIG_ENDIAN);
2206 offset += 1;
2208 if (type == READ_PARTITION_OPTYPE_QUERY_LIST) { /* 'Query List' */
2209 proto_tree_add_item(tn3270_tree,
2210 hf_tn3270_read_partition_reqtyp,
2211 tvb, offset,
2213 ENC_BIG_ENDIAN);
2214 offset += 1;
2216 if (sf_body_length > (offset - start)) {
2217 qcode_list_len = sf_body_length - (offset - start);
2218 query_list_tree = proto_tree_add_subtree(tn3270_tree, tvb, offset, qcode_list_len,
2219 ett_tn3270_query_list, NULL, "Query List");
2220 for (i = 0; i < qcode_list_len; i++) {
2221 proto_tree_add_item(query_list_tree,
2222 hf_tn3270_sf_query_reply,
2223 tvb, offset, 1, ENC_BIG_ENDIAN);
2224 offset += 1;
2229 return (offset - start);
2232 /*5.20 Request Recovery Data - Search for REQUEST_RECOVERY_DATA*/
2233 /*5.21 Reset Partition - Search for RESET_PARTITION */
2235 /*5.22 Restart */
2236 static int
2237 dissect_restart(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2238 int sf_body_length)
2240 int start = offset;
2242 proto_tree_add_item(tn3270_tree,
2243 hf_tn3270_resbyte,
2244 tvb, offset,
2246 ENC_BIG_ENDIAN);
2247 offset += 1;
2249 proto_tree_add_item(tn3270_tree,
2250 hf_tn3270_start_page,
2251 tvb, offset,
2253 ENC_BIG_ENDIAN);
2254 offset += 2;
2256 proto_tree_add_item(tn3270_tree,
2257 hf_tn3270_start_line,
2258 tvb, offset,
2260 ENC_BIG_ENDIAN);
2261 offset += 2;
2264 proto_tree_add_item(tn3270_tree,
2265 hf_tn3270_scs_data,
2266 tvb, offset,
2267 sf_body_length - (offset - start),
2268 ENC_NA);
2269 offset += (sf_body_length - (offset - start));
2271 return (offset - start);
2274 /* 5.23 SCS Data - Search for SCS_DATA */
2275 /* 5.24 Color Table - Search for COLOR_TABLE */
2276 /* 5.25 Format Group - Search for FORMAT_GROUP */
2277 /* 5.26 Set Checkpoint Interval - Search for CHECKPOINT_INTERVAL */
2279 /* 5.27 Set MSR Control */
2280 static int
2281 dissect_set_msr_control(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2282 int sf_body_length)
2284 int start = offset;
2286 static int * const byte[] = {
2287 &hf_tn3270_msr_user,
2288 &hf_tn3270_msr_locked,
2289 &hf_tn3270_msr_auto,
2290 &hf_tn3270_msr_ind1,
2291 &hf_tn3270_msr_ind2,
2292 NULL
2295 static const hf_items outbound_text_header_fields[] = {
2296 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2297 { &hf_tn3270_msr_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2298 { &hf_tn3270_msr_state_mask, &ett_tn3270_msr_state_mask, 1, byte, 0 },
2299 { &hf_tn3270_msr_state_value, NULL, 1, NULL, ENC_BIG_ENDIAN },
2300 { &hf_tn3270_msr_ind_mask, NULL, 1, NULL, ENC_BIG_ENDIAN },
2301 { &hf_tn3270_msr_ind_value, NULL, 1, NULL, ENC_BIG_ENDIAN },
2302 { NULL, NULL, 0, NULL, 0 }
2306 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2307 outbound_text_header_fields);
2309 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2311 return (offset - start);
2314 /* 5.28 Set Partition Characteristics */
2315 static int
2316 dissect_set_partition_characteristics_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
2319 int start = offset;
2320 uint16_t sdp;
2322 static const hf_items sdp1[] = {
2323 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2324 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2325 { &hf_tn3270_spc_sdp_ot, NULL, 1, NULL, ENC_BIG_ENDIAN },
2326 { &hf_tn3270_spc_sdp_ob, NULL, 1, NULL, ENC_BIG_ENDIAN },
2327 { &hf_tn3270_spc_sdp_ol, NULL, 1, NULL, ENC_BIG_ENDIAN },
2328 { &hf_tn3270_spc_sdp_or, NULL, 1, NULL, ENC_BIG_ENDIAN },
2329 { NULL, NULL, 0, NULL, 0 }
2332 static const hf_items sdp2[] = {
2333 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2334 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2335 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2336 { NULL, NULL, 0, NULL, 0 }
2339 static const hf_items sdp3[] = {
2340 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2341 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2342 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2343 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2344 { NULL, NULL, 0, NULL, 0 }
2348 sdp = tvb_get_ntohs(tvb, offset);
2350 switch (sdp) {
2351 case 0x0601: /*View Outport*/
2352 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2353 sdp1);
2354 break;
2355 case 0x0304: /*Enable User Call Up*/
2356 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2357 sdp2);
2358 break;
2359 case 0x0405: /*Select Base Character Set*/
2360 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2361 sdp3);
2362 break;
2363 default:
2364 return 0;
2367 return (offset - start);
2371 static int
2372 dissect_set_partition_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2373 int sf_body_length)
2376 int start = offset;
2377 int i;
2379 static const hf_items fields[] = {
2380 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2381 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
2382 { NULL, NULL, 0, NULL, 0 }
2386 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2387 fields);
2389 for (i = 0; i < 3; i++) {
2390 offset += dissect_set_partition_characteristics_sd_parms(tn3270_tree, tvb, offset);
2391 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2392 break;
2395 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2397 return (offset - start);
2400 /* 5.29 Set Printer Characteristics */
2401 static int
2402 dissect_set_printer_characteristics_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
2405 int start = offset;
2406 uint16_t sdp;
2408 static const hf_items sdp1[] = {
2409 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2410 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2411 { &hf_tn3270_spc_sdp_srepc, NULL, 1, NULL, ENC_BIG_ENDIAN },
2412 { NULL, NULL, 0, NULL, 0 }
2415 sdp = tvb_get_ntohs(tvb, offset);
2417 switch (sdp) {
2418 case 0x0301: /*Early Print Complete*/
2419 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2420 sdp1);
2421 break;
2422 default:
2423 return 0;
2426 return (offset - start);
2430 static int
2431 dissect_set_printer_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2432 int sf_body_length)
2435 int start = offset;
2436 int i;
2438 static const hf_items fields[] = {
2439 { &hf_tn3270_printer_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2440 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2441 { NULL, NULL, 0, NULL, 0 }
2444 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2445 fields);
2447 for (i = 0; i < 3; i++) {
2448 offset += dissect_set_printer_characteristics_sd_parms(tn3270_tree, tvb, offset);
2449 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2450 break;
2453 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2455 return (offset - start);
2459 /* 5.30 Set Reply Mode */
2460 static int
2461 dissect_set_reply_mode(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2462 int sf_body_length)
2464 int start = offset;
2465 int type;
2466 int i;
2468 static const hf_items fields[] = {
2469 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2470 { &hf_tn3270_mode, NULL, 1, NULL, ENC_BIG_ENDIAN },
2471 { NULL, NULL, 0, NULL, 0 }
2474 type = tvb_get_uint8(tvb, offset+1);
2476 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2477 fields);
2479 if (type == 0x02) { /* 'Query List' */
2480 for (i = 0; i < (sf_body_length-(offset-start)); i++) {
2481 proto_tree_add_item(tn3270_tree,
2482 hf_tn3270_reply_mode_attr_list,
2483 tvb, offset, 1, ENC_BIG_ENDIAN);
2484 offset += 1;
2488 return (offset - start);
2491 /* 5.31 Set Window Origin - Search for SET_WINDOW_ORIGIN */
2492 /* 6.6 Type 1 Text Inbound
2493 5.32 Type 1 Text Outbound */
2494 static int
2495 dissect_type_1_text(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2496 int sf_body_length)
2498 int start = offset;
2500 static const hf_items fields[] = {
2501 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2502 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
2503 { NULL, NULL, 0, NULL, 0 }
2506 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2507 fields);
2508 proto_tree_add_item(tn3270_tree,
2509 hf_tn3270_field_data,
2510 tvb, offset,
2511 sf_body_length - (offset - start),
2512 ENC_EBCDIC);
2513 offset += (sf_body_length - (offset - start));
2515 return (offset - start);
2518 /* 5.34 Data Chain */
2519 static unsigned
2520 dissect_data_chain(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2521 int sf_body_length)
2523 int start = offset;
2525 static int * const byte[] = {
2526 &hf_tn3270_data_chain_group,
2527 &hf_tn3270_data_chain_inbound_control,
2528 NULL
2531 static const hf_items data_chain_fields[] = {
2532 { &hf_tn3270_data_chain_fields, &ett_tn3270_data_chain_fields, 1, byte, 0 },
2533 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2534 { NULL, NULL, 0, NULL, 0 }
2537 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2538 data_chain_fields);
2540 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2542 return (offset - start);
2545 /* 5.35 Destination/Origin - Search for DESTINATION_OR_ORIGIN*/
2547 /* 5.36 Object Control */
2548 static int
2549 dissect_object_control(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2550 int sf_body_length)
2552 int start = offset;
2554 static const hf_items fields[] = {
2555 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2556 { &hf_tn3270_object_control_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2557 { &hf_tn3270_object_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2558 { NULL, NULL, 0, NULL, 0 }
2561 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2562 fields);
2564 proto_tree_add_item(tn3270_tree,
2565 hf_tn3270_type_1_text_outbound_data,
2566 tvb, offset,
2567 sf_body_length - (offset - start),
2568 ENC_NA);
2569 offset += (sf_body_length - (offset - start));
2571 return (offset - start);
2574 /* 5.37 Object Data - Search for OBJECT_DATA*/
2575 /* 5.38 Object Picture - Search for OBJECT_PICTURE */
2576 /* 5.39 OEM Data - Search for OEM_DATA */
2578 /* 5.40 Save/Restore Format */
2579 static int
2580 dissect_save_or_restore_format(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2581 int sf_body_length)
2583 int start = offset;
2585 hf_items fields[] = {
2586 { &hf_tn3270_save_or_restore_format_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2587 { &hf_tn3270_srf_fpcb, NULL, sf_body_length-1, NULL, ENC_NA },
2588 { NULL, NULL, 0, NULL, 0 }
2591 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2592 fields);
2594 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2596 return (offset - start);
2599 /* 5.41 Select Intelligent Printer Data Stream (IPDS) Mode - Search for SELECT_IPDS_MODE*/
2601 /* -----------------------------------------*/
2602 /* 6.0 CHAPTER 6. INBOUND STRUCTURED FIELDS */
2603 /* -----------------------------------------*/
2605 /* 6.2 Exception/Status */
2606 static int
2607 dissect_exception_or_status_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
2610 int start = offset;
2611 uint16_t sdp;
2613 static const hf_items sdp1[] = {
2614 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2615 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2616 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2617 { &hf_tn3270_sdp_excode, NULL, 2, NULL, ENC_BIG_ENDIAN },
2618 { NULL, NULL, 0, NULL, 0 }
2621 static const hf_items sdp2[] = {
2622 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2623 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2624 { &hf_tn3270_sdp_statcode, NULL, 2, NULL, ENC_BIG_ENDIAN },
2625 { NULL, NULL, 0, NULL, 0 }
2628 static const hf_items sdp3[] = {
2629 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2630 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2631 { &hf_tn3270_format_group, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2632 { &hf_tn3270_format_name, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2633 { NULL, NULL, 0, NULL, 0 }
2636 static const hf_items sdp4[] = {
2637 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2638 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2639 { &hf_tn3270_sdp_ngl, NULL, 2, NULL, ENC_BIG_ENDIAN },
2640 { &hf_tn3270_sdp_nml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2641 { &hf_tn3270_sdp_nlml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2642 { &hf_tn3270_sdp_stor, NULL, 4, NULL, ENC_BIG_ENDIAN },
2643 { NULL, NULL, 0, NULL, 0 }
2646 static const hf_items sdp5[] = {
2647 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2648 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2649 { &hf_tn3270_format_group, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2650 { &hf_tn3270_sdp_nml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2651 { NULL, NULL, 0, NULL, 0 }
2654 sdp = tvb_get_ntohs(tvb, offset);
2656 switch (sdp) {
2657 case 0x0601: /*Auxiliary Device Exception*/
2658 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2659 sdp1);
2660 break;
2661 case 0x0402: /*Auxiliary Device status*/
2662 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2663 sdp2);
2664 break;
2665 case 0x2203: /*Failing Format status*/
2666 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2667 sdp3);
2668 break;
2669 case 0x0C04: /*Format status*/
2670 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2671 sdp4);
2672 break;
2673 case 0x1405: /*Group status*/
2674 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2675 sdp5);
2676 break;
2677 default:
2678 return 0;
2681 return (offset - start);
2685 static int
2686 dissect_exception_or_status(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2687 int sf_body_length)
2689 int start = offset, i;
2691 static const hf_items fields[] = {
2692 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2693 { &hf_tn3270_exception_or_status_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2694 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2695 { NULL, NULL, 0, NULL, 0 }
2698 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2699 fields);
2701 for (i = 0; i < 5; i++) {
2702 offset += dissect_exception_or_status_sd_parms(tn3270_tree, tvb, offset);
2703 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2704 break;
2707 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2709 return (offset - start);
2712 /* 6.3 Inbound Text Header */
2713 static int
2714 dissect_inbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2715 int sf_body_length)
2717 int start = offset;
2719 static const hf_items outbound_text_header_fields[] = {
2720 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2721 { &hf_tn3270_aid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2722 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2723 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2724 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2725 { &hf_tn3270_lvl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2726 { &hf_tn3270_cro, NULL, 2, NULL, ENC_BIG_ENDIAN },
2727 { &hf_tn3270_cc, NULL, 2, NULL, ENC_BIG_ENDIAN },
2728 { &hf_tn3270_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2729 { &hf_tn3270_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2730 { &hf_tn3270_hw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2731 { &hf_tn3270_ww, NULL, 2, NULL, ENC_BIG_ENDIAN },
2732 { NULL, NULL, 0, NULL, 0 }
2736 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2737 outbound_text_header_fields);
2739 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2741 return (offset - start);
2744 /* 6.4 Inbound 3270DS */
2745 static int
2746 dissect_inbound_3270ds(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2747 tn3270_conv_info_t *tn3270_info, int sf_body_length)
2749 int start = offset;
2751 static const hf_items fields1[] = {
2752 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2753 { &hf_tn3270_aid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2754 { NULL, NULL, 0, NULL, 0 }
2757 hf_items fields2[] = {
2758 { &hf_tn3270_field_data, NULL, sf_body_length - 4, NULL, ENC_EBCDIC|ENC_NA },
2759 { NULL, NULL, 0, NULL, 0 }
2762 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset, fields1);
2763 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info);
2764 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset, fields2);
2766 return (offset - start);
2771 /* 6.5 Recovery Data */
2772 static int
2773 dissect_recovery_data(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2774 int sf_body_length)
2776 int start = offset;
2779 static const hf_items fields[] = {
2780 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2781 { &hf_tn3270_recovery_data_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2782 { &hf_tn3270_sld, NULL, 1, NULL, ENC_BIG_ENDIAN },
2783 { &hf_tn3270_charset, NULL, 1, NULL, ENC_BIG_ENDIAN },
2784 { &hf_tn3270_vertical, NULL, 2, NULL, ENC_BIG_ENDIAN },
2785 { &hf_tn3270_v_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2786 { &hf_tn3270_v_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2787 { &hf_tn3270_v_length, NULL, 2, NULL, ENC_BIG_ENDIAN },
2788 { &hf_tn3270_spd, NULL, 2, NULL, ENC_BIG_ENDIAN },
2789 { &hf_tn3270_horizon, NULL, 2, NULL, ENC_BIG_ENDIAN },
2790 { &hf_tn3270_h_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2791 { &hf_tn3270_h_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2792 { &hf_tn3270_h_length, NULL, 2, NULL, ENC_BIG_ENDIAN },
2793 { &hf_tn3270_color, NULL, 1, NULL, ENC_BIG_ENDIAN },
2794 { &hf_tn3270_hilite, NULL, 1, NULL, ENC_BIG_ENDIAN },
2795 { &hf_tn3270_pages, NULL, 2, NULL, ENC_BIG_ENDIAN },
2796 { &hf_tn3270_lines, NULL, 2, NULL, ENC_BIG_ENDIAN },
2797 { &hf_tn3270_checkpoint, NULL, 2, NULL, ENC_BIG_ENDIAN },
2798 { &hf_tn3270_c_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2799 { &hf_tn3270_c_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2800 { &hf_tn3270_c_seqoff, NULL, 2, NULL, ENC_BIG_ENDIAN },
2801 { &hf_tn3270_c_scsoff, NULL, 2, NULL, ENC_BIG_ENDIAN },
2802 { &hf_tn3270_prime, NULL, 1, NULL, ENC_BIG_ENDIAN },
2803 { NULL, NULL, 0, NULL, 0 }
2807 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2808 fields);
2810 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2812 return (offset - start);
2815 /* 6.6 Query Reply (Type 1 Text Inbound) - See above*/
2816 /* 6.7 and 6.8 Query Reply - Introductory Matter */
2818 /* 6.9 Query Reply (Alphanumeric Partitions) */
2819 static int
2820 dissect_query_reply_alphanumeric_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
2823 int start = offset;
2824 uint16_t sdp;
2826 static const hf_items sdp1[] = {
2827 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2828 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2829 { &hf_tn3270_ap_cm, NULL, 1, NULL, ENC_BIG_ENDIAN },
2830 { &hf_tn3270_ap_ro, NULL, 1, NULL, ENC_BIG_ENDIAN },
2831 { &hf_tn3270_ap_co, NULL, 1, NULL, ENC_BIG_ENDIAN },
2832 { &hf_tn3270_ap_fo, NULL, 2, NULL, ENC_BIG_ENDIAN },
2833 { NULL, NULL, 0, NULL, 0 }
2837 sdp = tvb_get_ntohs(tvb, offset);
2839 switch (sdp) {
2840 case 0x0702: /*Buffer Allocation*/
2841 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2842 sdp1);
2843 break;
2844 default:
2845 return 0;
2848 return (offset - start);
2852 static int
2853 dissect_query_reply_alphanumeric(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2854 int sf_body_length)
2856 int start = offset;
2858 static int * const byte[] = {
2859 &hf_tn3270_ap_vertical_scrolling,
2860 &hf_tn3270_ap_horizontal_scrolling,
2861 &hf_tn3270_ap_apres1,
2862 &hf_tn3270_ap_apa,
2863 &hf_tn3270_ap_pp,
2864 &hf_tn3270_ap_lc,
2865 &hf_tn3270_ap_mp,
2866 &hf_tn3270_ap_apres2,
2867 NULL
2870 static const hf_items fields[] = {
2871 { &hf_tn3270_ap_na, NULL, 1, NULL, ENC_BIG_ENDIAN },
2872 { &hf_tn3270_ap_m, NULL, 2, NULL, ENC_BIG_ENDIAN },
2873 { &hf_tn3270_query_reply_alphanumeric_flags, &ett_tn3270_query_reply_alphanumeric_flags, 1, byte, 0 },
2874 { NULL, NULL, 0, NULL, 0 }
2877 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2878 fields);
2880 offset += dissect_query_reply_alphanumeric_sd_parms(tn3270_tree, tvb, offset);
2882 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2884 return (offset - start);
2887 /* 6.10 Query Reply (Auxiliary Device) - Search for QUERY_REPLY_AUXILIARY_DEVICE */
2888 /* 6.11 Query Reply (BEGIN/End of File ) - Search for QUERY_REPLY_BEGIN_OR_END_OF_FILE */
2890 /* 6.12 Query Reply (Character Sets) */
2891 static int
2892 dissect_query_reply_character_sets(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
2893 int sf_body_length)
2895 int start = offset;
2896 int flagbyte1, flagbyte2;
2898 static int * const byte1[] = {
2899 &hf_tn3270_cs_ge,
2900 &hf_tn3270_cs_mi,
2901 &hf_tn3270_cs_lps,
2902 &hf_tn3270_cs_lpse,
2903 &hf_tn3270_cs_ms,
2904 &hf_tn3270_cs_ch2,
2905 &hf_tn3270_cs_gf,
2906 &hf_tn3270_cs_res,
2907 NULL
2910 static int * const byte2[] = {
2911 &hf_tn3270_cs_res2,
2912 &hf_tn3270_cs_pscs,
2913 &hf_tn3270_cs_res3,
2914 &hf_tn3270_cs_cf,
2915 NULL
2918 static int * const byte3[] = {
2919 &hf_tn3270_cs_form_type1,
2920 &hf_tn3270_cs_form_type2,
2921 &hf_tn3270_cs_form_type3,
2922 &hf_tn3270_cs_form_type4,
2923 &hf_tn3270_cs_form_type5,
2924 &hf_tn3270_cs_form_type6,
2925 &hf_tn3270_cs_form_type8,
2926 NULL
2929 static int * const byte4[] = {
2930 &hf_tn3270_cs_ds_load,
2931 &hf_tn3270_cs_ds_triple,
2932 &hf_tn3270_cs_ds_char,
2933 &hf_tn3270_cs_ds_cb,
2934 NULL
2938 static const hf_items fields[] = {
2939 { &hf_tn3270_character_sets_flags1, &ett_tn3270_character_sets_flags1, 1, byte1, 0 },
2940 { &hf_tn3270_character_sets_flags2, &ett_tn3270_character_sets_flags2, 1, byte2, 0 },
2941 { &hf_tn3270_sdw, NULL, 1, NULL, ENC_BIG_ENDIAN },
2942 { &hf_tn3270_sdh, NULL, 1, NULL, ENC_BIG_ENDIAN },
2943 { &hf_tn3270_form, &ett_tn3270_character_sets_form, 1, byte3, 0 },
2944 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2945 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2946 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2947 { &hf_tn3270_cs_dl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2948 { NULL, NULL, 0, NULL, 0 }
2951 static const hf_items descriptors[] = {
2952 { &hf_tn3270_cs_descriptor_set, NULL, 1, NULL, ENC_BIG_ENDIAN },
2953 { &hf_tn3270_cs_descriptor_flags, &ett_tn3270_cs_descriptor_flags, 1, byte4, 0 },
2954 { &hf_tn3270_lcid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2955 { NULL, NULL, 0, NULL, 0 }
2958 static const hf_items sw_sh[] = {
2959 { &hf_tn3270_sw, NULL, 1, NULL, ENC_BIG_ENDIAN },
2960 { &hf_tn3270_sh, NULL, 1, NULL, ENC_BIG_ENDIAN },
2961 { NULL, NULL, 0, NULL, 0 }
2964 static const hf_items subsn[] = {
2965 { &hf_tn3270_ssubsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
2966 { &hf_tn3270_esubsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
2967 { NULL, NULL, 0, NULL, 0 }
2970 static const hf_items gf[] = {
2971 { &hf_tn3270_ccsgid, NULL, 4, NULL, ENC_BIG_ENDIAN },
2972 { NULL, NULL, 0, NULL, 0 }
2975 static const hf_items cf[] = {
2976 { &hf_tn3270_ccsid, NULL, 2, NULL, ENC_BIG_ENDIAN },
2977 { NULL, NULL, 0, NULL, 0 }
2980 flagbyte1 = tvb_get_uint8(tvb, offset);
2981 flagbyte2 = tvb_get_uint8(tvb, offset+1);
2983 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2984 fields);
2986 while ((offset - start) < sf_body_length) {
2988 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2989 descriptors);
2991 if (flagbyte1 & QR_CS_MS) {
2992 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2993 sw_sh);
2996 if (flagbyte1 & QR_CS_CH2) {
2997 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2998 subsn);
3001 if (flagbyte1 & QR_CS_GF) {
3002 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3003 gf);
3006 if (flagbyte2 & QR_CS_CF) {
3007 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3008 cf);
3011 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3013 return (offset - start);
3016 /* 6.13 Query Reply (Color) */
3017 static int
3018 dissect_query_reply_color_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
3021 int start = offset;
3022 uint16_t sdp;
3024 static const hf_items sdp1[] = {
3025 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3026 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3027 { &hf_tn3270_db_cavdef, NULL, 1, NULL, ENC_BIG_ENDIAN },
3028 { &hf_tn3270_db_cidef, NULL, 1, NULL, ENC_BIG_ENDIAN },
3029 { NULL, NULL, 0, NULL, 0 }
3033 sdp = tvb_get_ntohs(tvb, offset);
3035 switch (sdp) {
3036 case 0x0402: /*Default Background Color*/
3037 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3038 sdp1);
3039 break;
3040 default:
3041 return 0;
3044 return (offset - start);
3048 static int
3049 dissect_query_reply_color(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3050 int sf_body_length)
3052 int start = offset;
3053 int i;
3054 int np;
3056 static int * const byte[] = {
3057 &hf_tn3270_c_prtblk,
3058 NULL
3061 static const hf_items fields[] = {
3062 { &hf_tn3270_color_flags, &ett_tn3270_color_flags, 1, byte, 0 },
3063 { &hf_tn3270_c_np, NULL, 1, NULL, ENC_BIG_ENDIAN },
3064 { NULL, NULL, 0, NULL, 0 }
3068 np = tvb_get_uint8(tvb, offset +1);
3069 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3070 fields);
3072 for (i=0; i < np; i++) {
3073 if (tvb_get_uint8(tvb, offset) == 0xFF) {
3074 offset += 1;
3076 proto_tree_add_item(tn3270_tree,
3077 hf_tn3270_c_cav,
3078 tvb, offset,
3080 ENC_BIG_ENDIAN);
3081 offset += 1;
3082 if (tvb_get_uint8(tvb, offset) == 0xFF) {
3083 offset += 1;
3085 proto_tree_add_item(tn3270_tree,
3086 hf_tn3270_c_ci,
3087 tvb, offset,
3089 ENC_BIG_ENDIAN);
3090 offset += 1;
3092 offset += dissect_query_reply_color_sd_parms(tn3270_tree, tvb, offset);
3094 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3096 return (offset - start);
3100 /* 6.36 - Query Reply (OEM Auxiliary Device) Self-Defining Parameters */
3101 static int
3102 dissect_daid_sd_parm(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
3105 int start = offset;
3107 static const hf_items sdp1[] = {
3108 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3109 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3110 { &hf_tn3270_sdp_daid, NULL, 2, NULL, ENC_BIG_ENDIAN },
3111 { NULL, NULL, 0, NULL, 0 }
3114 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3115 sdp1);
3116 return (offset - start);
3120 static int
3121 dissect_pclk_sd_parm(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
3124 int start = offset;
3126 static const hf_items sdp1[] = {
3127 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3128 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3129 { &hf_tn3270_oem_sdp_pclk_vers, NULL, 2, NULL, ENC_BIG_ENDIAN },
3130 { NULL, NULL, 0, NULL, 0 }
3133 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3134 sdp1);
3135 return (offset - start);
3139 static int
3140 dissect_query_reply_oem_auxiliary_device_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
3143 int start = offset;
3144 int sdp_len;
3145 int sdp;
3147 static const hf_items sdp1[] = {
3148 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3149 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3150 { &hf_tn3270_sdp_daid, NULL, 2, NULL, ENC_BIG_ENDIAN },
3151 { NULL, NULL, 0, NULL, 0 }
3154 static const hf_items sdp2[] = {
3155 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3156 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3157 { &hf_tn3270_oem_sdp_ll_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3158 { &hf_tn3270_oem_sdp_ll_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3160 { NULL, NULL, 0, NULL, 0 }
3163 static const hf_items sdp3[] = {
3164 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3165 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3166 { &hf_tn3270_oem_sdp_pclk_vers, NULL, 2, NULL, ENC_BIG_ENDIAN },
3167 { NULL, NULL, 0, NULL, 0 }
3171 sdp_len = tvb_get_uint8(tvb, offset);
3172 if ((sdp_len != 0x04) && (sdp_len != 0x06)) {
3173 return 0;
3176 sdp = tvb_get_uint8(tvb, offset+1);
3178 switch (sdp) {
3179 case 0x01:
3180 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3181 sdp1);
3182 break;
3183 case 0x02:
3184 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3185 sdp2);
3186 break;
3187 case 0x03:
3188 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3189 sdp3);
3190 break;
3191 default:
3192 return 0;
3195 return (offset - start);
3199 /* 6.14 - Query Reply (Cooperative Processing Requestor) */
3200 static int
3201 dissect_query_reply_cooperative(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3202 int sf_body_length)
3204 int start = offset;
3206 static const hf_items fields[] = {
3207 { &hf_tn3270_res_twobytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3208 { &hf_tn3270_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3209 { &hf_tn3270_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3210 { &hf_tn3270_featl, NULL, 1, NULL, ENC_BIG_ENDIAN },
3211 { &hf_tn3270_feats, NULL, 2, NULL, ENC_BIG_ENDIAN },
3212 { NULL, NULL, 0, NULL, 0 }
3216 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3217 fields);
3219 #if 0
3220 /*FIXME: Need to see this in action to dissect in detail */
3221 proto_tree_add_item(tn3270_tree,
3222 hf_tn3270_field_data,
3223 tvb, offset,
3224 sf_body_length - (offset-start),
3225 ENC_EBCDIC);
3226 offset += (sf_body_length - (offset - start));
3228 /* Uses same Self-Defining Parm as OEM Auxiliary Device */
3229 offset += dissect_query_reply_oem_auxiliary_device_sd_parms(tn3270_tree, tvb, offset);
3230 #endif
3232 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3234 return (offset - start);
3237 /* 6.15 - Query Reply (Data Chaining) */
3238 static int
3239 dissect_query_reply_data_chaining(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3240 int sf_body_length)
3242 int start = offset;
3244 static const hf_items fields[] = {
3245 { &hf_tn3270_dc_dir, NULL, 1, NULL, ENC_BIG_ENDIAN },
3246 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3247 { NULL, NULL, 0, NULL, 0 }
3250 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3251 fields);
3253 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3255 return (offset - start);
3258 /* 6.16 - Query Reply (Data Streams) */
3260 static int
3261 dissect_query_reply_data_streams(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3262 int sf_body_length)
3264 int start = offset;
3265 int i;
3267 proto_tree_add_item(tn3270_tree, hf_tn3270_ds_default_sfid, tvb, offset, 1,
3268 ENC_BIG_ENDIAN);
3269 offset += 1;
3271 for (i=0; i < (sf_body_length-(offset-start)); i++) {
3272 proto_tree_add_item(tn3270_tree,
3273 hf_tn3270_ds_sfid,
3274 tvb, offset,
3276 ENC_BIG_ENDIAN);
3277 offset += 1;
3279 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3281 return (offset - start);
3284 /* 6.17 - Query Reply (DBCS Asia) */
3286 static int
3287 dissect_query_reply_dbcs_asia_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
3290 int start = offset;
3291 int sdp_len;
3292 int sdp;
3294 static const hf_items sdp1[] = {
3295 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3296 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3297 { &hf_tn3270_asia_sdp_sosi_soset, NULL, 1, NULL, ENC_BIG_ENDIAN },
3298 { NULL, NULL, 0, NULL, 0 }
3301 static const hf_items sdp2[] = {
3302 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3303 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3304 { &hf_tn3270_asia_sdp_ic_func, NULL, 1, NULL, ENC_BIG_ENDIAN },
3305 { NULL, NULL, 0, NULL, 0 }
3308 sdp_len = tvb_get_uint8(tvb, offset);
3309 if (sdp_len != 0x03) {
3310 return 0;
3313 sdp = tvb_get_uint8(tvb, offset+1);
3315 switch (sdp) {
3316 case 0x01: /*SO/SI*/
3317 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3318 sdp1);
3319 break;
3320 case 0x02: /*Input Control*/
3321 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3322 sdp2);
3323 break;
3324 default:
3325 return 0;
3328 return (offset - start);
3332 static int
3333 dissect_query_reply_dbcs_asia(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3334 int sf_body_length)
3337 int start = offset;
3338 int i;
3340 static const hf_items fields[] = {
3341 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3342 { NULL, NULL, 0, NULL, 0 }
3346 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3347 fields);
3349 for (i = 0; i < 3; i++) {
3350 offset += dissect_query_reply_dbcs_asia_sd_parms(tn3270_tree, tvb, offset);
3351 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3352 break;
3355 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3357 return (offset - start);
3360 /* 6.18 - Query Reply (Device Characteristics) */
3361 static int
3362 dissect_query_reply_device_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb,
3363 int offset, int sf_body_length)
3365 int start = offset;
3367 #if 0 /* XXX: I don't think this is correct (i.e., this field is not part of this message) .... */
3368 proto_tree_add_item(tn3270_tree,
3369 hf_tn3270_sf_outbound_id,
3370 tvb, offset,
3372 ENC_BIG_ENDIAN);
3373 offset += 1;
3374 #endif
3376 /* TODO: dissect descriptors */
3377 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3379 return (offset - start);
3382 /* 6.19 - Query Reply (Distributed Data Management) */
3383 static int
3384 dissect_query_reply_distributed_data_management(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3385 int sf_body_length)
3387 int start = offset, i;
3388 int sdp;
3389 bool done = false;
3391 static const hf_items fields[] = {
3392 { &hf_tn3270_ddm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3393 { &hf_tn3270_ddm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3394 { &hf_tn3270_ddm_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3395 { &hf_tn3270_ddm_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3396 { &hf_tn3270_ddm_nss, NULL, 1, NULL, ENC_BIG_ENDIAN },
3397 { &hf_tn3270_ddm_ddmss, NULL, 1, NULL, ENC_BIG_ENDIAN },
3398 { NULL, NULL, 0, NULL, 0 }
3401 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3402 fields);
3404 for (i = 0; i < 3; i++) {
3405 sdp = tvb_get_uint8(tvb, offset+1);
3406 switch (sdp) {
3407 case 0x02: /*DDM*/
3408 /*TODO: DDM */
3409 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, tvb_get_uint8(tvb,offset));
3410 break;
3411 case 0x01: /*DAID*/
3412 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3413 break;
3414 case 0x03: /*PCLK*/
3415 offset += dissect_pclk_sd_parm(tn3270_tree, tvb, offset);
3416 break;
3417 default:
3418 done = true;
3419 break;
3421 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3422 break;
3425 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3427 return (offset - start);
3430 /* 6.20 - Query Reply (Document Interchange Architecture) */
3431 static int
3432 dissect_query_reply_document_interchange_architecture(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3433 int sf_body_length)
3435 int start = offset, sdp, ln, i;
3437 static const hf_items fields[] = {
3438 { &hf_tn3270_dia_flags, NULL, 2, NULL, ENC_BIG_ENDIAN },
3439 { &hf_tn3270_dia_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3440 { &hf_tn3270_dia_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3441 { NULL, NULL, 0, NULL, 0 }
3444 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3445 fields);
3447 ln = tvb_get_uint8(tvb, offset);
3448 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_nfs, tvb, offset, 1, ENC_BIG_ENDIAN);
3450 for (i=0; i < ln; i++) {
3451 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_diafs, tvb, offset, 1,
3452 ENC_BIG_ENDIAN);
3453 offset += 1;
3454 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_diafn, tvb, offset, 2,
3455 ENC_BIG_ENDIAN);
3456 offset += 1;
3459 sdp = tvb_get_uint8(tvb, offset+1);
3460 if (sdp == 0x01) { /*DAID*/
3461 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3464 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3466 return (offset - start);
3469 /* 6.21 - Query Reply (Extended Drawing Routine) */
3470 static int
3471 dissect_query_reply_extended_drawing_routine(proto_tree *tn3270_tree, tvbuff_t *tvb,
3472 int offset, int sf_body_length)
3474 int start = offset;
3476 proto_tree_add_item(tn3270_tree, hf_tn3270_field_data ,tvb, offset,
3477 sf_body_length, ENC_EBCDIC);
3479 offset += sf_body_length;
3481 return (offset - start);
3484 /* 6.22 - Query Reply (Field Outlining) */
3485 static int
3486 dissect_query_reply_field_outlining(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3487 int sf_body_length)
3489 int start = offset;
3491 static const hf_items fields[] = {
3492 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3493 { &hf_tn3270_fo_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3494 { &hf_tn3270_fo_vpos, NULL, 1, NULL, ENC_BIG_ENDIAN },
3495 { &hf_tn3270_fo_hpos, NULL, 1, NULL, ENC_BIG_ENDIAN },
3496 { &hf_tn3270_fo_hpos0, NULL, 1, NULL, ENC_BIG_ENDIAN },
3497 { &hf_tn3270_fo_hpos1, NULL, 1, NULL, ENC_BIG_ENDIAN },
3498 { NULL, NULL, 0, NULL, 0 }
3501 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3502 fields);
3504 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3506 return (offset - start);
3509 /* 6.23 - Query Reply (Field Validation) - Search for FIELD_VALIDATION*/
3510 /* 6.24 - Query Reply (Format Presentation) - Search for FORMAT_PRESENTATION*/
3512 /* 6.25 - Query Reply (Format Storage Auxiliary Device)*/
3513 static int
3514 dissect_query_reply_format_storage_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3515 int sf_body_length)
3517 int start = offset, sdp;
3519 static const hf_items fields[] = {
3520 { &hf_tn3270_fsad_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3521 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3522 { &hf_tn3270_fsad_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3523 { &hf_tn3270_fsad_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3524 { NULL, NULL, 0, NULL, 0 }
3527 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3528 fields);
3530 sdp = tvb_get_uint8(tvb, offset+1);
3531 if (sdp == 0x01) { /*DAID*/
3532 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3533 proto_tree_add_item(tn3270_tree, hf_tn3270_fsad_size ,tvb, offset,
3534 2, ENC_BIG_ENDIAN);
3535 offset += 2;
3538 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3540 return (offset - start);
3543 /* 6.26 - Query Reply (Graphic Color) - Search for GRAPHIC_COLOR*/
3544 /* 6.27 - Query Reply (Graphic Symbol Sets) - Search for GRAPHIC_SYMBOL_SETS*/
3546 /* 6.28 - Query Reply (Highlighting) */
3547 static int
3548 dissect_query_reply_highlighting(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3549 int sf_body_length)
3551 int start = offset;
3552 int i;
3553 int np;
3555 static const hf_items fields[] = {
3556 { &hf_tn3270_h_np, NULL, 1, NULL, ENC_BIG_ENDIAN },
3557 { NULL, NULL, 0, NULL, 0 }
3561 np = tvb_get_uint8(tvb, offset);
3562 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3563 fields);
3565 for (i=0; i < np; i++) {
3566 if (tvb_get_uint8(tvb, offset) == 0xFF) {
3567 offset += 1;
3569 proto_tree_add_item(tn3270_tree,
3570 hf_tn3270_h_vi,
3571 tvb, offset,
3573 ENC_BIG_ENDIAN);
3574 offset += 1;
3575 if (tvb_get_uint8(tvb, offset) == 0xFF) {
3576 offset += 1;
3578 proto_tree_add_item(tn3270_tree,
3579 hf_tn3270_h_ai,
3580 tvb, offset,
3582 ENC_BIG_ENDIAN);
3583 offset += 1;
3586 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3588 return (offset - start);
3591 /* 6.29 - Query Reply (IBM Auxiliary Device) */
3592 static int
3593 dissect_query_reply_ibm_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3594 int sf_body_length)
3596 int start = offset, i, sdp;
3597 bool done = false;
3599 static const hf_items fields[] = {
3600 { &hf_tn3270_ibm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3601 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3602 { &hf_tn3270_ibm_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3603 { &hf_tn3270_ibm_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3604 { &hf_tn3270_ibm_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3605 { NULL, NULL, 0, NULL, 0 }
3608 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3609 fields);
3611 for (i = 0; i < 3; i++) {
3612 sdp = tvb_get_uint8(tvb, offset+1);
3613 switch (sdp) {
3614 case 0x02: /*Printer Name*/
3615 /*TODO: Printer Name */
3616 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, tvb_get_uint8(tvb,offset));
3617 break;
3618 case 0x01: /*DAID*/
3619 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3620 break;
3621 case 0x03: /*PCLK*/
3622 offset += dissect_pclk_sd_parm(tn3270_tree, tvb, offset);
3623 break;
3624 default:
3625 done = true;
3626 break;
3628 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3629 break;
3632 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3634 return (offset - start);
3637 /* 6.30 - Query Reply (Image) */
3639 /* 6.31 - Query Reply (Implicit Partitions) */
3640 static int
3641 dissect_query_reply_implicit_partitions_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
3644 int start = offset;
3645 int sdp_len;
3646 int sdp;
3648 static const hf_items sdp1[] = {
3649 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3650 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3651 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3652 { &hf_tn3270_ipdd_wd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3653 { &hf_tn3270_ipdd_hd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3654 { &hf_tn3270_ipdd_wa, NULL, 2, NULL, ENC_BIG_ENDIAN },
3655 { &hf_tn3270_ipdd_ha, NULL, 2, NULL, ENC_BIG_ENDIAN },
3656 { NULL, NULL, 0, NULL, 0 }
3659 static const hf_items sdp2[] = {
3660 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3661 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3662 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3663 { &hf_tn3270_ippd_dpbs, NULL, 4, NULL, ENC_BIG_ENDIAN },
3664 { &hf_tn3270_ippd_apbs, NULL, 4, NULL, ENC_BIG_ENDIAN },
3665 { NULL, NULL, 0, NULL, 0 }
3668 static const hf_items sdp3[] = {
3669 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3670 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3671 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3672 { &hf_tn3270_ipccd_wcd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3673 { &hf_tn3270_ipccd_hcd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3674 { &hf_tn3270_ipccd_wca, NULL, 2, NULL, ENC_BIG_ENDIAN },
3675 { &hf_tn3270_ipccd_hca, NULL, 2, NULL, ENC_BIG_ENDIAN },
3676 { NULL, NULL, 0, NULL, 0 }
3679 sdp_len = tvb_get_uint8(tvb, offset);
3680 if (sdp_len != 0x0B) {
3681 return 0;
3684 sdp = tvb_get_uint8(tvb, offset+1);
3686 switch (sdp) {
3687 case QR_IP_SDP_DISPLAY:
3688 /* XXX: Save default and alternate screen size info as reported ? */
3689 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3690 sdp1);
3691 break;
3692 case QR_IP_SDP_PRINTER:
3693 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3694 sdp2);
3695 break;
3696 case QR_IP_SDP_CHARACTER:
3697 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3698 sdp3);
3699 break;
3700 default:
3701 return 0;
3704 return (offset - start);
3708 static int
3709 dissect_query_reply_implicit_partitions(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3710 int sf_body_length)
3712 int start = offset;
3713 int i;
3715 static const hf_items fields[] = {
3716 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3717 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3718 { NULL, NULL, 0, NULL, 0 }
3721 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3722 fields);
3724 for (i = 0; i < 3; i++) {
3725 int len;
3726 len = dissect_query_reply_implicit_partitions_sd_parms(tn3270_tree, tvb, offset);
3727 if ((len == 0) || (tvb_reported_length_remaining(tvb, offset) <= 0))
3728 break;
3729 offset += len;
3732 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3734 return (offset - start);
3737 /* 6.32 - Query Reply (IOCA Auxiliary Device) */
3738 static int
3739 dissect_query_reply_ioca_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3740 int sf_body_length)
3742 int start = offset;
3744 static const hf_items fields[] = {
3745 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3746 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3747 { &hf_tn3270_ioca_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3748 { &hf_tn3270_ioca_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3749 { &hf_tn3270_ioca_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3750 { NULL, NULL, 0, NULL, 0 }
3753 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3754 fields);
3756 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3758 return (offset - start);
3761 /* 6.33 - Query Reply (Line Type) - Search for LINE_TYPE*/
3763 /* 6.34 - Query Reply (MSR Control) */
3764 static int
3765 dissect_query_reply_msr_control(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3766 int sf_body_length)
3768 int start = offset;
3770 static const hf_items fields[] = {
3771 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3772 { &hf_tn3270_msr_nd, NULL, 1, NULL, ENC_BIG_ENDIAN },
3773 { &hf_tn3270_msr_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3774 { NULL, NULL, 0, NULL, 0 }
3777 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3778 fields);
3779 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3781 return (offset - start);
3784 /* 6.35 - Query Reply (Null) - Search for QUERY_REPLY_NULL */
3786 /* 6.36 - Query Reply (OEM Auxiliary Device) */
3787 static int
3788 dissect_query_reply_oem_auxiliary_device(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3789 int sf_body_length)
3791 int start = offset;
3792 int i;
3794 static const hf_items fields[] = {
3795 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3796 { &hf_tn3270_oem_dsref, NULL, 1, NULL, ENC_BIG_ENDIAN },
3797 { &hf_tn3270_oem_dtype, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
3798 { &hf_tn3270_oem_uname, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
3799 { NULL, NULL, 0, NULL, 0 }
3802 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3803 fields);
3805 for (i = 0; i < 3; i++) {
3806 offset += dissect_query_reply_oem_auxiliary_device_sd_parms(tn3270_tree, tvb, offset);
3807 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3808 break;
3811 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3813 return (offset - start);
3816 /* 6.37 - Query Reply (Paper Feed Techniques) */
3817 static int
3818 dissect_query_reply_paper_feed_techniques(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3819 int sf_body_length)
3821 int start = offset;
3823 static const hf_items fields[] = {
3824 { &hf_tn3270_pft_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3825 { &hf_tn3270_pft_tmo, NULL, 2, NULL, ENC_BIG_ENDIAN },
3826 { &hf_tn3270_pft_bmo, NULL, 2, NULL, ENC_BIG_ENDIAN },
3827 { NULL, NULL, 0, NULL, 0 }
3830 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3831 fields);
3832 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3834 return (offset - start);
3837 /* 6.38 - Query Reply (Partition Characteristics) */
3838 static int
3839 dissect_query_reply_partition_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3840 int sf_body_length)
3842 int start = offset, i, sdp;
3843 bool done = false;
3845 static const hf_items fields[] = {
3846 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3847 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3848 { NULL, NULL, 0, NULL, 0 }
3851 for (i = 0; i < 2; i++) {
3852 sdp = tvb_get_uint8(tvb, offset+1);
3853 switch (sdp) {
3854 case 0x01: /*Viewport Outline*/
3855 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3856 fields);
3857 proto_tree_add_item(tn3270_tree, hf_tn3270_pc_vo_thickness,
3858 tvb, offset, 1, ENC_BIG_ENDIAN);
3859 offset += 1;
3860 break;
3861 case 0x03: /*Enable User Call-Up*/
3862 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3863 fields);
3864 break;
3865 default:
3866 done = true;
3867 break;
3869 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3870 break;
3873 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3875 return (offset - start);
3878 /* 6.39 - Query Reply (Port) - Search for QUERY_REPLY_PORT */
3879 /* 6.40 - Query Reply (Procedure) - Search for QUERY_REPLY_PROCEDURE */
3881 /* 6.41 - Query Reply ((Product Defined Data Stream) */
3882 static int
3883 dissect_query_reply_product_defined_data_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3884 int sf_body_length)
3886 int start = offset, sdp;
3888 static const hf_items fields[] = {
3889 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3890 { &hf_tn3270_pdds_refid, NULL, 1, NULL, ENC_BIG_ENDIAN },
3891 { &hf_tn3270_pdds_ssid, NULL, 1, NULL, ENC_BIG_ENDIAN },
3892 { NULL, NULL, 0, NULL, 0 }
3895 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3896 fields);
3898 sdp = tvb_get_uint8(tvb, offset+1);
3899 if (sdp == 0x01) { /*DAID*/
3900 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3903 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3905 return (offset - start);
3908 /* 6.42 - Query Reply (Modes) */
3909 static int
3910 dissect_query_reply_modes(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3911 int sf_body_length)
3913 int start = offset;
3914 int i;
3916 for (i=0; i < sf_body_length; i++) {
3917 proto_tree_add_item(tn3270_tree,
3918 hf_tn3270_mode,
3919 tvb, offset,
3921 ENC_BIG_ENDIAN);
3922 offset += 1;
3925 return (offset - start);
3928 /* 6.43 - Query Reply (RPQ Names) */
3929 static int
3930 dissect_query_reply_rpq_names(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3931 int sf_body_length)
3933 int start = offset;
3934 int rpql;
3936 static const hf_items fields[] = {
3937 { &hf_tn3270_rpq_device, NULL, 4, NULL, ENC_EBCDIC|ENC_NA },
3938 { &hf_tn3270_rpq_mid, NULL, 4, NULL, ENC_BIG_ENDIAN },
3939 { NULL, NULL, 0, NULL, 0 }
3942 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3943 fields);
3945 rpql = tvb_get_uint8(tvb, offset);
3947 proto_tree_add_item(tn3270_tree,
3948 hf_tn3270_rpq_rpql,
3949 tvb, offset,
3951 ENC_BIG_ENDIAN);
3952 offset += 1;
3954 proto_tree_add_item(tn3270_tree,
3955 hf_tn3270_rpq_name,
3956 tvb, offset,
3957 (rpql - 1),
3958 ENC_EBCDIC);
3959 offset += (rpql-1);
3961 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3963 return (offset - start);
3966 /* 6.44 - Query Reply (Save/Restore Format) */
3967 static int
3968 dissect_query_reply_save_or_restore_format(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3969 int sf_body_length)
3971 int start = offset;
3973 static const hf_items fields[] = {
3974 { &hf_tn3270_srf_fpcbl, NULL, 1, NULL, ENC_NA },
3975 { NULL, NULL, 0, NULL, 0 }
3978 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3979 fields);
3981 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3983 return (offset - start);
3986 /* 6.45 - Query Reply (Segment) - Search for QUERY_REPLY_SEGMENT */
3988 /* 6.46 - Query Reply ((Settable Printer Characteristics) */
3989 static int
3990 dissect_query_reply_settable_printer_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
3991 int sf_body_length)
3993 int start = offset, sdp;
3995 static const hf_items fields[] = {
3996 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3997 { NULL, NULL, 0, NULL, 0 }
4000 static const hf_items fields2[] = {
4001 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
4002 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
4003 { NULL, NULL, 0, NULL, 0 }
4006 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4007 fields);
4009 sdp = tvb_get_uint8(tvb, offset+1);
4010 if (sdp == 0x01) { /*Early Print Complete*/
4011 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4012 fields2);
4013 proto_tree_add_item(tn3270_tree, hf_tn3270_spc_epc_flags, tvb, offset,
4014 1, ENC_BIG_ENDIAN);
4015 offset += 1;
4018 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4020 return (offset - start);
4023 /* 6.47 - Query Reply (Storage Pools) */
4024 static int
4025 dissect_query_reply_storage_pools(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
4026 int sf_body_length)
4028 int start = offset, sdp, i;
4030 static const hf_items fields2[] = {
4031 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
4032 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
4033 { &hf_tn3270_sp_spid, NULL, 1, NULL, ENC_BIG_ENDIAN },
4034 { &hf_tn3270_sp_size, NULL, 4, NULL, ENC_BIG_ENDIAN },
4035 { &hf_tn3270_sp_space, NULL, 4, NULL, ENC_BIG_ENDIAN },
4036 { NULL, NULL, 0, NULL, 0 }
4039 sdp = tvb_get_uint8(tvb, offset+1);
4040 if (sdp == 0x01) { /* Storage Pool Characteristics */
4041 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4042 fields2);
4043 for (i=0; i < (sf_body_length-(offset-start)); i+=2) {
4044 proto_tree_add_item(tn3270_tree, hf_tn3270_sp_objlist,
4045 tvb, offset, 2, ENC_BIG_ENDIAN);
4046 offset += 2;
4050 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4052 return (offset - start);
4055 /* 6.48 - Query Reply (Summary) */
4056 static int
4057 dissect_query_reply_summary(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
4058 int sf_body_length)
4060 int i;
4061 int datalen = 0;
4062 int length_remaining = tvb_reported_length_remaining(tvb, offset);
4064 for (i=0; i < sf_body_length; i++) {
4065 if (datalen >= length_remaining) {
4066 return (datalen);
4068 proto_tree_add_item(tn3270_tree,
4069 hf_tn3270_sf_query_reply,
4070 tvb, offset + datalen,
4072 ENC_BIG_ENDIAN);
4073 datalen += 1;
4075 datalen += dissect_unknown_data(tn3270_tree, tvb, offset+datalen, offset, sf_body_length);
4077 return (datalen);
4080 /* 6.49 - Query Reply (Text Partitions) */
4081 static int
4082 dissect_query_reply_text_partitions(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
4083 int sf_body_length)
4085 int start = offset, len, i;
4087 static const hf_items fields[] = {
4088 { &hf_tn3270_tp_nt, NULL, 1, NULL, ENC_BIG_ENDIAN },
4089 { &hf_tn3270_tp_m, NULL, 2, NULL, ENC_BIG_ENDIAN },
4090 { &hf_tn3270_tp_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
4091 { NULL, NULL, 0, NULL, 0 }
4094 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4095 fields);
4097 len = tvb_get_uint8(tvb, offset);
4098 proto_tree_add_item(tn3270_tree, hf_tn3270_tp_ntt, tvb, offset, 1, ENC_BIG_ENDIAN);
4099 offset += 1;
4101 for (i=0; i < len; i++) {
4102 proto_tree_add_item(tn3270_tree, hf_tn3270_tp_tlist,
4103 tvb, offset, 1, ENC_BIG_ENDIAN);
4104 offset += 1;
4107 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4109 return (offset - start);
4112 /* 6.50 - Query Reply (Transparency) */
4113 static int
4114 dissect_query_reply_transparency(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
4115 int sf_body_length)
4117 int start = offset, i, len;
4119 len = tvb_get_uint8(tvb, offset);
4120 proto_tree_add_item(tn3270_tree, hf_tn3270_t_np, tvb, offset, 1, ENC_BIG_ENDIAN);
4121 offset += 1;
4123 for (i=0; i < len; i+=2) {
4124 proto_tree_add_item(tn3270_tree, hf_tn3270_t_vi,
4125 tvb, offset, 1, ENC_BIG_ENDIAN);
4126 offset += 1;
4127 proto_tree_add_item(tn3270_tree, hf_tn3270_t_ai,
4128 tvb, offset, 1, ENC_BIG_ENDIAN);
4129 offset += 1;
4132 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4134 return (offset - start);
4137 /* 6.51 - Query Reply Usable Area */
4138 static int
4139 dissect_query_reply_usable_area(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
4140 int sf_body_length)
4142 int start = offset;
4143 int vcp;
4145 static int * const byte1[] = {
4146 &hf_tn3270_ua_reserved1,
4147 &hf_tn3270_ua_page_printer,
4148 &hf_tn3270_ua_reserved2,
4149 &hf_tn3270_ua_hard_copy,
4150 &hf_tn3270_ua_addressing,
4151 NULL
4154 static int * const byte2[] = {
4155 &hf_tn3270_ua_variable_cells,
4156 &hf_tn3270_ua_characters,
4157 &hf_tn3270_ua_cell_units,
4158 NULL
4161 static const hf_items fields[] = {
4162 { &hf_tn3270_usable_area_flags1, &ett_tn3270_usable_area_flags1, 1, byte1, 0 },
4163 { &hf_tn3270_usable_area_flags2, &ett_tn3270_usable_area_flags1, 1, byte2, 0 },
4164 { &hf_tn3270_ua_width_cells_pels, NULL, 2, NULL, ENC_BIG_ENDIAN },
4165 { &hf_tn3270_ua_height_cells_pels, NULL, 2, NULL, ENC_BIG_ENDIAN },
4166 { &hf_tn3270_ua_uom_cells_pels, NULL, 1, NULL, ENC_BIG_ENDIAN },
4167 { &hf_tn3270_ua_xr, NULL, 4, NULL, ENC_BIG_ENDIAN },
4168 { &hf_tn3270_ua_yr, NULL, 4, NULL, ENC_BIG_ENDIAN },
4169 { &hf_tn3270_ua_aw, NULL, 1, NULL, ENC_BIG_ENDIAN },
4170 { &hf_tn3270_ua_ah, NULL, 1, NULL, ENC_BIG_ENDIAN },
4171 { &hf_tn3270_ua_buffsz, NULL, 2, NULL, ENC_BIG_ENDIAN },
4172 { NULL, NULL, 0, NULL, 0 }
4175 static const hf_items fields2[] = {
4176 { &hf_tn3270_ua_xmin, NULL, 1, NULL, ENC_BIG_ENDIAN },
4177 { &hf_tn3270_ua_ymin, NULL, 1, NULL, ENC_BIG_ENDIAN },
4178 { &hf_tn3270_ua_xmax, NULL, 1, NULL, ENC_BIG_ENDIAN },
4179 { &hf_tn3270_ua_ymax, NULL, 1, NULL, ENC_BIG_ENDIAN },
4180 { NULL, NULL, 0, NULL, 0 }
4183 vcp = tvb_get_uint8(tvb, offset+1);
4185 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4186 fields);
4188 if ((vcp & QR_UA_VARIABLE_CELLS) != 0) {
4189 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4190 fields2);
4193 /*TODO: self defining parms */
4194 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4196 return (offset - start);
4199 /* 6.52 - Query Reply 3270 IPDS */
4200 static int
4201 dissect_query_reply_3270_ipds(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
4202 int sf_body_length)
4204 int start = offset;
4206 static const hf_items fields[] = {
4207 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
4208 { &hf_tn3270_3270_tranlim, NULL, 2, NULL, ENC_BIG_ENDIAN },
4209 { NULL, NULL, 0, NULL, 0 }
4212 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4213 fields);
4214 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4216 return (offset - start);
4219 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4220 /* call only with valid sf_id */
4221 static int
4222 process_inbound_structured_field(proto_tree *sf_tree, tvbuff_t *tvb, int offset,
4223 tn3270_conv_info_t *tn3270_info, unsigned sf_id, int sf_body_length)
4225 int start = offset; /* start of structured field param(s) */
4227 switch (sf_id) {
4228 case SF_IB_EXCEPTION_OR_STATUS:
4229 offset += dissect_exception_or_status(sf_tree, tvb, offset, sf_body_length);
4230 break;
4231 case SF_IB_INBOUND_TEXT_HEADER:
4232 offset += dissect_inbound_text_header(sf_tree, tvb, offset, sf_body_length);
4233 break;
4234 case SF_IB_INBOUND_3270DS:
4235 offset += dissect_inbound_3270ds(sf_tree, tvb, offset, tn3270_info, sf_body_length);
4236 break;
4237 case SF_IB_RECOVERY_DATA:
4238 offset += dissect_recovery_data(sf_tree, tvb, offset, sf_body_length);
4239 break;
4240 case SF_IB_TYPE_1_TEXT_INBOUND:
4241 offset += dissect_type_1_text(sf_tree, tvb, offset, sf_body_length);
4242 break;
4243 case SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS:
4244 offset += dissect_query_reply_alphanumeric(sf_tree, tvb, offset, sf_body_length);
4245 break;
4246 case SF_IB_QUERY_REPLY_AUXILIARY_DEVICE:
4247 case SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE:
4248 offset += dissect_query_reply_resbytes(sf_tree, tvb, offset, sf_body_length);
4249 break;
4250 case SF_IB_QUERY_REPLY_CHARACTER_SETS:
4251 offset += dissect_query_reply_character_sets(sf_tree, tvb, offset, sf_body_length);
4252 break;
4253 case SF_IB_QUERY_REPLY_COLOR:
4254 offset += dissect_query_reply_color(sf_tree, tvb, offset, sf_body_length);
4255 break;
4256 case SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR:
4257 offset += dissect_query_reply_cooperative(sf_tree, tvb, offset, sf_body_length);
4258 break;
4259 case SF_IB_QUERY_REPLY_DATA_CHAINING:
4260 offset += dissect_query_reply_data_chaining(sf_tree, tvb, offset, sf_body_length);
4261 break;
4262 case SF_IB_QUERY_REPLY_DATA_STREAMS:
4263 offset += dissect_query_reply_data_streams(sf_tree, tvb, offset, sf_body_length);
4264 break;
4265 case SF_IB_QUERY_REPLY_DBCS_ASIA:
4266 offset += dissect_query_reply_dbcs_asia(sf_tree, tvb, offset, sf_body_length);
4267 break;
4268 case SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS:
4269 /*TODO: implement this beast */
4270 offset += dissect_query_reply_device_characteristics(sf_tree, tvb, offset, sf_body_length);
4271 break;
4272 case SF_IB_QUERY_REPLY_SUMMARY:
4273 offset += dissect_query_reply_summary(sf_tree, tvb, offset, sf_body_length);
4274 break;
4275 case SF_IB_QUERY_REPLY_USABLE_AREA:
4276 offset += dissect_query_reply_usable_area(sf_tree, tvb, offset, sf_body_length);
4277 break;
4278 case SF_IB_QUERY_REPLY_HIGHLIGHTING:
4279 offset += dissect_query_reply_highlighting(sf_tree, tvb, offset, sf_body_length);
4280 break;
4281 case SF_IB_QUERY_REPLY_REPLY_MODES:
4282 offset += dissect_query_reply_modes(sf_tree, tvb, offset, sf_body_length);
4283 break;
4284 case SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT:
4285 offset += dissect_query_reply_distributed_data_management(sf_tree, tvb, offset, sf_body_length);
4286 break;
4287 case SF_IB_QUERY_REPLY_RPQ_NAMES:
4288 offset += dissect_query_reply_rpq_names(sf_tree, tvb, offset, sf_body_length);
4289 break;
4290 case SF_IB_QUERY_REPLY_IMPLICIT_PARTITION:
4291 offset += dissect_query_reply_implicit_partitions(sf_tree, tvb, offset, sf_body_length);
4292 break;
4293 case SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE:
4294 offset += dissect_query_reply_oem_auxiliary_device(sf_tree, tvb, offset, sf_body_length);
4295 break;
4296 case SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE:
4297 offset += dissect_query_reply_document_interchange_architecture(sf_tree, tvb, offset, sf_body_length);
4298 break;
4299 case SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE:
4300 offset += dissect_query_reply_extended_drawing_routine(sf_tree, tvb, offset, sf_body_length);
4301 break;
4302 case SF_IB_QUERY_REPLY_FIELD_OUTLINING:
4303 offset += dissect_query_reply_field_outlining(sf_tree, tvb, offset, sf_body_length);
4304 break;
4305 case SF_IB_QUERY_REPLY_FIELD_VALIDATION:
4306 offset += dissect_3270_field_validation(sf_tree, tvb, offset);
4307 break;
4308 case SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE:
4309 offset += dissect_query_reply_format_storage_aux_device(sf_tree, tvb, offset, sf_body_length);
4310 break;
4311 case SF_IB_QUERY_REPLY_GRAPHIC_COLOR:
4312 case SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS:
4313 case SF_IB_QUERY_REPLY_IMAGE:
4314 case SF_IB_QUERY_REPLY_LINE_TYPE:
4315 case SF_IB_QUERY_REPLY_PROCEDURE:
4316 case SF_IB_QUERY_REPLY_SEGMENT:
4317 /* Not an error - just has a data field like 'extended drawing'*/
4318 offset += dissect_query_reply_extended_drawing_routine(sf_tree, tvb, offset, sf_body_length);
4319 break;
4320 case SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE:
4321 offset += dissect_query_reply_ibm_aux_device(sf_tree, tvb, offset, sf_body_length);
4322 break;
4323 case SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE:
4324 offset += dissect_query_reply_ioca_aux_device(sf_tree, tvb, offset, sf_body_length);
4325 break;
4326 case SF_IB_QUERY_REPLY_MSR_CONTROL:
4327 offset += dissect_query_reply_msr_control(sf_tree, tvb, offset, sf_body_length);
4328 break;
4329 case SF_IB_QUERY_REPLY_FORMAT_PRESENTATION:
4330 case SF_IB_QUERY_REPLY_NULL:
4331 case SF_IB_QUERY_REPLY_PORT:
4332 /* This field is always empty */
4333 break;
4334 case SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES:
4335 offset += dissect_query_reply_paper_feed_techniques(sf_tree, tvb, offset, sf_body_length);
4336 break;
4337 case SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS:
4338 offset += dissect_query_reply_partition_characteristics(sf_tree, tvb, offset, sf_body_length);
4339 break;
4340 case SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM:
4341 offset += dissect_query_reply_product_defined_data_stream(sf_tree, tvb, offset, sf_body_length);
4342 break;
4343 case SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT:
4344 offset += dissect_query_reply_save_or_restore_format(sf_tree, tvb, offset, sf_body_length);
4345 break;
4346 case SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS:
4347 offset += dissect_query_reply_settable_printer_characteristics(sf_tree, tvb, offset, sf_body_length);
4348 break;
4349 case SF_IB_QUERY_REPLY_STORAGE_POOLS:
4350 offset += dissect_query_reply_storage_pools(sf_tree, tvb, offset, sf_body_length);
4351 break;
4352 case SF_IB_QUERY_REPLY_TEXT_PARTITIONS:
4353 offset += dissect_query_reply_text_partitions(sf_tree, tvb, offset, sf_body_length);
4354 break;
4355 case SF_IB_QUERY_REPLY_TRANSPARENCY:
4356 offset += dissect_query_reply_transparency(sf_tree, tvb, offset, sf_body_length);
4357 break;
4358 case SF_IB_QUERY_REPLY_3270_IPDS:
4359 offset += dissect_query_reply_3270_ipds(sf_tree, tvb, offset, sf_body_length);
4360 break;
4361 default:
4362 DISSECTOR_ASSERT_NOT_REACHED();
4363 break;
4366 return (offset - start);
4370 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4371 /* call only with valid sf_id */
4372 static int
4373 process_outbound_structured_field(proto_tree *sf_tree, packet_info *pinfo, tvbuff_t *tvb, int offset,
4374 tn3270_conv_info_t *tn3270_info, unsigned sf_id, int sf_body_length)
4376 int start = offset; /* start of structured field param(s) */
4378 switch (sf_id) {
4379 case SF_OB_READ_PARTITION:
4380 offset += dissect_read_partition(sf_tree, tvb, offset, sf_body_length);
4381 break;
4382 case SF_OB_ACTIVATE_PARTITION:
4383 case SF_OB_DESTROY_PARTITION:
4384 case SF_OB_RESET_PARTITION:
4385 proto_tree_add_item(sf_tree,
4386 hf_tn3270_partition_id,
4387 tvb, offset,
4389 ENC_BIG_ENDIAN);
4390 offset += 1;
4391 break;
4392 case SF_OB_CREATE_PARTITION:
4393 offset += dissect_create_partition(sf_tree, tvb, offset, sf_body_length);
4394 break;
4395 case SF_OB_ERASE_OR_RESET:
4396 /* Bit 0: 0= Use default screen size; 1= use alternate screen size */
4397 /* XXX: Not really valid: See comment under dissect_outbound_stream(). */
4398 if ((tvb_get_uint8(tvb, offset) & 0x80) != 0) {
4399 tn3270_info->rows = tn3270_info->altrows;
4400 tn3270_info->cols = tn3270_info->altcols;
4402 else {
4403 tn3270_info->rows = 24;
4404 tn3270_info->cols = 80;
4406 proto_tree_add_bits_item(sf_tree,
4407 hf_tn3270_erase_flags,
4408 tvb, offset<<3,
4410 ENC_BIG_ENDIAN);
4411 offset += 1;
4412 break;
4413 case SF_OB_LOAD_PROGRAMMED_SYMBOLS:
4414 offset += dissect_load_programmed_symbols(sf_tree, tvb, offset, sf_body_length);
4415 break;
4416 case SF_OB_OUTBOUND_3270DS:
4417 offset += dissect_outbound_3270ds(sf_tree, pinfo, tvb, offset, tn3270_info, sf_body_length);
4418 break;
4419 case SF_OB_PRESENT_ABSOLUTE_FORMAT:
4420 offset += dissect_present_absolute_format(sf_tree, tvb, offset, sf_body_length);
4421 break;
4422 case SF_OB_PRESENT_RELATIVE_FORMAT:
4423 offset += dissect_present_relative_format(sf_tree, tvb, offset, sf_body_length);
4424 break;
4425 case SF_OB_SCS_DATA:
4426 proto_tree_add_item(sf_tree,
4427 hf_tn3270_partition_id,
4428 tvb, offset,
4430 ENC_BIG_ENDIAN);
4431 offset += 1;
4432 proto_tree_add_item(sf_tree,
4433 hf_tn3270_scs_data,
4434 tvb, offset,
4435 (sf_body_length - (offset - start)),
4436 ENC_NA);
4437 offset += (sf_body_length - (offset - start));
4438 break;
4439 case SF_OB_SET_REPLY_MODE:
4440 offset += dissect_set_reply_mode(sf_tree, tvb, offset, sf_body_length);
4441 break;
4442 case SF_OB_SELECT_FORMAT_GROUP:
4443 proto_tree_add_item(sf_tree,
4444 hf_tn3270_partition_id,
4445 tvb, offset,
4447 ENC_BIG_ENDIAN);
4448 offset += 1;
4449 proto_tree_add_item(sf_tree,
4450 hf_tn3270_format_group,
4451 tvb, offset,
4452 (sf_body_length - (offset - start)),
4453 ENC_EBCDIC);
4454 offset += (sf_body_length - (offset - start));
4455 break;
4456 case SF_OB_SET_WINDOW_ORIGIN:
4457 proto_tree_add_item(sf_tree,
4458 hf_tn3270_partition_id,
4459 tvb, offset,
4461 ENC_BIG_ENDIAN);
4462 offset += 1;
4463 proto_tree_add_item(sf_tree,
4464 hf_tn3270_partition_rw,
4465 tvb, offset,
4467 ENC_BIG_ENDIAN);
4468 offset += 2;
4469 proto_tree_add_item(sf_tree,
4470 hf_tn3270_partition_cw,
4471 tvb, offset,
4473 ENC_BIG_ENDIAN);
4474 offset += 2;
4475 break;
4476 case SF_OB_BEGIN_OR_END_OF_FILE:
4477 proto_tree_add_item(sf_tree,
4478 hf_tn3270_partition_id,
4479 tvb, offset,
4481 ENC_BIG_ENDIAN);
4482 offset += 1;
4483 /*TODO: use bits_text */
4484 proto_tree_add_bits_item(sf_tree,
4485 hf_tn3270_begin_end_flags1,
4486 tvb, offset<<3,
4488 ENC_BIG_ENDIAN);
4489 offset += 1;
4490 proto_tree_add_item(sf_tree,
4491 hf_tn3270_begin_end_flags2,
4492 tvb, offset,
4494 ENC_BIG_ENDIAN);
4495 offset += 1;
4496 break;
4497 case SF_OB_LOAD_COLOR_TABLE:
4498 /* Refer to related graphics docs !*/
4499 proto_tree_add_item(sf_tree,
4500 hf_tn3270_load_color_command,
4501 tvb, offset,
4502 sf_body_length,
4503 ENC_NA);
4504 offset += sf_body_length;
4505 break;
4506 case SF_OB_LOAD_FORMAT_STORAGE:
4507 offset += dissect_load_format_storage(sf_tree, tvb, offset, sf_body_length);
4508 break;
4509 case SF_OB_LOAD_LINE_TYPE:
4510 /* Refer to related graphics docs !*/
4511 proto_tree_add_item(sf_tree,
4512 hf_tn3270_load_line_type_command,
4513 tvb, offset,
4514 sf_body_length,
4515 ENC_NA);
4516 offset += sf_body_length;
4517 break;
4518 case SF_OB_MODIFY_PARTITION:
4519 offset += dissect_modify_partition(sf_tree, tvb, offset, sf_body_length);
4520 break;
4521 case SF_OB_OUTBOUND_TEXT_HEADER:
4522 offset += dissect_outbound_text_header(sf_tree, tvb, offset, sf_body_length);
4523 break;
4524 case SF_OB_REQUEST_RECOVERY_DATA:
4525 proto_tree_add_item(sf_tree,
4526 hf_tn3270_resbyte,
4527 tvb, offset,
4529 ENC_BIG_ENDIAN);
4530 offset += 1;
4531 break;
4532 case SF_OB_RESTART:
4533 offset += dissect_restart(sf_tree, tvb, offset, sf_body_length);
4534 break;
4535 case SF_OB_SELECT_COLOR_TABLE:
4536 proto_tree_add_item(sf_tree,
4537 hf_tn3270_color_command,
4538 tvb, offset,
4540 ENC_BIG_ENDIAN);
4541 offset += 2;
4542 break;
4543 case SF_OB_SET_CHECKPOINT_INTERVAL:
4544 proto_tree_add_item(sf_tree,
4545 hf_tn3270_resbyte,
4546 tvb, offset,
4548 ENC_BIG_ENDIAN);
4549 offset += 1;
4550 proto_tree_add_item(sf_tree,
4551 hf_tn3270_interval,
4552 tvb, offset,
4554 ENC_BIG_ENDIAN);
4555 offset += 2;
4556 break;
4557 case SF_OB_SET_MSR_CONTROL:
4558 offset += dissect_set_msr_control(sf_tree, tvb, offset, sf_body_length);
4559 break;
4560 case SF_OB_SET_PARTITION_CHARACTERISTICS:
4561 offset += dissect_set_partition_characteristics(sf_tree, tvb, offset, sf_body_length);
4562 break;
4563 case SF_OB_SET_PRINTER_CHARACTERISTICS:
4564 offset += dissect_set_printer_characteristics(sf_tree, tvb, offset, sf_body_length);
4565 break;
4566 case SF_OB_TYPE_1_TEXT_OUTBOUND:
4567 offset += dissect_type_1_text(sf_tree, tvb, offset, sf_body_length);
4568 break;
4569 default:
4570 DISSECTOR_ASSERT_NOT_REACHED();
4571 break;
4574 return (offset - start);
4577 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4578 /* call only with valid sf_id */
4579 static int
4580 process_outbound_inbound_structured_field(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
4581 tn3270_conv_info_t *tn3270_info _U_, unsigned sf_id, int sf_body_length)
4583 int start = offset;
4585 switch (sf_id) {
4586 case SF_OB_IB_DATA_CHAIN:
4587 offset += dissect_data_chain(tn3270_tree, tvb, offset, sf_body_length);
4588 break;
4589 case SF_OB_IB_DESTINATION_OR_ORIGIN:
4590 proto_tree_add_item(tn3270_tree,
4591 hf_tn3270_destination_or_origin_flags_input_control,
4592 tvb, offset,
4594 ENC_BIG_ENDIAN);
4595 offset += 1;
4596 proto_tree_add_item(tn3270_tree,
4597 hf_tn3270_resbyte,
4598 tvb, offset,
4600 ENC_BIG_ENDIAN);
4601 offset += 1;
4602 proto_tree_add_item(tn3270_tree,
4603 hf_tn3270_destination_or_origin_doid,
4604 tvb, offset,
4606 ENC_BIG_ENDIAN);
4607 offset += 2;
4608 break;
4609 case SF_OB_IB_OBJECT_DATA:
4610 case SF_OB_IB_OBJECT_CONTROL:
4611 case SF_OB_IB_OBJECT_PICTURE:
4612 case SF_OB_IB_OEM_DATA: /* FIXME: Not really but same layout */
4613 offset += dissect_object_control(tn3270_tree, tvb, offset, sf_body_length);
4614 break;
4615 case SF_OB_IB_SAVE_OR_RESTORE_FORMAT:
4616 offset += dissect_save_or_restore_format(tn3270_tree, tvb, offset, sf_body_length);
4617 break;
4618 case SF_OB_IB_SELECT_IPDS_MODE:
4619 proto_tree_add_item(tn3270_tree,
4620 hf_tn3270_resbytes,
4621 tvb, offset,
4623 ENC_BIG_ENDIAN);
4624 offset += 2;
4625 break;
4626 default:
4627 DISSECTOR_ASSERT_NOT_REACHED();
4628 break;
4631 return (offset - start);
4634 static proto_tree *
4635 display_sf_hdr(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset,
4636 int sf_length, unsigned sf_id, unsigned sf_id_len, const char *sf_id_str)
4638 proto_tree *sf_tree;
4640 sf_tree = proto_tree_add_subtree_format(tn3270_tree, tvb, offset, sf_length,
4641 ett_sf, NULL, "Structured Field: %s", sf_id_str);
4643 proto_tree_add_item(sf_tree,
4644 hf_tn3270_sf_length,
4645 tvb, offset,
4647 ENC_BIG_ENDIAN);
4649 proto_tree_add_uint_format_value(sf_tree,
4650 (sf_id_len == 1) ? hf_tn3270_sf_single_byte_id : hf_tn3270_sf_double_byte_id,
4651 tvb, offset+2, sf_id_len,
4652 sf_id, "%s (0x%0*x)", sf_id_str, sf_id_len*2, sf_id);
4654 return sf_tree;
4657 static int
4658 dissect_structured_fields(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, int offset,
4659 tn3270_conv_info_t *tn3270_info, bool direction_inbound)
4661 proto_tree *sf_tree;
4662 int start;
4663 int sf_length;
4664 unsigned sf_id;
4665 unsigned sf_id_len;
4666 const char *sf_id_str;
4668 start = offset;
4670 while (tvb_reported_length_remaining(tvb, offset) >= 2) {
4672 /* Handle NULL bytes until we find a length value */
4673 /* XXX: An earlier version of the code for structured field */
4674 /* processing did this check only for inbound structured */
4675 /* fields. Should the same be done in this code which */
4676 /* combines handling for both inbound and outbound */
4677 /* structured fields ? */
4678 if ((sf_length = tvb_get_ntohs(tvb, offset)) == 0) {
4679 proto_tree_add_item(tn3270_tree,
4680 hf_tn3270_null,
4681 tvb, offset,
4683 ENC_BIG_ENDIAN);
4684 offset += 1;
4685 continue;
4688 sf_id = tvb_get_uint8(tvb, offset+2);
4689 sf_id_len = 1;
4690 if ((sf_id == 0x0F) ||
4691 (sf_id == 0x10) ||
4692 (sf_id == 0x81)) {
4693 sf_id = (sf_id << 8) + tvb_get_uint8(tvb, offset+3);
4694 sf_id_len = 2;
4697 sf_id_str = try_val_to_str(sf_id, direction_inbound ?
4698 vals_inbound_structured_fields : vals_outbound_structured_fields);
4699 if (sf_id_str != NULL) {
4700 sf_tree = display_sf_hdr(tn3270_tree, tvb, offset,
4701 sf_length, sf_id, sf_id_len, sf_id_str);
4702 offset += (sf_id_len + 2);
4703 if (direction_inbound) {
4704 offset += process_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4706 else {
4707 offset += process_outbound_structured_field(sf_tree, pinfo, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4709 continue;
4712 /* Not found above: See if an "outbound-inbound" field */
4713 sf_id_str = try_val_to_str(sf_id, vals_outbound_inbound_structured_fields);
4714 if (sf_id_str != NULL) {
4715 sf_tree = display_sf_hdr(tn3270_tree, tvb, offset,
4716 sf_length, sf_id, sf_id_len, sf_id_str);
4717 offset += (sf_id_len + 2);
4718 offset += process_outbound_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4719 continue;
4722 /* Not found */
4723 sf_id_str = wmem_strdup_printf(pinfo->pool, "Unknown [%0*x]", sf_id_len*2, sf_id);
4724 display_sf_hdr(tn3270_tree, tvb, offset, sf_length,
4725 sf_length, sf_id_len, sf_id_str);
4726 offset += sf_length;
4727 } /* while */
4729 return (offset - start);
4733 /* Start: Handle WCC, Orders and Data */
4735 static int
4736 dissect_stop_address(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
4738 int start = offset;
4739 int is_oc_ge;
4741 proto_tree_add_item(tn3270_tree,
4742 hf_tn3270_stop_address,
4743 tvb, offset,
4745 ENC_BIG_ENDIAN);
4746 offset += 1;
4747 is_oc_ge = tvb_get_uint8(tvb, offset);
4748 if (is_oc_ge != OC_GE) {
4749 proto_tree_add_item(tn3270_tree,
4750 hf_tn3270_character_code,
4751 tvb, offset,
4753 ENC_BIG_ENDIAN);
4754 offset += 1;
4757 return (offset - start);
4761 * From section "4.3.3 Set Buffer Address (SBA)" of the IBM document
4762 * cited above.
4766 * Address format.
4768 * XXX - what about 16-bit addressing?
4770 #define SBA_ADDRESS_FORMAT_MASK 0xC000
4771 #define SBA_ADDRESS_MASK_SHIFT 14
4772 #define SBA_ADDRESS_FORMAT(address) (((address) & SBA_ADDRESS_FORMAT_MASK) >> SBA_ADDRESS_MASK_SHIFT)
4774 #define SBA_ADDRESS_VALUE_MASK 0x3FFF
4775 #define SBA_ADDRESS_VALUE(address) ((address) & SBA_ADDRESS_VALUE_MASK)
4777 #define SBA_14_BIT_BINARY 0x0
4778 #define SBA_12_BIT_CODED_1 0x1
4779 #define SBA_RESERVED 0x2
4780 #define SBA_12_BIT_CODED_2 0x3
4782 static int
4783 dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset, int hf, tn3270_conv_info_t *tn3270_info)
4785 int start = offset;
4786 uint16_t buffer_addr;
4787 uint16_t address_format, address_value;
4788 uint8_t b1, b2;
4789 uint8_t rowsx = tn3270_info->rows;
4790 uint8_t colsx = tn3270_info->cols;
4792 buffer_addr = tvb_get_ntohs(tvb, offset);
4793 address_format = SBA_ADDRESS_FORMAT(buffer_addr);
4794 address_value = SBA_ADDRESS_VALUE(buffer_addr);
4797 * XXX - put the address format and address value into the protocol
4798 * tree as bitfields under these items?
4800 switch (address_format) {
4802 case SBA_14_BIT_BINARY:
4803 proto_tree_add_uint_format_value(tn3270_tree,
4805 tvb, offset, 2,
4806 buffer_addr,
4807 "14-bit address, %u = row %u, column %u [assuming a %ux%u display] (0x%04x)",
4808 address_value,
4809 (address_value / colsx) + 1,
4810 (address_value % colsx) + 1,
4811 rowsx, colsx,
4812 buffer_addr);
4813 break;
4815 case SBA_12_BIT_CODED_1:
4816 case SBA_12_BIT_CODED_2:
4818 * This is a wacky encoding. At least as I read the IBM document
4819 * in question, the lower 6 bits of the first byte of the SBA
4820 * address, and the lower 6 bits of the second byte of the SBA
4821 * address, are combined into a 12-bit binary address. The upper
4822 * 2 bits of the first byte are the address format; the upper 2
4823 * bits of the second byte are ignored.
4825 b1 = (address_value >> 8) & 0x3F;
4826 b2 = (address_value >> 0) & 0x3F;
4827 address_value = (b1 << 6) | b2;
4828 proto_tree_add_uint_format_value(tn3270_tree,
4830 tvb, offset, 2,
4831 buffer_addr,
4832 "12-bit address, %u = row %u, column %u [assuming a %ux%u display] (0x%04x)",
4833 address_value,
4834 (address_value / colsx) + 1,
4835 (address_value % colsx) + 1,
4836 rowsx, colsx,
4837 buffer_addr);
4838 break;
4840 case SBA_RESERVED:
4841 proto_tree_add_uint_format_value(tn3270_tree,
4843 tvb, offset, 2,
4844 buffer_addr,
4845 "Reserved (0x%04x)",
4846 buffer_addr);
4847 break;
4849 offset += 2;
4851 return (offset - start);
4854 static int
4855 dissect_field_attribute_pair(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
4857 int start = offset;
4858 int attribute_type;
4860 attribute_type = tvb_get_uint8(tvb, offset);
4861 proto_tree_add_item(tn3270_tree,
4862 hf_tn3270_attribute_type,
4863 tvb, offset,
4865 ENC_BIG_ENDIAN);
4866 offset += 1;
4867 switch (attribute_type) {
4868 case AT_ALL_CHARACTER_ATTRIBUTES:
4869 proto_tree_add_item(tn3270_tree,
4870 hf_tn3270_all_character_attributes,
4871 tvb, offset,
4873 ENC_BIG_ENDIAN);
4874 offset += 1;
4875 break;
4876 case AT_T3270_FIELD_ATTRIBUTE:
4877 offset += dissect_3270_field_attribute(tn3270_tree, tvb, offset);
4878 break;
4879 case AT_EXTENDED_HIGHLIGHTING:
4880 proto_tree_add_item(tn3270_tree,
4881 hf_tn3270_extended_highlighting,
4882 tvb, offset,
4884 ENC_BIG_ENDIAN);
4885 offset += 1;
4886 break;
4887 case AT_FOREGROUND_COLOR:
4888 case AT_BACKGROUND_COLOR:
4889 proto_tree_add_item(tn3270_tree,
4890 hf_tn3270_color,
4891 tvb, offset,
4893 ENC_BIG_ENDIAN);
4894 offset += 1;
4895 break;
4896 case AT_CHARACTER_SET:
4897 proto_tree_add_item(tn3270_tree,
4898 hf_tn3270_character_set,
4899 tvb, offset,
4901 ENC_BIG_ENDIAN);
4902 offset += 1;
4903 break;
4904 case AT_FIELD_OUTLINING:
4905 proto_tree_add_item(tn3270_tree,
4906 hf_tn3270_field_outlining,
4907 tvb, offset,
4909 ENC_BIG_ENDIAN);
4910 offset += 1;
4911 break;
4912 case AT_TRANSPARENCY:
4913 proto_tree_add_item(tn3270_tree,
4914 hf_tn3270_transparency,
4915 tvb, offset,
4917 ENC_BIG_ENDIAN);
4918 offset += 1;
4919 break;
4920 case AT_FIELD_VALIDATION:
4921 offset += dissect_3270_field_validation(tn3270_tree, tvb, offset);
4922 break;
4925 return (offset - start);
4928 static int
4929 dissect_field_attribute_pairs(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
4931 int start = offset;
4932 int no_of_pairs;
4933 int i;
4935 no_of_pairs = tvb_get_uint8(tvb, offset);
4936 proto_tree_add_item(tn3270_tree,
4937 hf_tn3270_number_of_attributes,
4938 tvb, offset,
4940 ENC_BIG_ENDIAN);
4941 offset += 1;
4943 for (i=0; i < no_of_pairs; i++) {
4944 offset += dissect_field_attribute_pair(tn3270_tree, tvb, offset);
4947 return (offset - start);
4950 static int
4951 dissect_orders_and_data(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, int offset, tn3270_conv_info_t *tn3270_info)
4953 int start = offset;
4954 int order_code;
4955 proto_item* item;
4957 /* Order Code */
4959 /* XXX: '0' is treated as data; See comment under add_data_until_next_order_code() */
4960 while (tvb_reported_length_remaining(tvb, offset) > 0) {
4961 order_code = tvb_get_uint8(tvb, offset);
4962 if ((order_code > 0) && (order_code <= OC_MAX)) { /* XXX: also 0xFF ?? */
4963 item = proto_tree_add_item(tn3270_tree,
4964 hf_tn3270_order_code,
4965 tvb, offset,
4967 ENC_BIG_ENDIAN);
4968 offset += 1;
4970 switch (order_code) {
4971 case OC_SF:
4972 offset += dissect_3270_field_attribute(tn3270_tree, tvb, offset);
4973 break;
4974 case OC_MF:
4975 case OC_SFE:
4976 offset += dissect_field_attribute_pairs(tn3270_tree, tvb, offset);
4977 break;
4978 case OC_SA:
4979 offset += dissect_field_attribute_pair(tn3270_tree, tvb, offset);
4980 break;
4981 case OC_EUA:
4982 case OC_RA:
4983 offset += dissect_stop_address(tn3270_tree, tvb, offset);
4984 break;
4985 case OC_GE:
4986 proto_tree_add_item(tn3270_tree,
4987 hf_tn3270_character_code,
4988 tvb, offset,
4990 ENC_BIG_ENDIAN);
4991 offset += 1;
4992 break;
4993 case OC_SBA:
4994 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_buffer_address, tn3270_info);
4995 break;
4996 case OC_PT: /* XXX: This case was previously commented out; I don't know why */
4997 case OC_IC:
4998 break;
4999 default:
5000 expert_add_info(pinfo, item, &ei_tn3270_order_code);
5001 break;
5002 } /* switch */
5004 else {
5005 offset += add_data_until_next_order_code(tn3270_tree, tvb, offset);
5007 } /* while */
5009 return (offset - start);
5012 /* End: Handle WCC, Orders and Data */
5015 static int
5016 dissect_tn3270e_header(proto_tree *tn3270_tree, tvbuff_t *tvb, int offset)
5018 proto_item *pi;
5019 proto_tree *tn3270e_hdr_tree;
5020 int start = offset;
5021 int data_type;
5023 static const hf_items fields[] = {
5024 { &hf_tn3270_tn3270e_data_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
5025 { &hf_tn3270_tn3270e_request_flag, NULL, 1, NULL, ENC_BIG_ENDIAN },
5026 { NULL, NULL, 0, NULL, 0 }
5029 data_type = tvb_get_uint8(tvb, offset);
5031 tn3270e_hdr_tree = proto_tree_add_subtree_format(tn3270_tree, tvb, offset, -1,
5032 ett_tn3270e_hdr, &pi, "TN3270E Header (Data Type: %s)",
5033 val_to_str_const(data_type, vals_tn3270_header_data_types, "Unknown"));
5035 offset += tn3270_add_hf_items(tn3270e_hdr_tree, tvb, offset,
5036 fields);
5037 switch(data_type) {
5038 case TN3270E_3270_DATA:
5039 case TN3270E_SCS_DATA:
5040 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_3270_SCS, tvb, offset, 1, ENC_BIG_ENDIAN);
5041 break;
5042 case TN3270E_RESPONSE:
5043 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_response, tvb, offset, 1, ENC_BIG_ENDIAN);
5044 break;
5045 case TN3270E_BIND_IMAGE:
5046 case TN3270E_NVT_DATA:
5047 case TN3270E_REQUEST:
5048 case TN3270E_SSCP_LU_DATA:
5049 case TN3270E_UNBIND:
5050 default:
5051 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_unused, tvb, offset, 1, ENC_BIG_ENDIAN);
5052 break;
5054 offset += 1;
5056 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN);
5057 offset += 2;
5059 switch (data_type) {
5060 case TN3270E_BIND_IMAGE:
5061 case TN3270E_NVT_DATA:
5062 case TN3270E_REQUEST:
5063 case TN3270E_RESPONSE:
5064 case TN3270E_SCS_DATA:
5065 case TN3270E_SSCP_LU_DATA:
5066 case TN3270E_UNBIND:
5067 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_header_data, tvb, offset, -1, ENC_EBCDIC);
5068 offset += tvb_reported_length_remaining(tvb, offset);
5069 break;
5070 default:
5071 break;
5074 proto_item_set_len(pi, offset - start);
5076 return (offset - start);
5079 /* Detect and Handle Direction of Stream */
5080 static int
5081 dissect_outbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, int offset, tn3270_conv_info_t *tn3270_info)
5083 int command_code;
5084 int start = offset;
5085 proto_item* item;
5087 /* Command Code*/
5088 command_code = tvb_get_uint8(tvb, offset);
5090 /* XXX: Storing rows/cols each time they change is not valid */
5091 /* since packets can (will be) randomly selected for dissection */
5092 /* after the initial dissection pass. In actuality screen size */
5093 /* "state" needs to be associated in some manner with each */
5094 /* frame of a conversation. */
5095 switch (command_code) {
5096 case CC_LCL_EW:
5097 case CC_RMT_EW:
5098 tn3270_info->rows = 24;
5099 tn3270_info->cols = 80;
5100 break;
5101 case CC_LCL_EWA:
5102 case CC_RMT_EWA:
5103 tn3270_info->rows = tn3270_info->altrows;
5104 tn3270_info->cols = tn3270_info->altcols;
5105 break;
5106 default:
5107 break;
5110 item = proto_tree_add_item(tn3270_tree,
5111 hf_tn3270_command_code,
5112 tvb, offset,
5114 ENC_BIG_ENDIAN);
5115 offset += 1;
5117 switch (command_code) {
5118 case CC_LCL_W:
5119 case CC_LCL_EW:
5120 case CC_LCL_EWA:
5121 case CC_LCL_EAU:
5122 case CC_RMT_W:
5123 case CC_RMT_EW:
5124 case CC_RMT_EWA:
5125 case CC_RMT_EAU:
5126 /* WCC */
5127 offset += dissect_wcc(tn3270_tree, tvb, offset);
5128 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5129 break;
5130 case CC_LCL_WSF:
5131 case CC_RMT_WSF:
5132 offset += dissect_structured_fields(tn3270_tree, pinfo, tvb, offset, tn3270_info, false);
5133 break;
5134 case CC_LCL_RB:
5135 case CC_LCL_RM:
5136 case CC_LCL_RMA:
5137 case CC_RMT_RB:
5138 case CC_RMT_RM:
5139 case CC_RMT_RMA:
5140 break;
5141 default:
5142 expert_add_info(pinfo, item, &ei_tn3270_command_code);
5143 break;
5146 return (offset - start);
5150 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */
5151 /* Dissect tvb as inbound */
5152 static int
5153 dissect_inbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, int offset, tn3270_conv_info_t *tn3270_info)
5155 int start = offset;
5156 int aid;
5157 proto_item* item;
5159 /* Command Code*/
5160 aid = tvb_get_uint8(tvb, offset);
5161 item = proto_tree_add_item(tn3270_tree,
5162 hf_tn3270_aid,
5163 tvb, offset,
5165 ENC_BIG_ENDIAN);
5166 offset += 1;
5167 switch (aid) {
5168 case AID_STRUCTURED_FIELD:
5169 offset += dissect_structured_fields(tn3270_tree, pinfo, tvb, offset, tn3270_info, true);
5170 break;
5171 case AID_PA1_KEY:
5172 case AID_PA2_KEY_CNCL:
5173 case AID_PA3_KEY:
5174 case AID_CLEAR_KEY:
5175 /* Certain AID bytes need not be followed by anything */
5176 /* XXX: Is this the correct/complete set of AID bytes for this case ? */
5177 if (tvb_reported_length_remaining(tvb, offset) <= 0)
5178 break;
5179 /* FALL THROUGH */
5180 case AID_READ_PARTITION_AID:
5181 case AID_NO_AID_GENERATED:
5182 case AID_NO_AID_GENERATED_PRINTER_ONLY:
5183 case AID_TRIGGER_ACTION:
5184 case AID_TEST_REQ_AND_SYS_REQ:
5185 case AID_PF1_KEY:
5186 case AID_PF2_KEY:
5187 case AID_PF3_KEY:
5188 case AID_PF4_KEY:
5189 case AID_PF5_KEY:
5190 case AID_PF6_KEY:
5191 case AID_PF7_KEY:
5192 case AID_PF8_KEY:
5193 case AID_PF9_KEY:
5194 case AID_PF10_KEY:
5195 case AID_PF11_KEY:
5196 case AID_PF12_KEY:
5197 case AID_PF13_KEY:
5198 case AID_PF14_KEY:
5199 case AID_PF15_KEY:
5200 case AID_PF16_KEY:
5201 case AID_PF17_KEY:
5202 case AID_PF18_KEY:
5203 case AID_PF19_KEY:
5204 case AID_PF20_KEY:
5205 case AID_PF21_KEY:
5206 case AID_PF22_KEY:
5207 case AID_PF23_KEY:
5208 case AID_PF24_KEY:
5209 case AID_CLEAR_PARTITION_KEY:
5210 case AID_ENTER_KEY:
5211 case AID_SELECTOR_PEN_ATTENTION:
5212 case AID_OPERATOR_ID_READER:
5213 case AID_MAG_READER_NUMBER:
5214 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info);
5215 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5216 break;
5217 default:
5218 expert_add_info(pinfo, item, &ei_tn3270_aid);
5219 offset += 1;
5220 break;
5223 return (offset - start);
5227 static int
5228 dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
5230 proto_tree *tn3270_tree;
5231 proto_item *pi;
5232 int offset = 0;
5233 conversation_t *conversation;
5234 tn3270_conv_info_t *tn3270_info = NULL;
5236 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TN3270");
5238 pinfo->fd->encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
5240 /* Do we have a conversation for this connection? */
5241 conversation = find_conversation_pinfo(pinfo, 0);
5242 if (conversation != NULL) {
5243 /* Do we already have a type and mechanism? */
5244 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5247 if (tn3270_info == NULL)
5248 return 0;
5250 pi = proto_tree_add_item(tree, proto_tn3270, tvb, offset, -1, ENC_NA);
5251 tn3270_tree = proto_item_add_subtree(pi, ett_tn3270);
5252 col_clear(pinfo->cinfo, COL_INFO);
5254 if (tn3270_info->extended) {
5255 offset += dissect_tn3270e_header(tn3270_tree, tvb, offset);
5258 if (tvb_reported_length_remaining(tvb, offset) <= 0)
5259 return offset;
5261 if (pinfo->srcport == tn3270_info->outbound_port) {
5262 col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data from Mainframe");
5264 else {
5265 col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data to Mainframe");
5268 if(tree) {
5269 while (tvb_reported_length_remaining(tvb, offset) > 0) {
5270 if (pinfo->srcport == tn3270_info->outbound_port) {
5271 offset += dissect_outbound_stream(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5273 else {
5274 offset += dissect_inbound_stream(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5279 return tvb_captured_length(tvb);
5282 void
5283 add_tn3270_conversation(packet_info *pinfo, int tn3270e, int model)
5285 conversation_t *conversation;
5286 tn3270_conv_info_t *tn3270_info;
5288 conversation = find_or_create_conversation(pinfo);
5291 * Do we already have a type and mechanism?
5293 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5294 if (tn3270_info == NULL) {
5295 /* No. Attach that information to the conversation, and add
5296 * it to the list of information structures.
5298 tn3270_info = wmem_new(wmem_file_scope(), tn3270_conv_info_t);
5300 tn3270_info->outbound_port = pinfo->destport;
5302 conversation_add_proto_data(conversation, proto_tn3270, tn3270_info);
5305 /* The maximum rows/cols is tied to the 3270 model number */
5306 switch (model) {
5307 default:
5308 case 2:
5309 tn3270_info->altrows = 24;
5310 tn3270_info->altcols = 80;
5311 break;
5312 case 3:
5313 tn3270_info->altrows = 32;
5314 tn3270_info->altcols = 80;
5315 break;
5316 case 4:
5317 tn3270_info->altrows = 43;
5318 tn3270_info->altcols = 80;
5319 break;
5320 case 5:
5321 tn3270_info->altrows = 27;
5322 tn3270_info->altcols = 132;
5323 break;
5325 tn3270_info->rows = 24;
5326 tn3270_info->cols = 80;
5328 tn3270_info->extended = tn3270e;
5333 find_tn3270_conversation(packet_info *pinfo)
5335 conversation_t *conversation = NULL;
5336 tn3270_conv_info_t *tn3270_info = NULL;
5339 * Do we have a conversation for this connection?
5341 conversation = find_conversation_pinfo(pinfo, 0);
5342 if (conversation != NULL) {
5343 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5344 if (tn3270_info != NULL) {
5346 * Do we already have a type and mechanism?
5348 return 1;
5351 return 0;
5354 void
5355 proto_register_tn3270(void)
5357 static hf_register_info hf[] = {
5358 { &hf_tn3270_command_code,
5359 { "Command Code",
5360 "tn3270.command_code",
5361 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5362 NULL, HFILL }
5364 { &hf_tn3270_sf_length,
5365 { "Structured Field Length",
5366 "tn3270.sf_length",
5367 FT_UINT16, BASE_DEC, NULL, 0x0,
5368 NULL, HFILL }
5371 /* 3.4 Write Control Characters */
5372 { &hf_tn3270_wcc_nop,
5373 { "WCC NOP",
5374 "tn3270.wcc.nop",
5375 FT_BOOLEAN, 8, NULL, WCC_NOP,
5376 NULL, HFILL }
5378 { &hf_tn3270_wcc_reset,
5379 { "WCC Reset",
5380 "tn3270.wcc.reset",
5381 FT_BOOLEAN, 8, NULL, WCC_RESET,
5382 NULL, HFILL }
5384 { &hf_tn3270_wcc_printer1,
5385 { "WCC Printer1",
5386 "tn3270.wcc.printer1",
5387 FT_BOOLEAN, 8, NULL, WCC_PRINTER1,
5388 NULL, HFILL }
5390 { &hf_tn3270_wcc_printer2,
5391 { "WCC Printer2",
5392 "tn3270.wcc.printer2",
5393 FT_BOOLEAN, 8, NULL, WCC_PRINTER2,
5394 NULL, HFILL }
5396 { &hf_tn3270_wcc_start_printer,
5397 { "WCC Start Printer",
5398 "tn3270.wcc.start_printer",
5399 FT_BOOLEAN, 8, NULL, WCC_START_PRINTER,
5400 NULL, HFILL }
5402 { &hf_tn3270_wcc_sound_alarm,
5403 { "WCC Sound Alarm",
5404 "tn3270.wcc.sound_alarm",
5405 FT_BOOLEAN, 8, NULL, WCC_SOUND_ALARM,
5406 NULL, HFILL }
5408 { &hf_tn3270_wcc_keyboard_restore,
5409 { "WCC Keyboard Restore",
5410 "tn3270.wcc.keyboard_restore",
5411 FT_BOOLEAN, 8, NULL, WCC_KEYBOARD_RESTORE,
5412 NULL, HFILL }
5414 { &hf_tn3270_wcc_reset_mdt,
5415 { "WCC Reset MDT",
5416 "tn3270.wcc.reset_mdt",
5417 FT_BOOLEAN, 8, NULL, WCC_RESET_MDT,
5418 NULL, HFILL }
5421 /* 8.7 Copy Control Codes (CCC) */
5422 { &hf_tn3270_ccc,
5423 { "Copy Control Code",
5424 "tn3270.ccc",
5425 FT_UINT8, BASE_HEX, NULL, 0,
5426 NULL, HFILL }
5428 { &hf_tn3270_ccc_coding,
5429 { "Coding",
5430 "tn3270.ccc_coding",
5431 FT_UINT8, BASE_HEX, NULL, CCC_GRAPHIC_CONVERT_MASK,
5432 NULL, HFILL }
5434 { &hf_tn3270_ccc_printout,
5435 { "Printout Format",
5436 "tn3270.ccc_printout",
5437 FT_UINT8, BASE_HEX, VALS(ccc_vals_printout_format), CCC_PRINT_BITS_MASK,
5438 NULL, HFILL }
5440 { &hf_tn3270_ccc_start_print,
5441 { "The start-print bit",
5442 "tn3270.ccc_start_print",
5443 FT_BOOLEAN, 8, NULL, CCC_START_PRINT,
5444 NULL, HFILL }
5446 { &hf_tn3270_ccc_sound_alarm,
5447 { "The sound-alarm bit",
5448 "tn3270.ccc_sound_alarm",
5449 FT_BOOLEAN, 8, NULL, CCC_SOUND_ALARM,
5450 NULL, HFILL }
5452 { &hf_tn3270_ccc_copytype,
5453 { "Type of Data to be Copied",
5454 "tn3270.ccc_copytype",
5455 FT_UINT8, BASE_HEX, VALS(ccc_vals_copytype), CCC_ATTRIBUTE_BITS_MASK,
5456 NULL, HFILL }
5459 /* 4.4.1 Field Attributes */
5460 { &hf_tn3270_field_attribute,
5461 { "3270 Field Attribute",
5462 "tn3270.field_attribute",
5463 FT_UINT8, BASE_HEX, NULL, 0,
5464 NULL, HFILL }
5466 { &hf_tn3270_fa_graphic_convert,
5467 { "Graphic Convert",
5468 "tn3270.fa.graphic_convert",
5469 FT_UINT8, BASE_HEX, NULL, FA_GRAPHIC_CONVERT_MASK,
5470 NULL, HFILL }
5472 { &hf_tn3270_fa_protected,
5473 { "Protected",
5474 "tn3270.fa.protected",
5475 FT_BOOLEAN, 8, NULL, FA_PROTECTED,
5476 NULL, HFILL }
5478 { &hf_tn3270_fa_numeric,
5479 { "Numeric",
5480 "tn3270.fa.numeric",
5481 FT_BOOLEAN, 8, NULL, FA_NUMERIC,
5482 NULL, HFILL }
5484 { &hf_tn3270_fa_display,
5485 { "Display",
5486 "tn3270.fa.display",
5487 FT_UINT8, BASE_HEX, VALS(vals_fa_display), FA_DISPLAY_BITS_MASK,
5488 NULL, HFILL }
5490 { &hf_tn3270_fa_reserved,
5491 { "Reserved",
5492 "tn3270.fa.reserved",
5493 FT_BOOLEAN, 8, NULL, FA_RESERVED,
5494 NULL, HFILL }
5496 { &hf_tn3270_fa_modified,
5497 { "Modified",
5498 "tn3270.fa.modified",
5499 FT_BOOLEAN, 8, NULL, FA_MODIFIED,
5500 NULL, HFILL }
5503 /* Order Code */
5504 { &hf_tn3270_order_code,
5505 { "Order Code",
5506 "tn3270.order_code",
5507 FT_UINT8, BASE_HEX, VALS(vals_order_codes), 0x0,
5508 NULL, HFILL }
5510 { &hf_tn3270_character_code,
5511 { "Character Code",
5512 "tn3270.character_code",
5513 FT_UINT8, BASE_HEX, NULL, 0x0,
5514 NULL, HFILL }
5516 { &hf_tn3270_stop_address,
5517 { "Stop Address",
5518 "tn3270.stop_address",
5519 FT_UINT16, BASE_DEC, NULL, 0x0,
5520 NULL, HFILL }
5522 { &hf_tn3270_attribute_type,
5523 { "Attribute Type",
5524 "tn3270.attribute_type",
5525 FT_UINT8, BASE_HEX, VALS(vals_attribute_types), 0x0,
5526 NULL, HFILL }
5528 { &hf_tn3270_extended_highlighting,
5529 { "Extended Highlighting",
5530 "tn3270.extended_highlighting",
5531 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
5532 NULL, HFILL }
5534 { &hf_tn3270_color,
5535 { "Color",
5536 "tn3270.color",
5537 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
5538 NULL, HFILL }
5540 { &hf_tn3270_character_set,
5541 { "Character Set",
5542 "tn3270.character_set",
5543 FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(rvals_at_character_set), 0x0,
5544 NULL, HFILL }
5546 { &hf_tn3270_field_outlining,
5547 { "Field Outlining",
5548 "tn3270.field_outlining",
5549 FT_UINT8, BASE_HEX, VALS(vals_at_field_outlining), 0x0,
5550 NULL, HFILL }
5552 { &hf_tn3270_transparency,
5553 { "Transparency",
5554 "tn3270.transparency",
5555 FT_UINT8, BASE_HEX, VALS(vals_at_transparency), 0x0,
5556 NULL, HFILL }
5559 { &hf_tn3270_field_validation_mandatory_fill,
5560 { "3270 Field validation_mandatory_fill",
5561 "tn3270.field_validation_mandatory_fill",
5562 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_mandatory_fill), AT_FV_MANDATORY_FILL,
5563 NULL, HFILL }
5565 { &hf_tn3270_field_validation_mandatory_entry,
5566 { "3270 Field validation_mandatory_entry",
5567 "tn3270.field_validation_mandatory_entry",
5568 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_mandatory_entry), AT_FV_MANDATORY_ENTRY,
5569 NULL, HFILL }
5571 { &hf_tn3270_field_validation_trigger,
5572 { "3270 Field validation_trigger",
5573 "tn3270.field_validation_trigger",
5574 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_trigger), AT_FV_TRIGGER,
5575 NULL, HFILL }
5578 { &hf_tn3270_all_character_attributes,
5579 { "all_character_attributes",
5580 "tn3270.all_character_attributes",
5581 FT_UINT8, BASE_HEX, NULL, 0x0,
5582 NULL, HFILL }
5584 { &hf_tn3270_aid,
5585 { "Attention Identification",
5586 "tn3270.aid",
5587 FT_UINT8, BASE_HEX, VALS(vals_attention_identification_bytes), 0x0,
5588 NULL, HFILL }
5591 { &hf_tn3270_buffer_address,
5592 { "Buffer Address",
5593 "tn3270.buffer_address",
5594 FT_UINT16, BASE_HEX, NULL, 0x0,
5595 NULL, HFILL }
5598 /* Self Defining Parameters */
5599 { &hf_tn3270_sdp_ln,
5600 { "Length of this Self-Defining Parameter",
5601 "tn3270.sdp_ln",
5602 FT_UINT8, BASE_DEC, NULL, 0x0,
5603 NULL, HFILL }
5605 { &hf_tn3270_sdp_id,
5606 { "Self-Defining Parameter ID",
5607 "tn3270.sdp_id",
5608 FT_UINT8, BASE_HEX, NULL, 0x0,
5609 NULL, HFILL }
5611 /* Self Defining Parameters */
5613 /* 5.6 - Begin/End of File */
5614 { &hf_tn3270_begin_end_flags1,
5615 { "Begin End Flags1",
5616 "tn3270.begin_end_flags1",
5617 FT_UINT8, BASE_HEX, NULL, 0x0,
5618 NULL, HFILL }
5620 { &hf_tn3270_begin_end_flags2,
5621 { "Begin End Flags2",
5622 "tn3270.begin_end_flags2",
5623 FT_UINT8, BASE_HEX, NULL, 0x0,
5624 NULL, HFILL }
5626 /* END - 5.6 - Begin/End of File */
5628 /* 5.7 - Create Partition */
5629 { &hf_tn3270_partition_id,
5630 { "Partition ID",
5631 "tn3270.partition_id",
5632 FT_UINT8, BASE_HEX, NULL, 0x0,
5633 NULL, HFILL }
5635 { &hf_tn3270_partition_uom,
5636 { "The unit of measure and address mode",
5637 "tn3270.partition_uom",
5638 FT_UINT8, BASE_HEX, NULL, 0x0,
5639 NULL, HFILL }
5641 { &hf_tn3270_partition_flags,
5642 { "Flags",
5643 "tn3270.partition_flags",
5644 FT_UINT8, BASE_HEX, NULL, 0x0,
5645 NULL, HFILL }
5647 { &hf_tn3270_partition_height,
5648 { "The height of the presentation space",
5649 "tn3270.partition_height",
5650 FT_UINT16, BASE_DEC, NULL, 0x0,
5651 NULL, HFILL }
5653 { &hf_tn3270_partition_width,
5654 { "The width of the presentation space",
5655 "tn3270.partition_width",
5656 FT_UINT16, BASE_DEC, NULL, 0x0,
5657 NULL, HFILL }
5659 { &hf_tn3270_partition_rv,
5660 { "The y, or row, origin of the viewport relative to the top edge of the usable area",
5661 "tn3270.partition_rv",
5662 FT_UINT16, BASE_DEC, NULL, 0x0,
5663 NULL, HFILL }
5665 { &hf_tn3270_partition_cv,
5666 { "The x, or column, origin of the viewport relative to the left side of the usable area",
5667 "tn3270.partition_cv",
5668 FT_UINT16, BASE_DEC, NULL, 0x0,
5669 NULL, HFILL }
5671 { &hf_tn3270_partition_hv,
5672 { "The height of the viewport",
5673 "tn3270.partition_hv",
5674 FT_UINT16, BASE_DEC, NULL, 0x0,
5675 NULL, HFILL }
5677 { &hf_tn3270_partition_wv,
5678 { "The width of the viewport",
5679 "tn3270.partition_wv",
5680 FT_UINT16, BASE_DEC, NULL, 0x0,
5681 NULL, HFILL }
5683 { &hf_tn3270_partition_rw,
5684 { "The y, or row, origin of the window relative to the top edge of the presentation space",
5685 "tn3270.partition_rw",
5686 FT_UINT16, BASE_DEC, NULL, 0x0,
5687 NULL, HFILL }
5689 { &hf_tn3270_partition_cw,
5690 { "The x, or column, origin of the window relative to the left edge of the presentation space",
5691 "tn3270.partition_cw",
5692 FT_UINT16, BASE_DEC, NULL, 0x0,
5693 NULL, HFILL }
5695 { &hf_tn3270_partition_rs,
5696 { "The number of units to be scrolled in a vertical multiple scroll",
5697 "tn3270.partition_rs",
5698 FT_UINT16, BASE_DEC, NULL, 0x0,
5699 NULL, HFILL }
5701 { &hf_tn3270_partition_res,
5702 { "Reserved",
5703 "tn3270.partition_res",
5704 FT_UINT16, BASE_DEC, NULL, 0x0,
5705 NULL, HFILL }
5707 { &hf_tn3270_partition_pw,
5708 { "The number of points in the horizontal direction in a character cell in this presentation space",
5709 "tn3270.partition_pw",
5710 FT_UINT8, BASE_HEX, NULL, 0x0,
5711 NULL, HFILL }
5713 { &hf_tn3270_partition_ph,
5714 { "The number of points in the vertical direction in a character cell in this presentation space",
5715 "tn3270.partition_ph",
5716 FT_UINT16, BASE_DEC, NULL, 0x0,
5717 NULL, HFILL }
5720 { &hf_tn3270_partition_command,
5721 { "Partition Command",
5722 "tn3270.partition_command",
5723 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5724 NULL, HFILL }
5726 /* End - 5.7 - Create Partition */
5728 /* 5.9 - Erase/Reset */
5729 { &hf_tn3270_erase_flags,
5730 { "Erase Flags",
5731 "tn3270.erase_flags",
5732 FT_UINT8, BASE_HEX, NULL, 0x0,
5733 NULL, HFILL }
5735 /* End - 5.9 - Erase/Reset */
5737 /* 5.10 - Load Color Table */
5738 { &hf_tn3270_load_color_command,
5739 { "Command",
5740 "tn3270.load_color_command",
5741 FT_BYTES, BASE_NONE, NULL, 0x0,
5742 NULL, HFILL }
5744 /* End - 5.10 - Load Color Table */
5746 /* 5.11 - Load Format Storage */
5747 { &hf_tn3270_load_format_storage_flags1,
5748 { "Flags",
5749 "tn3270.load_format_storage_flags1",
5750 FT_UINT8, BASE_HEX, NULL, 0x0,
5751 NULL, HFILL }
5753 { &hf_tn3270_load_format_storage_flags2,
5754 { "Flags (Reserved)",
5755 "tn3270.load_format_storage_flags2",
5756 FT_UINT8, BASE_HEX, NULL, 0x0,
5757 NULL, HFILL }
5759 { &hf_tn3270_load_format_storage_operand,
5760 { "Operand",
5761 "tn3270.load_format_storage_operand",
5762 FT_UINT8, BASE_HEX, VALS(vals_load_storage_format_operand), 0x0,
5763 NULL, HFILL }
5765 { &hf_tn3270_load_format_storage_localname,
5766 { "Local name for user selectable formats",
5767 "tn3270.load_format_storage_localname",
5768 FT_STRING, BASE_NONE, NULL, 0x0,
5769 NULL, HFILL }
5771 { &hf_tn3270_format_group,
5772 { "Format Group name",
5773 "tn3270.format_group_name",
5774 FT_STRING, BASE_NONE, NULL, 0x0,
5775 NULL, HFILL }
5777 { &hf_tn3270_format_name,
5778 { "Format name",
5779 "tn3270.format_name",
5780 FT_STRING, BASE_NONE, NULL, 0x0,
5781 NULL, HFILL }
5783 { &hf_tn3270_load_format_storage_format_data,
5784 { "Format data",
5785 "tn3270.load_format_storage_format_data",
5786 FT_STRING, BASE_NONE, NULL, 0x0,
5787 NULL, HFILL }},
5788 /* END - 5.11 - Load Format Storage */
5790 /* 5.12 - Load Line Type */
5791 { &hf_tn3270_load_line_type_command,
5792 { "Line Type Command",
5793 "tn3270.load_line_type_command",
5794 FT_BYTES, BASE_NONE, NULL, 0x0,
5795 NULL, HFILL }
5798 /* 5.13 - Load Programmed Symbols */
5799 { &hf_tn3270_ps_flags,
5800 { "Flags",
5801 "tn3270.ps_flags",
5802 FT_UINT8, BASE_HEX, NULL, 0x0,
5803 NULL, HFILL }
5805 { &hf_tn3270_ps_lcid,
5806 { "Local character set ID",
5807 "tn3270.ps_lcid",
5808 FT_UINT8, BASE_HEX, NULL, 0x0,
5809 NULL, HFILL }
5811 { &hf_tn3270_ps_char,
5812 { "Beginning code point X'41' through X'FE'",
5813 "tn3270.ps_char",
5814 FT_UINT8, BASE_HEX, NULL, 0x0,
5815 NULL, HFILL }
5817 { &hf_tn3270_ps_rws,
5818 { "Loadable Character Set RWS Number",
5819 "tn3270.ps_rws",
5820 FT_UINT8, BASE_HEX, NULL, 0x0,
5821 NULL, HFILL }
5823 { &hf_tn3270_extended_ps_length,
5824 { "Length of parameters for extended form, including the length parameter",
5825 "tn3270.extended_ps_length",
5826 FT_UINT8, BASE_HEX, NULL, 0x0,
5827 NULL, HFILL }
5829 { &hf_tn3270_extended_ps_flags,
5830 { "Flags",
5831 "tn3270.extended_ps_flags",
5832 FT_UINT8, BASE_HEX, NULL, 0x0,
5833 NULL, HFILL }
5835 { &hf_tn3270_extended_ps_lw,
5836 { "Number of X-units in character cell (width of character matrixes)",
5837 "tn3270.extended_ps_lw",
5838 FT_UINT8, BASE_HEX, NULL, 0x0,
5839 NULL, HFILL }
5841 { &hf_tn3270_extended_ps_lh,
5842 { "Number of Y-units in character cell (depth of character matrixes)",
5843 "tn3270.extended_ps_lh",
5844 FT_UINT8, BASE_HEX, NULL, 0x0,
5845 NULL, HFILL }
5847 { &hf_tn3270_extended_ps_subsn,
5848 { "Subsection ID",
5849 "tn3270.extended_ps_subsn",
5850 FT_UINT8, BASE_HEX, NULL, 0x0,
5851 NULL, HFILL }
5853 { &hf_tn3270_extended_ps_color,
5854 { "Color planes",
5855 "tn3270.extended_ps_color",
5856 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
5857 NULL, HFILL }
5859 { &hf_tn3270_extended_ps_stsubs,
5860 { "Starting Subsection Identifier",
5861 "tn3270.extended_ps_stsubs",
5862 FT_UINT8, BASE_HEX, NULL, 0x0,
5863 NULL, HFILL }
5865 { &hf_tn3270_extended_ps_echar,
5866 { "Ending code point",
5867 "tn3270.extended_ps_echar",
5868 FT_UINT8, BASE_HEX, NULL, 0x0,
5869 NULL, HFILL }
5871 { &hf_tn3270_extended_ps_nw,
5872 { "Number of width pairs",
5873 "tn3270.extended_ps_nw",
5874 FT_UINT8, BASE_HEX, NULL, 0x0,
5875 NULL, HFILL }
5877 { &hf_tn3270_extended_ps_nh,
5878 { "Number of height pairs",
5879 "tn3270.extended_ps_nh",
5880 FT_UINT8, BASE_HEX, NULL, 0x0,
5881 NULL, HFILL }
5883 { &hf_tn3270_extended_ps_res,
5884 { "Reserved",
5885 "tn3270.extended_ps_res",
5886 FT_UINT8, BASE_HEX, NULL, 0x0,
5887 NULL, HFILL }
5889 /* END - 5.13 - Load Programmed Symbols */
5891 /* 5.15 - Outbound Text Header */
5892 /* Note: some of these entries multiply used */
5893 { &hf_tn3270_outbound_text_header_operation_type,
5894 { "Outbound Text Operation Type",
5895 "tn3270.outbound_text_operation_type",
5896 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5897 NULL, HFILL }
5899 { &hf_tn3270_lvl,
5900 { "Cursor level",
5901 "tn3270.lvl",
5902 FT_UINT8, BASE_HEX, NULL, 0x0,
5903 NULL, HFILL }
5905 { &hf_tn3270_cro,
5906 { "Cursor row offset",
5907 "tn3270.cro",
5908 FT_UINT16, BASE_DEC, NULL, 0x0,
5909 NULL, HFILL }
5911 { &hf_tn3270_cc,
5912 { "Cursor column offset",
5913 "tn3270.cc",
5914 FT_UINT16, BASE_DEC, NULL, 0x0,
5915 NULL, HFILL }
5917 { &hf_tn3270_outbound_text_header_lhdr,
5918 { "Header length includes itself",
5919 "tn3270.outbound_text_header_lhdr",
5920 FT_UINT16, BASE_DEC, NULL, 0x0,
5921 NULL, HFILL }
5923 { &hf_tn3270_outbound_text_header_hdr,
5924 { "Initial format controls",
5925 "tn3270.outbound_text_header_hdr",
5926 FT_BYTES, BASE_NONE, NULL, 0x0,
5927 NULL, HFILL }
5929 /* END - 5.15 - Outbound Text Header */
5931 /* 5.16 - Outbound 3270DS */
5932 { &hf_tn3270_bsc,
5933 { "SNA BSC",
5934 "tn3270.bsc",
5935 FT_UINT16, BASE_HEX, NULL, 0x0,
5936 NULL, HFILL }
5938 /* END - 5.16 - Outbound 3270DS */
5940 /* 5.17 - Present Absolute Format */
5941 { &hf_tn3270_fpc,
5942 { "Format Presentation Command",
5943 "tn3270.fpc",
5944 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5945 NULL, HFILL }
5947 /* END - 5.17 - Present Absolute Format */
5949 /* 5.18 - Present Relative Format */
5950 { &hf_tn3270_fov,
5951 { "Format Offset Value",
5952 "tn3270.fov",
5953 FT_UINT16, BASE_DEC, NULL, 0x0,
5954 NULL, HFILL }
5956 /* End - 5.18 - Present Relative Format */
5958 /* 5.19 - Read Partition */
5959 { &hf_tn3270_read_partition_operation_type,
5960 { "Read Partition Operation Type",
5961 "tn3270.read_partition_optyp",
5962 FT_UINT8, BASE_HEX, VALS(vals_read_partition_operation_type), 0x0,
5963 NULL, HFILL }
5965 { &hf_tn3270_read_partition_reqtyp,
5966 { "Read Partition Request Type",
5967 "tn3270.read_partition_reqtyp",
5968 FT_UINT8, BASE_HEX, VALS(vals_read_partition_reqtype), READ_PARTITION_REQTYPE_MASK,
5969 NULL, HFILL }
5971 /* End - 5.19 - Read Partition */
5973 /* 5.22 - Restart */
5974 { &hf_tn3270_start_page,
5975 { "Number of pages to skip on restart",
5976 "tn3270.start_page",
5977 FT_UINT16, BASE_DEC, NULL, 0x0,
5978 NULL, HFILL }
5980 { &hf_tn3270_start_line,
5981 { "Number of lines to skip on page for restart",
5982 "tn3270.start_line",
5983 FT_UINT16, BASE_DEC, NULL, 0x0,
5984 NULL, HFILL }
5986 { &hf_tn3270_scs_data,
5987 { "SCS data (noncompressed and noncompacted) to set up for restart",
5988 "tn3270.scs_data",
5989 FT_BYTES, BASE_NONE, NULL, 0x0,
5990 NULL, HFILL }
5992 /* End - 5.22 - Restart */
5994 /* 5.24 - Select Color Table */
5995 { &hf_tn3270_color_command,
5996 { "Color Command",
5997 "tn3270.color_command",
5998 FT_UINT16, BASE_HEX, NULL, 0x0,
5999 NULL, HFILL }
6001 /* 5.24 - Select Color Table */
6003 /* 5.26 - Set Checkpoint Interval */
6004 { &hf_tn3270_interval,
6005 { "Checkpoint interval",
6006 "tn3270.interval",
6007 FT_UINT16, BASE_HEX, NULL, 0x0,
6008 "Specifies the number of pages in the interval between terminal checkpoints", HFILL }
6010 /* End - 5.26 - Set Checkpoint Interval */
6012 /* 5.27 - Set MSR Interval */
6013 { &hf_tn3270_msr_type,
6014 { "MSR type",
6015 "tn3270.msr_type",
6016 FT_UINT8, BASE_HEX, NULL, 0x0,
6017 NULL, HFILL }
6019 { &hf_tn3270_msr_state_mask,
6020 { "State Mask",
6021 "tn3270.msr_state_mask",
6022 FT_UINT8, BASE_HEX, NULL, 0x0,
6023 NULL, HFILL }
6025 { &hf_tn3270_msr_user,
6026 { "User Mode",
6027 "tn3270.msr.user",
6028 FT_BOOLEAN, 8, NULL, 0x80,
6029 NULL, HFILL }
6031 { &hf_tn3270_msr_locked,
6032 { "Locked",
6033 "tn3270.msr.locked",
6034 FT_BOOLEAN, 8, NULL, 0x40,
6035 NULL, HFILL }
6037 { &hf_tn3270_msr_auto,
6038 { "Auto Enter",
6039 "tn3270.msr.auto",
6040 FT_BOOLEAN, 8, NULL, 0x20,
6041 NULL, HFILL }
6043 { &hf_tn3270_msr_ind1,
6044 { "Audible Ind 1 Suppress",
6045 "tn3270.msr.ind1",
6046 FT_BOOLEAN, 8, NULL, 0x10,
6047 NULL, HFILL }
6049 { &hf_tn3270_msr_ind2,
6050 { "Audible Ind 2 Suppress",
6051 "tn3270.msr.ind2",
6052 FT_BOOLEAN, 8, NULL, 0x08,
6053 NULL, HFILL }
6055 { &hf_tn3270_msr_state_value,
6056 { "State Value", "tn3270.msr_state_value",
6057 FT_UINT8, BASE_HEX, NULL, 0x0,
6058 NULL, HFILL }
6060 { &hf_tn3270_msr_ind_mask,
6061 { "Indicator Mask",
6062 "tn3270.msr_ind_mask",
6063 FT_UINT8, BASE_HEX, NULL, 0x0,
6064 NULL, HFILL }
6066 { &hf_tn3270_msr_ind_value,
6067 { "Indicator Value",
6068 "tn3270.msr_ind_value",
6069 FT_UINT8, BASE_HEX, NULL, 0x0,
6070 NULL, HFILL }
6072 /* END - 5.27 - Set MSR Interval */
6074 /* 5.28 - Set Partition Characteristics */
6075 { &hf_tn3270_spc_sdp_ot,
6076 { "Top edge outline thickness",
6077 "tn3270.spc_sdp_ot",
6078 FT_UINT8, BASE_DEC, NULL, 0x0,
6079 NULL, HFILL }
6081 { &hf_tn3270_spc_sdp_ob,
6082 { "Bottom edge outline thickness",
6083 "tn3270.spc_sdp_ob",
6084 FT_UINT8, BASE_DEC, NULL, 0x0,
6085 NULL, HFILL }
6087 { &hf_tn3270_spc_sdp_ol,
6088 { "Left edge outline thickness",
6089 "tn3270.spc_sdp_ol",
6090 FT_UINT8, BASE_DEC, NULL, 0x0,
6091 NULL, HFILL }
6093 { &hf_tn3270_spc_sdp_or,
6094 { "Right edge outline thickness",
6095 "tn3270.spc_sdp_or",
6096 FT_UINT8, BASE_DEC, NULL, 0x0,
6097 NULL, HFILL }
6099 { &hf_tn3270_spc_sdp_eucflags,
6100 { "Flags",
6101 "tn3270.spc_sdp_eucflags",
6102 FT_UINT8, BASE_HEX, NULL, 0x0,
6103 NULL, HFILL }
6105 /* END - 5.28 - Set Partition Characteristics */
6107 /* 5.29 - Set Printer Characteristics */
6108 { &hf_tn3270_printer_flags,
6109 { "Flags",
6110 "tn3270.printer_flags",
6111 FT_UINT8, BASE_HEX, NULL, 0x0,
6112 NULL, HFILL }
6114 { &hf_tn3270_spc_sdp_srepc,
6115 { "Set/Reset Early Print Complete",
6116 "tn3270.spc_sdp_srepc",
6117 FT_UINT8, BASE_HEX, NULL, 0x0,
6118 NULL, HFILL }
6120 /* END - 5.29 - Set Printer Characteristics */
6122 /* 5.30 - Set Reply Mode */
6123 /* hf_tn3270_mode also used for 6.42: Query Reply (modes) */
6124 { &hf_tn3270_mode,
6125 { "Mode",
6126 "tn3270.mode",
6127 FT_UINT8, BASE_HEX, VALS(vals_reply_modes), 0x0,
6128 NULL, HFILL }
6130 { &hf_tn3270_reply_mode_attr_list,
6131 { "Type codes for the attribute types",
6132 "tn3270.reply_mode_attr_list",
6133 FT_UINT8, BASE_HEX, VALS(vals_attribute_types), 0x0,
6134 NULL, HFILL }
6136 /* END - 5.30 - Set Reply Mode */
6138 /* 5.34 - Data Chain */
6139 { &hf_tn3270_data_chain_fields,
6140 { "Data Chain Fields",
6141 "tn3270.data_chain_fields",
6142 FT_UINT8, BASE_HEX, NULL, 0x0,
6143 NULL, HFILL }
6145 { &hf_tn3270_data_chain_group,
6146 { "Data Chain Group",
6147 "tn3270.data_chain_group",
6148 FT_UINT8, BASE_HEX, VALS(vals_data_chain_group), DATA_CHAIN_GROUP_MASK,
6149 NULL, HFILL }
6151 { &hf_tn3270_data_chain_inbound_control,
6152 { "Data Chain Inbound Control",
6153 "tn3270.data_chain_inbound_control",
6154 FT_UINT8, BASE_HEX, VALS(vals_data_chain_inbound_control), DATA_CHAIN_INBOUND_CONTROL_MASK,
6155 NULL, HFILL }
6157 /* END - 5.34 - Data Chain */
6159 /* 5.35 - Destination/Origin */
6160 { &hf_tn3270_destination_or_origin_flags_input_control,
6161 { "Input Control",
6162 "tn3270.destination_or_origin_flags_input_control",
6163 FT_UINT8, BASE_HEX, VALS(vals_destination_or_origin_flags_input_control), DESTINATION_OR_ORIGIN_FLAGS_INPUT_CONTROL_MASK,
6164 NULL, HFILL }
6166 { &hf_tn3270_destination_or_origin_doid,
6167 { "DOID",
6168 "tn3270.destination_or_origin_doid",
6169 FT_UINT16, BASE_HEX, NULL, 0x0,
6170 NULL, HFILL }
6172 /* END - 5.35 - Destination/Origin */
6175 /* 5.36 - Object Control */
6176 { &hf_tn3270_object_control_flags,
6177 { "Flags",
6178 "tn3270.object_control_flags",
6179 FT_UINT8, BASE_HEX, NULL, 0x0,
6180 NULL, HFILL }
6182 { &hf_tn3270_object_type,
6183 { "Object Type",
6184 "tn3270.object_type",
6185 FT_UINT8, BASE_HEX, VALS(vals_oc_type), 0x0,
6186 NULL, HFILL }
6188 /* END - 5.36 - Object Control */
6190 /* 5.40 - Save/Restore Format */
6191 { &hf_tn3270_save_or_restore_format_flags,
6192 { "Flags",
6193 "tn3270.save_or_restore_format_flags",
6194 FT_UINT8, BASE_HEX, NULL, 0x0,
6195 NULL, HFILL }
6197 { &hf_tn3270_srf_fpcb,
6198 { "Contents of the FPCB that is to be saved or restored",
6199 "tn3270.srf_fpcb",
6200 FT_BYTES, BASE_NONE, NULL, 0x0,
6201 NULL, HFILL }
6204 /* 5.40 - Save/Restore Format */
6205 { &hf_tn3270_type_1_text_outbound_data,
6206 { "Type 1 text outbound data",
6207 "tn3270.type_1_text_outbound_data",
6208 FT_BYTES, BASE_NONE, NULL, 0x0,
6209 NULL, HFILL }
6212 /* 6.2 - Exception/Status */
6213 { &hf_tn3270_exception_or_status_flags,
6214 { "Flags",
6215 "tn3270.exception_or_status_flags",
6216 FT_UINT8, BASE_HEX, NULL, 0x0,
6217 NULL, HFILL }
6219 { &hf_tn3270_sdp_excode,
6220 { "Exception Code",
6221 "tn3270.sdp_excode",
6222 FT_UINT16, BASE_DEC, VALS(vals_sdp_excode), 0x0,
6223 NULL, HFILL }
6225 { &hf_tn3270_sdp_statcode,
6226 { "Status Code",
6227 "tn3270.sdp_statcode",
6228 FT_UINT16, BASE_DEC, VALS(vals_sdp_statcode), 0x0,
6229 NULL, HFILL }
6231 { &hf_tn3270_sdp_ngl,
6232 { "Number of groups currently assigned",
6233 "tn3270.sdp_ngl",
6234 FT_UINT16, BASE_DEC, NULL, 0x0,
6235 NULL, HFILL }
6237 { &hf_tn3270_sdp_nml,
6238 { "Number of formats currently loaded",
6239 "tn3270.sdp_nml",
6240 FT_UINT16, BASE_DEC, NULL, 0x0,
6241 NULL, HFILL }
6243 { &hf_tn3270_sdp_nlml,
6244 { "Number of local names used",
6245 "tn3270.sdp_nlml",
6246 FT_UINT16, BASE_DEC, NULL, 0x0,
6247 NULL, HFILL }
6249 { &hf_tn3270_sdp_stor,
6250 { "Amount of format storage space available (KB)",
6251 "tn3270.sdp_stor",
6252 FT_UINT32, BASE_DEC, NULL, 0x0,
6253 NULL, HFILL }
6255 /* 6.2 - Exception/Status */
6257 /* 6.3 - Inbound Text Header */
6258 { &hf_tn3270_hw,
6259 { "Window height",
6260 "tn3270.hw",
6261 FT_UINT16, BASE_DEC, NULL, 0x0,
6262 NULL, HFILL }
6264 { &hf_tn3270_rw,
6265 { "Row offset of window origin",
6266 "tn3270.rw",
6267 FT_UINT16, BASE_DEC, NULL, 0x0,
6268 NULL, HFILL }
6270 { &hf_tn3270_ww,
6271 { "Window width",
6272 "tn3270.ww",
6273 FT_UINT16, BASE_DEC, NULL, 0x0,
6274 NULL, HFILL }
6276 { &hf_tn3270_cw,
6277 { "Column Offset of Window Origin",
6278 "tn3270.cw",
6279 FT_UINT16, BASE_DEC, NULL, 0x0,
6280 NULL, HFILL }
6282 /* END - 6.3 - Inbound Text Header */
6284 /* 6.4 Inbound 3270DS */
6285 { &hf_tn3270_cursor_address,
6286 { "Cursor Address",
6287 "tn3270.cursor_address",
6288 FT_UINT16, BASE_HEX, NULL, 0x0,
6289 NULL, HFILL }
6291 /* END - 6.4 Inbound 3270DS */
6293 /* 6.5 - Recovery Data */
6294 { &hf_tn3270_recovery_data_flags,
6295 { "Flags",
6296 "tn3270.recovery_data_flags",
6297 FT_UINT8, BASE_HEX, NULL, 0x0,
6298 NULL, HFILL }
6300 { &hf_tn3270_sld,
6301 { "SLD -- Set line density parameter in effect at the checkpoint",
6302 "tn3270.sld",
6303 FT_UINT8, BASE_HEX, NULL, 0x0,
6304 NULL, HFILL }
6306 { &hf_tn3270_charset,
6307 { "Character set parameter of Set Attribute control in effect at the checkpoint",
6308 "tn3270.charset",
6309 FT_UINT8, BASE_HEX, NULL, 0x0,
6310 NULL, HFILL }
6312 { &hf_tn3270_vertical,
6313 { "Byte offset from Checkpoint Interval structured field to the Set Vertical Format control in effect for the checkpoint",
6314 "tn3270.vertical",
6315 FT_UINT32, BASE_DEC, NULL, 0x0,
6316 NULL, HFILL }
6318 { &hf_tn3270_v_offset,
6319 { "Byte offset within the string control byte string or the SVF character",
6320 "tn3270.v_offset",
6321 FT_UINT16, BASE_DEC, NULL, 0x0,
6322 NULL, HFILL }
6324 { &hf_tn3270_v_sequence,
6325 { "RU sequence number",
6326 "tn3270.v_sequence",
6327 FT_UINT16, BASE_DEC, NULL, 0x0,
6328 NULL, HFILL }
6330 { &hf_tn3270_v_length,
6331 { "Length of the SVF character string required for restart",
6332 "tn3270.v_length",
6333 FT_UINT16, BASE_DEC, NULL, 0x0,
6334 NULL, HFILL }
6336 { &hf_tn3270_spd,
6337 { "Set Primary Density parameter in effect at the checkpoint",
6338 "tn3270.spd",
6339 FT_UINT16, BASE_HEX, NULL, 0x0,
6340 NULL, HFILL }
6342 { &hf_tn3270_horizon,
6343 { "Byte offset from Checkpoint Interval structured field to the Set Horizontal Format control in effect for the checkpoint",
6344 "tn3270.horizon",
6345 FT_UINT32, BASE_DEC, NULL, 0x0,
6346 NULL, HFILL }
6348 { &hf_tn3270_h_offset,
6349 { "Byte offset from Checkpoint Interval structured field to the Set Horizontal Format control in effect for the checkpoint",
6350 "tn3270.h_offset",
6351 FT_UINT32, BASE_DEC, NULL, 0x0,
6352 NULL, HFILL }
6354 { &hf_tn3270_h_sequence,
6355 { "RU sequence number",
6356 "tn3270.h_sequence",
6357 FT_UINT16, BASE_DEC, NULL, 0x0,
6358 NULL, HFILL }
6360 { &hf_tn3270_h_length,
6361 { "Length of the SHF character string required for restart",
6362 "tn3270.h_length",
6363 FT_UINT16, BASE_DEC, NULL, 0x0,
6364 NULL, HFILL }
6366 { &hf_tn3270_hilite,
6367 { "Highlighting",
6368 "tn3270.hilite",
6369 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
6370 NULL, HFILL }
6372 { &hf_tn3270_pages,
6373 { "Number of pages printed since the checkpoint",
6374 "tn3270.pages",
6375 FT_UINT16, BASE_DEC, NULL, 0x0,
6376 NULL, HFILL }
6378 { &hf_tn3270_lines,
6379 { "Number of lines printed since the checkpoint",
6380 "tn3270.lines",
6381 FT_UINT16, BASE_DEC, NULL, 0x0,
6382 NULL, HFILL }
6384 { &hf_tn3270_checkpoint,
6385 { "Byte offset from Set Checkpoint Interval structured field to the first"
6386 " character after the code point or character that caused an eject to the"
6387 " checkpointed page",
6388 "tn3270.checkpoint",
6389 FT_UINT32, BASE_DEC, NULL, 0x0,
6390 NULL, HFILL }
6392 { &hf_tn3270_c_offset,
6393 { "Byte offset within the String Control Byte string or structured field of"
6394 " the checkpointed character",
6395 "tn3270.c_offset",
6396 FT_UINT16, BASE_DEC, NULL, 0x0,
6397 NULL, HFILL }
6399 { &hf_tn3270_c_sequence,
6400 { "RU sequence number of the RU containing the checkpoint character",
6401 "tn3270.c_sequence",
6402 FT_UINT16, BASE_DEC, NULL, 0x0,
6403 NULL, HFILL }
6405 { &hf_tn3270_c_seqoff,
6406 { "Byte offset within the RU of the checkpointed character",
6407 "tn3270.c_seqoff",
6408 FT_UINT16, BASE_DEC, NULL, 0x0,
6409 NULL, HFILL }
6411 { &hf_tn3270_c_scsoff,
6412 { "Byte offset within the parameterized SCS control code (for example, TRN) of the checkpointed character.",
6413 "tn3270.c_scsoff",
6414 FT_UINT16, BASE_DEC, NULL, 0x0,
6415 NULL, HFILL }
6417 { &hf_tn3270_prime,
6418 { "Prime compression character",
6419 "tn3270.prime",
6420 FT_UINT8, BASE_HEX, NULL, 0x0,
6421 NULL, HFILL }
6423 /* END - 6.5 - Recovery Data */
6425 /* 6.9 - Query Reply (Alphanumeric Partitions) */
6426 { &hf_tn3270_ap_na,
6427 { "Max number of alphanumeric partitions",
6428 "tn3270.ap_na",
6429 FT_UINT8, BASE_DEC, NULL, 0x0,
6430 NULL, HFILL }
6432 { &hf_tn3270_ap_m,
6433 { "Total available partition storage",
6434 "tn3270.ap_m",
6435 FT_UINT16, BASE_DEC, NULL, 0x0,
6436 NULL, HFILL }
6438 { &hf_tn3270_query_reply_alphanumeric_flags,
6439 { "Flags",
6440 "tn3270.ap_flags",
6441 FT_UINT8, BASE_HEX, NULL, 0x0,
6442 NULL, HFILL }
6444 { &hf_tn3270_ap_vertical_scrolling,
6445 { "Vertical Scrolling Supported",
6446 "tn3270.ap_vertical_scrolling",
6447 FT_BOOLEAN, 8, NULL, QR_AP_VERTWIN,
6448 NULL, HFILL }
6450 { &hf_tn3270_ap_horizontal_scrolling,
6451 { "Horizontal Scrolling Supported",
6452 "tn3270.ap_horizontal_scrolling",
6453 FT_BOOLEAN, 8, NULL, QR_AP_HORWIN,
6454 NULL, HFILL }
6456 { &hf_tn3270_ap_apres1,
6457 { "Reserved",
6458 "tn3270.ap_apres1",
6459 FT_BOOLEAN, 8, NULL, QR_AP_APRES1,
6460 NULL, HFILL }
6462 { &hf_tn3270_ap_apa,
6463 { "All Points addressability supported",
6464 "tn3270.ap_apa",
6465 FT_BOOLEAN, 8, NULL, QR_AP_APA_FLG,
6466 NULL, HFILL }
6468 { &hf_tn3270_ap_pp,
6469 { "Partition protection supported",
6470 "tn3270.ap_pp",
6471 FT_BOOLEAN, 8, NULL, QR_AP_PROT,
6472 NULL, HFILL }
6474 { &hf_tn3270_ap_lc,
6475 { "Presentation space local copy supported",
6476 "tn3270.ap_lc",
6477 FT_BOOLEAN, 8, NULL, QR_AP_LCOPY,
6478 NULL, HFILL }
6480 { &hf_tn3270_ap_mp,
6481 { "Modify Partition supported",
6482 "tn3270.ap_mp",
6483 FT_BOOLEAN, 8, NULL, QR_AP_MODPART,
6484 NULL, HFILL }
6486 { &hf_tn3270_ap_apres2,
6487 { "Reserved",
6488 "tn3270.ap_apres2",
6489 FT_BOOLEAN, 8, NULL, QR_AP_APRES2,
6490 NULL, HFILL }
6493 { &hf_tn3270_ap_cm,
6494 { "Character multiplier",
6495 "tn3270.ap_cm",
6496 FT_UINT8, BASE_DEC, NULL, 0x0,
6497 NULL, HFILL }
6499 { &hf_tn3270_ap_ro,
6500 { "Row overhead",
6501 "tn3270.ap_ro",
6502 FT_UINT8, BASE_DEC, NULL, 0x0,
6503 NULL, HFILL }
6505 { &hf_tn3270_ap_co,
6506 { "Column overhead",
6507 "tn3270.ap_co",
6508 FT_UINT8, BASE_DEC, NULL, 0x0,
6509 NULL, HFILL }
6511 { &hf_tn3270_ap_fo,
6512 { "Fixed overhead",
6513 "tn3270.ap_fo",
6514 FT_UINT16, BASE_DEC, NULL, 0x0,
6515 NULL, HFILL }
6517 /* END - 6.9 - Query Reply (Alphanumeric Partitions) */
6519 /* 6.12 - Query Reply (Character Sets) */
6520 { &hf_tn3270_character_sets_flags1,
6521 { "Flags (1)",
6522 "tn3270.character_sets_flags1",
6523 FT_UINT8, BASE_HEX, NULL, 0x0,
6524 NULL, HFILL }
6526 { &hf_tn3270_cs_ge,
6527 { "Graphic Escape supported",
6528 "tn3270.cs_ge",
6529 FT_BOOLEAN, 8, NULL, QR_CS_ALT,
6530 NULL, HFILL }
6532 { &hf_tn3270_cs_mi,
6533 { "Multiple LCIDs are supported",
6534 "tn3270.cs_mi",
6535 FT_BOOLEAN, 8, NULL, QR_CS_MULTID,
6536 NULL, HFILL }
6538 { &hf_tn3270_cs_lps,
6539 { "Load PSSF is supported",
6540 "tn3270.cs_lps",
6541 FT_BOOLEAN, 8, NULL, QR_CS_LOADABLE,
6542 NULL, HFILL }
6544 { &hf_tn3270_cs_lpse,
6545 { "Load PS EXTENDED is supported",
6546 "tn3270.cs_lpse",
6547 FT_BOOLEAN, 8, NULL, QR_CS_EXT,
6548 NULL, HFILL }
6550 { &hf_tn3270_cs_ms,
6551 { "More than one size of character slot is supported",
6552 "tn3270.cs_ms",
6553 FT_BOOLEAN, 8, NULL, QR_CS_MS,
6554 NULL, HFILL }
6556 { &hf_tn3270_cs_ch2,
6557 { "Two-byte coded character sets are supported",
6558 "tn3270.cs_ch2",
6559 FT_BOOLEAN, 8, NULL, QR_CS_CH2,
6560 NULL, HFILL }
6562 { &hf_tn3270_cs_gf,
6563 { "CGCSGID is present",
6564 "tn3270.cs_gf",
6565 FT_BOOLEAN, 8, NULL, QR_CS_GF,
6566 NULL, HFILL }
6568 { &hf_tn3270_cs_res,
6569 { "Reserved",
6570 "tn3270.cs_res",
6571 FT_BOOLEAN, 8, NULL, QR_CS_CSRES,
6572 NULL, HFILL }
6575 { &hf_tn3270_character_sets_flags2,
6576 { "Flags (2)",
6577 "tn3270.character_sets_flags2",
6578 FT_UINT8, BASE_HEX, NULL, 0x0,
6579 NULL, HFILL }
6581 { &hf_tn3270_cs_res2,
6582 { "Reserved",
6583 "tn3270.cs_res2",
6584 FT_BOOLEAN, 8, NULL, QR_CS_CSRES2,
6585 NULL, HFILL }
6587 { &hf_tn3270_cs_pscs,
6588 { "Load PS slot size match not required",
6589 "tn3270.cs_pscs",
6590 FT_BOOLEAN, 8, NULL, QR_CS_PSCS,
6591 NULL, HFILL }
6593 { &hf_tn3270_cs_res3,
6594 { "Reserved",
6595 "tn3270.cs_res3",
6596 FT_BOOLEAN, 8, NULL, QR_CS_CSRES3,
6597 NULL, HFILL }
6599 { &hf_tn3270_cs_cf,
6600 { "CCSID present",
6601 "tn3270.cs_cf",
6602 FT_BOOLEAN, 8, NULL, QR_CS_CF,
6603 NULL, HFILL }
6606 { &hf_tn3270_sdw,
6607 { "Default character slot width",
6608 "tn3270.cs_sdw",
6609 FT_UINT8, BASE_HEX, NULL, 0x0,
6610 NULL, HFILL }
6612 { &hf_tn3270_sdh,
6613 { "Default character slot height",
6614 "tn3270.cs_sdh",
6615 FT_UINT8, BASE_HEX, NULL, 0x0,
6616 NULL, HFILL }
6618 { &hf_tn3270_form,
6619 { "Form Types",
6620 "tn3270.form",
6621 FT_UINT8, BASE_HEX, NULL, 0x0,
6622 NULL, HFILL }
6624 { &hf_tn3270_formres,
6625 { "Form Types (Reserved)",
6626 "tn3270.formres",
6627 FT_UINT8, BASE_HEX, NULL, 0x0,
6628 NULL, HFILL }
6630 { &hf_tn3270_cs_form_type1,
6631 { "18-byte form",
6632 "tn3270.cs_form_type1",
6633 FT_BOOLEAN, 8, NULL, 0x80,
6634 "the first 2 bytes contain a 16-bit vertical slice,"
6635 " the following 16 bytes contain 8-bit horizontal slices. For a 9"
6636 " x 12 character matrix the last 4 bytes contain binary zero.", HFILL }
6638 { &hf_tn3270_cs_form_type2,
6639 { "18-byte form (COMPRESSED)",
6640 "tn3270.cs_form_type2",
6641 FT_BOOLEAN, 8, NULL, 0x40,
6642 "the first 2 bytes contain a 16-bit vertical slice,"
6643 " the following 16 bytes contain 8-bit horizontal slices. For a 9"
6644 " x 12 character matrix the last 4 bytes contain binary zero. (COMPRESSED)", HFILL }
6646 { &hf_tn3270_cs_form_type3,
6647 { "Row loading (from top to bottom)",
6648 "tn3270.cs_form_type3",
6649 FT_BOOLEAN, 8, NULL, 0x20,
6650 NULL, HFILL }
6652 { &hf_tn3270_cs_form_type4,
6653 { "Row loading (from top to bottom) (Compressed)",
6654 "tn3270.cs_form_type4",
6655 FT_BOOLEAN, 8, NULL, 0x10,
6656 NULL, HFILL }
6658 { &hf_tn3270_cs_form_type5,
6659 { "Column loading (from left to right)",
6660 "tn3270.cs_form_type5",
6661 FT_BOOLEAN, 8, NULL, 0x08,
6662 NULL, HFILL }
6664 { &hf_tn3270_cs_form_type6,
6665 { "Column loading (from left to right) (Compressed)",
6666 "tn3270.cs_form_type6",
6667 FT_BOOLEAN, 8, NULL, 0x04,
6668 NULL, HFILL }
6670 { &hf_tn3270_cs_form_type8,
6671 { "Vector",
6672 "tn3270.cs_form_type8",
6673 FT_BOOLEAN, 8, NULL, 0x02,
6674 NULL, HFILL }
6676 { &hf_tn3270_cs_dl,
6677 { "Length of each descriptor",
6678 "tn3270.cs_dl",
6679 FT_UINT8, BASE_DEC, NULL, 0x0,
6680 NULL, HFILL }
6683 { &hf_tn3270_cs_descriptor_set,
6684 { "Device Specific Character Set ID (PS store No.)",
6685 "tn3270.cs_descriptor_set",
6686 FT_UINT8, BASE_DEC, NULL, 0x0,
6687 NULL, HFILL }
6689 { &hf_tn3270_cs_descriptor_flags,
6690 { "Flags",
6691 "tn3270.cs_descriptor_flags",
6692 FT_UINT8, BASE_HEX, NULL, 0x0,
6693 NULL, HFILL }
6695 { &hf_tn3270_cs_ds_load,
6696 { "Loadable character set",
6697 "tn3270.cs_ds_load",
6698 FT_BOOLEAN, 8, NULL, 0x80,
6699 NULL, HFILL }
6701 { &hf_tn3270_cs_ds_triple,
6702 { "Triple-plane character set",
6703 "tn3270.cs_ds_triple",
6704 FT_BOOLEAN, 8, NULL, 0x40,
6705 NULL, HFILL }
6707 { &hf_tn3270_cs_ds_char,
6708 { "Double-Byte coded character set",
6709 "tn3270.cs_ds_char",
6710 FT_BOOLEAN, 8, NULL, 0x20,
6711 NULL, HFILL }
6713 { &hf_tn3270_cs_ds_cb,
6714 { "No LCID compare",
6715 "tn3270.cs_ds_cb",
6716 FT_BOOLEAN, 8, NULL, 0x10,
6717 NULL, HFILL }
6720 { &hf_tn3270_lcid,
6721 { "Local character set ID (alias)",
6722 "tn3270.lcid",
6723 FT_UINT8, BASE_HEX, NULL, 0x0,
6724 NULL, HFILL }
6726 { &hf_tn3270_sw,
6727 { "Width of the character slots in this characterset.",
6728 "tn3270.sw",
6729 FT_UINT8, BASE_HEX, NULL, 0x0,
6730 NULL, HFILL }
6732 { &hf_tn3270_sh,
6733 { "Height of the character slots in this character set.",
6734 "tn3270.sh",
6735 FT_UINT8, BASE_HEX, NULL, 0x0,
6736 NULL, HFILL }
6738 { &hf_tn3270_ssubsn,
6739 { "Starting subsection.",
6740 "tn3270.ssubsn",
6741 FT_UINT8, BASE_HEX, NULL, 0x0,
6742 NULL, HFILL }
6744 { &hf_tn3270_esubsn,
6745 { "Ending subsection.",
6746 "tn3270.esubsn",
6747 FT_UINT8, BASE_HEX, NULL, 0x0,
6748 NULL, HFILL }
6750 { &hf_tn3270_ccsgid,
6751 { "Coded Graphic Character Set Identifier.",
6752 "tn3270.ccsgid",
6753 FT_UINT64, BASE_HEX, NULL, 0x0,
6754 NULL, HFILL }
6756 { &hf_tn3270_ccsid,
6757 { "Coded Character Set Identifier.",
6758 "tn3270.ccsid",
6759 FT_UINT64, BASE_HEX, NULL, 0x0,
6760 NULL, HFILL }
6762 /* END - 6.12 - Query Reply (Character Sets) */
6764 /* 6.13 - Query Reply (Color) */
6765 { &hf_tn3270_color_flags,
6766 { "Flags",
6767 "tn3270.color_flags",
6768 FT_UINT8, BASE_HEX, NULL, 0x0,
6769 NULL, HFILL }
6771 { &hf_tn3270_c_prtblk,
6772 { "Printer only - black ribbon is loaded",
6773 "tn3270.cc_prtblk",
6774 FT_BOOLEAN, 8, NULL, 0x40,
6775 NULL, HFILL }
6777 { &hf_tn3270_c_np,
6778 { "Length of color attribute list",
6779 "tn3270.np",
6780 FT_UINT8, BASE_DEC, NULL, 0x0,
6781 NULL, HFILL }
6783 { &hf_tn3270_c_cav,
6784 { "Color attribute value accepted by the device",
6785 "tn3270.c_cav",
6786 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6787 NULL, HFILL }
6789 { &hf_tn3270_c_ci,
6790 { "Color identifier",
6791 "tn3270.c_ci",
6792 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6793 NULL, HFILL }
6795 { &hf_tn3270_db_cavdef,
6796 { "Default color attribute value",
6797 "tn3270.db_cavdef",
6798 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6799 NULL, HFILL }
6801 { &hf_tn3270_db_cidef,
6802 { "Default background color identifier",
6803 "tn3270.db_cidef",
6804 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6805 NULL, HFILL }
6807 /* END - 6.13 - Query Reply (Color) */
6809 /* 6.14 - Query Reply (Cooperative Processing Requestor) */
6810 { &hf_tn3270_limin,
6811 { "Maximum CPR bytes/transmission allowed inbound",
6812 "tn3270.limin",
6813 FT_UINT16, BASE_DEC, NULL, 0x0,
6814 NULL, HFILL }
6816 { &hf_tn3270_limout,
6817 { "Maximum CPR bytes/transmission allowed outbound",
6818 "tn3270.limout",
6819 FT_UINT16, BASE_DEC, NULL, 0x0,
6820 NULL, HFILL }
6822 { &hf_tn3270_featl,
6823 { "Length (in bytes) of feature information that follows",
6824 "tn3270.featl",
6825 FT_UINT8, BASE_DEC, NULL, 0x0,
6826 NULL, HFILL }
6828 { &hf_tn3270_feats,
6829 { "CPR length and feature flags",
6830 "tn3270.feats",
6831 FT_UINT16, BASE_DEC, NULL, 0x0,
6832 NULL, HFILL }
6834 /* END - 6.14 - Query Reply (Cooperative Processing Requestor) */
6836 /* 6.15 - Query Reply (Data Chaining) */
6837 { &hf_tn3270_dc_dir,
6838 { "Indicates which direction can use the Data Chain structured field.",
6839 "tn3270.dc_dir",
6840 FT_UINT8, BASE_HEX, VALS(vals_data_chaining_dir), 0xC0,
6841 NULL, HFILL }
6843 /* END - 6.15 - Query Reply (Data Chaining) */
6845 /* 6.16 - Query Reply (Data Streams) */
6846 { &hf_tn3270_ds_default_sfid,
6847 { "Default Data Stream",
6848 "tn3270.ds_default_sfid",
6849 FT_UINT8, BASE_HEX, VALS(vals_data_streams), 0x0,
6850 NULL, HFILL }
6852 { &hf_tn3270_ds_sfid,
6853 { "Supported Data Stream",
6854 "tn3270.ds_sfid",
6855 FT_UINT8, BASE_HEX, VALS(vals_data_streams), 0x0,
6856 NULL, HFILL }
6858 /* END - 6.16 - Query Reply (Data Streams) */
6860 /* 6.17 - Query Reply (DBCS Asia) */
6861 { &hf_tn3270_asia_sdp_sosi_soset,
6862 { "Set ID of the Shift Out (SO) character set",
6863 "tn3270.asia_sdp_sosi_soset",
6864 FT_UINT8, BASE_HEX, NULL, 0x0,
6865 NULL, HFILL }
6867 { &hf_tn3270_asia_sdp_ic_func,
6868 { "SO/SI Creation supported",
6869 "tn3270.asia_sdp_ic_func",
6870 FT_BOOLEAN, 8, NULL, 0x01,
6871 NULL, HFILL }
6873 /* END - 6.17 - Query Reply (DBCS Asia) */
6875 /* 6.19 - Query Reply (Distributed Data Management) */
6876 { &hf_tn3270_ddm_flags,
6877 { "Flags (Reserved)",
6878 "tn3270.ddm_flags",
6879 FT_UINT8, BASE_HEX, NULL, 0x0,
6880 NULL, HFILL }
6882 { &hf_tn3270_ddm_limin,
6883 { "Maximum DDM bytes/transmission allowed inbound",
6884 "tn3270.ddm_limin",
6885 FT_UINT16, BASE_DEC, NULL, 0x0,
6886 NULL, HFILL }
6888 { &hf_tn3270_ddm_limout,
6889 { "Maximum DDM bytes/transmission allowed outbound",
6890 "tn3270.ddm_limout",
6891 FT_UINT16, BASE_DEC, NULL, 0x0,
6892 NULL, HFILL }
6894 { &hf_tn3270_ddm_nss,
6895 { "Number of subsets supported",
6896 "tn3270.ddm_nss",
6897 FT_UINT8, BASE_HEX, NULL, 0x0,
6898 NULL, HFILL }
6900 { &hf_tn3270_ddm_ddmss,
6901 { "DDM subset identifier",
6902 "tn3270.ddm_ddmss",
6903 FT_UINT8, BASE_HEX, VALS(vals_qr_ddm), 0x0,
6904 NULL, HFILL }
6906 /* END - 6.19 - Query Reply (Distributed Data Management) */
6908 /* 6.20 - Query Reply (Document Interchange Architecture) */
6909 { &hf_tn3270_dia_flags,
6910 { "Flags (Reserved)",
6911 "tn3270.dia_flags",
6912 FT_UINT16, BASE_HEX, NULL, 0x0,
6913 NULL, HFILL }
6915 { &hf_tn3270_dia_limin,
6916 { "Maximum DIA bytes/transmission allowed inbound",
6917 "tn3270.dia_limin",
6918 FT_UINT16, BASE_DEC, NULL, 0x0,
6919 NULL, HFILL }
6921 { &hf_tn3270_dia_limout,
6922 { "Maximum DIA bytes/transmission allowed outbound",
6923 "tn3270.dia_limout",
6924 FT_UINT16, BASE_DEC, NULL, 0x0,
6925 NULL, HFILL }
6927 { &hf_tn3270_dia_nfs,
6928 { "Number of subsets supported",
6929 "tn3270.dia_nfs",
6930 FT_UINT8, BASE_HEX, NULL, 0x0,
6931 NULL, HFILL }
6933 { &hf_tn3270_dia_diafs,
6934 { "DIA function set identifier",
6935 "tn3270.dia_diafs",
6936 FT_UINT8, BASE_HEX, VALS(vals_qr_dia), 0x0,
6937 NULL, HFILL }
6939 { &hf_tn3270_dia_diafn,
6940 { "DIA function set number",
6941 "tn3270.dia_diafn",
6942 FT_UINT16, BASE_DEC, NULL, 0x0,
6943 NULL, HFILL }
6945 /* END - 6.20 - Query Reply (Document Interchange Architecture) */
6947 /* 6.22 - Query Reply (Field Outlining) */
6948 { &hf_tn3270_fo_flags,
6949 { "Flags",
6950 "tn3270.fo_flags",
6951 FT_UINT8, BASE_HEX, NULL, 0x0,
6952 NULL, HFILL }
6954 { &hf_tn3270_fo_vpos,
6955 { "Location of vertical line",
6956 "tn3270.fo_vpos",
6957 FT_UINT8, BASE_DEC, NULL, 0x0,
6958 NULL, HFILL }
6960 { &hf_tn3270_fo_hpos,
6961 { "Location of overline/underline",
6962 "tn3270.fo_hpos",
6963 FT_UINT8, BASE_DEC, NULL, 0x0,
6964 NULL, HFILL }
6966 { &hf_tn3270_fo_hpos0,
6967 { "Location of overline in case of separation",
6968 "tn3270.fo_hpos0",
6969 FT_UINT8, BASE_DEC, NULL, 0x0,
6970 NULL, HFILL }
6972 { &hf_tn3270_fo_hpos1,
6973 { "Location of underline in case of separation",
6974 "tn3270.fo_hpos1",
6975 FT_UINT8, BASE_DEC, NULL, 0x0,
6976 NULL, HFILL }
6978 /* END - 6.22 - Query Reply (Field Outlining) */
6980 /* 6.25 - Query Reply (Format Storage Auxiliary Device) */
6981 { &hf_tn3270_fsad_flags,
6982 { "Flags",
6983 "tn3270.fsad_flags",
6984 FT_UINT8, BASE_HEX, NULL, 0x0,
6985 NULL, HFILL }
6987 { &hf_tn3270_fsad_limin,
6988 { "Reserved for LIMIN parameter. Must be set to zeros.",
6989 "tn3270.fsad_limin",
6990 FT_UINT16, BASE_DEC, NULL, 0x0,
6991 NULL, HFILL }
6993 { &hf_tn3270_fsad_limout,
6994 { "Maximum bytes of format storage data per transmission allowed outbound.",
6995 "tn3270.fsad_limout",
6996 FT_UINT16, BASE_DEC, NULL, 0x0,
6997 NULL, HFILL }
6999 { &hf_tn3270_fsad_size,
7000 { "Size of the format storage space",
7001 "tn3270.fsad_size",
7002 FT_UINT16, BASE_DEC, NULL, 0x0,
7003 NULL, HFILL }
7005 /* END - 6.25 - Query Reply (Format Storage Auxiliary Device) */
7007 /* 6.28 - Query Reply (Highlighting) */
7008 { &hf_tn3270_h_np,
7009 { "Number of attribute-value/action pairs",
7010 "tn3270.h_np",
7011 FT_UINT8, BASE_DEC, NULL, 0x0,
7012 NULL, HFILL }
7014 { &hf_tn3270_h_vi,
7015 { "Data stream attribute value accepted",
7016 "tn3270.h_vi",
7017 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
7018 NULL, HFILL }
7020 { &hf_tn3270_h_ai,
7021 { "Data stream action",
7022 "tn3270.h_ai",
7023 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
7024 NULL, HFILL }
7026 /* END - Query Reply (Highlighting) */
7028 /* 6.29 - Query Reply (IBM Auxiliary Device) */
7029 { &hf_tn3270_ibm_flags,
7030 { "Flags",
7031 "tn3270.ibm_flags",
7032 FT_UINT8, BASE_HEX, NULL, 0x0,
7033 NULL, HFILL }
7035 { &hf_tn3270_ibm_limin,
7036 { "Inbound message size limit",
7037 "tn3270.ibm_limin",
7038 FT_UINT16, BASE_DEC, NULL, 0x0,
7039 NULL, HFILL }
7041 { &hf_tn3270_ibm_limout,
7042 { "Outbound message size limit",
7043 "tn3270.ibm_limout",
7044 FT_UINT16, BASE_DEC, NULL, 0x0,
7045 NULL, HFILL }
7047 { &hf_tn3270_ibm_type,
7048 { "Type of IBM Auxiliary Device",
7049 "tn3270.ibm_type",
7050 FT_UINT16, BASE_DEC, NULL, 0x0,
7051 NULL, HFILL }
7053 /* END - 6.29 - Query Reply (IBM Auxiliary Device) */
7055 /* 6.31 - Query Reply (Implicit Partitions) */
7056 { &hf_tn3270_ip_flags,
7057 { "Flags (Reserved)",
7058 "tn3270.ip_flags",
7059 FT_UINT8, BASE_HEX, NULL, 0x0,
7060 NULL, HFILL }
7062 { &hf_tn3270_ipdd_wd,
7063 { "Width of the Implicit Partition default screen size (in character cells)",
7064 "tn3270.ipdd_wd",
7065 FT_UINT16, BASE_DEC, NULL, 0x0,
7066 NULL, HFILL }
7068 { &hf_tn3270_ipdd_hd,
7069 { "Height of the Implicit Partition default screen size",
7070 "tn3270.ipdd_hd",
7071 FT_UINT16, BASE_DEC, NULL, 0x0,
7072 NULL, HFILL }
7074 { &hf_tn3270_ipdd_wa,
7075 { "Width of the Implicit Partition alternate screen size",
7076 "tn3270.ipdd_wa",
7077 FT_UINT16, BASE_DEC, NULL, 0x0,
7078 NULL, HFILL }
7080 { &hf_tn3270_ipdd_ha,
7081 { "Height of the Implicit Partition alternate screen size",
7082 "tn3270.ipdd_ha",
7083 FT_UINT16, BASE_DEC, NULL, 0x0,
7084 NULL, HFILL }
7086 { &hf_tn3270_ippd_dpbs,
7087 { "Default printer buffer size (in character cells)",
7088 "tn3270.ippd_dpbs",
7089 FT_UINT64, BASE_DEC, NULL, 0x0,
7090 NULL, HFILL }
7092 { &hf_tn3270_ippd_apbs,
7093 { "Default printer buffer size (in character cells)",
7094 "tn3270.ippd_apbs",
7095 FT_UINT64, BASE_DEC, NULL, 0x0,
7096 NULL, HFILL }
7098 { &hf_tn3270_ipccd_wcd,
7099 { "Width of the character cell for the Implicit Partition default screen size",
7100 "tn3270.ipccd_wcd",
7101 FT_UINT16, BASE_DEC, NULL, 0x0,
7102 NULL, HFILL }
7104 { &hf_tn3270_ipccd_hcd,
7105 { "Height of the character cell for the Implicit Partition default screen size",
7106 "tn3270.ipccd_hcd",
7107 FT_UINT16, BASE_DEC, NULL, 0x0,
7108 NULL, HFILL }
7110 { &hf_tn3270_ipccd_wca,
7111 { "Width of the character cell for the Implicit Partition alternate screen size",
7112 "tn3270.ipccd_wca",
7113 FT_UINT16, BASE_DEC, NULL, 0x0,
7114 NULL, HFILL }
7116 { &hf_tn3270_ipccd_hca,
7117 { "Height of the character cell for the Implicit Partition alternate screen size",
7118 "tn3270.ipccd_hca",
7119 FT_UINT16, BASE_DEC, NULL, 0x0,
7120 NULL, HFILL }
7122 /* END - Query Reply (Implicit Partitions) */
7124 /* 6.32 - Query Reply (IOCA Auxiliary Device) */
7125 { &hf_tn3270_ioca_limin,
7126 { "Max IOCA bytes/inbound transmission",
7127 "tn3270.ioca_limin",
7128 FT_UINT16, BASE_DEC, NULL, 0x0,
7129 NULL, HFILL }
7131 { &hf_tn3270_ioca_limout,
7132 { "Max IOCA bytes/outbound transmission",
7133 "tn3270.ioca_limout",
7134 FT_UINT16, BASE_DEC, NULL, 0x0,
7135 NULL, HFILL }
7137 { &hf_tn3270_ioca_type,
7138 { "Type of IOCA Auxiliary Device",
7139 "tn3270.ioca_type",
7140 FT_UINT16, BASE_DEC, NULL, 0x0,
7141 NULL, HFILL }
7143 /* END - 6.32 - Query Reply (IOCA Auxiliary Device) */
7145 /* 6.34 - Query Reply (MSR Control) */
7146 { &hf_tn3270_msr_nd,
7147 { "Number of MSR device types",
7148 "tn3270.msr_nd",
7149 FT_UINT8, BASE_DEC, NULL, 0x0,
7150 NULL, HFILL }
7152 /* END - 6.34 - Query Reply (MSR Control) */
7154 /* 6.36 - Query Reply (OEM Auxiliary Device) */
7155 { &hf_tn3270_oem_dsref,
7156 { "Data stream reference identifier",
7157 "tn3270.oem_dsref",
7158 FT_UINT8, BASE_HEX, NULL, 0x0,
7159 NULL, HFILL }
7161 { &hf_tn3270_oem_dtype,
7162 { "Device type",
7163 "tn3270.oem_dtype",
7164 FT_STRING, BASE_NONE, NULL, 0x0,
7165 NULL, HFILL }
7167 { &hf_tn3270_oem_uname,
7168 { "User assigned name",
7169 "tn3270.oem_uname",
7170 FT_STRING, BASE_NONE, NULL, 0x0,
7171 NULL, HFILL }
7173 { &hf_tn3270_sdp_daid,
7174 { "Destination/Origin ID",
7175 "tn3270.oem_sdp_daid_doid",
7176 FT_UINT16, BASE_DEC, NULL, 0x0,
7177 NULL, HFILL }
7179 { &hf_tn3270_oem_sdp_ll_limin,
7180 { "Maximum OEM dsf bytes/transmission allowed inbound",
7181 "tn3270.oem_sdp_ll_limin",
7182 FT_UINT16, BASE_DEC, NULL, 0x0,
7183 NULL, HFILL }
7185 { &hf_tn3270_oem_sdp_ll_limout,
7186 { "Maximum OEM dsf bytes/transmission allowed outbound",
7187 "tn3270.oem_sdp_ll_limout",
7188 FT_UINT16, BASE_DEC, NULL, 0x0,
7189 NULL, HFILL }
7191 { &hf_tn3270_oem_sdp_pclk_vers,
7192 { "Protocol version",
7193 "tn3270.oem_sdp_pclk_vers",
7194 FT_UINT16, BASE_DEC, NULL, 0x0,
7195 NULL, HFILL }
7197 /* END - 6.36 - Query Reply (OEM Auxiliary Device) */
7199 /* 6.37 - Query Reply (Paper Feed Techniques) */
7200 { &hf_tn3270_pft_flags,
7201 { "Flags",
7202 "tn3270.pft_flags",
7203 FT_UINT8, BASE_HEX, NULL, 0x0,
7204 NULL, HFILL }
7206 { &hf_tn3270_pft_tmo,
7207 { "Top margin offset in 1/1440ths of an inch",
7208 "tn3270.pft_tmo",
7209 FT_UINT16, BASE_DEC, NULL, 0x0,
7210 NULL, HFILL }
7212 { &hf_tn3270_pft_bmo,
7213 { "Bottom margin offset in 1/1440ths of an inch",
7214 "tn3270.pft_bmo",
7215 FT_UINT16, BASE_DEC, NULL, 0x0,
7216 NULL, HFILL }
7218 /* END - 6.37 - Query Reply (Paper Feed Techniques) */
7220 /* 6.38 - Query Reply (Partition Characteristics) */
7221 { &hf_tn3270_pc_vo_thickness,
7222 { "Thickness",
7223 "tn3270.pc_vo_thickness",
7224 FT_UINT8, BASE_DEC, NULL, 0x0,
7225 NULL, HFILL }
7227 /* END- 6.38 - Query Reply (Partition Characteristics) */
7229 /* 6.41 - Query Reply (Product Defined Data Stream) */
7230 { &hf_tn3270_pdds_refid,
7231 { "Reference identifier",
7232 "tn3270.pdds_refid",
7233 FT_UINT8, BASE_HEX, VALS(vals_qr_pdds_refid), 0x0,
7234 NULL, HFILL }
7236 { &hf_tn3270_pdds_ssid,
7237 { "Subset identifier",
7238 "tn3270.pdds_ssid",
7239 FT_UINT8, BASE_HEX, VALS(vals_qr_pdds_ssid), 0x0,
7240 NULL, HFILL }
7242 /* END - 6.41 - Query Reply (Product Defined Data Stream) */
7244 /* 6.43 - Query Reply (RPQ Names) */
7245 { &hf_tn3270_rpq_device,
7246 { "Device type identifier",
7247 "tn3270.rpq_device",
7248 FT_STRING, BASE_NONE, NULL, 0x0,
7249 NULL, HFILL }
7251 { &hf_tn3270_rpq_mid,
7252 { "Model type identifier",
7253 "tn3270.rpq_mid",
7254 FT_UINT64, BASE_DEC, NULL, 0x0,
7255 NULL, HFILL }
7257 { &hf_tn3270_rpq_rpql,
7258 { "Length of RPQ name (including this byte)",
7259 "tn3270.rpq_rpql",
7260 FT_UINT8, BASE_DEC, NULL, 0x0,
7261 NULL, HFILL }
7263 { &hf_tn3270_rpq_name,
7264 { "RPQ name",
7265 "tn3270.rpq_name",
7266 FT_STRING, BASE_NONE, NULL, 0x0,
7267 NULL, HFILL }
7269 /* END - Query Reply (Names) */
7271 /* 6.44 - Query Reply (Save or Restore Format) */
7272 { &hf_tn3270_srf_fpcbl,
7273 { "Format parameter control block length",
7274 "tn3270.srf_fpcbl",
7275 FT_UINT16, BASE_DEC, NULL, 0x0,
7276 NULL, HFILL }
7278 /* END - 6.44 - Query Reply (Save or Restore Format) */
7280 /* 6.45 - Query Reply (Settable Printer Characteristics) */
7281 { &hf_tn3270_spc_epc_flags,
7282 { "Flags",
7283 "tn3270.spc_epc_flags",
7284 FT_UINT8, BASE_HEX, NULL, 0x0,
7285 NULL, HFILL }
7287 /* END - 6.45 - Query Reply (Settable Printer Characteristics) */
7289 /* 6.47 - Query Reply (Storage Pools) */
7290 { &hf_tn3270_sp_spid,
7291 { "Storage pool identity",
7292 "tn3270.sp_spid",
7293 FT_UINT8, BASE_HEX, NULL, 0x0,
7294 NULL, HFILL }
7296 { &hf_tn3270_sp_size,
7297 { "Size of this storage pool when empty",
7298 "tn3270.sp_size",
7299 FT_UINT32, BASE_DEC, NULL, 0x0,
7300 NULL, HFILL }
7302 { &hf_tn3270_sp_space,
7303 { "Space available in this storage pool",
7304 "tn3270.sp_space",
7305 FT_UINT32, BASE_DEC, NULL, 0x0,
7306 NULL, HFILL }
7308 { &hf_tn3270_sp_objlist,
7309 { "Identifiers of objects housed in this storage pool",
7310 "tn3270.sp_objlist",
7311 FT_UINT16, BASE_HEX, VALS(vals_sp_objlist), 0x0,
7312 NULL, HFILL }
7314 /* END - 6.47 - Query Reply (Storage Pools) */
7316 /* 6.49 - Query Reply (Text Partitions) */
7317 { &hf_tn3270_tp_nt,
7318 { "Maximum number of text partitions",
7319 "tn3270.tp_nt",
7320 FT_UINT8, BASE_DEC, NULL, 0x0,
7321 NULL, HFILL }
7323 { &hf_tn3270_tp_m,
7324 { "Maximum partition size",
7325 "tn3270.tp_m",
7326 FT_UINT16, BASE_DEC, NULL, 0x0,
7327 NULL, HFILL }
7329 { &hf_tn3270_tp_flags,
7330 { "Flags",
7331 "tn3270.tp_flags",
7332 FT_UINT8, BASE_HEX, NULL, 0x0,
7333 NULL, HFILL }
7335 { &hf_tn3270_tp_ntt,
7336 { "Number of text types supported",
7337 "tn3270.tp_ntt",
7338 FT_UINT8, BASE_DEC, NULL, 0x0,
7339 NULL, HFILL }
7341 { &hf_tn3270_tp_tlist,
7342 { "List of types supported",
7343 "tn3270.tp_tlist",
7344 FT_UINT8, BASE_HEX, NULL, 0x0,
7345 NULL, HFILL }
7347 /* END - 6.49 - Query Reply (Text Partitions) */
7349 /* 6.50 - Query Reply (Transparency) */
7350 { &hf_tn3270_t_np,
7351 { "Number of pairs",
7352 "tn3270.t_np",
7353 FT_UINT8, BASE_DEC, NULL, 0x0,
7354 NULL, HFILL }
7356 { &hf_tn3270_t_vi,
7357 { "Data stream attribute value accepted",
7358 "tn3270.t_vi",
7359 FT_UINT8, BASE_HEX, NULL, 0x0,
7360 NULL, HFILL }
7362 { &hf_tn3270_t_ai,
7363 { "Associated action value",
7364 "tn3270.t_ai",
7365 FT_UINT8, BASE_HEX, NULL, 0x0,
7366 NULL, HFILL }
7368 /* END - 6.50 - Query Reply (Transparency) */
7370 /* 6.51 Query Reply Usable Area */
7371 { &hf_tn3270_usable_area_flags1,
7372 {"Usable Area Flags",
7373 "tn3270.query_reply_usable_area_flags1",
7374 FT_UINT8, BASE_HEX, NULL, 0,
7375 NULL, HFILL}
7377 { &hf_tn3270_ua_reserved1,
7378 { "Reserved",
7379 "tn3270.reserved",
7380 FT_BOOLEAN, 8, NULL, QR_UA_RESERVED1,
7381 NULL, HFILL }
7383 { &hf_tn3270_ua_page_printer,
7384 { "Page Printer",
7385 "tn3270.ua_page_printer",
7386 FT_BOOLEAN, 8, NULL, QR_UA_PAGE_PRINTER,
7387 NULL, HFILL }
7389 { &hf_tn3270_ua_reserved2,
7390 { "Reserved",
7391 "tn3270.reserved",
7392 FT_BOOLEAN, 8, NULL, QR_UA_RESERVED2,
7393 NULL, HFILL }
7395 { &hf_tn3270_ua_hard_copy,
7396 { "Hard Copy",
7397 "tn3270.ua_hard_copy",
7398 FT_BOOLEAN, 8, NULL, QR_UA_HARD_COPY,
7399 NULL, HFILL }
7401 { &hf_tn3270_ua_addressing,
7402 { "Usable Area Addressing",
7403 "tn3270.ua_addressing",
7404 FT_UINT8, BASE_HEX, VALS(vals_usable_area_addr_mode), QR_UA_ADDR_MODE_MASK,
7405 NULL, HFILL}
7407 { &hf_tn3270_usable_area_flags2,
7408 { "Usable Area Flags",
7409 "tn3270.query_reply_usable_area_flags2",
7410 FT_UINT8, BASE_HEX, NULL, 0x0,
7411 NULL, HFILL}
7413 { &hf_tn3270_ua_variable_cells,
7414 { "Variable Cells",
7415 "tn3270.ua_variable_cells",
7416 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_variable_cells), QR_UA_VARIABLE_CELLS,
7417 NULL, HFILL }
7419 { &hf_tn3270_ua_characters,
7420 { "Characters",
7421 "tn3270.ua_characters",
7422 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_characters), QR_UA_CHARACTERS,
7423 NULL, HFILL }
7425 { &hf_tn3270_ua_cell_units,
7426 { "Cell Units",
7427 "tn3270.ua_cell_units",
7428 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_cell_units), QR_UA_CELL_UNITS,
7429 NULL, HFILL }
7431 { &hf_tn3270_ua_width_cells_pels,
7432 { "Width of usable area in cells/pels",
7433 "tn3270.ua_width_cells_pels",
7434 FT_UINT16, BASE_DEC, NULL, 0x0,
7435 NULL, HFILL }
7437 { &hf_tn3270_ua_height_cells_pels,
7438 { "Height of usable area in cells/pels",
7439 "tn3270.ua_height_cells_pels",
7440 FT_UINT16, BASE_DEC, NULL, 0x0,
7441 NULL, HFILL }
7443 { &hf_tn3270_ua_uom_cells_pels,
7444 { "Units of measure for cells/pels",
7445 "tn3270.ua_uom_cells_pels",
7446 FT_UINT8, BASE_HEX, VALS(vals_usable_area_uom), 0x0,
7447 NULL, HFILL }
7449 { &hf_tn3270_ua_xr,
7450 { "Distance between points in X direction as a fraction",
7451 "tn3270.ua_xr",
7452 FT_UINT32, BASE_HEX, NULL, 0x0,
7453 "measured in UNITS, with 2-byte numerator and 2-byte denominator", HFILL }
7455 { &hf_tn3270_ua_yr,
7456 { "Distance between points in Y direction as a fraction",
7457 "tn3270.ua_yr",
7458 FT_UINT32, BASE_HEX, NULL, 0x0,
7459 "measured in UNITS, with 2-byte numerator and 2-byte denominator", HFILL }
7461 { &hf_tn3270_ua_aw,
7462 { "Number of X units in default cell",
7463 "tn3270.ua_aw",
7464 FT_UINT8, BASE_DEC, NULL, 0x0,
7465 NULL, HFILL }
7467 { &hf_tn3270_ua_ah,
7468 { "Number of Y units in default cell",
7469 "tn3270.ua_ah",
7470 FT_UINT8, BASE_DEC, NULL, 0x0,
7471 NULL, HFILL }
7473 { &hf_tn3270_ua_buffsz,
7474 { "Character buffer size (bytes)",
7475 "tn3270.ua_buffsz",
7476 FT_UINT16, BASE_DEC, NULL, 0x0,
7477 NULL, HFILL }
7479 { &hf_tn3270_ua_xmin,
7480 { "Minimum number of X units in variable cell",
7481 "tn3270.ua_xmin",
7482 FT_UINT8, BASE_DEC, NULL, 0x0,
7483 NULL, HFILL }
7485 { &hf_tn3270_ua_ymin,
7486 { "Minimum number of Y units in variable cell",
7487 "tn3270.ua_ymin",
7488 FT_UINT8, BASE_DEC, NULL, 0x0,
7489 NULL, HFILL }
7491 { &hf_tn3270_ua_xmax,
7492 { "Maximum number of X units in variable cell",
7493 "tn3270.ua_xmax",
7494 FT_UINT8, BASE_DEC, NULL, 0x0,
7495 NULL, HFILL }
7497 { &hf_tn3270_ua_ymax,
7498 { "Maximum number of Y units in variable cell",
7499 "tn3270.ua_ymax",
7500 FT_UINT8, BASE_DEC, NULL, 0x0,
7501 NULL, HFILL }
7503 /* End - 6.51 Query Reply Usable Area */
7505 /* 6.52 - Query Reply (3270 IPDS) */
7506 { &hf_tn3270_3270_tranlim,
7507 { "Maximum transmission size allowed outbound",
7508 "tn3270.3270_tranlim",
7509 FT_UINT16, BASE_DEC, NULL, 0x0,
7510 NULL, HFILL }
7512 /* END - 6.52 - Query Reply (3270 IPDS) */
7514 /* Miscellaneous */
7515 { &hf_tn3270_field_data,
7516 { "Field Data",
7517 "tn3270.field_data",
7518 FT_STRING, BASE_NONE, NULL, 0x0,
7519 "tn3270.field_data", HFILL }
7521 { &hf_tn3270_number_of_attributes,
7522 { "Number of Attributes",
7523 "tn3270.number_of_attributes",
7524 FT_UINT8, BASE_HEX, NULL, 0x0,
7525 NULL, HFILL }
7527 { &hf_tn3270_resbyte,
7528 { "Flags (Reserved)",
7529 "tn3270.resbyte",
7530 FT_UINT8, BASE_HEX, NULL, 0x0,
7531 NULL, HFILL }
7533 { &hf_tn3270_resbytes,
7534 { "Flags (Reserved)",
7535 "tn3270.resbytes",
7536 FT_UINT16, BASE_HEX, NULL, 0x0,
7537 NULL, HFILL }
7539 { &hf_tn3270_res_twobytes,
7540 { "Flags (Reserved)",
7541 "tn3270.res_twobytes",
7542 FT_UINT16, BASE_HEX, NULL, 0x0,
7543 NULL, HFILL }
7545 { &hf_tn3270_sf_single_byte_id,
7546 { "Structured Field",
7547 "tn3270.sf_id",
7548 FT_UINT8, BASE_HEX, NULL, 0x0,
7549 NULL, HFILL }
7551 { &hf_tn3270_sf_double_byte_id,
7552 { "Structured Field",
7553 "tn3270.sf_id",
7554 FT_UINT16, BASE_HEX, NULL, 0x0,
7555 NULL, HFILL }
7557 { &hf_tn3270_sf_query_reply,
7558 { "Query Reply",
7559 "tn3270.sf_query_reply",
7560 FT_UINT8, BASE_HEX, VALS(vals_sf_query_replies), 0x0,
7561 NULL, HFILL }
7563 { &hf_tn3270_null,
7564 { "Trailing Null (Possible Mainframe/Emulator Bug)",
7565 "tn3270.null",
7566 FT_UINT8, BASE_HEX, NULL, 0x0,
7567 NULL, HFILL }
7569 { &hf_tn3270_unknown_data,
7570 { "Unknown Data (Possible Mainframe/Emulator Bug)",
7571 "tn3270.unknown_data",
7572 FT_BYTES, BASE_NONE, NULL, 0x0,
7573 NULL, HFILL }
7576 /* TN3270E - Header Fields */
7577 { &hf_tn3270_tn3270e_data_type,
7578 { "TN3270E Data Type",
7579 "tn3270.tn3270e_data_type",
7580 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_data_types), 0x0,
7581 NULL, HFILL }
7583 { &hf_tn3270_tn3270e_request_flag,
7584 { "TN3270E Request Flag",
7585 "tn3270.tn3270e_request_flag",
7586 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_request_flags), 0x0,
7587 NULL, HFILL }
7589 { &hf_tn3270_tn3270e_response_flag_3270_SCS,
7590 { "TN3270E Response Flag",
7591 "tn3270.tn3270e_response_flag",
7592 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_response_flags_3270_SCS), 0x0,
7593 NULL, HFILL }
7595 { &hf_tn3270_tn3270e_response_flag_response,
7596 { "TN3270E Response Flag",
7597 "tn3270.tn3270e_response_flag",
7598 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_response_flags_response), 0x0,
7599 NULL, HFILL }
7601 { &hf_tn3270_tn3270e_response_flag_unused,
7602 { "TN3270E Response Flag",
7603 "tn3270.tn3270e_response_flag",
7604 FT_UINT8, BASE_HEX, NULL, 0x0,
7605 NULL, HFILL }
7607 { &hf_tn3270_tn3270e_seq_number,
7608 { "TN3270E Seq Number",
7609 "tn3270.tn3270e_seq_number",
7610 FT_UINT16, BASE_DEC, NULL, 0x0,
7611 NULL, HFILL }
7613 { &hf_tn3270_tn3270e_header_data,
7614 { "TN3270E Header Data",
7615 "tn3270.tn3270e_header_data",
7616 FT_STRING, BASE_NONE, NULL, 0x0,
7617 NULL, HFILL }
7621 static int *ett[] = {
7622 &ett_tn3270,
7623 &ett_tn3270e_hdr,
7624 &ett_sf,
7625 &ett_tn3270_field_attribute,
7626 &ett_tn3270_field_validation,
7627 &ett_tn3270_usable_area_flags1,
7628 &ett_tn3270_usable_area_flags2,
7629 &ett_tn3270_query_reply_alphanumeric_flags,
7630 &ett_tn3270_character_sets_flags1,
7631 &ett_tn3270_character_sets_flags2,
7632 &ett_tn3270_character_sets_form,
7633 &ett_tn3270_cs_descriptor_flags,
7634 &ett_tn3270_color_flags,
7635 &ett_tn3270_wcc,
7636 &ett_tn3270_ccc,
7637 &ett_tn3270_msr_state_mask,
7638 &ett_tn3270_data_chain_fields,
7639 &ett_tn3270_query_list
7642 static ei_register_info ei[] = {
7643 { &ei_tn3270_order_code, { "tn3270.order_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7644 { &ei_tn3270_command_code, { "tn3270.command_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7645 { &ei_tn3270_aid, { "tn3270.aid.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7648 expert_module_t* expert_tn3270;
7650 proto_tn3270 = proto_register_protocol("TN3270 Protocol", "TN3270", "tn3270");
7651 register_dissector("tn3270", dissect_tn3270, proto_tn3270);
7652 proto_register_field_array(proto_tn3270, hf, array_length(hf));
7653 proto_register_subtree_array(ett, array_length(ett));
7654 expert_tn3270 = expert_register_protocol(proto_tn3270);
7655 expert_register_field_array(expert_tn3270, ei, array_length(ei));
7660 * Editor modelines
7662 * Local Variables:
7663 * c-basic-offset: 2
7664 * tab-width: 8
7665 * indent-tabs-mode: nil
7666 * End:
7668 * ex: set shiftwidth=2 tabstop=8 expandtab:
7669 * :indentSize=2:tabSize=8:noTabs=true: