2 * Routines for tn3270.packet dissection
5 * 3270 Information Display System: Data Stream Programmer's Reference
7 * http://publib.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CN7P4000
8 * (Paragraph references in the comments in this file (e.g., 6.15) are to the above document)
10 * 3174 Establishment Controller Functional Description
12 * http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/cn7a7003
15 * RFC 1041: Telnet 3270 Regime Option
16 * http://tools.ietf.org/html/rfc1041
18 * RFC 1576: TN3270 Current Practices
19 * http://tools.ietf.org/html/rfc1576
21 * RFC 2355: TN3270 Enhancements
22 * http://tools.ietf.org/html/rfc2355
25 * Copyright 2009, Robert Hogan <robert@roberthogan.net>
27 * Wireshark - Network traffic analyzer
28 * By Gerald Combs <gerald@wireshark.org>
29 * Copyright 1998 Gerald Combs
31 * SPDX-License-Identifier: GPL-2.0-or-later
37 #include <epan/packet.h>
38 #include <epan/conversation.h>
39 #include <epan/expert.h>
41 #include "packet-tn3270.h"
43 void proto_register_tn3270(void);
46 * In the IBM "3270 Information Display System: Data Stream Programmer's Reference"
47 * document, the references to bit numbers in the text and tables
48 * are based upon the "MSB 0" bit numbering scheme.
49 * That is: bits are numbered in a byte from left-to-right:
50 * "Bit 0" is the MSB of the byte
51 * "Bit 7" is the LSB of the byte
56 - better tree display: e.g., separate tree for each order code ....
57 - review 'structured field grouping: 5.2
58 - Telnet uses 0xFF as IAC ["interpret as command"] and thus for
59 telnet: any actual 0xFF bytes in a 3270 data stream will be prefixed with
60 a 0xFF escape. The escapes should be removed from the TVB before the
61 buffer is passed to this dissector. See packet-telnet.c
62 - Show the 'as a fraction" display as xx/yy ?
65 /* Dissection is for EBCDIC 3270 */
67 /* OUTBOUND DATA STREAM (MAINFRAME PROGRAM -> DISPLAY)
69 ________________ _____ __________________
70 | Command Code |WCC | Orders and Data |
71 |________________|_____|__________________|
74 ______ ______________________
75 | WSF | Structured Field(s) |
76 |______|______________________|
80 /*--- 3270 Command Codes - "Local Attachment" ----- */
82 #define CC_LCL_EW 0x05
83 #define CC_LCL_EWA 0x0D
84 #define CC_LCL_EAU 0x0F
85 #define CC_LCL_WSF 0x11
87 #define CC_LCL_RB 0x02
88 #define CC_LCL_RM 0x06
89 #define CC_LCL_RMA 0x0E /* XXX Not valid ?? See 3174 Function Description 2.1.4 */
96 /*--- 3.3 3270 Command Codes - "Remote Attachment" ----- */
98 #define CC_RMT_EW 0xF5
99 #define CC_RMT_EWA 0x7E
100 #define CC_RMT_EAU 0x6F
101 #define CC_RMT_WSF 0xF3
103 #define CC_RMT_RB 0xF2
104 #define CC_RMT_RM 0xF6
105 #define CC_RMT_RMA 0x6E
107 #define CC_SNA_BSC 0xF7 /* local copy in a BSC environment */
109 static const value_string vals_command_codes[] = {
111 { CC_LCL_W, "Write (Local)" },
112 { CC_LCL_EW, "Erase/Write (Local)" },
113 { CC_LCL_EWA, "Erase/Write Alternate (Local)" },
114 { CC_LCL_EAU, "Erase All Unprotected (Local)" },
115 { CC_LCL_WSF, "Write Structured Field (Local)" },
116 { CC_LCL_RB, "Read Buffer (Local)" },
117 { CC_LCL_RM, "Read Modified (Local)" },
118 { CC_LCL_RMA, "Read Modified All (Local)" },
119 { CC_RMT_W, "Write" },
120 { CC_RMT_EW, "Erase/Write" },
121 { CC_RMT_EWA, "Erase/Write Alternate" },
122 { CC_RMT_EAU, "Erase All Unprotected" },
123 { CC_RMT_WSF, "Write Structured Field" },
124 { CC_RMT_RB, "Read Buffer" },
125 { CC_RMT_RM, "Read Modified" },
126 { CC_RMT_RMA, "Read Modified All" },
127 { CC_SNA_BSC, "BSC Copy" },
131 /*--- 3.4 WCC (Write Control Characters) ----- */
132 #define WCC_NOP 0x80 /* "Bit 0" */
133 #define WCC_RESET 0x40 /* "Bit 1" */
134 #define WCC_PRINTER1 0x20 /* "Bit 2" */
135 #define WCC_PRINTER2 0x10 /* "Bit 3" */
136 #define WCC_START_PRINTER 0x08 /* "Bit 4" */
137 #define WCC_SOUND_ALARM 0x04 /* "Bit 5" */
138 #define WCC_KEYBOARD_RESTORE 0x02 /* "Bit 6" */
139 #define WCC_RESET_MDT 0x01 /* "Bit 7" */
141 /*--- 4.3 Order Codes ----- */
155 static const value_string vals_order_codes[] = {
156 { OC_SF, "Start Field (SF)" },
157 { OC_SFE, "Start Field Extended (SFE)" },
158 { OC_SBA, "Set Buffer Address (SBA)" },
159 { OC_SA, "Set Attribute (SA)" },
160 { OC_MF, "Modify Field (MF)" },
161 { OC_IC, "Insert Cursor (IC)" },
162 { OC_PT, "Program Tab (PT)" },
163 { OC_RA, "Repeat to Address (RA)" },
164 { OC_EUA, "Erase Unprotected to Address (EUA)" },
165 { OC_GE, "Graphic Escape (GE)" },
170 /*--- 4.3.11 Format Control Orders ----- */
171 /* Special treatment for display */
182 static const value_string vals_format_control_orders[] = {
184 { FCO_SUB, "Substitute" },
185 { FCO_DUP, "Duplicate" },
186 { FCO_FM, "Field Mark" },
187 { FCO_FF, "Form Feed" },
188 { FCO_CR, "Carriage Return" },
189 { FCO_NL, "New Line" },
190 { FCO_EM, "End of Medium" },
191 { FCO_EO, "Eight Ones" },
196 /*--- 8.7 Copy Control Code ----- */
197 /* Use for "local Copy" in a "BSC [BiSync] Environment" */
199 /* "Coding Bits" are those required such that the */
200 /* complete 8 bit CCC is a valid EBCDIC character */
201 #define CCC_GRAPHIC_CONVERT_MASK 0xC0
203 #define CCC_PRINT_BITS_MASK 0x30
204 #define CCC_PRINT_BITS_POINT_LINE_LENGTH 0x00
205 #define CCC_PRINT_BITS_PRINT_LINE_40 0x01
206 #define CCC_PRINT_BITS_PRINT_LINE_64 0x02
207 #define CCC_PRINT_BITS_PRINT_LINE_80 0x03
209 static const value_string ccc_vals_printout_format[] = {
210 { CCC_PRINT_BITS_POINT_LINE_LENGTH,
211 "The NL, EM, and CR orders in the data stream determine pointline length. "
212 "Provides a 132-print position line when the orders are not present." },
213 { CCC_PRINT_BITS_PRINT_LINE_40,
214 "Specifies a 40-character print line." },
215 { CCC_PRINT_BITS_PRINT_LINE_64,
216 "Specifies a 64-character print line." },
217 { CCC_PRINT_BITS_PRINT_LINE_80,
218 "Specifies an 80-character print line." },
222 #define CCC_START_PRINT 0x08
223 #define CCC_SOUND_ALARM 0x04
225 #define CCC_ATTRIBUTE_BITS_MASK 0x03
226 #define CCC_ATTRIBUTE_BITS_ONLY_ATTRIBUTE_CHARACTERS 0x00
227 #define CCC_ATTRIBUTE_BITS_ATTRIBUTE_CHARACTERS_UNPROTECTED_AN 0x01
228 #define CCC_ATTRIBUTE_BITS_ALL_ATTRIBUTE_PROTECTED 0x02
229 #define CCC_ATTRIBUTE_BITS_ENTIRE_CONTENTS 0x03
231 static const value_string ccc_vals_copytype[] = {
232 { CCC_ATTRIBUTE_BITS_ONLY_ATTRIBUTE_CHARACTERS,
233 "Only attribute characters are copied." },
234 { CCC_ATTRIBUTE_BITS_ATTRIBUTE_CHARACTERS_UNPROTECTED_AN,
235 "Attribute characters and unprotected alphanumeric fields"
236 " (including nulls) are copied. Nulls are transferred for"
237 " the alphanumeric characters not copied from the"
238 " protected fields." },
239 { CCC_ATTRIBUTE_BITS_ALL_ATTRIBUTE_PROTECTED,
240 "All attribute characters and protected alphanumeric fields"
241 " (including nulls) are copied. Nulls are transferred for the alphanumeric characters not"
242 " copied from the unprotected fields." },
243 { CCC_ATTRIBUTE_BITS_ENTIRE_CONTENTS,
244 "The entire contents of the storage buffer (including nulls) are copied." },
248 /*--- 4.4.1 Field Attributes ----- */
249 #define FA_GRAPHIC_CONVERT_MASK 0xC0
251 #define FA_PROTECTED 0x20 /* "Bit 2" */
252 #define FA_NUMERIC 0x10 /* "Bit 3" */
254 #define FA_RESERVED 0x02 /* "Bit 6" */
255 #define FA_MODIFIED 0x01 /* "Bit 7" */
257 #define FA_DISPLAY_BITS_MASK 0x0C /* "Bits 4,5" */
258 #define FA_DISPLAY_BITS_DISPLAY_NOT_SELECTOR_PEN_DETECTABLE 0x00
259 #define FA_DISPLAY_BITS_DISPLAY_SELECTOR_PEN_DETECTABLE 0x01
260 #define FA_DISPLAY_BITS_INTENSIFIED_DISPLAY_SELECTOR_PEN_DETECTABLE 0x02
261 #define FA_DISPLAY_BITS_NON_DISPLAY_NON_DETECTABLE 0x03
263 static const value_string vals_fa_display[] = {
264 { FA_DISPLAY_BITS_DISPLAY_NOT_SELECTOR_PEN_DETECTABLE, "Display/Not Selector Pen Detectable" },
265 { FA_DISPLAY_BITS_DISPLAY_SELECTOR_PEN_DETECTABLE, "Display/Selector Pen Detectable" },
266 { FA_DISPLAY_BITS_INTENSIFIED_DISPLAY_SELECTOR_PEN_DETECTABLE, "Intensified Display/Selector Pen Detectable" },
267 { FA_DISPLAY_BITS_NON_DISPLAY_NON_DETECTABLE, "Non Display, Non Detectable (not printable)" },
271 /*--- 4.4.5 Attribute Types ----- */
272 #define AT_ALL_CHARACTER_ATTRIBUTES 0x00
273 #define AT_T3270_FIELD_ATTRIBUTE 0xC0
274 #define AT_FIELD_VALIDATION 0xC1
275 #define AT_FIELD_OUTLINING 0xC2
276 #define AT_EXTENDED_HIGHLIGHTING 0x41
277 #define AT_FOREGROUND_COLOR 0x42
278 #define AT_CHARACTER_SET 0x43
279 #define AT_BACKGROUND_COLOR 0x45
280 #define AT_TRANSPARENCY 0x46
283 static const value_string vals_attribute_types[] = {
284 { AT_ALL_CHARACTER_ATTRIBUTES, "All character attributes" },
285 { AT_T3270_FIELD_ATTRIBUTE, "3270 Field attribute" },
286 { AT_FIELD_VALIDATION, "Field validation" },
287 { AT_FIELD_OUTLINING, "Field outlining" },
288 { AT_EXTENDED_HIGHLIGHTING, "Extended highlighting" },
289 { AT_FOREGROUND_COLOR, "Foreground color" },
290 { AT_CHARACTER_SET, "Character set" },
291 { AT_BACKGROUND_COLOR, "Background color" },
292 { AT_TRANSPARENCY, "Transparency" },
296 /*--- 4.4.6.3 Extended Highlighting ----- */
297 #define AT_EH_DEFAULT_HIGHLIGHTING 0x00
298 #define AT_EH_NORMAL 0xF0
299 #define AT_EH_BLINK 0xF1
300 #define AT_EH_REVERSE_VIDEO 0xF2
301 #define AT_EH_UNDERSCORE 0xF4
303 static const value_string vals_at_extended_highlighting[] = {
304 { AT_EH_DEFAULT_HIGHLIGHTING, "Default" },
305 { AT_EH_NORMAL, "Normal (as determined by the 3270 field attribute)" },
306 { AT_EH_BLINK, "Blink" },
307 { AT_EH_REVERSE_VIDEO, "Reverse video" },
308 { AT_EH_UNDERSCORE, "Underscore." },
312 /*--- 4.4.6.4 Color Identifications ----- */
313 #define AT_CI_ALL_PLANES 0x00
314 #define AT_CI_BLUE_PLANE 0x01
315 #define AT_CI_RED_PLANE 0x02
316 #define AT_CI_GREEN_PLANE 0x04
317 #define AT_CI_NEUTRAL1 0xF0
318 #define AT_CI_BLUE 0xF1
319 #define AT_CI_RED 0xF2
320 #define AT_CI_PINK 0xF3
321 #define AT_CI_GREEN 0xF4
322 #define AT_CI_TURQUOISE 0xF5
323 #define AT_CI_YELLOW 0xF6
324 #define AT_CI_NEUTRAL2 0xF7
325 #define AT_CI_BLACK 0xF8
326 #define AT_CI_DEEP_BLUE 0xF9
327 #define AT_CI_ORANGE 0xFA
328 #define AT_CI_PURPLE 0xFB
329 #define AT_CI_PALE_GREEN 0xFC
330 #define AT_CI_PALE_TURQUOISE 0xFD
331 #define AT_CI_GREY 0xFE
332 #define AT_CI_WHITE 0xFF
335 static const value_string vals_at_color_identifications[] = {
336 { AT_CI_ALL_PLANES, "ALL PLANES" },
337 { AT_CI_BLUE_PLANE, "BLUE PLANE" },
338 { AT_CI_RED_PLANE, "RED PLANE" },
339 { AT_CI_GREEN_PLANE, "GREEN PLANE" },
340 { AT_CI_NEUTRAL1, "Neutral" },
341 { AT_CI_BLUE, "Blue" },
342 { AT_CI_RED, "Red" },
343 { AT_CI_PINK, "Pink" },
344 { AT_CI_GREEN, "Green" },
345 { AT_CI_TURQUOISE, "Turquoise" },
346 { AT_CI_YELLOW, "Yellow" },
347 { AT_CI_NEUTRAL2, "Neutral" },
348 { AT_CI_BLACK, "Black" },
349 { AT_CI_DEEP_BLUE, "Deep Blue" },
350 { AT_CI_ORANGE, "Orange" },
351 { AT_CI_PURPLE, "Purple" },
352 { AT_CI_PALE_GREEN, "Pale Green" },
353 { AT_CI_PALE_TURQUOISE, "Pale Turquoise" },
354 { AT_CI_GREY, "Grey" },
355 { AT_CI_WHITE, "White" },
359 /*--- 4.4.6.5 Character Set ----- */
360 #define AT_CS_DEFAULT_CHARACTER_SET 0x00
361 #define AT_CS_MIN_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS 0x40
362 #define AT_CS_MAX_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS 0xEF
363 #define AT_CS_MIN_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS 0xF0
364 #define AT_CS_MAX_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS 0xF7
365 #define AT_CS_MIN_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS 0xF8
366 #define AT_CS_MAX_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS 0xFE
368 static const range_string rvals_at_character_set[] = {
369 { AT_CS_DEFAULT_CHARACTER_SET,
370 AT_CS_DEFAULT_CHARACTER_SET,
371 "Default Character Set" },
372 { AT_CS_MIN_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS,
373 AT_CS_MAX_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS,
374 "Local Id For Loadable Character Sets" },
375 { AT_CS_MIN_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS,
376 AT_CS_MAX_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS,
377 "Local Id For Nonloadable Character Sets" },
378 { AT_CS_MIN_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS,
379 AT_CS_MAX_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS,
380 "Local Id For Two Byte Coded Character Sets" },
384 /*--- 4.4.6.6 Field Outlining ----- */
385 #define AT_FO_NO_OUTLINING_LINES 0X00
386 #define AT_FO_UNDERLINE_ONLY 0X01
387 #define AT_FO_RIGHT_VERTICAL_LINE_ONLY 0X02
388 #define AT_FO_OVERLINE_ONLY 0X04
389 #define AT_FO_LEFT_VERTICAL_LINE_ONLY 0X08
390 #define AT_FO_UNDERLINE_AND_RIGHT_VERTICAL_LINE 0X03
391 #define AT_FO_UNDERLINE_AND_OVERLINE 0X05
392 #define AT_FO_UNDERLINE_AND_LEFT_VERTICAL_LINE 0X09
393 #define AT_FO_RIGHT_VERTICAL_LINE_AND_OVERLINE 0X06
394 #define AT_FO_RIGHT_AND_LEFT_VERTICAL_LINES 0X0A
395 #define AT_FO_OVERLINE_AND_LEFT_VERTICAL_LINE 0X0C
396 #define AT_FO_RECTANGLE_MINUS_LEFT_VERTICAL_LINE 0X07
397 #define AT_FO_RECTANGLE_MINUS_OVERLINE 0X0B
398 #define AT_FO_RECTANGLE_MINUS_RIGHT_VERTICAL_LINE 0X0D
399 #define AT_FO_RECTANGLE_MINUS_UNDERLINE 0X0E
400 #define AT_FO_RECTANGLE 0X0F
402 static const value_string vals_at_field_outlining[] = {
403 { AT_FO_NO_OUTLINING_LINES, "No outlining lines" },
404 { AT_FO_UNDERLINE_ONLY, "Underline only" },
405 { AT_FO_RIGHT_VERTICAL_LINE_ONLY, "Right vertical line only" },
406 { AT_FO_OVERLINE_ONLY, "Overline only" },
407 { AT_FO_LEFT_VERTICAL_LINE_ONLY, "Left vertical line only" },
408 { AT_FO_UNDERLINE_AND_RIGHT_VERTICAL_LINE, "Underline and right vertical line" },
409 { AT_FO_UNDERLINE_AND_OVERLINE, "Underline and overline" },
410 { AT_FO_UNDERLINE_AND_LEFT_VERTICAL_LINE, "Underline and left vertical line" },
411 { AT_FO_RIGHT_VERTICAL_LINE_AND_OVERLINE, "Right vertical line and overline" },
412 { AT_FO_RIGHT_AND_LEFT_VERTICAL_LINES, "Right and left vertical lines" },
413 { AT_FO_OVERLINE_AND_LEFT_VERTICAL_LINE, "Overline and left vertical line" },
414 { AT_FO_RECTANGLE_MINUS_LEFT_VERTICAL_LINE, "Rectangle minus left vertical line" },
415 { AT_FO_RECTANGLE_MINUS_OVERLINE, "Rectangle minus overline" },
416 { AT_FO_RECTANGLE_MINUS_RIGHT_VERTICAL_LINE, "Rectangle minus right vertical line" },
417 { AT_FO_RECTANGLE_MINUS_UNDERLINE, "Rectangle minus underline" },
418 { AT_FO_RECTANGLE, "Rectangle" },
422 /*--- 4.4.6.7 Transparency ----- */
423 #define AT_TR_DEFAULT_TRANSPARENCY 0X00
424 #define AT_TR_BACKGROUND_IS_TRANSPARENT_OR 0XF0
425 #define AT_TR_BACKGROUND_IS_TRANSPARENT_XOR 0XF1
426 #define AT_TR_BACKGROUND_IS_OPAQUE 0XFF
428 static const value_string vals_at_transparency[] = {
429 { AT_TR_DEFAULT_TRANSPARENCY, "Default" },
430 { AT_TR_BACKGROUND_IS_TRANSPARENT_OR, "Background is transparent (OR)" },
431 { AT_TR_BACKGROUND_IS_TRANSPARENT_XOR, "Background is transparent (XOR)" },
432 { AT_TR_BACKGROUND_IS_OPAQUE, "Background is opaque (non-transparent)" },
436 /*--- 4.4.6.8 Field Validation ----- */
437 #define AT_FV_MANDATORY_FILL 0x04 /* "Bit 5" */
438 #define AT_FV_MANDATORY_ENTRY 0x02 /* "Bit 6" */
439 #define AT_FV_TRIGGER 0x01 /* "Bit 7" */
441 static const struct true_false_string tn3270_field_validation_mandatory_fill = {
446 static const struct true_false_string tn3270_field_validation_mandatory_entry = {
451 static const struct true_false_string tn3270_field_validation_trigger = {
456 /*--- 5.1 Outbound Structured Fields ----- */
457 #define SF_OB_ACTIVATE_PARTITION 0x0E
458 #define SF_OB_BEGIN_OR_END_OF_FILE 0x0F85
459 #define SF_OB_CREATE_PARTITION 0x0C
460 #define SF_OB_DESTROY_PARTITION 0x0D
461 #define SF_OB_ERASE_OR_RESET 0x03
462 #define SF_OB_LOAD_COLOR_TABLE 0x0F05
463 #define SF_OB_LOAD_FORMAT_STORAGE 0x0F24
464 #define SF_OB_LOAD_LINE_TYPE 0x0F07
465 #define SF_OB_LOAD_PROGRAMMED_SYMBOLS 0x06
466 #define SF_OB_MODIFY_PARTITION 0x0F0A
467 #define SF_OB_OUTBOUND_TEXT_HEADER 0x0F71
468 #define SF_OB_OUTBOUND_3270DS 0x40
469 #define SF_OB_PRESENT_ABSOLUTE_FORMAT 0x4B
470 #define SF_OB_PRESENT_RELATIVE_FORMAT 0x4C
471 #define SF_OB_SET_PARTITION_CHARACTERISTICS 0x0F08
472 #define SF_OB_SET_REPLY_MODE 0x09
473 #define SF_OB_TYPE_1_TEXT_OUTBOUND 0x0FC1
474 #define SF_OB_READ_PARTITION 0x01
475 #define SF_OB_REQUEST_RECOVERY_DATA 0x1030
476 #define SF_OB_RESET_PARTITION 0x00
477 #define SF_OB_RESTART 0x1033
478 #define SF_OB_SCS_DATA 0x41
479 #define SF_OB_SELECT_COLOR_TABLE 0x0F04
480 #define SF_OB_SELECT_FORMAT_GROUP 0x4A
481 #define SF_OB_SET_CHECKPOINT_INTERVAL 0x1032
482 #define SF_OB_SET_MSR_CONTROL 0x0F01
483 #define SF_OB_SET_PRINTER_CHARACTERISTICS 0x0F84
484 #define SF_OB_SET_WINDOW_ORIGIN 0x0B
487 static const value_string vals_outbound_structured_fields[] = {
488 { SF_OB_ACTIVATE_PARTITION, "Activate Partition" },
489 { SF_OB_BEGIN_OR_END_OF_FILE, "Begin Or End Of File" },
490 { SF_OB_CREATE_PARTITION, "Create Partition" },
491 { SF_OB_DESTROY_PARTITION, "Destroy Partition" },
492 { SF_OB_ERASE_OR_RESET, "Erase Or Reset" },
493 { SF_OB_LOAD_COLOR_TABLE, "Load Color Table" },
494 { SF_OB_LOAD_FORMAT_STORAGE, "Load Format Storage" },
495 { SF_OB_LOAD_LINE_TYPE, "Load Line Type" },
496 { SF_OB_LOAD_PROGRAMMED_SYMBOLS, "Load Programmed Symbols" },
497 { SF_OB_MODIFY_PARTITION, "Modify Partition" },
498 { SF_OB_OUTBOUND_TEXT_HEADER, "Outbound Text Header" },
499 { SF_OB_OUTBOUND_3270DS, "Outbound 3270ds" },
500 { SF_OB_PRESENT_ABSOLUTE_FORMAT, "Present Absolute Format" },
501 { SF_OB_PRESENT_RELATIVE_FORMAT, "Present Relative Format" },
502 { SF_OB_SET_PARTITION_CHARACTERISTICS, "Set Partition Characteristics" },
503 { SF_OB_SET_REPLY_MODE, "Set Reply Mode" },
504 { SF_OB_TYPE_1_TEXT_OUTBOUND, "Type 1 Text Outbound" },
505 { SF_OB_READ_PARTITION, "Read Partition" },
506 { SF_OB_REQUEST_RECOVERY_DATA, "Request Recovery Data" },
507 { SF_OB_RESET_PARTITION, "Reset Partition" },
508 { SF_OB_RESTART, "Restart" },
509 { SF_OB_SCS_DATA, "Scs Data" },
510 { SF_OB_SELECT_COLOR_TABLE, "Select Color Table" },
511 { SF_OB_SELECT_FORMAT_GROUP, "Select Format Group" },
512 { SF_OB_SET_CHECKPOINT_INTERVAL, "Set Checkpoint Interval" },
513 { SF_OB_SET_MSR_CONTROL, "Set Msr Control" },
514 { SF_OB_SET_PRINTER_CHARACTERISTICS, "Set Printer Characteristics" },
515 { SF_OB_SET_WINDOW_ORIGIN, "Set Window Origin" },
519 /*--- 5.1 Outbound/Inbound Structured Fields ----- */
520 #define SF_OB_IB_DATA_CHAIN 0x0F21
521 #define SF_OB_IB_DESTINATION_OR_ORIGIN 0x0F02
522 #define SF_OB_IB_OBJECT_CONTROL 0x0F11
523 #define SF_OB_IB_OBJECT_DATA 0x0F0F
524 #define SF_OB_IB_OBJECT_PICTURE 0x0F10
525 #define SF_OB_IB_OEM_DATA 0x0F1F
526 #define SF_OB_IB_SAVE_OR_RESTORE_FORMAT 0x1034
527 #define SF_OB_IB_SELECT_IPDS_MODE 0x0F83
529 static const value_string vals_outbound_inbound_structured_fields[] = {
530 { SF_OB_IB_DATA_CHAIN, "Data Chain" },
531 { SF_OB_IB_DESTINATION_OR_ORIGIN, "Destination/Origin" },
532 { SF_OB_IB_OBJECT_CONTROL, "Object Control" },
533 { SF_OB_IB_OBJECT_DATA, "Object Data" },
534 { SF_OB_IB_OBJECT_PICTURE, "Object Picture" },
535 { SF_OB_IB_OEM_DATA, "OEM Data" },
536 { SF_OB_IB_SAVE_OR_RESTORE_FORMAT, "Save/Restore Format" },
537 { SF_OB_IB_SELECT_IPDS_MODE, "Select IPDS Mode." },
541 /*--- 5.11 Load Format Storage ----- */
542 #define LOAD_FORMAT_STORAGE_OPERAND_ADD 0x01
543 #define LOAD_FORMAT_STORAGE_OPERAND_DELETE_FORMAT 0x02
544 #define LOAD_FORMAT_STORAGE_OPERAND_DELETE_GROUP 0x03
545 #define LOAD_FORMAT_STORAGE_OPERAND_RESET_ALL 0x04
546 #define LOAD_FORMAT_STORAGE_OPERAND_REQUEST_SUMMARY_STATUS 0x05
547 #define LOAD_FORMAT_STORAGE_OPERAND_REQUEST_GROUP_STATUS 0x06
549 static const value_string vals_load_storage_format_operand[] = {
550 { LOAD_FORMAT_STORAGE_OPERAND_ADD, "Add" },
551 { LOAD_FORMAT_STORAGE_OPERAND_DELETE_FORMAT, "Delete Format" },
552 { LOAD_FORMAT_STORAGE_OPERAND_DELETE_GROUP, "Delete Group" },
553 { LOAD_FORMAT_STORAGE_OPERAND_RESET_ALL, "Reset All" },
554 { LOAD_FORMAT_STORAGE_OPERAND_REQUEST_SUMMARY_STATUS, "Request Summary Status" },
555 { LOAD_FORMAT_STORAGE_OPERAND_REQUEST_GROUP_STATUS, "Request Group Status" },
559 /*--- 5.19 Read Partition ----- */
560 #define READ_PARTITION_OPTYPE_QUERY 0x02
561 #define READ_PARTITION_OPTYPE_QUERY_LIST 0x03
562 #define READ_PARTITION_OPTYPE_READ_MODIFIED_ALL 0x6E
563 #define READ_PARTITION_OPTYPE_READ_BUFFER 0xF2
564 #define READ_PARTITION_OPTYPE_READ_MODIFIED 0xF6
566 static const value_string vals_read_partition_operation_type[] = {
567 { READ_PARTITION_OPTYPE_QUERY, "Read Partition Query" },
568 { READ_PARTITION_OPTYPE_QUERY_LIST, "Read Partition Query List" },
569 { READ_PARTITION_OPTYPE_READ_MODIFIED_ALL, "Read Partition Read Modified All" },
570 { READ_PARTITION_OPTYPE_READ_BUFFER, "Read Partition Read Buffer" },
571 { READ_PARTITION_OPTYPE_READ_MODIFIED, "Read Partition Read Modified" },
575 #define READ_PARTITION_REQTYPE_MASK 0xC0
576 static const value_string vals_read_partition_reqtype[] = {
577 { 0x00, "QCODE List" },
578 { 0x01, "Equivalent + QCODE List" },
583 /*--- 5.34 Data Chain ----- */
584 #define DATA_CHAIN_GROUP_MASK 0x60
585 #define DATA_CHAIN_INBOUND_CONTROL_MASK 0x18
587 static const value_string vals_data_chain_group[] = {
588 { 0x00, "Continue" },
595 static const value_string vals_data_chain_inbound_control[] = {
596 { 0x00, "No Change" },
597 { 0x01, "Enable Inbound Data Chaining" },
598 { 0x02, "Disable Inbound Data Chaining" },
599 { 0x03, "Reserved" },
603 /*--- 5.35 Destination or Origin ----- */
604 #define DESTINATION_OR_ORIGIN_FLAGS_INPUT_CONTROL_MASK 0xC0
606 static const value_string vals_destination_or_origin_flags_input_control[] = {
607 { 0x00, "Enable input" },
608 { 0x01, "No Change" },
609 { 0x02, "Disable Input" },
610 { 0x03, "Reserved" },
615 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */
618 ______ _______ ________ _______
620 | AID | Cursor address | Data |
623 |______|_______|________|_______|
625 An inbound data stream can also consist of an AID (X'88') followed by
626 structured fields as follows:
627 ______ __________________ ________ ___________________
629 | AID | Structured Field | ...... | Structured Field |
631 |______|__________________|________|___________________|
636 /*--- 3.5.6 Attention Identification Bytes (AID) ----- */
637 #define AID_NO_AID_GENERATED 0x60
638 #define AID_NO_AID_GENERATED_PRINTER_ONLY 0xE8
639 #define AID_STRUCTURED_FIELD 0x88
640 #define AID_READ_PARTITION_AID 0x61
641 #define AID_TRIGGER_ACTION 0x7F
642 #define AID_TEST_REQ_AND_SYS_REQ 0xF0
643 #define AID_PF1_KEY 0xF1
644 #define AID_PF2_KEY 0xF2
645 #define AID_PF3_KEY 0xF3
646 #define AID_PF4_KEY 0xF4
647 #define AID_PF5_KEY 0xF5
648 #define AID_PF6_KEY 0xF6
649 #define AID_PF7_KEY 0xF7
650 #define AID_PF8_KEY 0xF8
651 #define AID_PF9_KEY 0xF9
652 #define AID_PF10_KEY 0x7A
653 #define AID_PF11_KEY 0x7B
654 #define AID_PF12_KEY 0x7C
655 #define AID_PF13_KEY 0xC1
656 #define AID_PF14_KEY 0xC2
657 #define AID_PF15_KEY 0xC3
658 #define AID_PF16_KEY 0xC4
659 #define AID_PF17_KEY 0xC5
660 #define AID_PF18_KEY 0xC6
661 #define AID_PF19_KEY 0xC7
662 #define AID_PF20_KEY 0xC8
663 #define AID_PF21_KEY 0xC9
664 #define AID_PF22_KEY 0x4A
665 #define AID_PF23_KEY 0x4B
666 #define AID_PF24_KEY 0x4C
667 #define AID_PA1_KEY 0x6C
668 #define AID_PA2_KEY_CNCL 0x6E
669 #define AID_PA3_KEY 0x6B
670 #define AID_CLEAR_KEY 0x6D
671 #define AID_CLEAR_PARTITION_KEY 0x6A
672 #define AID_ENTER_KEY 0x7D
673 #define AID_SELECTOR_PEN_ATTENTION 0x7E
674 #define AID_OPERATOR_ID_READER 0xE6
675 #define AID_MAG_READER_NUMBER 0xE7
677 static const value_string vals_attention_identification_bytes[] = {
678 { AID_NO_AID_GENERATED, "No AID generated" },
679 { AID_NO_AID_GENERATED_PRINTER_ONLY, "No AID generated (printer only)" },
680 { AID_STRUCTURED_FIELD, "Structured field" },
681 { AID_READ_PARTITION_AID, "Read partition" },
682 { AID_TRIGGER_ACTION, "Trigger action" },
683 { AID_TEST_REQ_AND_SYS_REQ, "Test Req and Sys Req" },
684 { AID_PF1_KEY, "PF1 key" },
685 { AID_PF2_KEY, "PF2 key" },
686 { AID_PF3_KEY, "PF3 key" },
687 { AID_PF4_KEY, "PF4 key" },
688 { AID_PF5_KEY, "PF5 key" },
689 { AID_PF6_KEY, "PF6 key" },
690 { AID_PF7_KEY, "PF7 key" },
691 { AID_PF8_KEY, "PF8 key" },
692 { AID_PF9_KEY, "PF9 key" },
693 { AID_PF10_KEY, "PF10 key" },
694 { AID_PF11_KEY, "PF11 key" },
695 { AID_PF12_KEY, "PF12 key" },
696 { AID_PF13_KEY, "PF13 key" },
697 { AID_PF14_KEY, "PF14 key" },
698 { AID_PF15_KEY, "PF15 key" },
699 { AID_PF16_KEY, "PF16 key" },
700 { AID_PF17_KEY, "PF17 key" },
701 { AID_PF18_KEY, "PF18 key" },
702 { AID_PF19_KEY, "PF19 key" },
703 { AID_PF20_KEY, "PF20 key" },
704 { AID_PF21_KEY, "PF21 key" },
705 { AID_PF22_KEY, "PF22 key" },
706 { AID_PF23_KEY, "PF23 key" },
707 { AID_PF24_KEY, "PF24 key" },
708 { AID_PA1_KEY, "PA1 key" },
709 { AID_PA2_KEY_CNCL, "PA2 key (Cncl)" },
710 { AID_PA3_KEY, "PA3 key" },
711 { AID_CLEAR_KEY, "Clear key" },
712 { AID_CLEAR_PARTITION_KEY, "Clear Partition key" },
713 { AID_ENTER_KEY, "Enter key" },
714 { AID_SELECTOR_PEN_ATTENTION, "Selector pen attention" },
715 { AID_OPERATOR_ID_READER, "Operator ID reader" },
716 { AID_MAG_READER_NUMBER, "Mag Reader Number" },
720 /*--- 5.3.6 Object Control ----- */
721 #define OBJC_GRAPHICS 0x00
722 #define OBJC_IMAGE 0x01
724 static const value_string vals_oc_type[] = {
725 { OBJC_GRAPHICS, "Graphics" },
726 { OBJC_IMAGE, "Image)" },
730 /*--- 6.1 Inbound Structured Fields ----- */
731 #define SF_IB_EXCEPTION_OR_STATUS 0x0F22
732 #define SF_IB_INBOUND_TEXT_HEADER 0x0FB1
733 #define SF_IB_INBOUND_3270DS 0x0F80 /* TODO: Check */
734 #define SF_IB_RECOVERY_DATA 0x1031
735 #define SF_IB_TYPE_1_TEXT_INBOUND 0x0FC1
736 #define SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS 0x8184
737 #define SF_IB_QUERY_REPLY_AUXILIARY_DEVICE 0x8199
738 #define SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE 0x819F
739 #define SF_IB_QUERY_REPLY_CHARACTER_SETS 0x8185
740 #define SF_IB_QUERY_REPLY_COLOR 0x8186
741 #define SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR 0x81AB
742 #define SF_IB_QUERY_REPLY_DATA_CHAINING 0x8198
743 #define SF_IB_QUERY_REPLY_DATA_STREAMS 0x81A2
744 #define SF_IB_QUERY_REPLY_DBCS_ASIA 0x8191
745 #define SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS 0x81A0
746 #define SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT 0x8195
747 #define SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE 0x8197
748 #define SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE 0x81B5
749 #define SF_IB_QUERY_REPLY_FIELD_OUTLINING 0x818C
750 #define SF_IB_QUERY_REPLY_FIELD_VALIDATION 0x818A
751 #define SF_IB_QUERY_REPLY_FORMAT_PRESENTATION 0x8190
752 #define SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE 0x8194
753 #define SF_IB_QUERY_REPLY_GRAPHIC_COLOR 0x81B4
754 #define SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS 0x81B6
755 #define SF_IB_QUERY_REPLY_HIGHLIGHTING 0x8187
756 #define SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE 0x819E
757 #define SF_IB_QUERY_REPLY_IMAGE 0x8182
758 #define SF_IB_QUERY_REPLY_IMPLICIT_PARTITION 0x81A6
759 #define SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE 0x81AA
760 #define SF_IB_QUERY_REPLY_LINE_TYPE 0x81B2
761 #define SF_IB_QUERY_REPLY_MSR_CONTROL 0x818B
762 #define SF_IB_QUERY_REPLY_NULL 0x81FF
763 #define SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE 0x818F
764 #define SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES 0x81A7
765 #define SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS 0x818E
766 #define SF_IB_QUERY_REPLY_PORT 0x81B3
767 #define SF_IB_QUERY_REPLY_PROCEDURE 0x81B1
768 #define SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM 0x819C
769 #define SF_IB_QUERY_REPLY_REPLY_MODES 0x8188
770 #define SF_IB_QUERY_REPLY_RPQ_NAMES 0x81A1
771 #define SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT 0x8192
772 #define SF_IB_QUERY_REPLY_SEGMENT 0x81B0
773 #define SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS 0x81A9
774 #define SF_IB_QUERY_REPLY_STORAGE_POOLS 0x8196
775 #define SF_IB_QUERY_REPLY_SUMMARY 0x8180
776 #define SF_IB_QUERY_REPLY_TEXT_PARTITIONS 0x8183
777 #define SF_IB_QUERY_REPLY_TRANSPARENCY 0x81A8
778 #define SF_IB_QUERY_REPLY_USABLE_AREA 0x8181
779 #define SF_IB_QUERY_REPLY_3270_IPDS 0x819A
781 static const value_string vals_inbound_structured_fields[] = {
782 { SF_IB_EXCEPTION_OR_STATUS, "Exception/Status" },
783 { SF_IB_INBOUND_TEXT_HEADER, "Inbound Text Header" },
784 { SF_IB_INBOUND_3270DS, "Inbound 3270DS" },
785 { SF_IB_RECOVERY_DATA, "Recovery Data" },
786 { SF_IB_TYPE_1_TEXT_INBOUND, "Type 1 Text Inbound" },
787 { SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS, "Query Reply (Alphanumeric Partitions)" },
788 { SF_IB_QUERY_REPLY_AUXILIARY_DEVICE, "Query Reply (Auxiliary Device)" },
789 { SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE, "Query Reply (Begin/End of File)" },
790 { SF_IB_QUERY_REPLY_CHARACTER_SETS, "Query Reply (Character Sets)" },
791 { SF_IB_QUERY_REPLY_COLOR, "Query Reply (Color)" },
792 { SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR, "Query Reply (Cooperative Processing Requestor)" },
793 { SF_IB_QUERY_REPLY_DATA_CHAINING, "Query Reply (Data Chaining)" },
794 { SF_IB_QUERY_REPLY_DATA_STREAMS, "Query Reply (Data Streams)" },
795 { SF_IB_QUERY_REPLY_DBCS_ASIA, "Query Reply (DBCS-Asia)" },
796 { SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS, "Query Reply (Device Characteristics)" },
797 { SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT, "Query Reply (Distributed Data Management)" },
798 { SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE, "Query Reply (Document Interchange Architecture)" },
799 { SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE, "Query Reply (Extended Drawing Routine)" },
800 { SF_IB_QUERY_REPLY_FIELD_OUTLINING, "Query Reply (Field Outlining)" },
801 { SF_IB_QUERY_REPLY_FIELD_VALIDATION, "Query Reply (Field Validation)" },
802 { SF_IB_QUERY_REPLY_FORMAT_PRESENTATION, "Query Reply (Format Presentation)" },
803 { SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE, "Query Reply (Format Storage Auxiliary Device)" },
804 { SF_IB_QUERY_REPLY_GRAPHIC_COLOR, "Query Reply (Graphic Color)" },
805 { SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS, "Query Reply (Graphic Symbol Sets)" },
806 { SF_IB_QUERY_REPLY_HIGHLIGHTING, "Query Reply (Highlighting)" },
807 { SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE, "Query Reply (IBM Auxiliary Device)" },
808 { SF_IB_QUERY_REPLY_IMAGE, "Query Reply (Image)" },
809 { SF_IB_QUERY_REPLY_IMPLICIT_PARTITION, "Query Reply (Implicit Partition)" },
810 { SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE, "Query Reply (IOCA Auxiliary Device)" },
811 { SF_IB_QUERY_REPLY_LINE_TYPE, "Query Reply (Line Type)" },
812 { SF_IB_QUERY_REPLY_MSR_CONTROL, "Query Reply (MSR Control)" },
813 { SF_IB_QUERY_REPLY_NULL, "Query Reply (Null)" },
814 { SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE, "Query Reply (OEM Auxiliary Device)" },
815 { SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES, "Query Reply (Paper Feed Techniques)" },
816 { SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS, "Query Reply (Partition Characteristics)" },
817 { SF_IB_QUERY_REPLY_PORT, "Query Reply (Port)" },
818 { SF_IB_QUERY_REPLY_PROCEDURE, "Query Reply (Procedure)" },
819 { SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM, "Query Reply (Product Defined Data Stream)" },
820 { SF_IB_QUERY_REPLY_REPLY_MODES, "Query Reply (Reply Modes)" },
821 { SF_IB_QUERY_REPLY_RPQ_NAMES, "Query Reply (RPQ Names)" },
822 { SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT, "Query Reply (Save/Restore Format)" },
823 { SF_IB_QUERY_REPLY_SEGMENT, "Query Reply (Segment)" },
824 { SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS, "Query Reply (Settable Printer Characteristics)" },
825 { SF_IB_QUERY_REPLY_STORAGE_POOLS, "Query Reply (Storage Pools)" },
826 { SF_IB_QUERY_REPLY_SUMMARY, "Query Reply (Summary)" },
827 { SF_IB_QUERY_REPLY_TEXT_PARTITIONS, "Query Reply (Text Partitions)" },
828 { SF_IB_QUERY_REPLY_TRANSPARENCY, "Query Reply (Transparency)" },
829 { SF_IB_QUERY_REPLY_USABLE_AREA, "Query Reply (Usable Area)" },
830 { SF_IB_QUERY_REPLY_3270_IPDS, "Query Reply (3270 IPDS)." },
834 /*--- 6.2 - Exception/Status ----- */
835 #define SDP_STATCODE_ACKNOWLEDGED 0x0000
836 #define SDP_STATCODE_AUXDEVICEAVAIL 0X0001
838 static const value_string vals_sdp_statcode[] = {
839 { SDP_STATCODE_ACKNOWLEDGED, "Acknowledged. The formats were successfully loaded, and no exception occurred." },
840 { SDP_STATCODE_AUXDEVICEAVAIL, "Auxiliary device available" },
844 #define SDP_EXCODE_INVALID_DOID 0x0801
845 #define SDP_EXCODE_DEVICENOTAVAIL 0X0802
846 #define SDP_EXCODE_RETIRED 0X0803
847 #define SDP_EXCODE_BUFFER_OVERRUN 0X0804
848 #define SDP_EXCODE_STORAGE 0X0805
849 #define SDP_EXCODE_FORMATNOTSPEC 0X0806
850 #define SDP_EXCODE_DATAERROR 0X0807
851 #define SDP_EXCODE_INSUFFRESOURCE 0X084B
852 #define SDP_EXCODE_EXCEEDSLIMIT 0X084C
853 #define SDP_EXCODE_FUNCTNOTSUPP 0X1003
855 static const value_string vals_sdp_excode[] = {
856 { SDP_EXCODE_INVALID_DOID,
857 "Invalid/unrecognized DOID in the Destination/Origin structured field."
858 " AVAILSTAT must be set to B'0'." },
859 { SDP_EXCODE_DEVICENOTAVAIL,
860 "DOID valid, but the auxiliary device is not available because of an"
861 " intervention required condition (for example, out of paper, power"
862 " off, or processing code not resident). Available status is sent"
863 " when the condition clears. AVAILSTAT must be set to B'1'." },
864 { SDP_EXCODE_RETIRED,
866 { SDP_EXCODE_BUFFER_OVERRUN,
868 { SDP_EXCODE_STORAGE,
869 "Insufficient storage. The loading of the formats could not be"
870 " completed because storage was exhausted." },
871 { SDP_EXCODE_FORMATNOTSPEC,
872 "The format or group name was not specified in the Load Format"
873 " Storage structured field." },
874 { SDP_EXCODE_DATAERROR,
876 { SDP_EXCODE_INSUFFRESOURCE,
877 "Temporary insufficient resource. The application does not have"
878 " a buffer available or is busy. The device chooses whether to"
879 " set send status when the condition clears and set AVAILSTAT accordingly." },
880 { SDP_EXCODE_EXCEEDSLIMIT,
881 "The auxiliary device data in the transmission exceeds the limit specified"
882 " in the LIMOUT parameter of the Query Reply for the auxiliary device."
883 " AVAILSTAT must be set to B'0'." },
884 { SDP_EXCODE_FUNCTNOTSUPP,
885 "Function not supported." },
889 /* Query Reply Types */
890 #define SF_QR_ALPHANUMERIC_PARTITIONS 0x84
891 #define SF_QR_AUXILIARY_DEVICE 0x99
892 #define SF_QR_QBEGIN_OR_END_OF_FILE 0x9F
893 #define SF_QR_CHARACTER_SETS 0x85
894 #define SF_QR_COLOR 0x86
895 #define SF_QR_COOPERATIVE_PROCESSING_REQUESTOR 0xAB
896 #define SF_QR_DATA_CHAINING 0x98
897 #define SF_QR_DATA_STREAMS 0xA2
898 #define SF_QR_DBCS_ASIA 0x91
899 #define SF_QR_DEVICE_CHARACTERISTICS 0xA0
900 #define SF_QR_DISTRIBUTED_DATA_MANAGEMENT 0x95
901 #define SF_QR_DOCUMENT_INTERCHANGE_ARCHITECTURE 0x97
902 #define SF_QR_EXTENDED_DRAWING_ROUTINE 0xB5
903 #define SF_QR_QFIELD_OUTLINING 0x8C
904 #define SF_QR_QFIELD_VALIDATION 0x8A
905 #define SF_QR_FORMAT_PRESENTATION 0x90
906 #define SF_QR_FORMAT_STORAGE_AUXILIARY_DEVICE 0x94
907 #define SF_QR_GRAPHIC_COLOR 0xB4
908 #define SF_QR_GRAPHIC_SYMBOL_SETS 0xB6
909 #define SF_QR_HIGHLIGHTING 0x87
910 #define SF_QR_IBM_AUXILIARY_DEVICE 0x9E
911 #define SF_QR_IMAGE 0x82
912 #define SF_QR_IMPLICIT_PARTITION 0xA6
913 #define SF_QR_IOCA_AUXILIARY_DEVICE 0xAA
914 #define SF_QR_LINE_TYPE 0xB2
915 #define SF_QR_MSR_CONTROL 0x8B
916 #define SF_QR_QNULL 0xFF
917 #define SF_QR_OEM_AUXILIARY_DEVICE 0x8F
918 #define SF_QR_PAPER_FEED_TECHNIQUES 0xA7
919 #define SF_QR_PARTITION_CHARACTERISTICS 0x8E
920 #define SF_QR_PORT 0xB3
921 #define SF_QR_PROCEDURE 0xB1
922 #define SF_QR_PRODUCT_DEFINED_DATA_STREAM 0x9C
923 #define SF_QR_REPLY_MODES 0x88
924 #define SF_QR_RPQ_NAMES 0xA1
925 #define SF_QR_QSAVE_OR_RESTORE_FORMAT 0x92
926 #define SF_QR_SEGMENT 0xB0
927 #define SF_QR_SETTABLE_PRINTER_CHARACTERISTICS 0xA9
928 #define SF_QR_STORAGE_POOLS 0x96
929 #define SF_QR_SUMMARY 0x80
930 #define SF_QR_TEXT_PARTITIONS 0x83
931 #define SF_QR_QTRANSPARENCY 0xA8
932 #define SF_QR_USABLE_AREA 0x81
933 #define SF_QR_T3270_IPDS 0x9A
935 static const value_string vals_sf_query_replies[] = {
936 { SF_QR_ALPHANUMERIC_PARTITIONS, "Alphanumeric Partitions" },
937 { SF_QR_AUXILIARY_DEVICE, "Auxiliary Device" },
938 { SF_QR_QBEGIN_OR_END_OF_FILE, "Begin/End of File" },
939 { SF_QR_CHARACTER_SETS, "Character Sets" },
940 { SF_QR_COLOR, "Color" },
941 { SF_QR_COOPERATIVE_PROCESSING_REQUESTOR, "Cooperative Processing Requestor" },
942 { SF_QR_DATA_CHAINING, "Data Chaining" },
943 { SF_QR_DATA_STREAMS, "Data Streams" },
944 { SF_QR_DBCS_ASIA, "DBCS-Asia" },
945 { SF_QR_DEVICE_CHARACTERISTICS, "Device Characteristics" },
946 { SF_QR_DISTRIBUTED_DATA_MANAGEMENT, "Distributed Data Management" },
947 { SF_QR_DOCUMENT_INTERCHANGE_ARCHITECTURE, "Document Interchange Architecture" },
948 { SF_QR_EXTENDED_DRAWING_ROUTINE, "Extended Drawing Routine" },
949 { SF_QR_QFIELD_OUTLINING, "Field Outlining" },
950 { SF_QR_QFIELD_VALIDATION, "Field Validation" },
951 { SF_QR_FORMAT_PRESENTATION, "Format Presentation" },
952 { SF_QR_FORMAT_STORAGE_AUXILIARY_DEVICE, "Format Storage Auxiliary Device" },
953 { SF_QR_GRAPHIC_COLOR, "Graphic Color" },
954 { SF_QR_GRAPHIC_SYMBOL_SETS, "Graphic Symbol Sets" },
955 { SF_QR_HIGHLIGHTING, "Highlighting" },
956 { SF_QR_IBM_AUXILIARY_DEVICE, "IBM Auxiliary Device" },
957 { SF_QR_IMAGE, "Image" },
958 { SF_QR_IMPLICIT_PARTITION, "Implicit Partition" },
959 { SF_QR_IOCA_AUXILIARY_DEVICE, "IOCA Auxiliary Device" },
960 { SF_QR_LINE_TYPE, "Line Type" },
961 { SF_QR_MSR_CONTROL, "MSR Control" },
962 { SF_QR_QNULL, "Null" },
963 { SF_QR_OEM_AUXILIARY_DEVICE, "OEM Auxiliary Device" },
964 { SF_QR_PAPER_FEED_TECHNIQUES, "Paper Feed Techniques" },
965 { SF_QR_PARTITION_CHARACTERISTICS, "Partition Characteristics" },
966 { SF_QR_PORT, "Port" },
967 { SF_QR_PROCEDURE, "Procedure" },
968 { SF_QR_PRODUCT_DEFINED_DATA_STREAM, "Product Defined Data Stream" },
969 { SF_QR_REPLY_MODES, "Reply Modes" },
970 { SF_QR_RPQ_NAMES, "RPQ Names" },
971 { SF_QR_QSAVE_OR_RESTORE_FORMAT, "Save/Restore Format" },
972 { SF_QR_SEGMENT, "Segment" },
973 { SF_QR_SETTABLE_PRINTER_CHARACTERISTICS, "Settable Printer Characteristics" },
974 { SF_QR_STORAGE_POOLS, "Storage Pools" },
975 { SF_QR_SUMMARY, "Summary" },
976 { SF_QR_TEXT_PARTITIONS, "Text Partitions" },
977 { SF_QR_QTRANSPARENCY, "Transparency" },
978 { SF_QR_USABLE_AREA, "Usable Area" },
979 { SF_QR_T3270_IPDS, "3270 IPDS." },
983 /*--- 6.9 Query Reply Alphanumeric Partitions ----- */
984 #define QR_AP_VERTWIN 0x80
985 #define QR_AP_HORWIN 0x40
986 #define QR_AP_APRES1 0x20
987 #define QR_AP_APA_FLG 0x10
988 #define QR_AP_PROT 0x08
989 #define QR_AP_LCOPY 0x04
990 #define QR_AP_MODPART 0x02
991 #define QR_AP_APRES2 0x01
993 /*--- 6.12 - Query Reply (Character Sets) ----- */
994 #define QR_CS_ALT 0x80
995 #define QR_CS_MULTID 0x40
996 #define QR_CS_LOADABLE 0x20
997 #define QR_CS_EXT 0x10
998 #define QR_CS_MS 0x08
999 #define QR_CS_CH2 0x04
1000 #define QR_CS_GF 0x02
1001 #define QR_CS_CSRES 0x01
1003 #define QR_CS_CSRES2 0x80
1004 #define QR_CS_PSCS 0x40
1005 #define QR_CS_CSRES3 0x20
1006 #define QR_CS_CF 0x10
1007 #define QR_CS_CSRES4 0x08
1008 #define QR_CS_CSRES5 0x04
1009 #define QR_CS_GCSRES6 0x02
1010 #define QR_CS_CSRES7 0x01
1013 /*--- 6.15 Query Reply (Data Chaining) ----- */
1014 static const value_string vals_data_chaining_dir[] = {
1016 { 0x01, "From device only" },
1017 { 0x02, "To device only" },
1021 /*--- 6.16 Query Reply (Data Streams) ----- */
1022 #define QR_DS_SCS 0x00
1023 #define QR_DS_DCAL2 0x01
1024 #define QR_DS_IPDS 0x02
1026 static const value_string vals_data_streams[] = {
1028 "SCS Base Data Stream with extensions as specified in the BIND request"
1029 " and Device Characteristics Query Reply structured field" },
1031 "Document Content Architecture Level 2" },
1033 "IPDS as defined in related documentation" },
1037 /*--- 6.51 Query Reply Usable Area ----- */
1038 #define QR_UA_RESERVED1 0x80
1039 #define QR_UA_PAGE_PRINTER 0x40
1040 #define QR_UA_RESERVED2 0x20
1041 #define QR_UA_HARD_COPY 0x10
1043 #define QR_UA_ADDR_MODE_MASK 0x0F
1044 #define QR_UA_ADDR_MODE_RESERVED1 0x00
1045 #define QR_UA_ADDR_MODE_TWELVE_FOURTEEN_BIT_OK 0x01
1046 #define QR_UA_ADDR_MODE_RESERVED2 0x02
1047 #define QR_UA_ADDR_MODE_TWELVE_FOURTEEN_SXTN_BIT_OK 0x03
1048 #define QR_UA_ADDR_MODE_UNMAPPED 0x0F
1050 static const value_string vals_usable_area_addr_mode[] = {
1051 { QR_UA_ADDR_MODE_RESERVED1, "Reserved" },
1052 { QR_UA_ADDR_MODE_TWELVE_FOURTEEN_BIT_OK, "Twelve/Fourteen Bit Addressing Allowed" },
1053 { QR_UA_ADDR_MODE_RESERVED2, "Reserved" },
1054 { QR_UA_ADDR_MODE_TWELVE_FOURTEEN_SXTN_BIT_OK , "Twelve/Fourteen/Sixteen Bit Addressing Allowed" },
1055 { QR_UA_ADDR_MODE_UNMAPPED, "Unmapped" },
1059 #define QR_UA_VARIABLE_CELLS 0x80
1060 #define QR_UA_CHARACTERS 0x40
1061 #define QR_UA_CELL_UNITS 0x20
1063 static const struct true_false_string tn3270_tfs_ua_variable_cells = {
1068 static const struct true_false_string tn3270_tfs_ua_characters = {
1069 "Non-matrix character",
1073 static const struct true_false_string tn3270_tfs_ua_cell_units = {
1079 #define QR_UA_UOM_INCHES 0x00
1080 #define QR_UA_UOM_MILLIMETERS 0x01
1082 static const value_string vals_usable_area_uom[] = {
1083 { QR_UA_UOM_INCHES, "Inches" },
1084 { QR_UA_UOM_MILLIMETERS, "Millimeters" },
1088 /*--- 6.42 - Query reply (Reply Modes) ----- */
1089 /* Also for: 5.30 - Set Reply Mode */
1091 #define RM_REPLY_FIELD_MODE 0x00
1092 #define RM_REPLY_EXTENDED_FIELD_MODE 0x01
1093 #define RM_REPLY_CHARACTER_MODE 0x02
1095 static const value_string vals_reply_modes[] = {
1096 { RM_REPLY_FIELD_MODE, "Field Mode" },
1097 { RM_REPLY_EXTENDED_FIELD_MODE, "Extended Field Mode" },
1098 { RM_REPLY_CHARACTER_MODE, "Character Mode" },
1102 /*--- 6.19 - Query Reply (Distributed Data Management) ----- */
1103 #define QR_DDM_COPY_SUBSET_1 0x01
1105 static const value_string vals_qr_ddm[] = {
1106 { QR_DDM_COPY_SUBSET_1, "DDM Copy Subset 1" },
1110 /*--- 6.20 - Query Reply (Document Interchange Architecture) ----- */
1111 #define QR_DIA_FILE_SERVER 0x01
1112 #define QR_DIA_FILE_REQ 0x02
1113 #define QR_DIA_FILE_SERVER_REQ 0x03
1115 static const value_string vals_qr_dia[] = {
1116 { QR_DIA_FILE_SERVER, "File Server" },
1117 { QR_DIA_FILE_REQ, "File Requestor" },
1118 { QR_DIA_FILE_SERVER_REQ, "Both File Server and File Requestor" },
1122 /*--- 6.31 - Query Reply (Implicit Partitions) ----- */
1123 #define QR_IP_SDP_DISPLAY 0x01
1124 #define QR_IP_SDP_PRINTER 0x02
1125 #define QR_IP_SDP_CHARACTER 0x03
1128 static const value_string vals_qr_ip[] = {
1129 { QR_IP_SDP_DISPLAY, "Display Devices" },
1130 { QR_IP_SDP_PRINTER, "Printer Devices" },
1131 { QR_IP_SDP_CHARACTER, "Character Devices" },
1136 /*--- 6.41 - Query Reply (Product Defined Data Streams) ----- */
1137 #define QR_PDDS_REFID_GRAPH5080 0x01
1138 #define QR_PDDS_REFID_WHIPAPI 0x02
1140 static const value_string vals_qr_pdds_refid[] = {
1141 { QR_PDDS_REFID_GRAPH5080, "Supports the 5080 Graphics System" },
1142 { QR_PDDS_REFID_WHIPAPI, "Supports the WHIP API data stream" },
1146 #define QR_PDDS_SSID_HFGD 0x01
1147 #define QR_PDDS_SSID_RS232 0x02
1149 static const value_string vals_qr_pdds_ssid[] = {
1150 { QR_PDDS_SSID_HFGD , "5080 HFGD Graphics Subset" },
1151 { QR_PDDS_SSID_RS232, "5080 RS232 Ports Subset" },
1155 /*--- 6.47 - Query Reply (Storage Pools) ----- */
1156 #define QR_SP_OBJ_SEGMENT1 0x0001
1157 #define QR_SP_OBJ_PROCEDURE1 0x0002
1158 #define QR_SP_OBJ_EXTENDED_DRAWING 0x0003
1159 #define QR_SP_OBJ_DATA_UNIT 0x0004
1160 #define QR_SP_OBJ_TEMPORARY 0x0005
1161 #define QR_SP_OBJ_LINE_TYPE1 0x0006
1162 #define QR_SP_OBJ_SYMBOL_SET 0x0007
1164 static const value_string vals_sp_objlist[] = {
1165 { QR_SP_OBJ_SEGMENT1, "Segment" },
1166 { QR_SP_OBJ_PROCEDURE1, "Procedure" },
1167 { QR_SP_OBJ_EXTENDED_DRAWING, "Extended drawing routine" },
1168 { QR_SP_OBJ_DATA_UNIT, "Data unit" },
1169 { QR_SP_OBJ_TEMPORARY, "Temporary" },
1170 { QR_SP_OBJ_LINE_TYPE1, "Line type" },
1171 { QR_SP_OBJ_SYMBOL_SET, "Symbol set" },
1175 /* TN3270E Header - Data Type */
1176 #define TN3270E_3270_DATA 0x00
1177 #define TN3270E_BIND_IMAGE 0x03
1178 #define TN3270E_NVT_DATA 0x05
1179 #define TN3270E_REQUEST 0x06
1180 #define TN3270E_RESPONSE 0x02
1181 #define TN3270E_SCS_DATA 0x01
1182 #define TN3270E_SSCP_LU_DATA 0x07
1183 #define TN3270E_UNBIND 0x04
1185 static const value_string vals_tn3270_header_data_types[] = {
1186 { TN3270E_3270_DATA, "3270_DATA" },
1187 { TN3270E_BIND_IMAGE, "BIND_IMAGE" },
1188 { TN3270E_NVT_DATA, "NVT_DATA" },
1189 { TN3270E_REQUEST, "REQUEST" },
1190 { TN3270E_RESPONSE, "RESPONSE" },
1191 { TN3270E_SCS_DATA, "SCS_DATA" },
1192 { TN3270E_SSCP_LU_DATA, "SSCP_LU_DATA" },
1193 { TN3270E_UNBIND, "UNBIND" },
1198 /* TN3270E Header - Request Flags */
1199 #define TN3270E_COND_CLEARED 0x00
1201 static const value_string vals_tn3270_header_request_flags[] = {
1202 { TN3270E_COND_CLEARED, "Condition Cleared" },
1206 /* TN3270E Header - Response Flags - Data Type 3270 and SCS */
1207 #define TN3270E_NO_RESPONSE 0x00
1208 #define TN3270E_ERROR_RESPONSE 0x01
1209 #define TN3270E_ALWAYS_RESPONSE 0x02
1211 static const value_string vals_tn3270_header_response_flags_3270_SCS[] = {
1212 { TN3270E_NO_RESPONSE, "No-Response" },
1213 { TN3270E_ERROR_RESPONSE, "Error-Response" },
1214 { TN3270E_ALWAYS_RESPONSE, "Always-Response" },
1218 /* TN3270E Header _ Response Flags - Data Type Response */
1219 #define TN3270E_POSITIVE_RESPONSE 0x00
1220 #define TN3270E_NEGATIVE_RESPONSE 0x01
1222 static const value_string vals_tn3270_header_response_flags_response[] = {
1223 { TN3270E_POSITIVE_RESPONSE, "Positive-Response" },
1224 { TN3270E_NEGATIVE_RESPONSE, "Negative-Response" },
1229 * Data structure attached to a conversation, giving session information.
1231 typedef struct tn3270_conv_info_t {
1232 guint32 outbound_port;
1238 } tn3270_conv_info_t;
1241 static int proto_tn3270 = -1;
1243 static int hf_tn3270_fa_display = -1;
1244 static int hf_tn3270_fa_graphic_convert = -1;
1245 static int hf_tn3270_fa_modified = -1;
1246 static int hf_tn3270_fa_numeric = -1;
1247 static int hf_tn3270_fa_protected = -1;
1248 static int hf_tn3270_fa_reserved = -1;
1249 static int hf_tn3270_field_attribute = -1;
1250 static int hf_tn3270_aid = -1;
1251 static int hf_tn3270_all_character_attributes = -1;
1252 static int hf_tn3270_attribute_type = -1;
1253 static int hf_tn3270_begin_end_flags1 = -1;
1254 static int hf_tn3270_begin_end_flags2 = -1;
1255 static int hf_tn3270_bsc = -1;
1256 static int hf_tn3270_buffer_address = -1;
1257 static int hf_tn3270_c_cav = -1;
1258 static int hf_tn3270_cc = -1;
1259 static int hf_tn3270_character_code = -1;
1260 static int hf_tn3270_character_set = -1;
1261 static int hf_tn3270_charset = -1;
1262 static int hf_tn3270_checkpoint = -1;
1263 static int hf_tn3270_c_ci = -1;
1264 static int hf_tn3270_c_offset = -1;
1265 static int hf_tn3270_color = -1;
1266 static int hf_tn3270_color_command = -1;
1267 static int hf_tn3270_color_flags = -1;
1268 static int hf_tn3270_command_code = -1;
1269 static int hf_tn3270_cro = -1;
1270 static int hf_tn3270_c_scsoff = -1;
1271 static int hf_tn3270_c_seqoff = -1;
1272 static int hf_tn3270_c_sequence = -1;
1273 static int hf_tn3270_cursor_address = -1;
1274 static int hf_tn3270_cw = -1;
1275 static int hf_tn3270_data_chain_fields = -1;
1276 static int hf_tn3270_data_chain_group = -1;
1277 static int hf_tn3270_data_chain_inbound_control = -1;
1278 static int hf_tn3270_destination_or_origin_flags_input_control = -1;
1279 static int hf_tn3270_destination_or_origin_doid = -1;
1280 static int hf_tn3270_erase_flags = -1;
1281 static int hf_tn3270_exception_or_status_flags = -1;
1282 static int hf_tn3270_extended_highlighting = -1;
1283 static int hf_tn3270_extended_ps_color = -1;
1284 static int hf_tn3270_extended_ps_echar = -1;
1285 static int hf_tn3270_extended_ps_flags = -1;
1286 static int hf_tn3270_extended_ps_length = -1;
1287 static int hf_tn3270_extended_ps_lw = -1;
1288 static int hf_tn3270_extended_ps_lh = -1;
1289 static int hf_tn3270_extended_ps_nh = -1;
1290 static int hf_tn3270_extended_ps_nw = -1;
1291 static int hf_tn3270_extended_ps_res = -1;
1292 static int hf_tn3270_extended_ps_stsubs = -1;
1293 static int hf_tn3270_extended_ps_subsn = -1;
1294 static int hf_tn3270_featl = -1;
1295 static int hf_tn3270_feats = -1;
1296 static int hf_tn3270_field_data = -1;
1297 static int hf_tn3270_field_outlining = -1;
1298 static int hf_tn3270_field_validation_mandatory_entry = -1;
1299 static int hf_tn3270_field_validation_mandatory_fill = -1;
1300 static int hf_tn3270_field_validation_trigger = -1;
1301 static int hf_tn3270_format_group = -1;
1302 static int hf_tn3270_format_name = -1;
1303 static int hf_tn3270_fov = -1;
1304 static int hf_tn3270_fpc = -1;
1305 static int hf_tn3270_hilite = -1;
1306 static int hf_tn3270_h_length = -1;
1307 static int hf_tn3270_h_offset = -1;
1308 static int hf_tn3270_horizon = -1;
1309 static int hf_tn3270_h_sequence = -1;
1310 static int hf_tn3270_hw = -1;
1311 static int hf_tn3270_interval = -1;
1312 static int hf_tn3270_limin = -1;
1313 static int hf_tn3270_limout = -1;
1314 static int hf_tn3270_lines = -1;
1315 static int hf_tn3270_load_color_command = -1;
1316 static int hf_tn3270_load_format_storage_flags1 = -1;
1317 static int hf_tn3270_load_format_storage_flags2 = -1;
1318 static int hf_tn3270_load_format_storage_format_data = -1;
1319 static int hf_tn3270_load_format_storage_localname = -1;
1320 static int hf_tn3270_load_format_storage_operand = -1;
1321 static int hf_tn3270_load_line_type_command = -1;
1322 static int hf_tn3270_lvl = -1;
1323 static int hf_tn3270_mode = -1;
1324 static int hf_tn3270_msr_ind_mask = -1;
1325 static int hf_tn3270_msr_ind_value = -1;
1326 static int hf_tn3270_msr_state_mask = -1;
1327 static int hf_tn3270_msr_state_value = -1;
1328 static int hf_tn3270_msr_type = -1;
1329 static int hf_tn3270_ap_na = -1;
1330 static int hf_tn3270_ap_m = -1;
1331 static int hf_tn3270_ap_vertical_scrolling = -1;
1332 static int hf_tn3270_ap_horizontal_scrolling = -1;
1333 static int hf_tn3270_ap_apres1 = -1;
1334 static int hf_tn3270_ap_apa = -1;
1335 static int hf_tn3270_ap_pp = -1;
1336 static int hf_tn3270_ap_lc = -1;
1337 static int hf_tn3270_ap_mp = -1;
1338 static int hf_tn3270_ap_apres2 = -1;
1339 static int hf_tn3270_c_np = -1;
1340 static int hf_tn3270_number_of_attributes = -1;
1341 static int hf_tn3270_object_control_flags = -1;
1342 static int hf_tn3270_object_type = -1;
1343 static int hf_tn3270_order_code = -1;
1344 static int hf_tn3270_outbound_text_header_operation_type = -1;
1345 static int hf_tn3270_outbound_text_header_hdr = -1;
1346 static int hf_tn3270_outbound_text_header_lhdr = -1;
1347 static int hf_tn3270_pages = -1;
1348 static int hf_tn3270_partition_command = -1;
1349 static int hf_tn3270_partition_cv = -1;
1350 static int hf_tn3270_partition_cw = -1;
1351 static int hf_tn3270_partition_flags = -1;
1352 static int hf_tn3270_partition_height = -1;
1353 static int hf_tn3270_partition_hv = -1;
1354 static int hf_tn3270_partition_id = -1;
1355 static int hf_tn3270_partition_ph = -1;
1356 static int hf_tn3270_partition_pw = -1;
1357 static int hf_tn3270_partition_res = -1;
1358 static int hf_tn3270_partition_rs = -1;
1359 static int hf_tn3270_partition_rv = -1;
1360 static int hf_tn3270_partition_rw = -1;
1361 static int hf_tn3270_partition_uom = -1;
1362 static int hf_tn3270_partition_width = -1;
1363 static int hf_tn3270_partition_wv = -1;
1364 static int hf_tn3270_prime = -1;
1365 static int hf_tn3270_printer_flags = -1;
1366 static int hf_tn3270_ps_char = -1;
1367 static int hf_tn3270_ps_flags = -1;
1368 static int hf_tn3270_ps_lcid = -1;
1369 static int hf_tn3270_ps_rws = -1;
1370 static int hf_tn3270_query_reply_alphanumeric_flags = -1;
1371 static int hf_tn3270_recovery_data_flags = -1;
1372 static int hf_tn3270_reply_mode_attr_list = -1;
1373 static int hf_tn3270_read_partition_operation_type = -1;
1374 static int hf_tn3270_read_partition_reqtyp = -1;
1375 static int hf_tn3270_resbyte = -1;
1376 static int hf_tn3270_resbytes = -1;
1377 static int hf_tn3270_res_twobytes = -1;
1378 static int hf_tn3270_rw = -1;
1379 static int hf_tn3270_save_or_restore_format_flags = -1;
1380 static int hf_tn3270_scs_data = -1;
1381 static int hf_tn3270_sf_single_byte_id = -1;
1382 static int hf_tn3270_sf_double_byte_id = -1;
1383 static int hf_tn3270_sf_length = -1;
1384 static int hf_tn3270_sf_query_reply = -1;
1385 static int hf_tn3270_sld = -1;
1386 static int hf_tn3270_spd = -1;
1387 static int hf_tn3270_start_line = -1;
1388 static int hf_tn3270_start_page = -1;
1389 static int hf_tn3270_stop_address = -1;
1390 static int hf_tn3270_transparency = -1;
1391 static int hf_tn3270_type_1_text_outbound_data = -1;
1392 static int hf_tn3270_vertical = -1;
1393 static int hf_tn3270_v_length = -1;
1394 static int hf_tn3270_v_offset = -1;
1395 static int hf_tn3270_v_sequence = -1;
1396 static int hf_tn3270_wcc_nop = -1;
1397 static int hf_tn3270_wcc_reset = -1;
1398 static int hf_tn3270_wcc_printer1 = -1;
1399 static int hf_tn3270_wcc_printer2 = -1;
1400 static int hf_tn3270_wcc_start_printer = -1;
1401 static int hf_tn3270_wcc_sound_alarm = -1;
1402 static int hf_tn3270_wcc_keyboard_restore = -1;
1403 static int hf_tn3270_wcc_reset_mdt = -1;
1404 static int hf_tn3270_ww = -1;
1405 static int hf_tn3270_tn3270e_data_type = -1;
1406 static int hf_tn3270_tn3270e_request_flag = -1;
1407 static int hf_tn3270_tn3270e_response_flag_3270_SCS = -1;
1408 static int hf_tn3270_tn3270e_response_flag_response = -1;
1409 static int hf_tn3270_tn3270e_response_flag_unused = -1;
1410 static int hf_tn3270_tn3270e_seq_number = -1;
1411 static int hf_tn3270_tn3270e_header_data = -1;
1412 static int hf_tn3270_ua_cell_units = -1;
1413 static int hf_tn3270_ua_characters = -1;
1414 static int hf_tn3270_ua_hard_copy = -1;
1415 static int hf_tn3270_ua_page_printer = -1;
1416 static int hf_tn3270_ua_reserved1 = -1;
1417 static int hf_tn3270_ua_reserved2 = -1;
1418 static int hf_tn3270_ua_variable_cells = -1;
1419 static int hf_tn3270_usable_area_flags1 = -1;
1420 static int hf_tn3270_usable_area_flags2 = -1;
1421 static int hf_tn3270_ua_addressing = -1;
1422 static int hf_tn3270_ua_width_cells_pels = -1;
1423 static int hf_tn3270_ua_height_cells_pels = -1;
1424 static int hf_tn3270_ua_uom_cells_pels = -1;
1425 static int hf_tn3270_ua_xr = -1;
1426 static int hf_tn3270_ua_yr = -1;
1427 static int hf_tn3270_ua_aw = -1;
1428 static int hf_tn3270_ua_ah = -1;
1429 static int hf_tn3270_ua_buffsz = -1;
1430 static int hf_tn3270_ua_xmin = -1;
1431 static int hf_tn3270_ua_ymin = -1;
1432 static int hf_tn3270_ua_xmax = -1;
1433 static int hf_tn3270_ua_ymax = -1;
1434 static int hf_tn3270_cs_ge = -1;
1435 static int hf_tn3270_cs_mi = -1;
1436 static int hf_tn3270_cs_lps = -1;
1437 static int hf_tn3270_cs_lpse = -1;
1438 static int hf_tn3270_cs_ms = -1;
1439 static int hf_tn3270_cs_ch2 = -1;
1440 static int hf_tn3270_cs_gf = -1;
1441 static int hf_tn3270_cs_res = -1;
1442 static int hf_tn3270_cs_res2 = -1;
1443 static int hf_tn3270_cs_pscs = -1;
1444 static int hf_tn3270_cs_res3 = -1;
1445 static int hf_tn3270_cs_cf = -1;
1446 static int hf_tn3270_cs_form_type1 = -1;
1447 static int hf_tn3270_cs_form_type2 = -1;
1448 static int hf_tn3270_cs_form_type3 = -1;
1449 static int hf_tn3270_cs_form_type4 = -1;
1450 static int hf_tn3270_cs_form_type5 = -1;
1451 static int hf_tn3270_cs_form_type6 = -1;
1452 static int hf_tn3270_cs_form_type8 = -1;
1453 static int hf_tn3270_cs_ds_load = -1;
1454 static int hf_tn3270_cs_ds_triple = -1;
1455 static int hf_tn3270_cs_ds_char = -1;
1456 static int hf_tn3270_cs_ds_cb = -1;
1457 static int hf_tn3270_character_sets_flags1 = -1;
1458 static int hf_tn3270_character_sets_flags2 = -1;
1459 static int hf_tn3270_sdw = -1;
1460 static int hf_tn3270_sdh = -1;
1461 static int hf_tn3270_form = -1;
1462 static int hf_tn3270_formres = -1;
1463 static int hf_tn3270_cs_dl = -1;
1464 static int hf_tn3270_cs_descriptor_set = -1;
1465 static int hf_tn3270_cs_descriptor_flags = -1;
1466 static int hf_tn3270_lcid = -1;
1467 static int hf_tn3270_sw = -1;
1468 static int hf_tn3270_sh = -1;
1469 static int hf_tn3270_ssubsn = -1;
1470 static int hf_tn3270_esubsn = -1;
1471 static int hf_tn3270_ccsgid = -1;
1472 static int hf_tn3270_ccsid = -1;
1473 static int hf_tn3270_c_prtblk = -1;
1474 static int hf_tn3270_h_np = -1;
1475 static int hf_tn3270_h_vi = -1;
1476 static int hf_tn3270_h_ai = -1;
1477 static int hf_tn3270_ddm_flags = -1;
1478 static int hf_tn3270_ddm_limin = -1;
1479 static int hf_tn3270_ddm_limout = -1;
1480 static int hf_tn3270_ddm_nss = -1;
1481 static int hf_tn3270_ddm_ddmss = -1;
1482 static int hf_tn3270_rpq_device = -1;
1483 static int hf_tn3270_rpq_mid = -1;
1484 static int hf_tn3270_rpq_rpql = -1;
1485 static int hf_tn3270_rpq_name = -1;
1486 static int hf_tn3270_ip_flags = -1;
1487 static int hf_tn3270_ipdd_wd = -1;
1488 static int hf_tn3270_ipdd_hd = -1;
1489 static int hf_tn3270_ipdd_wa = -1;
1490 static int hf_tn3270_ipdd_ha = -1;
1491 static int hf_tn3270_ippd_dpbs = -1;
1492 static int hf_tn3270_ippd_apbs = -1;
1493 static int hf_tn3270_ipccd_wcd = -1;
1494 static int hf_tn3270_ipccd_hcd = -1;
1495 static int hf_tn3270_ipccd_wca = -1;
1496 static int hf_tn3270_ipccd_hca = -1;
1497 static int hf_tn3270_dc_dir = -1;
1498 static int hf_tn3270_oem_dsref = -1;
1499 static int hf_tn3270_oem_dtype = -1;
1500 static int hf_tn3270_oem_uname = -1;
1501 static int hf_tn3270_sdp_daid = -1;
1502 static int hf_tn3270_oem_sdp_ll_limin = -1;
1503 static int hf_tn3270_oem_sdp_ll_limout = -1;
1504 static int hf_tn3270_oem_sdp_pclk_vers = -1;
1505 static int hf_tn3270_null = -1;
1506 static int hf_tn3270_unknown_data = -1;
1507 static int hf_tn3270_ds_default_sfid = -1;
1508 static int hf_tn3270_ds_sfid = -1;
1509 static int hf_tn3270_asia_sdp_sosi_soset = -1;
1510 static int hf_tn3270_asia_sdp_ic_func = -1;
1511 static int hf_tn3270_ccc = -1;
1512 static int hf_tn3270_ccc_coding = -1;
1513 static int hf_tn3270_ccc_printout = -1;
1514 static int hf_tn3270_ccc_start_print = -1;
1515 static int hf_tn3270_ccc_sound_alarm = -1;
1516 static int hf_tn3270_ccc_copytype = -1;
1517 static int hf_tn3270_msr_user = -1;
1518 static int hf_tn3270_msr_locked = -1;
1519 static int hf_tn3270_msr_auto = -1;
1520 static int hf_tn3270_msr_ind1 = -1;
1521 static int hf_tn3270_msr_ind2 = -1;
1522 static int hf_tn3270_spc_sdp_ot = -1;
1523 static int hf_tn3270_spc_sdp_ob = -1;
1524 static int hf_tn3270_spc_sdp_ol = -1;
1525 static int hf_tn3270_spc_sdp_or = -1;
1526 static int hf_tn3270_spc_sdp_eucflags = -1;
1527 static int hf_tn3270_spc_sdp_srepc = -1;
1528 static int hf_tn3270_srf_fpcb = -1;
1529 static int hf_tn3270_sdp_statcode = -1;
1530 static int hf_tn3270_sdp_excode = -1;
1531 static int hf_tn3270_sdp_ngl = -1;
1532 static int hf_tn3270_sdp_nml = -1;
1533 static int hf_tn3270_sdp_nlml = -1;
1534 static int hf_tn3270_sdp_stor = -1;
1535 static int hf_tn3270_ap_cm = -1;
1536 static int hf_tn3270_ap_ro = -1;
1537 static int hf_tn3270_ap_co = -1;
1538 static int hf_tn3270_ap_fo = -1;
1539 static int hf_tn3270_sdp_ln = -1;
1540 static int hf_tn3270_sdp_id = -1;
1541 static int hf_tn3270_db_cavdef = -1;
1542 static int hf_tn3270_db_cidef = -1;
1543 static int hf_tn3270_dia_flags = -1;
1544 static int hf_tn3270_dia_limin = -1;
1545 static int hf_tn3270_dia_limout = -1;
1546 static int hf_tn3270_dia_nfs = -1;
1547 static int hf_tn3270_dia_diafs = -1;
1548 static int hf_tn3270_dia_diafn = -1;
1549 static int hf_tn3270_fo_flags = -1;
1550 static int hf_tn3270_fo_vpos = -1;
1551 static int hf_tn3270_fo_hpos = -1;
1552 static int hf_tn3270_fo_hpos0 = -1;
1553 static int hf_tn3270_fo_hpos1 = -1;
1554 static int hf_tn3270_fsad_flags = -1;
1555 static int hf_tn3270_fsad_limin = -1;
1556 static int hf_tn3270_fsad_limout = -1;
1557 static int hf_tn3270_fsad_size = -1;
1558 static int hf_tn3270_ibm_flags = -1;
1559 static int hf_tn3270_ibm_limin = -1;
1560 static int hf_tn3270_ibm_limout = -1;
1561 static int hf_tn3270_ibm_type = -1;
1562 static int hf_tn3270_msr_nd = -1;
1563 static int hf_tn3270_pft_flags = -1;
1564 static int hf_tn3270_pft_tmo = -1;
1565 static int hf_tn3270_pft_bmo = -1;
1566 static int hf_tn3270_ioca_limin = -1;
1567 static int hf_tn3270_ioca_limout = -1;
1568 static int hf_tn3270_ioca_type = -1;
1569 static int hf_tn3270_pc_vo_thickness = -1;
1570 static int hf_tn3270_pdds_ssid = -1;
1571 static int hf_tn3270_pdds_refid = -1;
1572 static int hf_tn3270_srf_fpcbl = -1;
1573 static int hf_tn3270_spc_epc_flags = -1;
1574 static int hf_tn3270_sp_spid = -1;
1575 static int hf_tn3270_sp_size = -1;
1576 static int hf_tn3270_sp_space = -1;
1577 static int hf_tn3270_sp_objlist = -1;
1578 static int hf_tn3270_tp_nt = -1;
1579 static int hf_tn3270_tp_m = -1;
1580 static int hf_tn3270_tp_flags = -1;
1581 static int hf_tn3270_tp_ntt = -1;
1582 static int hf_tn3270_tp_tlist = -1;
1583 static int hf_tn3270_t_np = -1;
1584 static int hf_tn3270_t_vi = -1;
1585 static int hf_tn3270_t_ai = -1;
1586 static int hf_tn3270_3270_tranlim = -1;
1588 static gint ett_tn3270 = -1;
1589 static gint ett_tn3270e_hdr = -1;
1590 static gint ett_sf = -1;
1591 static gint ett_tn3270_field_attribute = -1;
1592 static gint ett_tn3270_field_validation = -1;
1593 static gint ett_tn3270_wcc = -1;
1594 static gint ett_tn3270_usable_area_flags1 = -1;
1595 static gint ett_tn3270_usable_area_flags2 = -1;
1596 static gint ett_tn3270_query_reply_alphanumeric_flags = -1;
1597 static gint ett_tn3270_character_sets_flags1 = -1;
1598 static gint ett_tn3270_character_sets_flags2 = -1;
1599 static gint ett_tn3270_character_sets_form = -1;
1600 static gint ett_tn3270_cs_descriptor_flags = -1;
1601 static gint ett_tn3270_color_flags = -1;
1602 static gint ett_tn3270_ccc = -1;
1603 static gint ett_tn3270_msr_state_mask = -1;
1604 static gint ett_tn3270_data_chain_fields = -1;
1605 static gint ett_tn3270_query_list = -1;
1607 static expert_field ei_tn3270_order_code = EI_INIT;
1608 static expert_field ei_tn3270_command_code = EI_INIT;
1609 static expert_field ei_tn3270_aid = EI_INIT;
1611 static gint dissect_orders_and_data(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info);
1612 static gint dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint hf, tn3270_conv_info_t *tn3270_info);
1614 typedef struct hf_items {
1616 gint *bitmask_ett_idx_p;
1618 const gint **bitmask;
1619 const gint encoding;
1622 /* Utility Functions */
1625 tn3270_add_hf_items(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
1626 const hf_items *fields)
1628 gint start = offset;
1631 for (i = 0; fields[i].hf_idx_p; i++) {
1632 if (fields[i].bitmask == 0) {
1633 proto_tree_add_item(tn3270_tree,
1634 *fields[i].hf_idx_p,
1637 fields[i].encoding);
1640 proto_tree_add_bitmask(tn3270_tree, tvb, offset, *fields[i].hf_idx_p,
1641 *fields[i].bitmask_ett_idx_p, fields[i].bitmask, ENC_BIG_ENDIAN);
1643 offset += fields[i].length;
1646 return (offset - start);
1650 * offset; tvb offset of next byte of data (first byte of unprocessed data);
1651 * start: tvb offset of beginning of data;
1652 * data_length: total length of data;
1655 dissect_unknown_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint start,
1660 len_left = (data_length) - (offset - start);
1663 proto_tree_add_item(tn3270_tree, hf_tn3270_unknown_data,
1664 tvb, offset, len_left,
1673 add_data_until_next_order_code(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1676 gint length_remaining = tvb_reported_length_remaining(tvb, offset);
1679 * "All order codes have an EBCDIC value in the range of hexadecimal 00
1680 * (X'00') through hexadecimal 3F (X'3F'). Order codes with values in this
1681 * range but not defined in this chapter are rejected."
1682 * However, the code (as originally committed) treats a '0' order code as data.
1685 while (datalen < length_remaining) {
1687 order_code = tvb_get_guint8(tvb, offset + datalen);
1688 if ((order_code > 0) && (order_code <= OC_MAX))
1694 /* XXX: Need to handle "Format Control Orders" ?? */
1695 proto_tree_add_item(tn3270_tree, hf_tn3270_field_data, tvb, offset,
1696 datalen, ENC_EBCDIC|ENC_NA);
1703 dissect_query_reply_resbytes(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
1704 gint sf_body_length)
1706 gint start = offset;
1708 static const hf_items fields[] = {
1709 { &hf_tn3270_res_twobytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
1710 { NULL, NULL, 0, NULL, 0 }
1714 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1717 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1719 return (offset - start);
1723 dissect_wcc(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1726 static const gint *wcc_fields[] = {
1728 &hf_tn3270_wcc_reset,
1729 &hf_tn3270_wcc_printer1,
1730 &hf_tn3270_wcc_printer2,
1731 &hf_tn3270_wcc_start_printer,
1732 &hf_tn3270_wcc_sound_alarm,
1733 &hf_tn3270_wcc_keyboard_restore,
1734 &hf_tn3270_wcc_reset_mdt,
1738 /* Qualifier and DeviceType */
1739 proto_tree_add_bitmask_text(tn3270_tree, tvb, offset, 1, "Write Control Character: ", "None",
1740 ett_tn3270_wcc, wcc_fields, ENC_BIG_ENDIAN, 0);
1746 dissect_3270_field_validation(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1748 gint start = offset;
1750 static const gint *byte[] = {
1751 &hf_tn3270_field_validation_mandatory_fill,
1752 &hf_tn3270_field_validation_mandatory_entry,
1753 &hf_tn3270_field_validation_trigger,
1757 proto_tree_add_bitmask_text(tn3270_tree, tvb, 1, 1, "Field Validation: ",
1758 "None", ett_tn3270_field_validation, byte, ENC_BIG_ENDIAN, 0);
1762 return (offset - start);
1767 dissect_3270_field_attribute(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1769 gint start = offset;
1771 static const gint *byte[] = {
1772 &hf_tn3270_fa_graphic_convert,
1773 &hf_tn3270_fa_protected,
1774 &hf_tn3270_fa_numeric,
1775 &hf_tn3270_fa_display,
1776 &hf_tn3270_fa_reserved,
1777 &hf_tn3270_fa_modified,
1782 proto_tree_add_bitmask(tn3270_tree, tvb, offset, hf_tn3270_field_attribute,
1783 ett_tn3270_field_attribute, byte, ENC_BIG_ENDIAN);
1787 return (offset - start);
1790 /* 8.7 - Copy Control Code */
1792 dissect_ccc(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1794 gint start = offset;
1796 static const gint *byte[] = {
1797 &hf_tn3270_ccc_coding,
1798 &hf_tn3270_ccc_printout,
1799 &hf_tn3270_ccc_start_print,
1800 &hf_tn3270_ccc_sound_alarm,
1801 &hf_tn3270_ccc_copytype,
1805 proto_tree_add_bitmask(tn3270_tree, tvb, offset, hf_tn3270_ccc,
1806 ett_tn3270_ccc, byte, ENC_BIG_ENDIAN);
1810 return (offset - start);
1813 /* End - Utility Functions */
1815 /* Start: Handle Structured Fields */
1817 /* --------------------------------------------------- */
1818 /* 5.0 Outbound/Inbound and Outbound Structured Fields */
1819 /* --------------------------------------------------- */
1821 /* 5.5 Activate Partition - Search for ACTIVATE_PARTITION */
1822 /* 5.6 Begin/End of File - Search for BEGIN_OR_END_OF_FILE */
1823 /* 5.7 Create Partition */
1825 dissect_create_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1827 gint start = offset;
1829 static const hf_items fields[] = {
1830 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
1831 { &hf_tn3270_partition_uom, NULL, 1, NULL, ENC_BIG_ENDIAN },
1832 { &hf_tn3270_partition_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1833 { &hf_tn3270_partition_height, NULL, 2, NULL, ENC_BIG_ENDIAN },
1834 { &hf_tn3270_partition_width, NULL, 2, NULL, ENC_BIG_ENDIAN },
1835 { &hf_tn3270_partition_rv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1836 { &hf_tn3270_partition_cv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1837 { &hf_tn3270_partition_hv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1838 { &hf_tn3270_partition_wv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1839 { &hf_tn3270_partition_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1840 { &hf_tn3270_partition_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1841 { &hf_tn3270_partition_rs, NULL, 2, NULL, ENC_BIG_ENDIAN },
1842 { &hf_tn3270_partition_res, NULL, 2, NULL, ENC_BIG_ENDIAN },
1843 { &hf_tn3270_partition_pw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1844 { &hf_tn3270_partition_ph, NULL, 2, NULL, ENC_BIG_ENDIAN },
1845 { NULL, NULL, 0, NULL, 0 }
1849 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1852 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1854 return (offset - start);
1857 /* 5.7 Create Partition - Search for CREATE_PARTITION */
1858 /* 5.8 Destroy Partition - Search for DESTROY_PARTITION */
1859 /* 5.9 Erase/Reset - Search for ERASE_OR_RESET */
1860 /* 5.10 Load Color Table - Search for LOAD_COLOR_TABLE */
1862 /* 5.11 Load Format Storage */
1864 dissect_load_format_storage(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1866 gint start = offset;
1869 static const hf_items fields[] = {
1870 { &hf_tn3270_load_format_storage_flags1, NULL, 1, NULL, ENC_BIG_ENDIAN },
1871 { &hf_tn3270_load_format_storage_flags2, NULL, 1, NULL, ENC_BIG_ENDIAN },
1872 { &hf_tn3270_load_format_storage_operand, NULL, 1, NULL, ENC_BIG_ENDIAN },
1873 { &hf_tn3270_load_format_storage_localname, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
1874 { &hf_tn3270_format_group, NULL, 6, NULL, ENC_EBCDIC|ENC_NA },
1875 { &hf_tn3270_format_name, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
1876 { NULL, NULL, 0, NULL, 0 }
1879 operand = tvb_get_guint8(tvb, offset+2);
1881 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1884 if (operand == LOAD_FORMAT_STORAGE_OPERAND_ADD) {
1885 gint fmtln = sf_body_length - (offset - start);
1886 proto_tree_add_item(tn3270_tree, hf_tn3270_load_format_storage_format_data,
1887 tvb, offset, fmtln, ENC_EBCDIC|ENC_NA);
1891 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1893 return (offset - start);
1896 /* 5.12 Load Line Type - Search for LOAD_LINE_TYPE */
1898 /* 5.13 Load Programmed Symbols (Load PS) */
1900 dissect_load_programmed_symbols(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1902 gint start = offset, i;
1904 gint8 extended_ps_length;
1906 static const hf_items ps_fields[] = {
1907 { &hf_tn3270_ps_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1908 { &hf_tn3270_ps_lcid, NULL, 1, NULL, ENC_BIG_ENDIAN },
1909 { &hf_tn3270_ps_char, NULL, 1, NULL, ENC_BIG_ENDIAN },
1910 { &hf_tn3270_ps_rws, NULL, 1, NULL, ENC_BIG_ENDIAN },
1911 { NULL, NULL, 0, NULL, 0 }
1914 static const hf_items extended_ps_fields[] = {
1915 { &hf_tn3270_extended_ps_lw, NULL, 1, NULL, ENC_BIG_ENDIAN },
1916 { &hf_tn3270_extended_ps_lh, NULL, 1, NULL, ENC_BIG_ENDIAN },
1917 { &hf_tn3270_extended_ps_subsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
1918 { &hf_tn3270_extended_ps_color, NULL, 1, NULL, ENC_BIG_ENDIAN },
1919 { &hf_tn3270_extended_ps_stsubs, NULL, 1, NULL, ENC_BIG_ENDIAN },
1920 { &hf_tn3270_extended_ps_echar, NULL, 1, NULL, ENC_BIG_ENDIAN },
1921 { &hf_tn3270_extended_ps_nw, NULL, 1, NULL, ENC_BIG_ENDIAN },
1922 { &hf_tn3270_extended_ps_nh, NULL, 1, NULL, ENC_BIG_ENDIAN },
1923 { &hf_tn3270_extended_ps_res, NULL, 1, NULL, ENC_BIG_ENDIAN },
1924 { NULL, NULL, 0, NULL, 0 }
1927 flags = tvb_get_guint8(tvb, offset);
1928 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1931 /*If extended flag not set return */
1932 if (!(flags & 0x80)) {
1933 return (offset - start);
1936 extended_ps_length = tvb_get_guint8(tvb, offset);
1937 proto_tree_add_item(tn3270_tree, hf_tn3270_extended_ps_length,
1938 tvb, offset, 1, ENC_BIG_ENDIAN);
1940 proto_tree_add_item(tn3270_tree, hf_tn3270_extended_ps_flags,
1941 tvb, offset, 1, ENC_BIG_ENDIAN);
1944 for (i = 0; i < extended_ps_length; ++i) {
1945 if (extended_ps_fields[i].hf_idx_p == NULL) {
1946 break; /* Malformed (Bad value for extended_ps_length) ! ToDo: 'expert' */
1948 proto_tree_add_item(tn3270_tree, *extended_ps_fields[i].hf_idx_p,
1949 tvb, offset, extended_ps_fields[i].length,
1950 extended_ps_fields[i].encoding);
1951 offset += extended_ps_fields[i].length;
1955 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1957 return (offset - start);
1960 /* 5.14 Modify Partition) */
1962 dissect_modify_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1964 gint start = offset;
1966 static const hf_items fields[] = {
1967 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1968 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
1969 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1970 { &hf_tn3270_partition_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1971 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1972 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
1973 { &hf_tn3270_partition_rv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1974 { &hf_tn3270_partition_cv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1975 { &hf_tn3270_partition_hv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1976 { &hf_tn3270_partition_wv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1977 { &hf_tn3270_partition_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1978 { &hf_tn3270_partition_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1979 { &hf_tn3270_partition_rs, NULL, 2, NULL, ENC_BIG_ENDIAN },
1980 { &hf_tn3270_partition_res, NULL, 2, NULL, ENC_BIG_ENDIAN },
1981 { &hf_tn3270_partition_pw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1982 { &hf_tn3270_partition_ph, NULL, 2, NULL, ENC_BIG_ENDIAN },
1983 { NULL, NULL, 0, NULL, 0 }
1987 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1990 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1992 return (offset - start);
1995 /* 5.15 Outbound Text Header */
1997 dissect_outbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
1998 gint sf_body_length)
2000 gint start = offset;
2003 static const hf_items outbound_text_header_fields1[] = {
2004 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2005 { &hf_tn3270_outbound_text_header_operation_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2006 { NULL, NULL, 0, NULL, 0 }
2009 static const hf_items outbound_text_header_fields2[] = {
2010 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2011 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2012 { &hf_tn3270_lvl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2013 { &hf_tn3270_cro, NULL, 2, NULL, ENC_BIG_ENDIAN },
2014 { &hf_tn3270_cc, NULL, 2, NULL, ENC_BIG_ENDIAN },
2015 { NULL, NULL, 0, NULL, 0 }
2018 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2019 outbound_text_header_fields1);
2020 offset += dissect_wcc(tn3270_tree, tvb, offset);
2021 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2022 outbound_text_header_fields2);
2024 hdr_length = tvb_get_ntohs(tvb, offset);
2026 proto_tree_add_item(tn3270_tree, hf_tn3270_outbound_text_header_lhdr,
2027 tvb, offset, 2, ENC_BIG_ENDIAN);
2030 proto_tree_add_item(tn3270_tree, hf_tn3270_outbound_text_header_hdr,
2031 tvb, offset, hdr_length, ENC_NA);
2032 offset += hdr_length;
2034 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2036 return (offset - start);
2039 /* 5.16 Outbound 3270DS */
2041 dissect_outbound_3270ds(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
2042 tn3270_conv_info_t *tn3270_info, gint sf_body_length )
2044 gint start = offset;
2047 proto_tree_add_item(tn3270_tree,
2048 hf_tn3270_partition_id,
2054 cmd = tvb_get_guint8(tvb, offset);
2055 proto_tree_add_item(tn3270_tree,
2056 hf_tn3270_partition_command,
2064 /* FIXME: the spec is ambiguous at best about what to expect here,
2065 need a live sample to validate. */
2066 offset += dissect_ccc(tn3270_tree, tvb, offset);
2067 proto_tree_add_item(tn3270_tree,
2074 /* XXX: are "local" commands valid for Outbound 3270DS ? */
2084 if ((offset - start) < sf_body_length)
2085 offset += dissect_wcc(tn3270_tree, tvb, offset);
2086 if ((offset - start) < sf_body_length)
2087 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
2093 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2095 return (offset - start);
2098 /* 5.17 Present Absolute Format */
2100 dissect_present_absolute_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2101 gint sf_body_length)
2103 gint start = offset;
2105 proto_tree_add_item(tn3270_tree,
2106 hf_tn3270_partition_id,
2112 proto_tree_add_item(tn3270_tree,
2119 offset += dissect_wcc(tn3270_tree, tvb, offset);
2121 proto_tree_add_item(tn3270_tree,
2122 hf_tn3270_format_name,
2124 sf_body_length - (offset - start),
2126 offset += (sf_body_length - (offset - start));
2128 return (offset - start);
2131 /* 5.18 Present Relative Format */
2133 dissect_present_relative_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2134 gint sf_body_length)
2136 gint start = offset;
2138 proto_tree_add_item(tn3270_tree,
2139 hf_tn3270_partition_id,
2145 proto_tree_add_item(tn3270_tree,
2152 proto_tree_add_item(tn3270_tree,
2159 offset += dissect_wcc(tn3270_tree, tvb, offset);
2161 proto_tree_add_item(tn3270_tree,
2162 hf_tn3270_format_name,
2164 sf_body_length - (offset - start),
2166 offset += (sf_body_length - (offset - start));
2168 return (offset - start);
2171 /* 5.19 Read Partition */
2173 dissect_read_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2174 gint sf_body_length)
2176 gint start = offset;
2178 proto_tree *query_list_tree;
2179 gint qcode_list_len, i;
2181 proto_tree_add_item(tn3270_tree,
2182 hf_tn3270_partition_id,
2188 type = tvb_get_guint8(tvb, offset);
2189 if (type == 0xFF) { /* Partition ID of 0xFF is escaped with another 0xFF */
2190 /* XXX: removing tn3270 IAX escapes should be handled in the telnet dissector ! */
2192 type = tvb_get_guint8(tvb, offset);
2195 proto_tree_add_item(tn3270_tree,
2196 hf_tn3270_read_partition_operation_type,
2202 if (type == READ_PARTITION_OPTYPE_QUERY_LIST) { /* 'Query List' */
2203 proto_tree_add_item(tn3270_tree,
2204 hf_tn3270_read_partition_reqtyp,
2210 if (sf_body_length > (offset - start)) {
2211 qcode_list_len = sf_body_length - (offset - start);
2212 query_list_tree = proto_tree_add_subtree(tn3270_tree, tvb, offset, qcode_list_len,
2213 ett_tn3270_query_list, NULL, "Query List");
2214 for (i = 0; i < qcode_list_len; i++) {
2215 proto_tree_add_item(query_list_tree,
2216 hf_tn3270_sf_query_reply,
2217 tvb, offset, 1, ENC_BIG_ENDIAN);
2223 return (offset - start);
2226 /*5.20 Request Recovery Data - Search for REQUEST_RECOVERY_DATA*/
2227 /*5.21 Reset Partition - Search for RESET_PARTITION */
2231 dissect_restart(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2232 gint sf_body_length)
2234 gint start = offset;
2236 proto_tree_add_item(tn3270_tree,
2243 proto_tree_add_item(tn3270_tree,
2244 hf_tn3270_start_page,
2250 proto_tree_add_item(tn3270_tree,
2251 hf_tn3270_start_line,
2258 proto_tree_add_item(tn3270_tree,
2261 sf_body_length - (offset - start),
2263 offset += (sf_body_length - (offset - start));
2265 return (offset - start);
2268 /* 5.23 SCS Data - Search for SCS_DATA */
2269 /* 5.24 Color Table - Search for COLOR_TABLE */
2270 /* 5.25 Format Group - Search for FORMAT_GROUP */
2271 /* 5.26 Set Checkpoint Interval - Search for CHECKPOINT_INTERVAL */
2273 /* 5.27 Set MSR Control */
2275 dissect_set_msr_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2276 gint sf_body_length)
2278 gint start = offset;
2280 static const gint *byte[] = {
2281 &hf_tn3270_msr_user,
2282 &hf_tn3270_msr_locked,
2283 &hf_tn3270_msr_auto,
2284 &hf_tn3270_msr_ind1,
2285 &hf_tn3270_msr_ind2,
2289 static const hf_items outbound_text_header_fields[] = {
2290 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2291 { &hf_tn3270_msr_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2292 { &hf_tn3270_msr_state_mask, &ett_tn3270_msr_state_mask, 1, byte, 0 },
2293 { &hf_tn3270_msr_state_value, NULL, 1, NULL, ENC_BIG_ENDIAN },
2294 { &hf_tn3270_msr_ind_mask, NULL, 1, NULL, ENC_BIG_ENDIAN },
2295 { &hf_tn3270_msr_ind_value, NULL, 1, NULL, ENC_BIG_ENDIAN },
2296 { NULL, NULL, 0, NULL, 0 }
2300 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2301 outbound_text_header_fields);
2303 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2305 return (offset - start);
2308 /* 5.28 Set Partition Characteristics */
2310 dissect_set_partition_characteristics_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2313 gint start = offset;
2316 static const hf_items sdp1[] = {
2317 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2318 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2319 { &hf_tn3270_spc_sdp_ot, NULL, 1, NULL, ENC_BIG_ENDIAN },
2320 { &hf_tn3270_spc_sdp_ob, NULL, 1, NULL, ENC_BIG_ENDIAN },
2321 { &hf_tn3270_spc_sdp_ol, NULL, 1, NULL, ENC_BIG_ENDIAN },
2322 { &hf_tn3270_spc_sdp_or, NULL, 1, NULL, ENC_BIG_ENDIAN },
2323 { NULL, NULL, 0, NULL, 0 }
2326 static const hf_items sdp2[] = {
2327 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2328 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2329 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2330 { NULL, NULL, 0, NULL, 0 }
2333 static const hf_items sdp3[] = {
2334 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2335 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2336 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2337 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2338 { NULL, NULL, 0, NULL, 0 }
2342 sdp = tvb_get_ntohs(tvb, offset);
2345 case 0x0601: /*View Outport*/
2346 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2349 case 0x0304: /*Enable User Call Up*/
2350 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2353 case 0x0405: /*Select Base Character Set*/
2354 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2361 return (offset - start);
2366 dissect_set_partition_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2367 gint sf_body_length)
2370 gint start = offset;
2373 static const hf_items fields[] = {
2374 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2375 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
2376 { NULL, NULL, 0, NULL, 0 }
2380 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2383 for (i = 0; i < 3; i++) {
2384 offset += dissect_set_partition_characteristics_sd_parms(tn3270_tree, tvb, offset);
2385 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2389 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2391 return (offset - start);
2394 /* 5.29 Set Printer Characteristics */
2396 dissect_set_printer_characteristics_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2399 gint start = offset;
2402 static const hf_items sdp1[] = {
2403 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2404 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2405 { &hf_tn3270_spc_sdp_srepc, NULL, 1, NULL, ENC_BIG_ENDIAN },
2406 { NULL, NULL, 0, NULL, 0 }
2409 sdp = tvb_get_ntohs(tvb, offset);
2412 case 0x0301: /*Early Print Complete*/
2413 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2420 return (offset - start);
2425 dissect_set_printer_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2426 gint sf_body_length)
2429 gint start = offset;
2432 static const hf_items fields[] = {
2433 { &hf_tn3270_printer_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2434 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2435 { NULL, NULL, 0, NULL, 0 }
2438 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2441 for (i = 0; i < 3; i++) {
2442 offset += dissect_set_printer_characteristics_sd_parms(tn3270_tree, tvb, offset);
2443 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2447 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2449 return (offset - start);
2453 /* 5.30 Set Reply Mode */
2455 dissect_set_reply_mode(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2456 gint sf_body_length)
2458 gint start = offset;
2462 static const hf_items fields[] = {
2463 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2464 { &hf_tn3270_mode, NULL, 1, NULL, ENC_BIG_ENDIAN },
2465 { NULL, NULL, 0, NULL, 0 }
2468 type = tvb_get_guint8(tvb, offset+1);
2470 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2473 if (type == 0x02) { /* 'Query List' */
2474 for (i = 0; i < (sf_body_length-(offset-start)); i++) {
2475 proto_tree_add_item(tn3270_tree,
2476 hf_tn3270_reply_mode_attr_list,
2477 tvb, offset, 1, ENC_BIG_ENDIAN);
2482 return (offset - start);
2485 /* 5.31 Set Window Origin - Search for SET_WINDOW_ORIGIN */
2486 /* 6.6 Type 1 Text Inbound
2487 5.32 Type 1 Text Outbound */
2489 dissect_type_1_text(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2490 gint sf_body_length)
2492 gint start = offset;
2494 static const hf_items fields[] = {
2495 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2496 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
2497 { NULL, NULL, 0, NULL, 0 }
2500 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2502 proto_tree_add_item(tn3270_tree,
2503 hf_tn3270_field_data,
2505 sf_body_length - (offset - start),
2507 offset += (sf_body_length - (offset - start));
2509 return (offset - start);
2512 /* 5.34 Data Chain */
2514 dissect_data_chain(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2515 gint sf_body_length)
2517 gint start = offset;
2519 static const gint *byte[] = {
2520 &hf_tn3270_data_chain_group,
2521 &hf_tn3270_data_chain_inbound_control,
2525 static const hf_items data_chain_fields[] = {
2526 { &hf_tn3270_data_chain_fields, &ett_tn3270_data_chain_fields, 1, byte, 0 },
2527 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2528 { NULL, NULL, 0, NULL, 0 }
2531 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2534 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2536 return (offset - start);
2539 /* 5.35 Destination/Origin - Search for DESTINATION_OR_ORIGIN*/
2541 /* 5.36 Object Control */
2543 dissect_object_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2544 gint sf_body_length)
2546 gint start = offset;
2548 static const hf_items fields[] = {
2549 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2550 { &hf_tn3270_object_control_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2551 { &hf_tn3270_object_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2552 { NULL, NULL, 0, NULL, 0 }
2555 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2558 proto_tree_add_item(tn3270_tree,
2559 hf_tn3270_type_1_text_outbound_data,
2561 sf_body_length - (offset - start),
2563 offset += (sf_body_length - (offset - start));
2565 return (offset - start);
2568 /* 5.37 Object Data - Search for OBJECT_DATA*/
2569 /* 5.38 Object Picture - Search for OBJECT_PICTURE */
2570 /* 5.39 OEM Data - Search for OEM_DATA */
2572 /* 5.40 Save/Restore Format */
2574 dissect_save_or_restore_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2575 gint sf_body_length)
2577 gint start = offset;
2579 hf_items fields[] = {
2580 { &hf_tn3270_save_or_restore_format_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2581 { &hf_tn3270_srf_fpcb, NULL, sf_body_length-1, NULL, ENC_NA },
2582 { NULL, NULL, 0, NULL, 0 }
2585 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2588 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2590 return (offset - start);
2593 /* 5.41 Select Intelligent Printer Data Stream (IPDS) Mode - Search for SELECT_IPDS_MODE*/
2595 /* -----------------------------------------*/
2596 /* 6.0 CHAPTER 6. INBOUND STRUCTURED FIELDS */
2597 /* -----------------------------------------*/
2599 /* 6.2 Exception/Status */
2601 dissect_exception_or_status_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2604 gint start = offset;
2607 static const hf_items sdp1[] = {
2608 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2609 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2610 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2611 { &hf_tn3270_sdp_excode, NULL, 2, NULL, ENC_BIG_ENDIAN },
2612 { NULL, NULL, 0, NULL, 0 }
2615 static const hf_items sdp2[] = {
2616 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2617 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2618 { &hf_tn3270_sdp_statcode, NULL, 2, NULL, ENC_BIG_ENDIAN },
2619 { NULL, NULL, 0, NULL, 0 }
2622 static const hf_items sdp3[] = {
2623 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2624 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2625 { &hf_tn3270_format_group, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2626 { &hf_tn3270_format_name, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2627 { NULL, NULL, 0, NULL, 0 }
2630 static const hf_items sdp4[] = {
2631 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2632 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2633 { &hf_tn3270_sdp_ngl, NULL, 2, NULL, ENC_BIG_ENDIAN },
2634 { &hf_tn3270_sdp_nml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2635 { &hf_tn3270_sdp_nlml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2636 { &hf_tn3270_sdp_stor, NULL, 4, NULL, ENC_BIG_ENDIAN },
2637 { NULL, NULL, 0, NULL, 0 }
2640 static const hf_items sdp5[] = {
2641 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2642 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2643 { &hf_tn3270_format_group, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2644 { &hf_tn3270_sdp_nml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2645 { NULL, NULL, 0, NULL, 0 }
2648 sdp = tvb_get_ntohs(tvb, offset);
2651 case 0x0601: /*Auxiliary Device Exception*/
2652 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2655 case 0x0402: /*Auxiliary Device status*/
2656 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2659 case 0x2203: /*Failing Format status*/
2660 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2663 case 0x0C04: /*Format status*/
2664 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2667 case 0x1405: /*Group status*/
2668 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2675 return (offset - start);
2680 dissect_exception_or_status(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2681 gint sf_body_length)
2683 gint start = offset, i;
2685 static const hf_items fields[] = {
2686 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2687 { &hf_tn3270_exception_or_status_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2688 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2689 { NULL, NULL, 0, NULL, 0 }
2692 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2695 for (i = 0; i < 5; i++) {
2696 offset += dissect_exception_or_status_sd_parms(tn3270_tree, tvb, offset);
2697 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2701 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2703 return (offset - start);
2706 /* 6.3 Inbound Text Header */
2708 dissect_inbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2709 gint sf_body_length)
2711 gint start = offset;
2713 static const hf_items outbound_text_header_fields[] = {
2714 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2715 { &hf_tn3270_aid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2716 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2717 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2718 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2719 { &hf_tn3270_lvl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2720 { &hf_tn3270_cro, NULL, 2, NULL, ENC_BIG_ENDIAN },
2721 { &hf_tn3270_cc, NULL, 2, NULL, ENC_BIG_ENDIAN },
2722 { &hf_tn3270_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2723 { &hf_tn3270_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2724 { &hf_tn3270_hw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2725 { &hf_tn3270_ww, NULL, 2, NULL, ENC_BIG_ENDIAN },
2726 { NULL, NULL, 0, NULL, 0 }
2730 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2731 outbound_text_header_fields);
2733 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2735 return (offset - start);
2738 /* 6.4 Inbound 3270DS */
2740 dissect_inbound_3270ds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2741 tn3270_conv_info_t *tn3270_info, gint sf_body_length)
2743 gint start = offset;
2745 static const hf_items fields1[] = {
2746 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2747 { &hf_tn3270_aid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2748 { NULL, NULL, 0, NULL, 0 }
2751 hf_items fields2[] = {
2752 { &hf_tn3270_field_data, NULL, sf_body_length - 4, NULL, ENC_EBCDIC|ENC_NA },
2753 { NULL, NULL, 0, NULL, 0 }
2756 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset, fields1);
2757 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info);
2758 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset, fields2);
2760 return (offset - start);
2765 /* 6.5 Recovery Data */
2767 dissect_recovery_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2768 gint sf_body_length)
2770 gint start = offset;
2773 static const hf_items fields[] = {
2774 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2775 { &hf_tn3270_recovery_data_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2776 { &hf_tn3270_sld, NULL, 1, NULL, ENC_BIG_ENDIAN },
2777 { &hf_tn3270_charset, NULL, 1, NULL, ENC_BIG_ENDIAN },
2778 { &hf_tn3270_vertical, NULL, 2, NULL, ENC_BIG_ENDIAN },
2779 { &hf_tn3270_v_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2780 { &hf_tn3270_v_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2781 { &hf_tn3270_v_length, NULL, 2, NULL, ENC_BIG_ENDIAN },
2782 { &hf_tn3270_spd, NULL, 2, NULL, ENC_BIG_ENDIAN },
2783 { &hf_tn3270_horizon, NULL, 2, NULL, ENC_BIG_ENDIAN },
2784 { &hf_tn3270_h_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2785 { &hf_tn3270_h_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2786 { &hf_tn3270_h_length, NULL, 2, NULL, ENC_BIG_ENDIAN },
2787 { &hf_tn3270_color, NULL, 1, NULL, ENC_BIG_ENDIAN },
2788 { &hf_tn3270_hilite, NULL, 1, NULL, ENC_BIG_ENDIAN },
2789 { &hf_tn3270_pages, NULL, 2, NULL, ENC_BIG_ENDIAN },
2790 { &hf_tn3270_lines, NULL, 2, NULL, ENC_BIG_ENDIAN },
2791 { &hf_tn3270_checkpoint, NULL, 2, NULL, ENC_BIG_ENDIAN },
2792 { &hf_tn3270_c_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2793 { &hf_tn3270_c_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2794 { &hf_tn3270_c_seqoff, NULL, 2, NULL, ENC_BIG_ENDIAN },
2795 { &hf_tn3270_c_scsoff, NULL, 2, NULL, ENC_BIG_ENDIAN },
2796 { &hf_tn3270_prime, NULL, 1, NULL, ENC_BIG_ENDIAN },
2797 { NULL, NULL, 0, NULL, 0 }
2801 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2804 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2806 return (offset - start);
2809 /* 6.6 Query Reply (Type 1 Text Inbound) - See above*/
2810 /* 6.7 and 6.8 Query Reply - Introductory Matter */
2812 /* 6.9 Query Reply (Alphanumeric Partitions) */
2814 dissect_query_reply_alphanumeric_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2817 gint start = offset;
2820 static const hf_items sdp1[] = {
2821 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2822 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2823 { &hf_tn3270_ap_cm, NULL, 1, NULL, ENC_BIG_ENDIAN },
2824 { &hf_tn3270_ap_ro, NULL, 1, NULL, ENC_BIG_ENDIAN },
2825 { &hf_tn3270_ap_co, NULL, 1, NULL, ENC_BIG_ENDIAN },
2826 { &hf_tn3270_ap_fo, NULL, 2, NULL, ENC_BIG_ENDIAN },
2827 { NULL, NULL, 0, NULL, 0 }
2831 sdp = tvb_get_ntohs(tvb, offset);
2834 case 0x0702: /*Buffer Allocation*/
2835 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2842 return (offset - start);
2847 dissect_query_reply_alphanumeric(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2848 gint sf_body_length)
2850 gint start = offset;
2852 static const gint *byte[] = {
2853 &hf_tn3270_ap_vertical_scrolling,
2854 &hf_tn3270_ap_horizontal_scrolling,
2855 &hf_tn3270_ap_apres1,
2860 &hf_tn3270_ap_apres2,
2864 static const hf_items fields[] = {
2865 { &hf_tn3270_ap_na, NULL, 1, NULL, ENC_BIG_ENDIAN },
2866 { &hf_tn3270_ap_m, NULL, 2, NULL, ENC_BIG_ENDIAN },
2867 { &hf_tn3270_query_reply_alphanumeric_flags, &ett_tn3270_query_reply_alphanumeric_flags, 1, byte, 0 },
2868 { NULL, NULL, 0, NULL, 0 }
2871 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2874 offset += dissect_query_reply_alphanumeric_sd_parms(tn3270_tree, tvb, offset);
2876 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2878 return (offset - start);
2881 /* 6.10 Query Reply (Auxiliary Device) - Search for QUERY_REPLY_AUXILIARY_DEVICE */
2882 /* 6.11 Query Reply (BEGIN/End of File ) - Search for QUERY_REPLY_BEGIN_OR_END_OF_FILE */
2884 /* 6.12 Query Reply (Character Sets) */
2886 dissect_query_reply_character_sets(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2887 gint sf_body_length)
2889 gint start = offset;
2890 gint flagbyte1, flagbyte2;
2892 static const gint *byte1[] = {
2904 static const gint *byte2[] = {
2912 static const gint *byte3[] = {
2913 &hf_tn3270_cs_form_type1,
2914 &hf_tn3270_cs_form_type2,
2915 &hf_tn3270_cs_form_type3,
2916 &hf_tn3270_cs_form_type4,
2917 &hf_tn3270_cs_form_type5,
2918 &hf_tn3270_cs_form_type6,
2919 &hf_tn3270_cs_form_type8,
2923 static const gint *byte4[] = {
2924 &hf_tn3270_cs_ds_load,
2925 &hf_tn3270_cs_ds_triple,
2926 &hf_tn3270_cs_ds_char,
2927 &hf_tn3270_cs_ds_cb,
2932 static const hf_items fields[] = {
2933 { &hf_tn3270_character_sets_flags1, &ett_tn3270_character_sets_flags1, 1, byte1, 0 },
2934 { &hf_tn3270_character_sets_flags2, &ett_tn3270_character_sets_flags2, 1, byte2, 0 },
2935 { &hf_tn3270_sdw, NULL, 1, NULL, ENC_BIG_ENDIAN },
2936 { &hf_tn3270_sdh, NULL, 1, NULL, ENC_BIG_ENDIAN },
2937 { &hf_tn3270_form, &ett_tn3270_character_sets_form, 1, byte3, 0 },
2938 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2939 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2940 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2941 { &hf_tn3270_cs_dl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2942 { NULL, NULL, 0, NULL, 0 }
2945 static const hf_items descriptors[] = {
2946 { &hf_tn3270_cs_descriptor_set, NULL, 1, NULL, ENC_BIG_ENDIAN },
2947 { &hf_tn3270_cs_descriptor_flags, &ett_tn3270_cs_descriptor_flags, 1, byte4, 0 },
2948 { &hf_tn3270_lcid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2949 { NULL, NULL, 0, NULL, 0 }
2952 static const hf_items sw_sh[] = {
2953 { &hf_tn3270_sw, NULL, 1, NULL, ENC_BIG_ENDIAN },
2954 { &hf_tn3270_sh, NULL, 1, NULL, ENC_BIG_ENDIAN },
2955 { NULL, NULL, 0, NULL, 0 }
2958 static const hf_items subsn[] = {
2959 { &hf_tn3270_ssubsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
2960 { &hf_tn3270_esubsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
2961 { NULL, NULL, 0, NULL, 0 }
2964 static const hf_items gf[] = {
2965 { &hf_tn3270_ccsgid, NULL, 4, NULL, ENC_BIG_ENDIAN },
2966 { NULL, NULL, 0, NULL, 0 }
2969 static const hf_items cf[] = {
2970 { &hf_tn3270_ccsid, NULL, 2, NULL, ENC_BIG_ENDIAN },
2971 { NULL, NULL, 0, NULL, 0 }
2974 flagbyte1 = tvb_get_guint8(tvb, offset);
2975 flagbyte2 = tvb_get_guint8(tvb, offset+1);
2977 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2980 while ((offset - start) < sf_body_length) {
2982 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2985 if (flagbyte1 & QR_CS_MS) {
2986 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2990 if (flagbyte1 & QR_CS_CH2) {
2991 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2995 if (flagbyte1 & QR_CS_GF) {
2996 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3000 if (flagbyte2 & QR_CS_CF) {
3001 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3005 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3007 return (offset - start);
3010 /* 6.13 Query Reply (Color) */
3012 dissect_query_reply_color_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3015 gint start = offset;
3018 static const hf_items sdp1[] = {
3019 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3020 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3021 { &hf_tn3270_db_cavdef, NULL, 1, NULL, ENC_BIG_ENDIAN },
3022 { &hf_tn3270_db_cidef, NULL, 1, NULL, ENC_BIG_ENDIAN },
3023 { NULL, NULL, 0, NULL, 0 }
3027 sdp = tvb_get_ntohs(tvb, offset);
3030 case 0x0402: /*Default Background Color*/
3031 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3038 return (offset - start);
3043 dissect_query_reply_color(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3044 gint sf_body_length)
3046 gint start = offset;
3050 static const gint *byte[] = {
3051 &hf_tn3270_c_prtblk,
3055 static const hf_items fields[] = {
3056 { &hf_tn3270_color_flags, &ett_tn3270_color_flags, 1, byte, 0 },
3057 { &hf_tn3270_c_np, NULL, 1, NULL, ENC_BIG_ENDIAN },
3058 { NULL, NULL, 0, NULL, 0 }
3062 np = tvb_get_guint8(tvb, offset +1);
3063 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3066 for (i=0; i < np; i++) {
3067 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3070 proto_tree_add_item(tn3270_tree,
3076 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3079 proto_tree_add_item(tn3270_tree,
3086 offset += dissect_query_reply_color_sd_parms(tn3270_tree, tvb, offset);
3088 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3090 return (offset - start);
3094 /* 6.36 - Query Reply (OEM Auxiliary Device) Self-Defining Parameters */
3096 dissect_daid_sd_parm(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3099 gint start = offset;
3101 static const hf_items sdp1[] = {
3102 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3103 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3104 { &hf_tn3270_sdp_daid, NULL, 2, NULL, ENC_BIG_ENDIAN },
3105 { NULL, NULL, 0, NULL, 0 }
3108 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3110 return (offset - start);
3115 dissect_pclk_sd_parm(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3118 gint start = offset;
3120 static const hf_items sdp1[] = {
3121 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3122 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3123 { &hf_tn3270_oem_sdp_pclk_vers, NULL, 2, NULL, ENC_BIG_ENDIAN },
3124 { NULL, NULL, 0, NULL, 0 }
3127 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3129 return (offset - start);
3134 dissect_query_reply_oem_auxiliary_device_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3137 gint start = offset;
3141 static const hf_items sdp1[] = {
3142 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3143 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3144 { &hf_tn3270_sdp_daid, NULL, 2, NULL, ENC_BIG_ENDIAN },
3145 { NULL, NULL, 0, NULL, 0 }
3148 static const hf_items sdp2[] = {
3149 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3150 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3151 { &hf_tn3270_oem_sdp_ll_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3152 { &hf_tn3270_oem_sdp_ll_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3154 { NULL, NULL, 0, NULL, 0 }
3157 static const hf_items sdp3[] = {
3158 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3159 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3160 { &hf_tn3270_oem_sdp_pclk_vers, NULL, 2, NULL, ENC_BIG_ENDIAN },
3161 { NULL, NULL, 0, NULL, 0 }
3165 sdp_len = tvb_get_guint8(tvb, offset);
3166 if ((sdp_len != 0x04) && (sdp_len != 0x06)) {
3170 sdp = tvb_get_guint8(tvb, offset+1);
3174 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3178 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3182 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3189 return (offset - start);
3193 /* 6.14 - Query Reply (Cooperative Processing Requestor) */
3195 dissect_query_reply_cooperative(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3196 gint sf_body_length)
3198 gint start = offset;
3200 static const hf_items fields[] = {
3201 { &hf_tn3270_res_twobytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3202 { &hf_tn3270_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3203 { &hf_tn3270_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3204 { &hf_tn3270_featl, NULL, 1, NULL, ENC_BIG_ENDIAN },
3205 { &hf_tn3270_feats, NULL, 2, NULL, ENC_BIG_ENDIAN },
3206 { NULL, NULL, 0, NULL, 0 }
3210 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3214 /*FIXME: Need to see this in action to dissect in detail */
3215 proto_tree_add_item(tn3270_tree,
3216 hf_tn3270_field_data,
3218 sf_body_length - (offset-start),
3220 offset += (sf_body_length - (offset - start));
3222 /* Uses same Self-Defining Parm as OEM Auxiliary Device */
3223 offset += dissect_query_reply_oem_auxiliary_device_sd_parms(tn3270_tree, tvb, offset);
3226 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3228 return (offset - start);
3231 /* 6.15 - Query Reply (Data Chaining) */
3233 dissect_query_reply_data_chaining(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3234 gint sf_body_length)
3236 gint start = offset;
3238 static const hf_items fields[] = {
3239 { &hf_tn3270_dc_dir, NULL, 1, NULL, ENC_BIG_ENDIAN },
3240 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3241 { NULL, NULL, 0, NULL, 0 }
3244 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3247 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3249 return (offset - start);
3252 /* 6.16 - Query Reply (Data Streams) */
3255 dissect_query_reply_data_streams(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3256 gint sf_body_length)
3258 gint start = offset;
3261 proto_tree_add_item(tn3270_tree, hf_tn3270_ds_default_sfid, tvb, offset, 1,
3265 for (i=0; i < (sf_body_length-(offset-start)); i++) {
3266 proto_tree_add_item(tn3270_tree,
3273 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3275 return (offset - start);
3278 /* 6.17 - Query Reply (DBCS Asia) */
3281 dissect_query_reply_dbcs_asia_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3284 gint start = offset;
3288 static const hf_items sdp1[] = {
3289 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3290 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3291 { &hf_tn3270_asia_sdp_sosi_soset, NULL, 1, NULL, ENC_BIG_ENDIAN },
3292 { NULL, NULL, 0, NULL, 0 }
3295 static const hf_items sdp2[] = {
3296 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3297 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3298 { &hf_tn3270_asia_sdp_ic_func, NULL, 1, NULL, ENC_BIG_ENDIAN },
3299 { NULL, NULL, 0, NULL, 0 }
3302 sdp_len = tvb_get_guint8(tvb, offset);
3303 if (sdp_len != 0x03) {
3307 sdp = tvb_get_guint8(tvb, offset+1);
3310 case 0x01: /*SO/SI*/
3311 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3314 case 0x02: /*Input Control*/
3315 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3322 return (offset - start);
3327 dissect_query_reply_dbcs_asia(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3328 gint sf_body_length)
3331 gint start = offset;
3334 static const hf_items fields[] = {
3335 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3336 { NULL, NULL, 0, NULL, 0 }
3340 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3343 for (i = 0; i < 3; i++) {
3344 offset += dissect_query_reply_dbcs_asia_sd_parms(tn3270_tree, tvb, offset);
3345 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3349 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3351 return (offset - start);
3354 /* 6.18 - Query Reply (Device Characteristics) */
3356 dissect_query_reply_device_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb,
3357 gint offset, gint sf_body_length)
3359 gint start = offset;
3361 #if 0 /* XXX: I don't think this is correct (i.e., this field is not part of this message) .... */
3362 proto_tree_add_item(tn3270_tree,
3363 hf_tn3270_sf_outbound_id,
3370 /* TODO: dissect descriptors */
3371 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3373 return (offset - start);
3376 /* 6.19 - Query Reply (Distributed Data Management) */
3378 dissect_query_reply_distributed_data_management(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3379 gint sf_body_length)
3381 gint start = offset, i;
3383 gboolean done = FALSE;
3385 static const hf_items fields[] = {
3386 { &hf_tn3270_ddm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3387 { &hf_tn3270_ddm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3388 { &hf_tn3270_ddm_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3389 { &hf_tn3270_ddm_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3390 { &hf_tn3270_ddm_nss, NULL, 1, NULL, ENC_BIG_ENDIAN },
3391 { &hf_tn3270_ddm_ddmss, NULL, 1, NULL, ENC_BIG_ENDIAN },
3392 { NULL, NULL, 0, NULL, 0 }
3395 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3398 for (i = 0; i < 3; i++) {
3399 sdp = tvb_get_guint8(tvb, offset+1);
3403 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, tvb_get_guint8(tvb,offset));
3406 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3409 offset += dissect_pclk_sd_parm(tn3270_tree, tvb, offset);
3415 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3419 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3421 return (offset - start);
3424 /* 6.20 - Query Reply (Document Interchange Architecture) */
3426 dissect_query_reply_document_interchange_architecture(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3427 gint sf_body_length)
3429 gint start = offset, sdp, ln, i;
3431 static const hf_items fields[] = {
3432 { &hf_tn3270_dia_flags, NULL, 2, NULL, ENC_BIG_ENDIAN },
3433 { &hf_tn3270_dia_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3434 { &hf_tn3270_dia_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3435 { NULL, NULL, 0, NULL, 0 }
3438 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3441 ln = tvb_get_guint8(tvb, offset);
3442 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_nfs, tvb, offset, 1, ENC_BIG_ENDIAN);
3444 for (i=0; i < ln; i++) {
3445 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_diafs, tvb, offset, 1,
3448 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_diafn, tvb, offset, 2,
3453 sdp = tvb_get_guint8(tvb, offset+1);
3454 if (sdp == 0x01) { /*DAID*/
3455 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3458 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3460 return (offset - start);
3463 /* 6.21 - Query Reply (Extended Drawing Routine) */
3465 dissect_query_reply_extended_drawing_routine(proto_tree *tn3270_tree, tvbuff_t *tvb,
3466 gint offset, gint sf_body_length)
3468 gint start = offset;
3470 proto_tree_add_item(tn3270_tree, hf_tn3270_field_data ,tvb, offset,
3471 sf_body_length, ENC_EBCDIC|ENC_NA);
3473 offset += sf_body_length;
3475 return (offset - start);
3478 /* 6.22 - Query Reply (Field Outlining) */
3480 dissect_query_reply_field_outlining(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3481 gint sf_body_length)
3483 gint start = offset;
3485 static const hf_items fields[] = {
3486 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3487 { &hf_tn3270_fo_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3488 { &hf_tn3270_fo_vpos, NULL, 1, NULL, ENC_BIG_ENDIAN },
3489 { &hf_tn3270_fo_hpos, NULL, 1, NULL, ENC_BIG_ENDIAN },
3490 { &hf_tn3270_fo_hpos0, NULL, 1, NULL, ENC_BIG_ENDIAN },
3491 { &hf_tn3270_fo_hpos1, NULL, 1, NULL, ENC_BIG_ENDIAN },
3492 { NULL, NULL, 0, NULL, 0 }
3495 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3498 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3500 return (offset - start);
3503 /* 6.23 - Query Reply (Field Validation) - Search for FIELD_VALIDATION*/
3504 /* 6.24 - Query Reply (Format Presentation) - Search for FORMAT_PRESENTATION*/
3506 /* 6.25 - Query Reply (Format Storage Auxiliary Device)*/
3508 dissect_query_reply_format_storage_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3509 gint sf_body_length)
3511 gint start = offset, sdp;
3513 static const hf_items fields[] = {
3514 { &hf_tn3270_fsad_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3515 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3516 { &hf_tn3270_fsad_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3517 { &hf_tn3270_fsad_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3518 { NULL, NULL, 0, NULL, 0 }
3521 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3524 sdp = tvb_get_guint8(tvb, offset+1);
3525 if (sdp == 0x01) { /*DAID*/
3526 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3527 proto_tree_add_item(tn3270_tree, hf_tn3270_fsad_size ,tvb, offset,
3532 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3534 return (offset - start);
3537 /* 6.26 - Query Reply (Graphic Color) - Search for GRAPHIC_COLOR*/
3538 /* 6.27 - Query Reply (Graphic Symbol Sets) - Search for GRAPHIC_SYMBOL_SETS*/
3540 /* 6.28 - Query Reply (Highlighting) */
3542 dissect_query_reply_highlighting(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3543 gint sf_body_length)
3545 gint start = offset;
3549 static const hf_items fields[] = {
3550 { &hf_tn3270_h_np, NULL, 1, NULL, ENC_BIG_ENDIAN },
3551 { NULL, NULL, 0, NULL, 0 }
3555 np = tvb_get_guint8(tvb, offset);
3556 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3559 for (i=0; i < np; i++) {
3560 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3563 proto_tree_add_item(tn3270_tree,
3569 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3572 proto_tree_add_item(tn3270_tree,
3580 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3582 return (offset - start);
3585 /* 6.29 - Query Reply (IBM Auxiliary Device) */
3587 dissect_query_reply_ibm_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3588 gint sf_body_length)
3590 gint start = offset, i, sdp;
3591 gboolean done = FALSE;
3593 static const hf_items fields[] = {
3594 { &hf_tn3270_ibm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3595 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3596 { &hf_tn3270_ibm_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3597 { &hf_tn3270_ibm_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3598 { &hf_tn3270_ibm_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3599 { NULL, NULL, 0, NULL, 0 }
3602 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3605 for (i = 0; i < 3; i++) {
3606 sdp = tvb_get_guint8(tvb, offset+1);
3608 case 0x02: /*Printer Name*/
3609 /*TODO: Printer Name */
3610 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, tvb_get_guint8(tvb,offset));
3613 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3616 offset += dissect_pclk_sd_parm(tn3270_tree, tvb, offset);
3622 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3626 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3628 return (offset - start);
3631 /* 6.30 - Query Reply (Image) */
3633 /* 6.31 - Query Reply (Implicit Partitions) */
3635 dissect_query_reply_implicit_partitions_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3638 gint start = offset;
3642 static const hf_items sdp1[] = {
3643 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3644 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3645 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3646 { &hf_tn3270_ipdd_wd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3647 { &hf_tn3270_ipdd_hd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3648 { &hf_tn3270_ipdd_wa, NULL, 2, NULL, ENC_BIG_ENDIAN },
3649 { &hf_tn3270_ipdd_ha, NULL, 2, NULL, ENC_BIG_ENDIAN },
3650 { NULL, NULL, 0, NULL, 0 }
3653 static const hf_items sdp2[] = {
3654 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3655 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3656 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3657 { &hf_tn3270_ippd_dpbs, NULL, 4, NULL, ENC_BIG_ENDIAN },
3658 { &hf_tn3270_ippd_apbs, NULL, 4, NULL, ENC_BIG_ENDIAN },
3659 { NULL, NULL, 0, NULL, 0 }
3662 static const hf_items sdp3[] = {
3663 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3664 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3665 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3666 { &hf_tn3270_ipccd_wcd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3667 { &hf_tn3270_ipccd_hcd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3668 { &hf_tn3270_ipccd_wca, NULL, 2, NULL, ENC_BIG_ENDIAN },
3669 { &hf_tn3270_ipccd_hca, NULL, 2, NULL, ENC_BIG_ENDIAN },
3670 { NULL, NULL, 0, NULL, 0 }
3673 sdp_len = tvb_get_guint8(tvb, offset);
3674 if (sdp_len != 0x0B) {
3678 sdp = tvb_get_guint8(tvb, offset+1);
3681 case QR_IP_SDP_DISPLAY:
3682 /* XXX: Save default and alternate screen size info as reported ? */
3683 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3686 case QR_IP_SDP_PRINTER:
3687 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3690 case QR_IP_SDP_CHARACTER:
3691 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3698 return (offset - start);
3703 dissect_query_reply_implicit_partitions(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3704 gint sf_body_length)
3706 gint start = offset;
3709 static const hf_items fields[] = {
3710 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3711 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3712 { NULL, NULL, 0, NULL, 0 }
3715 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3718 for (i = 0; i < 3; i++) {
3720 len = dissect_query_reply_implicit_partitions_sd_parms(tn3270_tree, tvb, offset);
3721 if ((len == 0) || (tvb_reported_length_remaining(tvb, offset) <= 0))
3726 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3728 return (offset - start);
3731 /* 6.32 - Query Reply (IOCA Auxiliary Device) */
3733 dissect_query_reply_ioca_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3734 gint sf_body_length)
3736 gint start = offset;
3738 static const hf_items fields[] = {
3739 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3740 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3741 { &hf_tn3270_ioca_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3742 { &hf_tn3270_ioca_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3743 { &hf_tn3270_ioca_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3744 { NULL, NULL, 0, NULL, 0 }
3747 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3750 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3752 return (offset - start);
3755 /* 6.33 - Query Reply (Line Type) - Search for LINE_TYPE*/
3757 /* 6.34 - Query Reply (MSR Control) */
3759 dissect_query_reply_msr_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3760 gint sf_body_length)
3762 gint start = offset;
3764 static const hf_items fields[] = {
3765 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3766 { &hf_tn3270_msr_nd, NULL, 1, NULL, ENC_BIG_ENDIAN },
3767 { &hf_tn3270_msr_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3768 { NULL, NULL, 0, NULL, 0 }
3771 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3773 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3775 return (offset - start);
3778 /* 6.35 - Query Reply (Null) - Search for QUERY_REPLY_NULL */
3780 /* 6.36 - Query Reply (OEM Auxiliary Device) */
3782 dissect_query_reply_oem_auxiliary_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3783 gint sf_body_length)
3785 gint start = offset;
3788 static const hf_items fields[] = {
3789 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3790 { &hf_tn3270_oem_dsref, NULL, 1, NULL, ENC_BIG_ENDIAN },
3791 { &hf_tn3270_oem_dtype, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
3792 { &hf_tn3270_oem_uname, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
3793 { NULL, NULL, 0, NULL, 0 }
3796 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3799 for (i = 0; i < 3; i++) {
3800 offset += dissect_query_reply_oem_auxiliary_device_sd_parms(tn3270_tree, tvb, offset);
3801 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3805 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3807 return (offset - start);
3810 /* 6.37 - Query Reply (Paper Feed Techniques) */
3812 dissect_query_reply_paper_feed_techniques(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3813 gint sf_body_length)
3815 gint start = offset;
3817 static const hf_items fields[] = {
3818 { &hf_tn3270_pft_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3819 { &hf_tn3270_pft_tmo, NULL, 2, NULL, ENC_BIG_ENDIAN },
3820 { &hf_tn3270_pft_bmo, NULL, 2, NULL, ENC_BIG_ENDIAN },
3821 { NULL, NULL, 0, NULL, 0 }
3824 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3826 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3828 return (offset - start);
3831 /* 6.38 - Query Reply (Partition Characteristics) */
3833 dissect_query_reply_partition_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3834 gint sf_body_length)
3836 gint start = offset, i, sdp;
3837 gboolean done = FALSE;
3839 static const hf_items fields[] = {
3840 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3841 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3842 { NULL, NULL, 0, NULL, 0 }
3845 for (i = 0; i < 2; i++) {
3846 sdp = tvb_get_guint8(tvb, offset+1);
3848 case 0x01: /*Viewport Outline*/
3849 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3851 proto_tree_add_item(tn3270_tree, hf_tn3270_pc_vo_thickness,
3852 tvb, offset, 1, ENC_BIG_ENDIAN);
3855 case 0x03: /*Enable User Call-Up*/
3856 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3863 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3867 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3869 return (offset - start);
3872 /* 6.39 - Query Reply (Port) - Search for QUERY_REPLY_PORT */
3873 /* 6.40 - Query Reply (Procedure) - Search for QUERY_REPLY_PROCEDURE */
3875 /* 6.41 - Query Reply ((Product Defined Data Stream) */
3877 dissect_query_reply_product_defined_data_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3878 gint sf_body_length)
3880 gint start = offset, sdp;
3882 static const hf_items fields[] = {
3883 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3884 { &hf_tn3270_pdds_refid, NULL, 1, NULL, ENC_BIG_ENDIAN },
3885 { &hf_tn3270_pdds_ssid, NULL, 1, NULL, ENC_BIG_ENDIAN },
3886 { NULL, NULL, 0, NULL, 0 }
3889 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3892 sdp = tvb_get_guint8(tvb, offset+1);
3893 if (sdp == 0x01) { /*DAID*/
3894 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3897 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3899 return (offset - start);
3902 /* 6.42 - Query Reply (Modes) */
3904 dissect_query_reply_modes(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3905 gint sf_body_length)
3907 gint start = offset;
3910 for (i=0; i < sf_body_length; i++) {
3911 proto_tree_add_item(tn3270_tree,
3919 return (offset - start);
3922 /* 6.43 - Query Reply (RPQ Names) */
3924 dissect_query_reply_rpq_names(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3925 gint sf_body_length)
3927 gint start = offset;
3930 static const hf_items fields[] = {
3931 { &hf_tn3270_rpq_device, NULL, 4, NULL, ENC_EBCDIC|ENC_NA },
3932 { &hf_tn3270_rpq_mid, NULL, 4, NULL, ENC_BIG_ENDIAN },
3933 { NULL, NULL, 0, NULL, 0 }
3936 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3939 rpql = tvb_get_guint8(tvb, offset);
3941 proto_tree_add_item(tn3270_tree,
3948 proto_tree_add_item(tn3270_tree,
3955 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3957 return (offset - start);
3960 /* 6.44 - Query Reply (Save/Restore Format) */
3962 dissect_query_reply_save_or_restore_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3963 gint sf_body_length)
3965 gint start = offset;
3967 static const hf_items fields[] = {
3968 { &hf_tn3270_srf_fpcbl, NULL, 1, NULL, ENC_NA },
3969 { NULL, NULL, 0, NULL, 0 }
3972 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3975 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3977 return (offset - start);
3980 /* 6.45 - Query Reply (Segment) - Search for QUERY_REPLY_SEGMENT */
3982 /* 6.46 - Query Reply ((Settable Printer Characteristics) */
3984 dissect_query_reply_settable_printer_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3985 gint sf_body_length)
3987 gint start = offset, sdp;
3989 static const hf_items fields[] = {
3990 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3991 { NULL, NULL, 0, NULL, 0 }
3994 static const hf_items fields2[] = {
3995 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3996 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3997 { NULL, NULL, 0, NULL, 0 }
4000 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4003 sdp = tvb_get_guint8(tvb, offset+1);
4004 if (sdp == 0x01) { /*Early Print Complete*/
4005 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4007 proto_tree_add_item(tn3270_tree, hf_tn3270_spc_epc_flags, tvb, offset,
4012 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4014 return (offset - start);
4017 /* 6.47 - Query Reply (Storage Pools) */
4019 dissect_query_reply_storage_pools(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4020 gint sf_body_length)
4022 gint start = offset, sdp, i;
4024 static const hf_items fields2[] = {
4025 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
4026 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
4027 { &hf_tn3270_sp_spid, NULL, 1, NULL, ENC_BIG_ENDIAN },
4028 { &hf_tn3270_sp_size, NULL, 4, NULL, ENC_BIG_ENDIAN },
4029 { &hf_tn3270_sp_space, NULL, 4, NULL, ENC_BIG_ENDIAN },
4030 { NULL, NULL, 0, NULL, 0 }
4033 sdp = tvb_get_guint8(tvb, offset+1);
4034 if (sdp == 0x01) { /* Storage Pool Characteristics */
4035 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4037 for (i=0; i < (sf_body_length-(offset-start)); i+=2) {
4038 proto_tree_add_item(tn3270_tree, hf_tn3270_sp_objlist,
4039 tvb, offset, 2, ENC_BIG_ENDIAN);
4044 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4046 return (offset - start);
4049 /* 6.48 - Query Reply (Summary) */
4051 dissect_query_reply_summary(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4052 gint sf_body_length)
4056 gint length_remaining = tvb_reported_length_remaining(tvb, offset);
4058 for (i=0; i < sf_body_length; i++) {
4059 if (datalen >= length_remaining) {
4062 proto_tree_add_item(tn3270_tree,
4063 hf_tn3270_sf_query_reply,
4064 tvb, offset + datalen,
4069 datalen += dissect_unknown_data(tn3270_tree, tvb, offset+datalen, offset, sf_body_length);
4074 /* 6.49 - Query Reply (Text Partitions) */
4076 dissect_query_reply_text_partitions(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4077 gint sf_body_length)
4079 gint start = offset, len, i;
4081 static const hf_items fields[] = {
4082 { &hf_tn3270_tp_nt, NULL, 1, NULL, ENC_BIG_ENDIAN },
4083 { &hf_tn3270_tp_m, NULL, 2, NULL, ENC_BIG_ENDIAN },
4084 { &hf_tn3270_tp_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
4085 { NULL, NULL, 0, NULL, 0 }
4088 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4091 len = tvb_get_guint8(tvb, offset);
4092 proto_tree_add_item(tn3270_tree, hf_tn3270_tp_ntt, tvb, offset, 1, ENC_BIG_ENDIAN);
4095 for (i=0; i < len; i++) {
4096 proto_tree_add_item(tn3270_tree, hf_tn3270_tp_tlist,
4097 tvb, offset, 1, ENC_BIG_ENDIAN);
4101 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4103 return (offset - start);
4106 /* 6.50 - Query Reply (Transparency) */
4108 dissect_query_reply_transparency(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4109 gint sf_body_length)
4111 gint start = offset, i, len;
4113 len = tvb_get_guint8(tvb, offset);
4114 proto_tree_add_item(tn3270_tree, hf_tn3270_t_np, tvb, offset, 1, ENC_BIG_ENDIAN);
4117 for (i=0; i < len; i+=2) {
4118 proto_tree_add_item(tn3270_tree, hf_tn3270_t_vi,
4119 tvb, offset, 1, ENC_BIG_ENDIAN);
4121 proto_tree_add_item(tn3270_tree, hf_tn3270_t_ai,
4122 tvb, offset, 1, ENC_BIG_ENDIAN);
4126 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4128 return (offset - start);
4131 /* 6.51 - Query Reply Usable Area */
4133 dissect_query_reply_usable_area(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4134 gint sf_body_length)
4136 gint start = offset;
4139 static const gint *byte1[] = {
4140 &hf_tn3270_ua_reserved1,
4141 &hf_tn3270_ua_page_printer,
4142 &hf_tn3270_ua_reserved2,
4143 &hf_tn3270_ua_hard_copy,
4144 &hf_tn3270_ua_addressing,
4148 static const gint *byte2[] = {
4149 &hf_tn3270_ua_variable_cells,
4150 &hf_tn3270_ua_characters,
4151 &hf_tn3270_ua_cell_units,
4155 static const hf_items fields[] = {
4156 { &hf_tn3270_usable_area_flags1, &ett_tn3270_usable_area_flags1, 1, byte1, 0 },
4157 { &hf_tn3270_usable_area_flags2, &ett_tn3270_usable_area_flags1, 1, byte2, 0 },
4158 { &hf_tn3270_ua_width_cells_pels, NULL, 2, NULL, ENC_BIG_ENDIAN },
4159 { &hf_tn3270_ua_height_cells_pels, NULL, 2, NULL, ENC_BIG_ENDIAN },
4160 { &hf_tn3270_ua_uom_cells_pels, NULL, 1, NULL, ENC_BIG_ENDIAN },
4161 { &hf_tn3270_ua_xr, NULL, 4, NULL, ENC_BIG_ENDIAN },
4162 { &hf_tn3270_ua_yr, NULL, 4, NULL, ENC_BIG_ENDIAN },
4163 { &hf_tn3270_ua_aw, NULL, 1, NULL, ENC_BIG_ENDIAN },
4164 { &hf_tn3270_ua_ah, NULL, 1, NULL, ENC_BIG_ENDIAN },
4165 { &hf_tn3270_ua_buffsz, NULL, 2, NULL, ENC_BIG_ENDIAN },
4166 { NULL, NULL, 0, NULL, 0 }
4169 static const hf_items fields2[] = {
4170 { &hf_tn3270_ua_xmin, NULL, 1, NULL, ENC_BIG_ENDIAN },
4171 { &hf_tn3270_ua_ymin, NULL, 1, NULL, ENC_BIG_ENDIAN },
4172 { &hf_tn3270_ua_xmax, NULL, 1, NULL, ENC_BIG_ENDIAN },
4173 { &hf_tn3270_ua_ymax, NULL, 1, NULL, ENC_BIG_ENDIAN },
4174 { NULL, NULL, 0, NULL, 0 }
4177 vcp = tvb_get_guint8(tvb, offset+1);
4179 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4182 if ((vcp & QR_UA_VARIABLE_CELLS) != 0) {
4183 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4187 /*TODO: self defining parms */
4188 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4190 return (offset - start);
4193 /* 6.52 - Query Reply 3270 IPDS */
4195 dissect_query_reply_3270_ipds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4196 gint sf_body_length)
4198 gint start = offset;
4200 static const hf_items fields[] = {
4201 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
4202 { &hf_tn3270_3270_tranlim, NULL, 2, NULL, ENC_BIG_ENDIAN },
4203 { NULL, NULL, 0, NULL, 0 }
4206 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4208 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4210 return (offset - start);
4213 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4214 /* call only with valid sf_id */
4216 process_inbound_structured_field(proto_tree *sf_tree, tvbuff_t *tvb, gint offset,
4217 tn3270_conv_info_t *tn3270_info, guint sf_id, gint sf_body_length)
4219 gint start = offset; /* start of structured field param(s) */
4222 case SF_IB_EXCEPTION_OR_STATUS:
4223 offset += dissect_exception_or_status(sf_tree, tvb, offset, sf_body_length);
4225 case SF_IB_INBOUND_TEXT_HEADER:
4226 offset += dissect_inbound_text_header(sf_tree, tvb, offset, sf_body_length);
4228 case SF_IB_INBOUND_3270DS:
4229 offset += dissect_inbound_3270ds(sf_tree, tvb, offset, tn3270_info, sf_body_length);
4231 case SF_IB_RECOVERY_DATA:
4232 offset += dissect_recovery_data(sf_tree, tvb, offset, sf_body_length);
4234 case SF_IB_TYPE_1_TEXT_INBOUND:
4235 offset += dissect_type_1_text(sf_tree, tvb, offset, sf_body_length);
4237 case SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS:
4238 offset += dissect_query_reply_alphanumeric(sf_tree, tvb, offset, sf_body_length);
4240 case SF_IB_QUERY_REPLY_AUXILIARY_DEVICE:
4241 case SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE:
4242 offset += dissect_query_reply_resbytes(sf_tree, tvb, offset, sf_body_length);
4244 case SF_IB_QUERY_REPLY_CHARACTER_SETS:
4245 offset += dissect_query_reply_character_sets(sf_tree, tvb, offset, sf_body_length);
4247 case SF_IB_QUERY_REPLY_COLOR:
4248 offset += dissect_query_reply_color(sf_tree, tvb, offset, sf_body_length);
4250 case SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR:
4251 offset += dissect_query_reply_cooperative(sf_tree, tvb, offset, sf_body_length);
4253 case SF_IB_QUERY_REPLY_DATA_CHAINING:
4254 offset += dissect_query_reply_data_chaining(sf_tree, tvb, offset, sf_body_length);
4256 case SF_IB_QUERY_REPLY_DATA_STREAMS:
4257 offset += dissect_query_reply_data_streams(sf_tree, tvb, offset, sf_body_length);
4259 case SF_IB_QUERY_REPLY_DBCS_ASIA:
4260 offset += dissect_query_reply_dbcs_asia(sf_tree, tvb, offset, sf_body_length);
4262 case SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS:
4263 /*TODO: implement this beast */
4264 offset += dissect_query_reply_device_characteristics(sf_tree, tvb, offset, sf_body_length);
4266 case SF_IB_QUERY_REPLY_SUMMARY:
4267 offset += dissect_query_reply_summary(sf_tree, tvb, offset, sf_body_length);
4269 case SF_IB_QUERY_REPLY_USABLE_AREA:
4270 offset += dissect_query_reply_usable_area(sf_tree, tvb, offset, sf_body_length);
4272 case SF_IB_QUERY_REPLY_HIGHLIGHTING:
4273 offset += dissect_query_reply_highlighting(sf_tree, tvb, offset, sf_body_length);
4275 case SF_IB_QUERY_REPLY_REPLY_MODES:
4276 offset += dissect_query_reply_modes(sf_tree, tvb, offset, sf_body_length);
4278 case SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT:
4279 offset += dissect_query_reply_distributed_data_management(sf_tree, tvb, offset, sf_body_length);
4281 case SF_IB_QUERY_REPLY_RPQ_NAMES:
4282 offset += dissect_query_reply_rpq_names(sf_tree, tvb, offset, sf_body_length);
4284 case SF_IB_QUERY_REPLY_IMPLICIT_PARTITION:
4285 offset += dissect_query_reply_implicit_partitions(sf_tree, tvb, offset, sf_body_length);
4287 case SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE:
4288 offset += dissect_query_reply_oem_auxiliary_device(sf_tree, tvb, offset, sf_body_length);
4290 case SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE:
4291 offset += dissect_query_reply_document_interchange_architecture(sf_tree, tvb, offset, sf_body_length);
4293 case SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE:
4294 offset += dissect_query_reply_extended_drawing_routine(sf_tree, tvb, offset, sf_body_length);
4296 case SF_IB_QUERY_REPLY_FIELD_OUTLINING:
4297 offset += dissect_query_reply_field_outlining(sf_tree, tvb, offset, sf_body_length);
4299 case SF_IB_QUERY_REPLY_FIELD_VALIDATION:
4300 offset += dissect_3270_field_validation(sf_tree, tvb, offset);
4302 case SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE:
4303 offset += dissect_query_reply_format_storage_aux_device(sf_tree, tvb, offset, sf_body_length);
4305 case SF_IB_QUERY_REPLY_GRAPHIC_COLOR:
4306 case SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS:
4307 case SF_IB_QUERY_REPLY_IMAGE:
4308 case SF_IB_QUERY_REPLY_LINE_TYPE:
4309 case SF_IB_QUERY_REPLY_PROCEDURE:
4310 case SF_IB_QUERY_REPLY_SEGMENT:
4311 /* Not an error - just has a data field like 'extended drawing'*/
4312 offset += dissect_query_reply_extended_drawing_routine(sf_tree, tvb, offset, sf_body_length);
4314 case SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE:
4315 offset += dissect_query_reply_ibm_aux_device(sf_tree, tvb, offset, sf_body_length);
4317 case SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE:
4318 offset += dissect_query_reply_ioca_aux_device(sf_tree, tvb, offset, sf_body_length);
4320 case SF_IB_QUERY_REPLY_MSR_CONTROL:
4321 offset += dissect_query_reply_msr_control(sf_tree, tvb, offset, sf_body_length);
4323 case SF_IB_QUERY_REPLY_FORMAT_PRESENTATION:
4324 case SF_IB_QUERY_REPLY_NULL:
4325 case SF_IB_QUERY_REPLY_PORT:
4326 /* This field is always empty */
4328 case SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES:
4329 offset += dissect_query_reply_paper_feed_techniques(sf_tree, tvb, offset, sf_body_length);
4331 case SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS:
4332 offset += dissect_query_reply_partition_characteristics(sf_tree, tvb, offset, sf_body_length);
4334 case SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM:
4335 offset += dissect_query_reply_product_defined_data_stream(sf_tree, tvb, offset, sf_body_length);
4337 case SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT:
4338 offset += dissect_query_reply_save_or_restore_format(sf_tree, tvb, offset, sf_body_length);
4340 case SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS:
4341 offset += dissect_query_reply_settable_printer_characteristics(sf_tree, tvb, offset, sf_body_length);
4343 case SF_IB_QUERY_REPLY_STORAGE_POOLS:
4344 offset += dissect_query_reply_storage_pools(sf_tree, tvb, offset, sf_body_length);
4346 case SF_IB_QUERY_REPLY_TEXT_PARTITIONS:
4347 offset += dissect_query_reply_text_partitions(sf_tree, tvb, offset, sf_body_length);
4349 case SF_IB_QUERY_REPLY_TRANSPARENCY:
4350 offset += dissect_query_reply_transparency(sf_tree, tvb, offset, sf_body_length);
4352 case SF_IB_QUERY_REPLY_3270_IPDS:
4353 offset += dissect_query_reply_3270_ipds(sf_tree, tvb, offset, sf_body_length);
4356 DISSECTOR_ASSERT_NOT_REACHED();
4360 return (offset - start);
4364 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4365 /* call only with valid sf_id */
4367 process_outbound_structured_field(proto_tree *sf_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
4368 tn3270_conv_info_t *tn3270_info, guint sf_id, gint sf_body_length)
4370 gint start = offset; /* start of structured field param(s) */
4373 case SF_OB_READ_PARTITION:
4374 offset += dissect_read_partition(sf_tree, tvb, offset, sf_body_length);
4376 case SF_OB_ACTIVATE_PARTITION:
4377 case SF_OB_DESTROY_PARTITION:
4378 case SF_OB_RESET_PARTITION:
4379 proto_tree_add_item(sf_tree,
4380 hf_tn3270_partition_id,
4386 case SF_OB_CREATE_PARTITION:
4387 offset += dissect_create_partition(sf_tree, tvb, offset, sf_body_length);
4389 case SF_OB_ERASE_OR_RESET:
4390 /* Bit 0: 0= Use default screen size; 1= use alternate screen size */
4391 /* XXX: Not really valid: See comment under dissect_outbound_stream(). */
4392 if ((tvb_get_guint8(tvb, offset) & 0x80) != 0) {
4393 tn3270_info->rows = tn3270_info->altrows;
4394 tn3270_info->cols = tn3270_info->altcols;
4397 tn3270_info->rows = 24;
4398 tn3270_info->cols = 80;
4400 proto_tree_add_bits_item(sf_tree,
4401 hf_tn3270_erase_flags,
4407 case SF_OB_LOAD_PROGRAMMED_SYMBOLS:
4408 offset += dissect_load_programmed_symbols(sf_tree, tvb, offset, sf_body_length);
4410 case SF_OB_OUTBOUND_3270DS:
4411 offset += dissect_outbound_3270ds(sf_tree, pinfo, tvb, offset, tn3270_info, sf_body_length);
4413 case SF_OB_PRESENT_ABSOLUTE_FORMAT:
4414 offset += dissect_present_absolute_format(sf_tree, tvb, offset, sf_body_length);
4416 case SF_OB_PRESENT_RELATIVE_FORMAT:
4417 offset += dissect_present_relative_format(sf_tree, tvb, offset, sf_body_length);
4419 case SF_OB_SCS_DATA:
4420 proto_tree_add_item(sf_tree,
4421 hf_tn3270_partition_id,
4426 proto_tree_add_item(sf_tree,
4429 (sf_body_length - (offset - start)),
4431 offset += (sf_body_length - (offset - start));
4433 case SF_OB_SET_REPLY_MODE:
4434 offset += dissect_set_reply_mode(sf_tree, tvb, offset, sf_body_length);
4436 case SF_OB_SELECT_FORMAT_GROUP:
4437 proto_tree_add_item(sf_tree,
4438 hf_tn3270_partition_id,
4443 proto_tree_add_item(sf_tree,
4444 hf_tn3270_format_group,
4446 (sf_body_length - (offset - start)),
4448 offset += (sf_body_length - (offset - start));
4450 case SF_OB_SET_WINDOW_ORIGIN:
4451 proto_tree_add_item(sf_tree,
4452 hf_tn3270_partition_id,
4457 proto_tree_add_item(sf_tree,
4458 hf_tn3270_partition_rw,
4463 proto_tree_add_item(sf_tree,
4464 hf_tn3270_partition_cw,
4470 case SF_OB_BEGIN_OR_END_OF_FILE:
4471 proto_tree_add_item(sf_tree,
4472 hf_tn3270_partition_id,
4477 /*TODO: use bits_text */
4478 proto_tree_add_bits_item(sf_tree,
4479 hf_tn3270_begin_end_flags1,
4484 proto_tree_add_item(sf_tree,
4485 hf_tn3270_begin_end_flags2,
4491 case SF_OB_LOAD_COLOR_TABLE:
4492 /* Refer to related graphics docs !*/
4493 proto_tree_add_item(sf_tree,
4494 hf_tn3270_load_color_command,
4498 offset += sf_body_length;
4500 case SF_OB_LOAD_FORMAT_STORAGE:
4501 offset += dissect_load_format_storage(sf_tree, tvb, offset, sf_body_length);
4503 case SF_OB_LOAD_LINE_TYPE:
4504 /* Refer to related graphics docs !*/
4505 proto_tree_add_item(sf_tree,
4506 hf_tn3270_load_line_type_command,
4510 offset += sf_body_length;
4512 case SF_OB_MODIFY_PARTITION:
4513 offset += dissect_modify_partition(sf_tree, tvb, offset, sf_body_length);
4515 case SF_OB_OUTBOUND_TEXT_HEADER:
4516 offset += dissect_outbound_text_header(sf_tree, tvb, offset, sf_body_length);
4518 case SF_OB_REQUEST_RECOVERY_DATA:
4519 proto_tree_add_item(sf_tree,
4527 offset += dissect_restart(sf_tree, tvb, offset, sf_body_length);
4529 case SF_OB_SELECT_COLOR_TABLE:
4530 proto_tree_add_item(sf_tree,
4531 hf_tn3270_color_command,
4537 case SF_OB_SET_CHECKPOINT_INTERVAL:
4538 proto_tree_add_item(sf_tree,
4544 proto_tree_add_item(sf_tree,
4551 case SF_OB_SET_MSR_CONTROL:
4552 offset += dissect_set_msr_control(sf_tree, tvb, offset, sf_body_length);
4554 case SF_OB_SET_PARTITION_CHARACTERISTICS:
4555 offset += dissect_set_partition_characteristics(sf_tree, tvb, offset, sf_body_length);
4557 case SF_OB_SET_PRINTER_CHARACTERISTICS:
4558 offset += dissect_set_printer_characteristics(sf_tree, tvb, offset, sf_body_length);
4560 case SF_OB_TYPE_1_TEXT_OUTBOUND:
4561 offset += dissect_type_1_text(sf_tree, tvb, offset, sf_body_length);
4564 DISSECTOR_ASSERT_NOT_REACHED();
4568 return (offset - start);
4571 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4572 /* call only with valid sf_id */
4574 process_outbound_inbound_structured_field(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4575 tn3270_conv_info_t *tn3270_info _U_, guint sf_id, gint sf_body_length)
4577 gint start = offset;
4580 case SF_OB_IB_DATA_CHAIN:
4581 offset += dissect_data_chain(tn3270_tree, tvb, offset, sf_body_length);
4583 case SF_OB_IB_DESTINATION_OR_ORIGIN:
4584 proto_tree_add_item(tn3270_tree,
4585 hf_tn3270_destination_or_origin_flags_input_control,
4590 proto_tree_add_item(tn3270_tree,
4596 proto_tree_add_item(tn3270_tree,
4597 hf_tn3270_destination_or_origin_doid,
4603 case SF_OB_IB_OBJECT_DATA:
4604 case SF_OB_IB_OBJECT_CONTROL:
4605 case SF_OB_IB_OBJECT_PICTURE:
4606 case SF_OB_IB_OEM_DATA: /* FIXME: Not really but same layout */
4607 offset += dissect_object_control(tn3270_tree, tvb, offset, sf_body_length);
4609 case SF_OB_IB_SAVE_OR_RESTORE_FORMAT:
4610 offset += dissect_save_or_restore_format(tn3270_tree, tvb, offset, sf_body_length);
4612 case SF_OB_IB_SELECT_IPDS_MODE:
4613 proto_tree_add_item(tn3270_tree,
4621 DISSECTOR_ASSERT_NOT_REACHED();
4625 return (offset - start);
4629 display_sf_hdr(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4630 gint sf_length, guint sf_id, guint sf_id_len, const gchar *sf_id_str)
4632 proto_tree *sf_tree;
4634 sf_tree = proto_tree_add_subtree_format(tn3270_tree, tvb, offset, sf_length,
4635 ett_sf, NULL, "Structured Field: %s", sf_id_str);
4637 proto_tree_add_item(sf_tree,
4638 hf_tn3270_sf_length,
4643 proto_tree_add_uint_format_value(sf_tree,
4644 (sf_id_len == 1) ? hf_tn3270_sf_single_byte_id : hf_tn3270_sf_double_byte_id,
4645 tvb, offset+2, sf_id_len,
4646 sf_id, "%s (0x%0*x)", sf_id_str, sf_id_len*2, sf_id);
4652 dissect_structured_fields(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
4653 tn3270_conv_info_t *tn3270_info, gboolean direction_inbound)
4655 proto_tree *sf_tree;
4660 const gchar *sf_id_str;
4664 while (tvb_reported_length_remaining(tvb, offset) >= 2) {
4666 /* Handle NULL bytes until we find a length value */
4667 /* XXX: An earlier version of the code for structured field */
4668 /* processing did this check only for inbound structured */
4669 /* fields. Should the same be done in this code which */
4670 /* combines handling for both inbound and outbound */
4671 /* structured fields ? */
4672 if ((sf_length = tvb_get_ntohs(tvb, offset)) == 0) {
4673 proto_tree_add_item(tn3270_tree,
4682 sf_id = tvb_get_guint8(tvb, offset+2);
4684 if ((sf_id == 0x0F) ||
4687 sf_id = (sf_id << 8) + tvb_get_guint8(tvb, offset+3);
4691 sf_id_str = try_val_to_str(sf_id, direction_inbound ?
4692 vals_inbound_structured_fields : vals_outbound_structured_fields);
4693 if (sf_id_str != NULL) {
4694 sf_tree = display_sf_hdr(tn3270_tree, tvb, offset,
4695 sf_length, sf_id, sf_id_len, sf_id_str);
4696 offset += (sf_id_len + 2);
4697 if (direction_inbound) {
4698 offset += process_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4701 offset += process_outbound_structured_field(sf_tree, pinfo, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4706 /* Not found above: See if an "outbound-inbound" field */
4707 sf_id_str = try_val_to_str(sf_id, vals_outbound_inbound_structured_fields);
4708 if (sf_id_str != NULL) {
4709 sf_tree = display_sf_hdr(tn3270_tree, tvb, offset,
4710 sf_length, sf_id, sf_id_len, sf_id_str);
4711 offset += (sf_id_len + 2);
4712 offset += process_outbound_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4717 sf_id_str = wmem_strdup_printf(wmem_packet_scope(), "Unknown [%0*x]", sf_id_len*2, sf_id);
4718 display_sf_hdr(tn3270_tree, tvb, offset, sf_length,
4719 sf_length, sf_id_len, sf_id_str);
4720 offset += sf_length;
4723 return (offset - start);
4727 /* Start: Handle WCC, Orders and Data */
4730 dissect_stop_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4732 gint start = offset;
4735 proto_tree_add_item(tn3270_tree,
4736 hf_tn3270_stop_address,
4741 is_oc_ge = tvb_get_guint8(tvb, offset);
4742 if (is_oc_ge != OC_GE) {
4743 proto_tree_add_item(tn3270_tree,
4744 hf_tn3270_character_code,
4751 return (offset - start);
4755 * From section "4.3.3 Set Buffer Address (SBA)" of the IBM document
4762 * XXX - what about 16-bit addressing?
4764 #define SBA_ADDRESS_FORMAT_MASK 0xC000
4765 #define SBA_ADDRESS_MASK_SHIFT 14
4766 #define SBA_ADDRESS_FORMAT(address) (((address) & SBA_ADDRESS_FORMAT_MASK) >> SBA_ADDRESS_MASK_SHIFT)
4768 #define SBA_ADDRESS_VALUE_MASK 0x3FFF
4769 #define SBA_ADDRESS_VALUE(address) ((address) & SBA_ADDRESS_VALUE_MASK)
4771 #define SBA_14_BIT_BINARY 0x0
4772 #define SBA_12_BIT_CODED_1 0x1
4773 #define SBA_RESERVED 0x2
4774 #define SBA_12_BIT_CODED_2 0x3
4777 dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint hf, tn3270_conv_info_t *tn3270_info)
4779 gint start = offset;
4780 guint16 buffer_addr;
4781 guint16 address_format, address_value;
4783 guint8 rowsx = tn3270_info->rows;
4784 guint8 colsx = tn3270_info->cols;
4786 buffer_addr = tvb_get_ntohs(tvb, offset);
4787 address_format = SBA_ADDRESS_FORMAT(buffer_addr);
4788 address_value = SBA_ADDRESS_VALUE(buffer_addr);
4791 * XXX - put the address format and address value into the protocol
4792 * tree as bitfields under these items?
4794 switch (address_format) {
4796 case SBA_14_BIT_BINARY:
4797 proto_tree_add_uint_format_value(tn3270_tree,
4801 "14-bit address, %u = row %u, column %u [assuming a %ux%u display] (0x%04x)",
4803 (address_value / colsx) + 1,
4804 (address_value % colsx) + 1,
4809 case SBA_12_BIT_CODED_1:
4810 case SBA_12_BIT_CODED_2:
4812 * This is a wacky encoding. At least as I read the IBM document
4813 * in question, the lower 6 bits of the first byte of the SBA
4814 * address, and the lower 6 bits of the second byte of the SBA
4815 * address, are combined into a 12-bit binary address. The upper
4816 * 2 bits of the first byte are the address format; the upper 2
4817 * bits of the second byte are ignored.
4819 b1 = (address_value >> 8) & 0x3F;
4820 b2 = (address_value >> 0) & 0x3F;
4821 address_value = (b1 << 6) | b2;
4822 proto_tree_add_uint_format_value(tn3270_tree,
4826 "12-bit address, %u = row %u, column %u [assuming a %ux%u display] (0x%04x)",
4828 (address_value / colsx) + 1,
4829 (address_value % colsx) + 1,
4835 proto_tree_add_uint_format_value(tn3270_tree,
4839 "Reserved (0x%04x)",
4845 return (offset - start);
4849 dissect_field_attribute_pair(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4851 gint start = offset;
4852 gint attribute_type;
4854 attribute_type = tvb_get_guint8(tvb, offset);
4855 proto_tree_add_item(tn3270_tree,
4856 hf_tn3270_attribute_type,
4861 switch (attribute_type) {
4862 case AT_ALL_CHARACTER_ATTRIBUTES:
4863 proto_tree_add_item(tn3270_tree,
4864 hf_tn3270_all_character_attributes,
4870 case AT_T3270_FIELD_ATTRIBUTE:
4871 offset += dissect_3270_field_attribute(tn3270_tree, tvb, offset);
4873 case AT_EXTENDED_HIGHLIGHTING:
4874 proto_tree_add_item(tn3270_tree,
4875 hf_tn3270_extended_highlighting,
4881 case AT_FOREGROUND_COLOR:
4882 case AT_BACKGROUND_COLOR:
4883 proto_tree_add_item(tn3270_tree,
4890 case AT_CHARACTER_SET:
4891 proto_tree_add_item(tn3270_tree,
4892 hf_tn3270_character_set,
4898 case AT_FIELD_OUTLINING:
4899 proto_tree_add_item(tn3270_tree,
4900 hf_tn3270_field_outlining,
4906 case AT_TRANSPARENCY:
4907 proto_tree_add_item(tn3270_tree,
4908 hf_tn3270_transparency,
4914 case AT_FIELD_VALIDATION:
4915 offset += dissect_3270_field_validation(tn3270_tree, tvb, offset);
4919 return (offset - start);
4923 dissect_field_attribute_pairs(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4925 gint start = offset;
4929 no_of_pairs = tvb_get_guint8(tvb, offset);
4930 proto_tree_add_item(tn3270_tree,
4931 hf_tn3270_number_of_attributes,
4937 for (i=0; i < no_of_pairs; i++) {
4938 offset += dissect_field_attribute_pair(tn3270_tree, tvb, offset);
4941 return (offset - start);
4945 dissect_orders_and_data(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
4947 gint start = offset;
4953 /* XXX: '0' is treated as data; See comment under add_data_until_next_order_code() */
4954 while (tvb_reported_length_remaining(tvb, offset) > 0) {
4955 order_code = tvb_get_guint8(tvb, offset);
4956 if ((order_code > 0) && (order_code <= OC_MAX)) { /* XXX: also 0xFF ?? */
4957 item = proto_tree_add_item(tn3270_tree,
4958 hf_tn3270_order_code,
4964 switch (order_code) {
4966 offset += dissect_3270_field_attribute(tn3270_tree, tvb, offset);
4970 offset += dissect_field_attribute_pairs(tn3270_tree, tvb, offset);
4973 offset += dissect_field_attribute_pair(tn3270_tree, tvb, offset);
4977 offset += dissect_stop_address(tn3270_tree, tvb, offset);
4980 proto_tree_add_item(tn3270_tree,
4981 hf_tn3270_character_code,
4988 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_buffer_address, tn3270_info);
4990 case OC_PT: /* XXX: This case was previously commented out; I don't know why */
4994 expert_add_info(pinfo, item, &ei_tn3270_order_code);
4999 offset += add_data_until_next_order_code(tn3270_tree, tvb, offset);
5003 return (offset - start);
5006 /* End: Handle WCC, Orders and Data */
5010 dissect_tn3270e_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
5013 proto_tree *tn3270e_hdr_tree;
5014 gint start = offset;
5017 static const hf_items fields[] = {
5018 { &hf_tn3270_tn3270e_data_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
5019 { &hf_tn3270_tn3270e_request_flag, NULL, 1, NULL, ENC_BIG_ENDIAN },
5020 { NULL, NULL, 0, NULL, 0 }
5023 data_type = tvb_get_guint8(tvb, offset);
5025 tn3270e_hdr_tree = proto_tree_add_subtree_format(tn3270_tree, tvb, offset, -1,
5026 ett_tn3270e_hdr, &pi, "TN3270E Header (Data Type: %s)",
5027 val_to_str_const(data_type, vals_tn3270_header_data_types, "Unknown"));
5029 offset += tn3270_add_hf_items(tn3270e_hdr_tree, tvb, offset,
5032 case TN3270E_3270_DATA:
5033 case TN3270E_SCS_DATA:
5034 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_3270_SCS, tvb, offset, 1, ENC_BIG_ENDIAN);
5036 case TN3270E_RESPONSE:
5037 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_response, tvb, offset, 1, ENC_BIG_ENDIAN);
5039 case TN3270E_BIND_IMAGE:
5040 case TN3270E_NVT_DATA:
5041 case TN3270E_REQUEST:
5042 case TN3270E_SSCP_LU_DATA:
5043 case TN3270E_UNBIND:
5045 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_unused, tvb, offset, 1, ENC_BIG_ENDIAN);
5050 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN);
5053 switch (data_type) {
5054 case TN3270E_BIND_IMAGE:
5055 case TN3270E_NVT_DATA:
5056 case TN3270E_REQUEST:
5057 case TN3270E_RESPONSE:
5058 case TN3270E_SCS_DATA:
5059 case TN3270E_SSCP_LU_DATA:
5060 case TN3270E_UNBIND:
5061 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_header_data, tvb, offset, -1, ENC_EBCDIC|ENC_NA);
5062 offset += tvb_reported_length_remaining(tvb, offset);
5068 proto_item_set_len(pi, offset - start);
5070 return (offset - start);
5073 /* Detect and Handle Direction of Stream */
5075 dissect_outbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
5078 gint start = offset;
5082 command_code = tvb_get_guint8(tvb, offset);
5084 /* XXX: Storing rows/cols each time they change is not valid */
5085 /* since packets can (will be) randomly selected for dissection */
5086 /* after the initial dissection pass. In actuality screen size */
5087 /* "state" needs to be associated in some manner with each */
5088 /* frame of a conversation. */
5089 switch (command_code) {
5092 tn3270_info->rows = 24;
5093 tn3270_info->cols = 80;
5097 tn3270_info->rows = tn3270_info->altrows;
5098 tn3270_info->cols = tn3270_info->altcols;
5104 item = proto_tree_add_item(tn3270_tree,
5105 hf_tn3270_command_code,
5111 switch (command_code) {
5121 offset += dissect_wcc(tn3270_tree, tvb, offset);
5122 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5126 offset += dissect_structured_fields(tn3270_tree, pinfo, tvb, offset, tn3270_info, FALSE);
5136 expert_add_info(pinfo, item, &ei_tn3270_command_code);
5140 return (offset - start);
5144 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */
5145 /* Dissect tvb as inbound */
5147 dissect_inbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
5149 gint start = offset;
5154 aid = tvb_get_guint8(tvb, offset);
5155 item = proto_tree_add_item(tn3270_tree,
5162 case AID_STRUCTURED_FIELD:
5163 offset += dissect_structured_fields(tn3270_tree, pinfo, tvb, offset, tn3270_info, TRUE);
5166 case AID_PA2_KEY_CNCL:
5169 /* Certain AID bytes need not be followed by anything */
5170 /* XXX: Is this the correct/complete set of AID bytes for this case ? */
5171 if (tvb_reported_length_remaining(tvb, offset) <= 0)
5174 case AID_READ_PARTITION_AID:
5175 case AID_NO_AID_GENERATED:
5176 case AID_NO_AID_GENERATED_PRINTER_ONLY:
5177 case AID_TRIGGER_ACTION:
5178 case AID_TEST_REQ_AND_SYS_REQ:
5203 case AID_CLEAR_PARTITION_KEY:
5205 case AID_SELECTOR_PEN_ATTENTION:
5206 case AID_OPERATOR_ID_READER:
5207 case AID_MAG_READER_NUMBER:
5208 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info);
5209 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5212 expert_add_info(pinfo, item, &ei_tn3270_aid);
5217 return (offset - start);
5222 dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
5224 proto_tree *tn3270_tree;
5227 conversation_t *conversation;
5228 tn3270_conv_info_t *tn3270_info = NULL;
5230 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TN3270");
5232 pinfo->fd->encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
5234 /* Do we have a conversation for this connection? */
5235 conversation = find_conversation_pinfo(pinfo, 0);
5236 if (conversation != NULL) {
5237 /* Do we already have a type and mechanism? */
5238 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5241 if (tn3270_info == NULL)
5244 pi = proto_tree_add_item(tree, proto_tn3270, tvb, offset, -1, ENC_NA);
5245 tn3270_tree = proto_item_add_subtree(pi, ett_tn3270);
5246 col_clear(pinfo->cinfo, COL_INFO);
5248 if (tn3270_info->extended) {
5249 offset += dissect_tn3270e_header(tn3270_tree, tvb, offset);
5252 if (tvb_reported_length_remaining(tvb, offset) <= 0)
5255 if (pinfo->srcport == tn3270_info->outbound_port) {
5256 col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data from Mainframe");
5259 col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data to Mainframe");
5263 while (tvb_reported_length_remaining(tvb, offset) > 0) {
5264 if (pinfo->srcport == tn3270_info->outbound_port) {
5265 offset += dissect_outbound_stream(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5268 offset += dissect_inbound_stream(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5273 return tvb_captured_length(tvb);
5277 add_tn3270_conversation(packet_info *pinfo, int tn3270e, gint model)
5279 conversation_t *conversation;
5280 tn3270_conv_info_t *tn3270_info;
5282 conversation = find_or_create_conversation(pinfo);
5285 * Do we already have a type and mechanism?
5287 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5288 if (tn3270_info == NULL) {
5289 /* No. Attach that information to the conversation, and add
5290 * it to the list of information structures.
5292 tn3270_info = wmem_new(wmem_file_scope(), tn3270_conv_info_t);
5294 tn3270_info->outbound_port = pinfo->destport;
5296 conversation_add_proto_data(conversation, proto_tn3270, tn3270_info);
5299 /* The maximum rows/cols is tied to the 3270 model number */
5303 tn3270_info->altrows = 24;
5304 tn3270_info->altcols = 80;
5307 tn3270_info->altrows = 32;
5308 tn3270_info->altcols = 80;
5311 tn3270_info->altrows = 43;
5312 tn3270_info->altcols = 80;
5315 tn3270_info->altrows = 27;
5316 tn3270_info->altcols = 132;
5319 tn3270_info->rows = 24;
5320 tn3270_info->cols = 80;
5322 tn3270_info->extended = tn3270e;
5327 find_tn3270_conversation(packet_info *pinfo)
5329 conversation_t *conversation = NULL;
5330 tn3270_conv_info_t *tn3270_info = NULL;
5333 * Do we have a conversation for this connection?
5335 conversation = find_conversation_pinfo(pinfo, 0);
5336 if (conversation != NULL) {
5337 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5338 if (tn3270_info != NULL) {
5340 * Do we already have a type and mechanism?
5349 proto_register_tn3270(void)
5351 static hf_register_info hf[] = {
5352 { &hf_tn3270_command_code,
5354 "tn3270.command_code",
5355 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5358 { &hf_tn3270_sf_length,
5359 { "Structured Field Length",
5361 FT_UINT16, BASE_DEC, NULL, 0x0,
5365 /* 3.4 Write Control Characters */
5366 { &hf_tn3270_wcc_nop,
5369 FT_BOOLEAN, 8, NULL, WCC_NOP,
5372 { &hf_tn3270_wcc_reset,
5375 FT_BOOLEAN, 8, NULL, WCC_RESET,
5378 { &hf_tn3270_wcc_printer1,
5380 "tn3270.wcc.printer1",
5381 FT_BOOLEAN, 8, NULL, WCC_PRINTER1,
5384 { &hf_tn3270_wcc_printer2,
5386 "tn3270.wcc.printer2",
5387 FT_BOOLEAN, 8, NULL, WCC_PRINTER2,
5390 { &hf_tn3270_wcc_start_printer,
5391 { "WCC Start Printer",
5392 "tn3270.wcc.start_printer",
5393 FT_BOOLEAN, 8, NULL, WCC_START_PRINTER,
5396 { &hf_tn3270_wcc_sound_alarm,
5397 { "WCC Sound Alarm",
5398 "tn3270.wcc.sound_alarm",
5399 FT_BOOLEAN, 8, NULL, WCC_SOUND_ALARM,
5402 { &hf_tn3270_wcc_keyboard_restore,
5403 { "WCC Keyboard Restore",
5404 "tn3270.wcc.keyboard_restore",
5405 FT_BOOLEAN, 8, NULL, WCC_KEYBOARD_RESTORE,
5408 { &hf_tn3270_wcc_reset_mdt,
5410 "tn3270.wcc.reset_mdt",
5411 FT_BOOLEAN, 8, NULL, WCC_RESET_MDT,
5415 /* 8.7 Copy Control Codes (CCC) */
5417 { "Copy Control Code",
5419 FT_UINT8, BASE_HEX, NULL, 0,
5422 { &hf_tn3270_ccc_coding,
5424 "tn3270.ccc_coding",
5425 FT_UINT8, BASE_HEX, NULL, CCC_GRAPHIC_CONVERT_MASK,
5428 { &hf_tn3270_ccc_printout,
5429 { "Printout Format",
5430 "tn3270.ccc_printout",
5431 FT_UINT8, BASE_HEX, VALS(ccc_vals_printout_format), CCC_PRINT_BITS_MASK,
5434 { &hf_tn3270_ccc_start_print,
5435 { "The start-print bit",
5436 "tn3270.ccc_start_print",
5437 FT_BOOLEAN, 8, NULL, CCC_START_PRINT,
5440 { &hf_tn3270_ccc_sound_alarm,
5441 { "The sound-alarm bit",
5442 "tn3270.ccc_sound_alarm",
5443 FT_BOOLEAN, 8, NULL, CCC_SOUND_ALARM,
5446 { &hf_tn3270_ccc_copytype,
5447 { "Type of Data to be Copied",
5448 "tn3270.ccc_copytype",
5449 FT_UINT8, BASE_HEX, VALS(ccc_vals_copytype), CCC_ATTRIBUTE_BITS_MASK,
5453 /* 4.4.1 Field Attributes */
5454 { &hf_tn3270_field_attribute,
5455 { "3270 Field Attribute",
5456 "tn3270.field_attribute",
5457 FT_UINT8, BASE_HEX, NULL, 0,
5460 { &hf_tn3270_fa_graphic_convert,
5461 { "Graphic Convert",
5462 "tn3270.fa.graphic_convert",
5463 FT_UINT8, BASE_HEX, NULL, FA_GRAPHIC_CONVERT_MASK,
5466 { &hf_tn3270_fa_protected,
5468 "tn3270.fa.protected",
5469 FT_BOOLEAN, 8, NULL, FA_PROTECTED,
5472 { &hf_tn3270_fa_numeric,
5474 "tn3270.fa.numeric",
5475 FT_BOOLEAN, 8, NULL, FA_NUMERIC,
5478 { &hf_tn3270_fa_display,
5480 "tn3270.fa.display",
5481 FT_UINT8, BASE_HEX, VALS(vals_fa_display), FA_DISPLAY_BITS_MASK,
5484 { &hf_tn3270_fa_reserved,
5486 "tn3270.fa.reserved",
5487 FT_BOOLEAN, 8, NULL, FA_RESERVED,
5490 { &hf_tn3270_fa_modified,
5492 "tn3270.fa.modified",
5493 FT_BOOLEAN, 8, NULL, FA_MODIFIED,
5498 { &hf_tn3270_order_code,
5500 "tn3270.order_code",
5501 FT_UINT8, BASE_HEX, VALS(vals_order_codes), 0x0,
5504 { &hf_tn3270_character_code,
5506 "tn3270.character_code",
5507 FT_UINT8, BASE_HEX, NULL, 0x0,
5510 { &hf_tn3270_stop_address,
5512 "tn3270.stop_address",
5513 FT_UINT16, BASE_DEC, NULL, 0x0,
5516 { &hf_tn3270_attribute_type,
5518 "tn3270.attribute_type",
5519 FT_UINT8, BASE_HEX, VALS(vals_attribute_types), 0x0,
5522 { &hf_tn3270_extended_highlighting,
5523 { "Extended Highlighting",
5524 "tn3270.extended_highlighting",
5525 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
5531 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
5534 { &hf_tn3270_character_set,
5536 "tn3270.character_set",
5537 FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(rvals_at_character_set), 0x0,
5540 { &hf_tn3270_field_outlining,
5541 { "Field Outlining",
5542 "tn3270.field_outlining",
5543 FT_UINT8, BASE_HEX, VALS(vals_at_field_outlining), 0x0,
5546 { &hf_tn3270_transparency,
5548 "tn3270.transparency",
5549 FT_UINT8, BASE_HEX, VALS(vals_at_transparency), 0x0,
5553 { &hf_tn3270_field_validation_mandatory_fill,
5554 { "3270 Field validation_mandatory_fill",
5555 "tn3270.field_validation_mandatory_fill",
5556 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_mandatory_fill), AT_FV_MANDATORY_FILL,
5559 { &hf_tn3270_field_validation_mandatory_entry,
5560 { "3270 Field validation_mandatory_entry",
5561 "tn3270.field_validation_mandatory_entry",
5562 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_mandatory_entry), AT_FV_MANDATORY_ENTRY,
5565 { &hf_tn3270_field_validation_trigger,
5566 { "3270 Field validation_trigger",
5567 "tn3270.field_validation_trigger",
5568 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_trigger), AT_FV_TRIGGER,
5572 { &hf_tn3270_all_character_attributes,
5573 { "all_character_attributes",
5574 "tn3270.all_character_attributes",
5575 FT_UINT8, BASE_HEX, NULL, 0x0,
5579 { "Attention Identification",
5581 FT_UINT8, BASE_HEX, VALS(vals_attention_identification_bytes), 0x0,
5585 { &hf_tn3270_buffer_address,
5587 "tn3270.buffer_address",
5588 FT_UINT16, BASE_HEX, NULL, 0x0,
5592 /* Self Defining Parameters */
5593 { &hf_tn3270_sdp_ln,
5594 { "Length of this Self-Defining Parameter",
5596 FT_UINT8, BASE_DEC, NULL, 0x0,
5599 { &hf_tn3270_sdp_id,
5600 { "Self-Defining Parameter ID",
5602 FT_UINT8, BASE_HEX, NULL, 0x0,
5605 /* Self Defining Parameters */
5607 /* 5.6 - Begin/End of File */
5608 { &hf_tn3270_begin_end_flags1,
5609 { "Begin End Flags1",
5610 "tn3270.begin_end_flags1",
5611 FT_UINT8, BASE_HEX, NULL, 0x0,
5614 { &hf_tn3270_begin_end_flags2,
5615 { "Begin End Flags2",
5616 "tn3270.begin_end_flags2",
5617 FT_UINT8, BASE_HEX, NULL, 0x0,
5620 /* END - 5.6 - Begin/End of File */
5622 /* 5.7 - Create Partition */
5623 { &hf_tn3270_partition_id,
5625 "tn3270.partition_id",
5626 FT_UINT8, BASE_HEX, NULL, 0x0,
5629 { &hf_tn3270_partition_uom,
5630 { "The unit of measure and address mode",
5631 "tn3270.partition_uom",
5632 FT_UINT8, BASE_HEX, NULL, 0x0,
5635 { &hf_tn3270_partition_flags,
5637 "tn3270.partition_flags",
5638 FT_UINT8, BASE_HEX, NULL, 0x0,
5641 { &hf_tn3270_partition_height,
5642 { "The height of the presentation space",
5643 "tn3270.partition_height",
5644 FT_UINT16, BASE_DEC, NULL, 0x0,
5647 { &hf_tn3270_partition_width,
5648 { "The width of the presentation space",
5649 "tn3270.partition_width",
5650 FT_UINT16, BASE_DEC, NULL, 0x0,
5653 { &hf_tn3270_partition_rv,
5654 { "The y, or row, origin of the viewport relative to the top edge of the usable area",
5655 "tn3270.partition_rv",
5656 FT_UINT16, BASE_DEC, NULL, 0x0,
5659 { &hf_tn3270_partition_cv,
5660 { "The x, or column, origin of the viewport relative to the left side of the usable area",
5661 "tn3270.partition_cv",
5662 FT_UINT16, BASE_DEC, NULL, 0x0,
5665 { &hf_tn3270_partition_hv,
5666 { "The height of the viewport",
5667 "tn3270.partition_hv",
5668 FT_UINT16, BASE_DEC, NULL, 0x0,
5671 { &hf_tn3270_partition_wv,
5672 { "The width of the viewport",
5673 "tn3270.partition_wv",
5674 FT_UINT16, BASE_DEC, NULL, 0x0,
5677 { &hf_tn3270_partition_rw,
5678 { "The y, or row, origin of the window relative to the top edge of the presentation space",
5679 "tn3270.partition_rw",
5680 FT_UINT16, BASE_DEC, NULL, 0x0,
5683 { &hf_tn3270_partition_cw,
5684 { "The x, or column, origin of the window relative to the left edge of the presentation space",
5685 "tn3270.partition_cw",
5686 FT_UINT16, BASE_DEC, NULL, 0x0,
5689 { &hf_tn3270_partition_rs,
5690 { "The number of units to be scrolled in a vertical multiple scroll",
5691 "tn3270.partition_rs",
5692 FT_UINT16, BASE_DEC, NULL, 0x0,
5695 { &hf_tn3270_partition_res,
5697 "tn3270.partition_res",
5698 FT_UINT16, BASE_DEC, NULL, 0x0,
5701 { &hf_tn3270_partition_pw,
5702 { "The number of points in the horizontal direction in a character cell in this presentation space",
5703 "tn3270.partition_pw",
5704 FT_UINT8, BASE_HEX, NULL, 0x0,
5707 { &hf_tn3270_partition_ph,
5708 { "The number of points in the vertical direction in a character cell in this presentation space",
5709 "tn3270.partition_ph",
5710 FT_UINT16, BASE_DEC, NULL, 0x0,
5714 { &hf_tn3270_partition_command,
5715 { "Partition Command",
5716 "tn3270.partition_command",
5717 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5720 /* End - 5.7 - Create Partition */
5722 /* 5.9 - Erase/Reset */
5723 { &hf_tn3270_erase_flags,
5725 "tn3270.erase_flags",
5726 FT_UINT8, BASE_HEX, NULL, 0x0,
5729 /* End - 5.9 - Erase/Reset */
5731 /* 5.10 - Load Color Table */
5732 { &hf_tn3270_load_color_command,
5734 "tn3270.load_color_command",
5735 FT_BYTES, BASE_NONE, NULL, 0x0,
5738 /* End - 5.10 - Load Color Table */
5740 /* 5.11 - Load Format Storage */
5741 { &hf_tn3270_load_format_storage_flags1,
5743 "tn3270.load_format_storage_flags1",
5744 FT_UINT8, BASE_HEX, NULL, 0x0,
5747 { &hf_tn3270_load_format_storage_flags2,
5748 { "Flags (Reserved)",
5749 "tn3270.load_format_storage_flags2",
5750 FT_UINT8, BASE_HEX, NULL, 0x0,
5753 { &hf_tn3270_load_format_storage_operand,
5755 "tn3270.load_format_storage_operand",
5756 FT_UINT8, BASE_HEX, VALS(vals_load_storage_format_operand), 0x0,
5759 { &hf_tn3270_load_format_storage_localname,
5760 { "Local name for user selectable formats",
5761 "tn3270.load_format_storage_localname",
5762 FT_STRING, BASE_NONE, NULL, 0x0,
5765 { &hf_tn3270_format_group,
5766 { "Format Group name",
5767 "tn3270.format_group_name",
5768 FT_STRING, BASE_NONE, NULL, 0x0,
5771 { &hf_tn3270_format_name,
5773 "tn3270.format_name",
5774 FT_STRING, BASE_NONE, NULL, 0x0,
5777 { &hf_tn3270_load_format_storage_format_data,
5779 "tn3270.load_format_storage_format_data",
5780 FT_STRING, BASE_NONE, NULL, 0x0,
5782 /* END - 5.11 - Load Format Storage */
5784 /* 5.12 - Load Line Type */
5785 { &hf_tn3270_load_line_type_command,
5786 { "Line Type Command",
5787 "tn3270.load_line_type_command",
5788 FT_BYTES, BASE_NONE, NULL, 0x0,
5792 /* 5.13 - Load Programmed Symbols */
5793 { &hf_tn3270_ps_flags,
5796 FT_UINT8, BASE_HEX, NULL, 0x0,
5799 { &hf_tn3270_ps_lcid,
5800 { "Local character set ID",
5802 FT_UINT8, BASE_HEX, NULL, 0x0,
5805 { &hf_tn3270_ps_char,
5806 { "Beginning code point X'41' through X'FE'",
5808 FT_UINT8, BASE_HEX, NULL, 0x0,
5811 { &hf_tn3270_ps_rws,
5812 { "Loadable Character Set RWS Number",
5814 FT_UINT8, BASE_HEX, NULL, 0x0,
5817 { &hf_tn3270_extended_ps_length,
5818 { "Length of parameters for extended form, including the length parameter",
5819 "tn3270.extended_ps_length",
5820 FT_UINT8, BASE_HEX, NULL, 0x0,
5823 { &hf_tn3270_extended_ps_flags,
5825 "tn3270.extended_ps_flags",
5826 FT_UINT8, BASE_HEX, NULL, 0x0,
5829 { &hf_tn3270_extended_ps_lw,
5830 { "Number of X-units in character cell (width of character matrixes)",
5831 "tn3270.extended_ps_lw",
5832 FT_UINT8, BASE_HEX, NULL, 0x0,
5835 { &hf_tn3270_extended_ps_lh,
5836 { "Number of Y-units in character cell (depth ofcharacter matrixes)",
5837 "tn3270.extended_ps_lh",
5838 FT_UINT8, BASE_HEX, NULL, 0x0,
5841 { &hf_tn3270_extended_ps_subsn,
5843 "tn3270.extended_ps_subsn",
5844 FT_UINT8, BASE_HEX, NULL, 0x0,
5847 { &hf_tn3270_extended_ps_color,
5849 "tn3270.extended_ps_color",
5850 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
5853 { &hf_tn3270_extended_ps_stsubs,
5854 { "Starting Subsection Identifier",
5855 "tn3270.extended_ps_stsubs",
5856 FT_UINT8, BASE_HEX, NULL, 0x0,
5859 { &hf_tn3270_extended_ps_echar,
5860 { "Ending code point",
5861 "tn3270.extended_ps_echar",
5862 FT_UINT8, BASE_HEX, NULL, 0x0,
5865 { &hf_tn3270_extended_ps_nw,
5866 { "Number of width pairs",
5867 "tn3270.extended_ps_nw",
5868 FT_UINT8, BASE_HEX, NULL, 0x0,
5871 { &hf_tn3270_extended_ps_nh,
5872 { "Number of height pairs",
5873 "tn3270.extended_ps_nh",
5874 FT_UINT8, BASE_HEX, NULL, 0x0,
5877 { &hf_tn3270_extended_ps_res,
5879 "tn3270.extended_ps_res",
5880 FT_UINT8, BASE_HEX, NULL, 0x0,
5883 /* END - 5.13 - Load Programmed Symbols */
5885 /* 5.15 - Outbound Text Header */
5886 /* Note: some of these entries multiply used */
5887 { &hf_tn3270_outbound_text_header_operation_type,
5888 { "Outbound Text Operation Type",
5889 "tn3270.outbound_text_operation_type",
5890 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5896 FT_UINT8, BASE_HEX, NULL, 0x0,
5900 { "Cursor row offset",
5902 FT_UINT16, BASE_DEC, NULL, 0x0,
5906 { "Cursor column offset",
5908 FT_UINT16, BASE_DEC, NULL, 0x0,
5911 { &hf_tn3270_outbound_text_header_lhdr,
5912 { "Header length includes itself",
5913 "tn3270.outbound_text_header_lhdr",
5914 FT_UINT16, BASE_DEC, NULL, 0x0,
5917 { &hf_tn3270_outbound_text_header_hdr,
5918 { "Initial format controls",
5919 "tn3270.outbound_text_header_hdr",
5920 FT_BYTES, BASE_NONE, NULL, 0x0,
5923 /* END - 5.15 - Outbound Text Header */
5925 /* 5.16 - Outbound 3270DS */
5929 FT_UINT8, BASE_HEX, NULL, 0x0,
5932 /* END - 5.16 - Outbound 3270DS */
5934 /* 5.17 - Present Absolute Format */
5936 { "Format Presentation Command",
5938 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5941 /* END - 5.17 - Present Absolute Format */
5943 /* 5.18 - Present Relative Format */
5945 { "Format Offset Value",
5947 FT_UINT16, BASE_DEC, NULL, 0x0,
5950 /* End - 5.18 - Present Relative Format */
5952 /* 5.19 - Read Partition */
5953 { &hf_tn3270_read_partition_operation_type,
5954 { "Read Partition Operation Type",
5955 "tn3270.read_partition_reqtyp",
5956 FT_UINT8, BASE_HEX, VALS(vals_read_partition_operation_type), 0x0,
5959 { &hf_tn3270_read_partition_reqtyp,
5960 { "Read Partition Request Type",
5961 "tn3270.read_partition_reqtyp",
5962 FT_UINT8, BASE_HEX, VALS(vals_read_partition_reqtype), READ_PARTITION_REQTYPE_MASK,
5965 /* End - 5.19 - Read Partition */
5967 /* 5.22 - Restart */
5968 { &hf_tn3270_start_page,
5969 { "Number of pages to skip on restart",
5970 "tn3270.start_page",
5971 FT_UINT16, BASE_DEC, NULL, 0x0,
5974 { &hf_tn3270_start_line,
5975 { "Number of lines to skip on page for restart",
5976 "tn3270.start_line",
5977 FT_UINT16, BASE_DEC, NULL, 0x0,
5980 { &hf_tn3270_scs_data,
5981 { "SCS data (noncompressed and noncompacted) to set up for restart",
5983 FT_BYTES, BASE_NONE, NULL, 0x0,
5986 /* End - 5.22 - Restart */
5988 /* 5.24 - Select Color Table */
5989 { &hf_tn3270_color_command,
5991 "tn3270.color_command",
5992 FT_UINT16, BASE_HEX, NULL, 0x0,
5995 /* 5.24 - Select Color Table */
5997 /* 5.26 - Set Checkpoint Interval */
5998 { &hf_tn3270_interval,
5999 { "Checkpoint interval",
6001 FT_UINT8, BASE_HEX, NULL, 0x0,
6002 "Specifies the number of pages in the interval between terminal checkpoints", HFILL }
6004 /* End - 5.26 - Set Checkpoint Interval */
6006 /* 5.27 - Set MSR Interval */
6007 { &hf_tn3270_msr_type,
6010 FT_UINT8, BASE_HEX, NULL, 0x0,
6013 { &hf_tn3270_msr_state_mask,
6015 "tn3270.msr_state_mask",
6016 FT_UINT8, BASE_HEX, NULL, 0x0,
6019 { &hf_tn3270_msr_user,
6022 FT_BOOLEAN, 8, NULL, 0x80,
6025 { &hf_tn3270_msr_locked,
6027 "tn3270.msr.locked",
6028 FT_BOOLEAN, 8, NULL, 0x40,
6031 { &hf_tn3270_msr_auto,
6034 FT_BOOLEAN, 8, NULL, 0x20,
6037 { &hf_tn3270_msr_ind1,
6038 { "Audible Ind 1 Suppress",
6040 FT_BOOLEAN, 8, NULL, 0x10,
6043 { &hf_tn3270_msr_ind2,
6044 { "Audible Ind 2 Suppress",
6046 FT_BOOLEAN, 8, NULL, 0x08,
6049 { &hf_tn3270_msr_state_value,
6050 { "State Value", "tn3270.msr_state_value",
6051 FT_UINT8, BASE_HEX, NULL, 0x0,
6054 { &hf_tn3270_msr_ind_mask,
6056 "tn3270.msr_ind_mask",
6057 FT_UINT8, BASE_HEX, NULL, 0x0,
6060 { &hf_tn3270_msr_ind_value,
6061 { "Indicator Value",
6062 "tn3270.msr_ind_value",
6063 FT_UINT8, BASE_HEX, NULL, 0x0,
6066 /* END - 5.27 - Set MSR Interval */
6068 /* 5.28 - Set Partition Characteristics */
6069 { &hf_tn3270_spc_sdp_ot,
6070 { "Top edge outline thickness",
6071 "tn3270.spc_sdp_ot",
6072 FT_UINT8, BASE_DEC, NULL, 0x0,
6075 { &hf_tn3270_spc_sdp_ob,
6076 { "Bottom edge outline thickness",
6077 "tn3270.spc_sdp_ob",
6078 FT_UINT8, BASE_DEC, NULL, 0x0,
6081 { &hf_tn3270_spc_sdp_ol,
6082 { "Left edge outline thickness",
6083 "tn3270.spc_sdp_ol",
6084 FT_UINT8, BASE_DEC, NULL, 0x0,
6087 { &hf_tn3270_spc_sdp_or,
6088 { "Right edge outline thickness",
6089 "tn3270.spc_sdp_or",
6090 FT_UINT8, BASE_DEC, NULL, 0x0,
6093 { &hf_tn3270_spc_sdp_eucflags,
6095 "tn3270.spc_sdp_eucflags",
6096 FT_UINT8, BASE_HEX, NULL, 0x0,
6099 /* END - 5.28 - Set Partition Characteristics */
6101 /* 5.29 - Set Printer Characteristics */
6102 { &hf_tn3270_printer_flags,
6104 "tn3270.printer_flags",
6105 FT_UINT8, BASE_HEX, NULL, 0x0,
6108 { &hf_tn3270_spc_sdp_srepc,
6109 { "Set/Reset Early Print Complete",
6110 "tn3270.spc_sdp_srepc",
6111 FT_UINT8, BASE_HEX, NULL, 0x0,
6114 /* END - 5.29 - Set Printer Characteristics */
6116 /* 5.30 - Set Reply Mode */
6117 /* hf_tn3270_mode also used for 6.42: Query Reply (modes) */
6121 FT_UINT8, BASE_HEX, VALS(vals_reply_modes), 0x0,
6124 { &hf_tn3270_reply_mode_attr_list,
6125 { "Type codes for the attribute types",
6126 "tn3270.reply_mode_attr_list",
6127 FT_UINT8, BASE_HEX, VALS(vals_attribute_types), 0x0,
6130 /* END - 5.30 - Set Reply Mode */
6132 /* 5.34 - Data Chain */
6133 { &hf_tn3270_data_chain_fields,
6134 { "Data Chain Fields",
6135 "tn3270.data_chain_fields",
6136 FT_UINT8, BASE_HEX, NULL, 0x0,
6139 { &hf_tn3270_data_chain_group,
6140 { "Data Chain Group",
6141 "tn3270.data_chain_group",
6142 FT_UINT8, BASE_HEX, VALS(vals_data_chain_group), DATA_CHAIN_GROUP_MASK,
6145 { &hf_tn3270_data_chain_inbound_control,
6146 { "Data Chain Inbound Control",
6147 "tn3270.data_chain_inbound_control",
6148 FT_UINT8, BASE_HEX, VALS(vals_data_chain_inbound_control), DATA_CHAIN_INBOUND_CONTROL_MASK,
6151 /* END - 5.34 - Data Chain */
6153 /* 5.35 - Destination/Origin */
6154 { &hf_tn3270_destination_or_origin_flags_input_control,
6156 "tn3270.destination_or_origin_flags_input_control",
6157 FT_UINT8, BASE_HEX, VALS(vals_destination_or_origin_flags_input_control), DESTINATION_OR_ORIGIN_FLAGS_INPUT_CONTROL_MASK,
6160 { &hf_tn3270_destination_or_origin_doid,
6162 "tn3270.destination_or_origin_doid",
6163 FT_UINT16, BASE_HEX, NULL, 0x0,
6166 /* END - 5.35 - Destination/Origin */
6169 /* 5.36 - Object Control */
6170 { &hf_tn3270_object_control_flags,
6172 "tn3270.object_control_flags",
6173 FT_UINT8, BASE_HEX, NULL, 0x0,
6176 { &hf_tn3270_object_type,
6178 "tn3270.object_type",
6179 FT_UINT8, BASE_HEX, VALS(vals_oc_type), 0x0,
6182 /* END - 5.36 - Object Control */
6184 /* 5.40 - Save/Restore Format */
6185 { &hf_tn3270_save_or_restore_format_flags,
6187 "tn3270.save_or_restore_format_flags",
6188 FT_UINT8, BASE_HEX, NULL, 0x0,
6191 { &hf_tn3270_srf_fpcb,
6192 { "Contents of the FPCB that is to be saved or restored",
6194 FT_BYTES, BASE_NONE, NULL, 0x0,
6198 /* 5.40 - Save/Restore Format */
6199 { &hf_tn3270_type_1_text_outbound_data,
6200 { "Type 1 text outbound data",
6201 "tn3270.type_1_text_outbound_data",
6202 FT_BYTES, BASE_NONE, NULL, 0x0,
6206 /* 6.2 - Exception/Status */
6207 { &hf_tn3270_exception_or_status_flags,
6209 "tn3270.exception_or_status_flags",
6210 FT_UINT8, BASE_HEX, NULL, 0x0,
6213 { &hf_tn3270_sdp_excode,
6215 "tn3270.sdp_excode",
6216 FT_UINT16, BASE_DEC, VALS(vals_sdp_excode), 0x0,
6219 { &hf_tn3270_sdp_statcode,
6221 "tn3270.sdp_statcode",
6222 FT_UINT16, BASE_DEC, VALS(vals_sdp_statcode), 0x0,
6225 { &hf_tn3270_sdp_ngl,
6226 { "Number of groups currently assigned",
6228 FT_UINT16, BASE_DEC, NULL, 0x0,
6231 { &hf_tn3270_sdp_nml,
6232 { "Number of formats currently loaded",
6234 FT_UINT16, BASE_DEC, NULL, 0x0,
6237 { &hf_tn3270_sdp_nlml,
6238 { "Number of local names used",
6240 FT_UINT16, BASE_DEC, NULL, 0x0,
6243 { &hf_tn3270_sdp_stor,
6244 { "Amount of format storage space available (KB)",
6246 FT_UINT32, BASE_DEC, NULL, 0x0,
6249 /* 6.2 - Exception/Status */
6251 /* 6.3 - Inbound Text Header */
6255 FT_UINT16, BASE_DEC, NULL, 0x0,
6259 { "Row offset of window origin",
6261 FT_UINT16, BASE_DEC, NULL, 0x0,
6267 FT_UINT16, BASE_DEC, NULL, 0x0,
6271 { "Column Offset of Window Origin",
6273 FT_UINT16, BASE_DEC, NULL, 0x0,
6276 /* END - 6.3 - Inbound Text Header */
6278 /* 6.4 Inbound 3270DS */
6279 { &hf_tn3270_cursor_address,
6281 "tn3270.cursor_address",
6282 FT_UINT16, BASE_HEX, NULL, 0x0,
6285 /* END - 6.4 Inbound 3270DS */
6287 /* 6.5 - Recovery Data */
6288 { &hf_tn3270_recovery_data_flags,
6290 "tn3270.recovery_data_flags",
6291 FT_UINT8, BASE_HEX, NULL, 0x0,
6295 { "SLD -- Set line density parameter in effect at the checkpoint",
6297 FT_UINT8, BASE_HEX, NULL, 0x0,
6300 { &hf_tn3270_charset,
6301 { "Character set parameter of Set Attribute control in effect at the checkpoint",
6303 FT_UINT8, BASE_HEX, NULL, 0x0,
6306 { &hf_tn3270_vertical,
6307 { "Byte offset from Checkpoint Interval structured field to the Set Vertical Format control in effect for the checkpoint",
6309 FT_UINT32, BASE_DEC, NULL, 0x0,
6312 { &hf_tn3270_v_offset,
6313 { "Byte offset within the string control byte string or the SVF character",
6315 FT_UINT16, BASE_DEC, NULL, 0x0,
6318 { &hf_tn3270_v_sequence,
6319 { "RU sequence number",
6320 "tn3270.v_sequence",
6321 FT_UINT16, BASE_DEC, NULL, 0x0,
6324 { &hf_tn3270_v_length,
6325 { "Length of the SVF character string required for restart",
6327 FT_UINT16, BASE_DEC, NULL, 0x0,
6331 { "Set Primary Density parameter in effect at the checkpoint",
6333 FT_UINT16, BASE_HEX, NULL, 0x0,
6336 { &hf_tn3270_horizon,
6337 { "Byte offset from Checkpoint Interval structured field to the Set Horizontal Format control in effect for the checkpoint",
6339 FT_UINT32, BASE_DEC, NULL, 0x0,
6342 { &hf_tn3270_h_offset,
6343 { "Byte offset from Checkpoint Interval structured field to the Set Horizontal Format control in effect for the checkpoint",
6345 FT_UINT32, BASE_DEC, NULL, 0x0,
6348 { &hf_tn3270_h_sequence,
6349 { "RU sequence number",
6350 "tn3270.h_sequence",
6351 FT_UINT16, BASE_DEC, NULL, 0x0,
6354 { &hf_tn3270_h_length,
6355 { "Length of the SHF character string required for restart",
6357 FT_UINT16, BASE_DEC, NULL, 0x0,
6360 { &hf_tn3270_hilite,
6363 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
6367 { "Number of pages printed since the checkpoint",
6369 FT_UINT16, BASE_DEC, NULL, 0x0,
6373 { "Number of lines printed since the checkpoint",
6375 FT_UINT16, BASE_DEC, NULL, 0x0,
6378 { &hf_tn3270_checkpoint,
6379 { "Byte offset from Set Checkpoint Interval structured field to the first"
6380 " character afterhe code point or character that caused an eject to the"
6381 " checkpointed page",
6382 "tn3270.checkpoint",
6383 FT_UINT32, BASE_DEC, NULL, 0x0,
6386 { &hf_tn3270_c_offset,
6387 { "Byte offset within the String Control Byte string or structured field of"
6388 " the checkpointed character",
6390 FT_UINT16, BASE_DEC, NULL, 0x0,
6393 { &hf_tn3270_c_sequence,
6394 { "RU sequence number of the RU containing the checkpoint character",
6395 "tn3270.c_sequence",
6396 FT_UINT16, BASE_DEC, NULL, 0x0,
6399 { &hf_tn3270_c_seqoff,
6400 { "Byte offset within the RU of the checkpointed character",
6402 FT_UINT16, BASE_DEC, NULL, 0x0,
6405 { &hf_tn3270_c_scsoff,
6406 { "Byte offset within the parameterized SCS control code (for example, TRN) of the checkpointed character.",
6408 FT_UINT16, BASE_DEC, NULL, 0x0,
6412 { "Prime compression character",
6414 FT_UINT8, BASE_HEX, NULL, 0x0,
6417 /* END - 6.5 - Recovery Data */
6419 /* 6.9 - Query Reply (Alphanumeric Partitions) */
6421 { "Max number of alphanumeric partitions",
6423 FT_UINT8, BASE_DEC, NULL, 0x0,
6427 { "Total available partition storage",
6429 FT_UINT16, BASE_DEC, NULL, 0x0,
6432 { &hf_tn3270_query_reply_alphanumeric_flags,
6435 FT_UINT8, BASE_HEX, NULL, 0x0,
6438 { &hf_tn3270_ap_vertical_scrolling,
6439 { "Vertical Scrolling Supported",
6440 "tn3270.ap_vertical_scrolling",
6441 FT_BOOLEAN, 8, NULL, QR_AP_VERTWIN,
6444 { &hf_tn3270_ap_horizontal_scrolling,
6445 { "Horizontal Scrolling Supported",
6446 "tn3270.ap_horizontal_scrolling",
6447 FT_BOOLEAN, 8, NULL, QR_AP_HORWIN,
6450 { &hf_tn3270_ap_apres1,
6453 FT_BOOLEAN, 8, NULL, QR_AP_APRES1,
6456 { &hf_tn3270_ap_apa,
6457 { "All Points addressability supported",
6459 FT_BOOLEAN, 8, NULL, QR_AP_APA_FLG,
6463 { "Partition protection supported",
6465 FT_BOOLEAN, 8, NULL, QR_AP_PROT,
6469 { "Presentation space local copy supported",
6471 FT_BOOLEAN, 8, NULL, QR_AP_LCOPY,
6475 { "Modify Partition supported",
6477 FT_BOOLEAN, 8, NULL, QR_AP_MODPART,
6480 { &hf_tn3270_ap_apres2,
6483 FT_BOOLEAN, 8, NULL, QR_AP_APRES2,
6488 { "Character multiplier",
6490 FT_UINT8, BASE_DEC, NULL, 0x0,
6496 FT_UINT8, BASE_DEC, NULL, 0x0,
6500 { "Column overhead",
6502 FT_UINT8, BASE_DEC, NULL, 0x0,
6508 FT_UINT16, BASE_DEC, NULL, 0x0,
6511 /* END - 6.9 - Query Reply (Alphanumeric Partitions) */
6513 /* 6.12 - Query Reply (Character Sets) */
6514 { &hf_tn3270_character_sets_flags1,
6516 "tn3270.character_sets_flags1",
6517 FT_UINT8, BASE_HEX, NULL, 0x0,
6521 { "Graphic Escape supported",
6523 FT_BOOLEAN, 8, NULL, QR_CS_ALT,
6527 { "Multiple LCIDs are supported",
6529 FT_BOOLEAN, 8, NULL, QR_CS_MULTID,
6532 { &hf_tn3270_cs_lps,
6533 { "Load PSSF is supported",
6535 FT_BOOLEAN, 8, NULL, QR_CS_LOADABLE,
6538 { &hf_tn3270_cs_lpse,
6539 { "Load PS EXTENDED is supported",
6541 FT_BOOLEAN, 8, NULL, QR_CS_EXT,
6545 { "More than one size of character slot is supported",
6547 FT_BOOLEAN, 8, NULL, QR_CS_MS,
6550 { &hf_tn3270_cs_ch2,
6551 { "Two-byte coded character sets are supported",
6553 FT_BOOLEAN, 8, NULL, QR_CS_CH2,
6557 { "CGCSGID is present",
6559 FT_BOOLEAN, 8, NULL, QR_CS_GF,
6562 { &hf_tn3270_cs_res,
6565 FT_BOOLEAN, 8, NULL, QR_CS_CSRES,
6569 { &hf_tn3270_character_sets_flags2,
6571 "tn3270.character_sets_flags2",
6572 FT_UINT8, BASE_HEX, NULL, 0x0,
6575 { &hf_tn3270_cs_res2,
6578 FT_BOOLEAN, 8, NULL, QR_CS_CSRES2,
6581 { &hf_tn3270_cs_pscs,
6582 { "Load PS slot size match not required",
6584 FT_BOOLEAN, 8, NULL, QR_CS_PSCS,
6587 { &hf_tn3270_cs_res3,
6590 FT_BOOLEAN, 8, NULL, QR_CS_CSRES3,
6596 FT_BOOLEAN, 8, NULL, QR_CS_CF,
6601 { "Default character slot width",
6603 FT_UINT8, BASE_HEX, NULL, 0x0,
6607 { "Default character slot height",
6609 FT_UINT8, BASE_HEX, NULL, 0x0,
6615 FT_UINT8, BASE_HEX, NULL, 0x0,
6618 { &hf_tn3270_formres,
6619 { "Form Types (Reserved)",
6621 FT_UINT8, BASE_HEX, NULL, 0x0,
6624 { &hf_tn3270_cs_form_type1,
6626 "tn3270.cs_form_type1",
6627 FT_BOOLEAN, 8, NULL, 0x80,
6628 "the first 2 bytes contain a 16-bit vertical slice,"
6629 " the following 16 bytes contain 8-bit horizontal slices. For a 9"
6630 " x 12 character matrix the last 4 bytes contain binary zero.", HFILL }
6632 { &hf_tn3270_cs_form_type2,
6633 { "18-byte form (COMPRESSED)",
6634 "tn3270.cs_form_type2",
6635 FT_BOOLEAN, 8, NULL, 0x40,
6636 "the first 2 bytes contain a 16-bit vertical slice,"
6637 " the following 16 bytes contain 8-bit horizontal slices. For a 9"
6638 " x 12 character matrix the last 4 bytes contain binary zero. (COMPRESSED)", HFILL }
6640 { &hf_tn3270_cs_form_type3,
6641 { "Row loading (from top to bottom)",
6642 "tn3270.cs_form_type3",
6643 FT_BOOLEAN, 8, NULL, 0x20,
6646 { &hf_tn3270_cs_form_type4,
6647 { "Row loading (from top to bottom) (Compressed)",
6648 "tn3270.cs_form_type4",
6649 FT_BOOLEAN, 8, NULL, 0x10,
6652 { &hf_tn3270_cs_form_type5,
6653 { "Column loading (from left to right)",
6654 "tn3270.cs_form_type5",
6655 FT_BOOLEAN, 8, NULL, 0x08,
6658 { &hf_tn3270_cs_form_type6,
6659 { "Column loading (from left to right) (Compressed)",
6660 "tn3270.cs_form_type6",
6661 FT_BOOLEAN, 8, NULL, 0x04,
6664 { &hf_tn3270_cs_form_type8,
6666 "tn3270.cs_form_type8",
6667 FT_BOOLEAN, 8, NULL, 0x02,
6671 { "Length of each descriptor",
6673 FT_UINT8, BASE_DEC, NULL, 0x0,
6677 { &hf_tn3270_cs_descriptor_set,
6678 { "Device Specific Character Set ID (PS store No.)",
6679 "tn3270.cs_descriptor_set",
6680 FT_UINT8, BASE_DEC, NULL, 0x0,
6683 { &hf_tn3270_cs_descriptor_flags,
6685 "tn3270.cs_descriptor_flags",
6686 FT_UINT8, BASE_HEX, NULL, 0x0,
6689 { &hf_tn3270_cs_ds_load,
6690 { "Loadable character set",
6691 "tn3270.cs_ds_load",
6692 FT_BOOLEAN, 8, NULL, 0x80,
6695 { &hf_tn3270_cs_ds_triple,
6696 { "Triple-plane character set",
6697 "tn3270.cs_ds_triple",
6698 FT_BOOLEAN, 8, NULL, 0x40,
6701 { &hf_tn3270_cs_ds_char,
6702 { "Double-Byte coded character set",
6703 "tn3270.cs_ds_char",
6704 FT_BOOLEAN, 8, NULL, 0x20,
6707 { &hf_tn3270_cs_ds_cb,
6708 { "No LCID compare",
6710 FT_BOOLEAN, 8, NULL, 0x10,
6715 { "Local character set ID (alias)",
6717 FT_UINT8, BASE_HEX, NULL, 0x0,
6721 { "Width of the character slots in this characterset.",
6723 FT_UINT8, BASE_HEX, NULL, 0x0,
6727 { "Height of the character slots in this character set.",
6729 FT_UINT8, BASE_HEX, NULL, 0x0,
6732 { &hf_tn3270_ssubsn,
6733 { "Starting subsection.",
6735 FT_UINT8, BASE_HEX, NULL, 0x0,
6738 { &hf_tn3270_esubsn,
6739 { "Ending subsection.",
6741 FT_UINT8, BASE_HEX, NULL, 0x0,
6744 { &hf_tn3270_ccsgid,
6745 { "Coded Graphic Character Set Identifier.",
6747 FT_UINT64, BASE_HEX, NULL, 0x0,
6751 { "Coded Character Set Identifier.",
6753 FT_UINT64, BASE_HEX, NULL, 0x0,
6756 /* END - 6.12 - Query Reply (Character Sets) */
6758 /* 6.13 - Query Reply (Color) */
6759 { &hf_tn3270_color_flags,
6761 "tn3270.color_flags",
6762 FT_UINT8, BASE_HEX, NULL, 0x0,
6765 { &hf_tn3270_c_prtblk,
6766 { "Printer only - black ribbon is loaded",
6768 FT_BOOLEAN, 8, NULL, 0x40,
6772 { "Length of color attribute list",
6774 FT_UINT8, BASE_DEC, NULL, 0x0,
6778 { "Color attribute value accepted by the device",
6780 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6784 { "Color identifier",
6786 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6789 { &hf_tn3270_db_cavdef,
6790 { "Default color attribute value",
6792 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6795 { &hf_tn3270_db_cidef,
6796 { "Default background color identifier",
6798 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6801 /* END - 6.13 - Query Reply (Color) */
6803 /* 6.14 - Query Reply (Cooperative Processing Requestor) */
6805 { "Maximum CPR bytes/transmission allowed inbound",
6807 FT_UINT16, BASE_DEC, NULL, 0x0,
6810 { &hf_tn3270_limout,
6811 { "Maximum CPR bytes/transmission allowed outbound",
6813 FT_UINT16, BASE_DEC, NULL, 0x0,
6817 { "Length (in bytes) of feature information that follows",
6819 FT_UINT8, BASE_DEC, NULL, 0x0,
6823 { "CPR length and feature flags",
6825 FT_UINT16, BASE_DEC, NULL, 0x0,
6828 /* END - 6.14 - Query Reply (Cooperative Processing Requestor) */
6830 /* 6.15 - Query Reply (Data Chaining) */
6831 { &hf_tn3270_dc_dir,
6832 { "Indicates which direction can use the Data Chain structured field.",
6834 FT_UINT8, BASE_HEX, VALS(vals_data_chaining_dir), 0xC0,
6837 /* END - 6.15 - Query Reply (Data Chaining) */
6839 /* 6.16 - Query Reply (Data Streams) */
6840 { &hf_tn3270_ds_default_sfid,
6841 { "Default Data Stream",
6842 "tn3270.ds_default_sfid",
6843 FT_UINT8, BASE_HEX, VALS(vals_data_streams), 0x0,
6846 { &hf_tn3270_ds_sfid,
6847 { "Supported Data Stream",
6849 FT_UINT8, BASE_HEX, VALS(vals_data_streams), 0x0,
6852 /* END - 6.16 - Query Reply (Data Streams) */
6854 /* 6.17 - Query Reply (DBCS Asia) */
6855 { &hf_tn3270_asia_sdp_sosi_soset,
6856 { "Set ID of the Shift Out (SO) character set",
6857 "tn3270.asia_sdp_sosi_soset",
6858 FT_UINT8, BASE_HEX, NULL, 0x0,
6861 { &hf_tn3270_asia_sdp_ic_func,
6862 { "SO/SI Creation supported",
6863 "tn3270.asia_sdp_ic_func",
6864 FT_BOOLEAN, 8, NULL, 0x01,
6867 /* END - 6.17 - Query Reply (DBCS Asia) */
6869 /* 6.19 - Query Reply (Distributed Data Management) */
6870 { &hf_tn3270_ddm_flags,
6871 { "Flags (Reserved)",
6873 FT_UINT8, BASE_HEX, NULL, 0x0,
6876 { &hf_tn3270_ddm_limin,
6877 { "Maximum DDM bytes/transmission allowed inbound",
6879 FT_UINT16, BASE_DEC, NULL, 0x0,
6882 { &hf_tn3270_ddm_limout,
6883 { "Maximum DDM bytes/transmission allowed outbound",
6884 "tn3270.ddm_limout",
6885 FT_UINT16, BASE_DEC, NULL, 0x0,
6888 { &hf_tn3270_ddm_nss,
6889 { "Number of subsets supported",
6891 FT_UINT8, BASE_HEX, NULL, 0x0,
6894 { &hf_tn3270_ddm_ddmss,
6895 { "DDM subset identifier",
6897 FT_UINT8, BASE_HEX, VALS(vals_qr_ddm), 0x0,
6900 /* END - 6.19 - Query Reply (Distributed Data Management) */
6902 /* 6.20 - Query Reply (Document Interchange Architecture) */
6903 { &hf_tn3270_dia_flags,
6904 { "Flags (Reserved)",
6906 FT_UINT16, BASE_HEX, NULL, 0x0,
6909 { &hf_tn3270_dia_limin,
6910 { "Maximum DIA bytes/transmission allowed inbound",
6912 FT_UINT16, BASE_DEC, NULL, 0x0,
6915 { &hf_tn3270_dia_limout,
6916 { "Maximum DIA bytes/transmission allowed outbound",
6917 "tn3270.dia_limout",
6918 FT_UINT16, BASE_DEC, NULL, 0x0,
6921 { &hf_tn3270_dia_nfs,
6922 { "Number of subsets supported",
6924 FT_UINT8, BASE_HEX, NULL, 0x0,
6927 { &hf_tn3270_dia_diafs,
6928 { "DIA function set identifier",
6930 FT_UINT8, BASE_HEX, VALS(vals_qr_dia), 0x0,
6933 { &hf_tn3270_dia_diafn,
6934 { "DIA function set number",
6936 FT_UINT16, BASE_DEC, NULL, 0x0,
6939 /* END - 6.20 - Query Reply (Document Interchange Architecture) */
6941 /* 6.22 - Query Reply (Field Outlining) */
6942 { &hf_tn3270_fo_flags,
6945 FT_UINT8, BASE_HEX, NULL, 0x0,
6948 { &hf_tn3270_fo_vpos,
6949 { "Location of vertical line",
6951 FT_UINT8, BASE_DEC, NULL, 0x0,
6954 { &hf_tn3270_fo_hpos,
6955 { "Location of overline/underline",
6957 FT_UINT8, BASE_DEC, NULL, 0x0,
6960 { &hf_tn3270_fo_hpos0,
6961 { "Location of overline in case of separation",
6963 FT_UINT8, BASE_DEC, NULL, 0x0,
6966 { &hf_tn3270_fo_hpos1,
6967 { "Location of underline in case of separation",
6969 FT_UINT8, BASE_DEC, NULL, 0x0,
6972 /* END - 6.22 - Query Reply (Field Outlining) */
6974 /* 6.25 - Query Reply (Format Storage Auxiliary Device) */
6975 { &hf_tn3270_fsad_flags,
6977 "tn3270.fsad_flags",
6978 FT_UINT8, BASE_HEX, NULL, 0x0,
6981 { &hf_tn3270_fsad_limin,
6982 { "Reserved for LIMIN parameter. Must be set to zeros.",
6983 "tn3270.fsad_limin",
6984 FT_UINT16, BASE_DEC, NULL, 0x0,
6987 { &hf_tn3270_fsad_limout,
6988 { "Maximum bytes of format storage data per transmission allowed outbound.",
6989 "tn3270.fsad_limout",
6990 FT_UINT16, BASE_DEC, NULL, 0x0,
6993 { &hf_tn3270_fsad_size,
6994 { "Size of the format storage space",
6996 FT_UINT16, BASE_DEC, NULL, 0x0,
6999 /* END - 6.25 - Query Reply (Format Storage Auxiliary Device) */
7001 /* 6.28 - Query Reply (Highlighting) */
7003 { "Number of attribute-value/action pairs",
7005 FT_UINT8, BASE_DEC, NULL, 0x0,
7009 { "Data stream attribute value accepted",
7011 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
7015 { "Data stream action",
7017 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
7020 /* END - Query Reply (Highlighting) */
7022 /* 6.29 - Query Reply (IBM Auxiliary Device) */
7023 { &hf_tn3270_ibm_flags,
7026 FT_UINT8, BASE_HEX, NULL, 0x0,
7029 { &hf_tn3270_ibm_limin,
7030 { "Inbound message size limit",
7032 FT_UINT16, BASE_DEC, NULL, 0x0,
7035 { &hf_tn3270_ibm_limout,
7036 { "Outbound message size limit",
7037 "tn3270.ibm_limout",
7038 FT_UINT16, BASE_DEC, NULL, 0x0,
7041 { &hf_tn3270_ibm_type,
7042 { "Type of IBM Auxiliary Device",
7044 FT_UINT16, BASE_DEC, NULL, 0x0,
7047 /* END - 6.29 - Query Reply (IBM Auxiliary Device) */
7049 /* 6.31 - Query Reply (Implicit Partitions) */
7050 { &hf_tn3270_ip_flags,
7051 { "Flags (Reserved)",
7053 FT_UINT8, BASE_HEX, NULL, 0x0,
7056 { &hf_tn3270_ipdd_wd,
7057 { "Width of the Implicit Partition default screen size (in character cells)",
7059 FT_UINT16, BASE_DEC, NULL, 0x0,
7062 { &hf_tn3270_ipdd_hd,
7063 { "Height of the Implicit Partition default screen size",
7065 FT_UINT16, BASE_DEC, NULL, 0x0,
7068 { &hf_tn3270_ipdd_wa,
7069 { "Width of the Implicit Partition alternate screen size",
7071 FT_UINT16, BASE_DEC, NULL, 0x0,
7074 { &hf_tn3270_ipdd_ha,
7075 { "Height of the Implicit Partition alternate screen size",
7077 FT_UINT16, BASE_DEC, NULL, 0x0,
7080 { &hf_tn3270_ippd_dpbs,
7081 { "Default printer buffer size (in character cells)",
7083 FT_UINT64, BASE_DEC, NULL, 0x0,
7086 { &hf_tn3270_ippd_apbs,
7087 { "Default printer buffer size (in character cells)",
7089 FT_UINT64, BASE_DEC, NULL, 0x0,
7092 { &hf_tn3270_ipccd_wcd,
7093 { "Width of the character cell for the Implicit Partition default screen size",
7095 FT_UINT16, BASE_DEC, NULL, 0x0,
7098 { &hf_tn3270_ipccd_hcd,
7099 { "Height of the character cell for the Implicit Partition default screen size",
7101 FT_UINT16, BASE_DEC, NULL, 0x0,
7104 { &hf_tn3270_ipccd_wca,
7105 { "Width of the character cell for the Implicit Partition alternate screen size",
7107 FT_UINT16, BASE_DEC, NULL, 0x0,
7110 { &hf_tn3270_ipccd_hca,
7111 { "Height of the character cell for the Implicit Partition alternate screen size",
7113 FT_UINT16, BASE_DEC, NULL, 0x0,
7116 /* END - Query Reply (Implicit Partitions) */
7118 /* 6.32 - Query Reply (IOCA Auxiliary Device) */
7119 { &hf_tn3270_ioca_limin,
7120 { "Max IOCA bytes/inbound transmission",
7121 "tn3270.ioca_limin",
7122 FT_UINT16, BASE_DEC, NULL, 0x0,
7125 { &hf_tn3270_ioca_limout,
7126 { "Max IOCA bytes/outbound transmission",
7127 "tn3270.ioca_limout",
7128 FT_UINT16, BASE_DEC, NULL, 0x0,
7131 { &hf_tn3270_ioca_type,
7132 { "Type of IOCA Auxiliary Device",
7134 FT_UINT16, BASE_DEC, NULL, 0x0,
7137 /* END - 6.32 - Query Reply (IOCA Auxiliary Device) */
7139 /* 6.34 - Query Reply (MSR Control) */
7140 { &hf_tn3270_msr_nd,
7141 { "Number of MSR device types",
7143 FT_UINT8, BASE_DEC, NULL, 0x0,
7146 /* END - 6.34 - Query Reply (MSR Control) */
7148 /* 6.36 - Query Reply (OEM Auxiliary Device) */
7149 { &hf_tn3270_oem_dsref,
7150 { "Data stream reference identifier",
7152 FT_UINT8, BASE_HEX, NULL, 0x0,
7155 { &hf_tn3270_oem_dtype,
7158 FT_STRING, BASE_NONE, NULL, 0x0,
7161 { &hf_tn3270_oem_uname,
7162 { "User assigned name",
7164 FT_STRING, BASE_NONE, NULL, 0x0,
7167 { &hf_tn3270_sdp_daid,
7168 { "Destination/Origin ID",
7169 "tn3270.oem_sdp_daid_doid",
7170 FT_UINT16, BASE_DEC, NULL, 0x0,
7173 { &hf_tn3270_oem_sdp_ll_limin,
7174 { "Maximum OEM dsf bytes/transmission allowed inbound",
7175 "tn3270.oem_sdp_ll_limin",
7176 FT_UINT16, BASE_DEC, NULL, 0x0,
7179 { &hf_tn3270_oem_sdp_ll_limout,
7180 { "Maximum OEM dsf bytes/transmission allowed outbound",
7181 "tn3270.oem_sdp_ll_limout",
7182 FT_UINT16, BASE_DEC, NULL, 0x0,
7185 { &hf_tn3270_oem_sdp_pclk_vers,
7186 { "Protocol version",
7187 "tn3270.oem_sdp_pclk_vers",
7188 FT_UINT16, BASE_DEC, NULL, 0x0,
7191 /* END - 6.36 - Query Reply (OEM Auxiliary Device) */
7193 /* 6.37 - Query Reply (Paper Feed Techniques) */
7194 { &hf_tn3270_pft_flags,
7197 FT_UINT8, BASE_HEX, NULL, 0x0,
7200 { &hf_tn3270_pft_tmo,
7201 { "Top margin offset in 1/1440ths of an inch",
7203 FT_UINT16, BASE_DEC, NULL, 0x0,
7206 { &hf_tn3270_pft_bmo,
7207 { "Bottom margin offset in 1/1440ths of an inch",
7209 FT_UINT16, BASE_DEC, NULL, 0x0,
7212 /* END - 6.37 - Query Reply (Paper Feed Techniques) */
7214 /* 6.38 - Query Reply (Partition Characteristics) */
7215 { &hf_tn3270_pc_vo_thickness,
7217 "tn3270.pc_vo_thickness",
7218 FT_UINT8, BASE_DEC, NULL, 0x0,
7221 /* END- 6.38 - Query Reply (Partition Characteristics) */
7223 /* 6.41 - Query Reply (Product Defined Data Stream) */
7224 { &hf_tn3270_pdds_refid,
7225 { "Reference identifier",
7226 "tn3270.pdds_refid",
7227 FT_UINT8, BASE_HEX, VALS(vals_qr_pdds_refid), 0x0,
7230 { &hf_tn3270_pdds_ssid,
7231 { "Subset identifier",
7233 FT_UINT8, BASE_HEX, VALS(vals_qr_pdds_ssid), 0x0,
7236 /* END - 6.41 - Query Reply (Product Defined Data Stream) */
7238 /* 6.43 - Query Reply (RPQ Names) */
7239 { &hf_tn3270_rpq_device,
7240 { "Device type identifier",
7241 "tn3270.rpq_device",
7242 FT_STRING, BASE_NONE, NULL, 0x0,
7245 { &hf_tn3270_rpq_mid,
7246 { "Model type identifier",
7248 FT_UINT64, BASE_DEC, NULL, 0x0,
7251 { &hf_tn3270_rpq_rpql,
7252 { "Length of RPQ name (including this byte)",
7254 FT_UINT8, BASE_DEC, NULL, 0x0,
7257 { &hf_tn3270_rpq_name,
7260 FT_STRING, BASE_NONE, NULL, 0x0,
7263 /* END - Query Reply (Names) */
7265 /* 6.44 - Query Reply (Save or Restore Format) */
7266 { &hf_tn3270_srf_fpcbl,
7267 { "Format parameter control block length",
7269 FT_UINT16, BASE_DEC, NULL, 0x0,
7272 /* END - 6.44 - Query Reply (Save or Restore Format) */
7274 /* 6.45 - Query Reply (Settable Printer Characteristics) */
7275 { &hf_tn3270_spc_epc_flags,
7277 "tn3270.spc_epc_flags",
7278 FT_UINT8, BASE_HEX, NULL, 0x0,
7281 /* END - 6.45 - Query Reply (Settable Printer Characteristics) */
7283 /* 6.47 - Query Reply (Storage Pools) */
7284 { &hf_tn3270_sp_spid,
7285 { "Storage pool identity",
7287 FT_UINT8, BASE_HEX, NULL, 0x0,
7290 { &hf_tn3270_sp_size,
7291 { "Size of this storage pool when empty",
7293 FT_UINT32, BASE_DEC, NULL, 0x0,
7296 { &hf_tn3270_sp_space,
7297 { "Space available in this storage pool",
7299 FT_UINT32, BASE_DEC, NULL, 0x0,
7302 { &hf_tn3270_sp_objlist,
7303 { "Identifiers of objects housed in this storage pool",
7304 "tn3270.sp_objlist",
7305 FT_UINT16, BASE_HEX, VALS(vals_sp_objlist), 0x0,
7308 /* END - 6.47 - Query Reply (Storage Pools) */
7310 /* 6.49 - Query Reply (Text Partitions) */
7312 { "Maximum number of text partitions",
7314 FT_UINT8, BASE_DEC, NULL, 0x0,
7318 { "Maximum partition size",
7320 FT_UINT16, BASE_DEC, NULL, 0x0,
7323 { &hf_tn3270_tp_flags,
7326 FT_UINT8, BASE_HEX, NULL, 0x0,
7329 { &hf_tn3270_tp_ntt,
7330 { "Number of text types supported",
7332 FT_UINT8, BASE_DEC, NULL, 0x0,
7335 { &hf_tn3270_tp_tlist,
7336 { "List of types supported",
7338 FT_UINT8, BASE_HEX, NULL, 0x0,
7341 /* END - 6.49 - Query Reply (Text Partitions) */
7343 /* 6.50 - Query Reply (Transparency) */
7345 { "Number of pairs",
7347 FT_UINT8, BASE_DEC, NULL, 0x0,
7351 { "Data stream attribute value accepted",
7353 FT_UINT8, BASE_HEX, NULL, 0x0,
7357 { "Associated action value",
7359 FT_UINT8, BASE_HEX, NULL, 0x0,
7362 /* END - 6.50 - Query Reply (Transparency) */
7364 /* 6.51 Query Reply Usable Area */
7365 { &hf_tn3270_usable_area_flags1,
7366 {"Usable Area Flags",
7367 "tn3270.query_reply_usable_area_flags1",
7368 FT_UINT8, BASE_HEX, NULL, 0,
7371 { &hf_tn3270_ua_reserved1,
7374 FT_BOOLEAN, 8, NULL, QR_UA_RESERVED1,
7377 { &hf_tn3270_ua_page_printer,
7379 "tn3270.ua_page_printer",
7380 FT_BOOLEAN, 8, NULL, QR_UA_PAGE_PRINTER,
7383 { &hf_tn3270_ua_reserved2,
7386 FT_BOOLEAN, 8, NULL, QR_UA_RESERVED2,
7389 { &hf_tn3270_ua_hard_copy,
7391 "tn3270.ua_hard_copy",
7392 FT_BOOLEAN, 8, NULL, QR_UA_HARD_COPY,
7395 { &hf_tn3270_ua_addressing,
7396 { "Usable Area Addressing",
7397 "tn3270.ua_addressing",
7398 FT_UINT8, BASE_HEX, VALS(vals_usable_area_addr_mode), QR_UA_ADDR_MODE_MASK,
7401 { &hf_tn3270_usable_area_flags2,
7402 { "Usable Area Flags",
7403 "tn3270.query_reply_usable_area_flags2",
7404 FT_UINT8, BASE_HEX, NULL, 0x0,
7407 { &hf_tn3270_ua_variable_cells,
7409 "tn3270.ua_variable_cells",
7410 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_variable_cells), QR_UA_VARIABLE_CELLS,
7413 { &hf_tn3270_ua_characters,
7415 "tn3270.ua_characters",
7416 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_characters), QR_UA_CHARACTERS,
7419 { &hf_tn3270_ua_cell_units,
7421 "tn3270.ua_cell_units",
7422 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_cell_units), QR_UA_CELL_UNITS,
7425 { &hf_tn3270_ua_width_cells_pels,
7426 { "Width of usable area in cells/pels",
7427 "tn3270.ua_width_cells_pels",
7428 FT_UINT16, BASE_DEC, NULL, 0x0,
7431 { &hf_tn3270_ua_height_cells_pels,
7432 { "Height of usable area in cells/pels",
7433 "tn3270.ua_height_cells_pels",
7434 FT_UINT16, BASE_DEC, NULL, 0x0,
7437 { &hf_tn3270_ua_uom_cells_pels,
7438 { "Units of measure for cells/pels",
7439 "tn3270.ua_uom_cells_pels",
7440 FT_UINT8, BASE_HEX, VALS(vals_usable_area_uom), 0x0,
7444 { "Distance between points in X direction as a fraction",
7446 FT_UINT32, BASE_HEX, NULL, 0x0,
7447 "measured in UNITS, with 2-byte numerator and 2-byte denominator", HFILL }
7450 { "Distance between points in Y direction as a fraction",
7452 FT_UINT32, BASE_HEX, NULL, 0x0,
7453 "measured in UNITS, with 2-byte numerator and 2-byte denominator", HFILL }
7456 { "Number of X units in default cell",
7458 FT_UINT8, BASE_DEC, NULL, 0x0,
7462 { "Number of Y units in default cell",
7464 FT_UINT8, BASE_DEC, NULL, 0x0,
7467 { &hf_tn3270_ua_buffsz,
7468 { "Character buffer size (bytes)",
7470 FT_UINT16, BASE_DEC, NULL, 0x0,
7473 { &hf_tn3270_ua_xmin,
7474 { "Minimum number of X units in variable cell",
7476 FT_UINT8, BASE_DEC, NULL, 0x0,
7479 { &hf_tn3270_ua_ymin,
7480 { "Minimum number of Y units in variable cell",
7482 FT_UINT8, BASE_DEC, NULL, 0x0,
7485 { &hf_tn3270_ua_xmax,
7486 { "Maximum number of X units in variable cell",
7488 FT_UINT8, BASE_DEC, NULL, 0x0,
7491 { &hf_tn3270_ua_ymax,
7492 { "Maximum number of Y units in variable cell",
7494 FT_UINT8, BASE_DEC, NULL, 0x0,
7497 /* End - 6.51 Query Reply Usable Area */
7499 /* 6.52 - Query Reply (3270 IPDS) */
7500 { &hf_tn3270_3270_tranlim,
7501 { "Maximum transmission size allowed outbound",
7502 "tn3270.3270_tranlim",
7503 FT_UINT16, BASE_DEC, NULL, 0x0,
7506 /* END - 6.52 - Query Reply (3270 IPDS) */
7509 { &hf_tn3270_field_data,
7511 "tn3270.field_data",
7512 FT_STRING, BASE_NONE, NULL, 0x0,
7513 "tn3270.field_data", HFILL }
7515 { &hf_tn3270_number_of_attributes,
7516 { "Number of Attributes",
7517 "tn3270.number_of_attributes",
7518 FT_UINT8, BASE_HEX, NULL, 0x0,
7521 { &hf_tn3270_resbyte,
7522 { "Flags (Reserved)",
7524 FT_UINT8, BASE_HEX, NULL, 0x0,
7527 { &hf_tn3270_resbytes,
7528 { "Flags (Reserved)",
7530 FT_UINT8, BASE_HEX, NULL, 0x0,
7533 { &hf_tn3270_res_twobytes,
7534 { "Flags (Reserved)",
7535 "tn3270.res_twobytes",
7536 FT_UINT16, BASE_HEX, NULL, 0x0,
7539 { &hf_tn3270_sf_single_byte_id,
7540 { "Structured Field",
7542 FT_UINT8, BASE_HEX, NULL, 0x0,
7545 { &hf_tn3270_sf_double_byte_id,
7546 { "Structured Field",
7548 FT_UINT16, BASE_HEX, NULL, 0x0,
7551 { &hf_tn3270_sf_query_reply,
7553 "tn3270.sf_query_reply",
7554 FT_UINT8, BASE_HEX, VALS(vals_sf_query_replies), 0x0,
7558 { "Trailing Null (Possible Mainframe/Emulator Bug)",
7560 FT_UINT8, BASE_HEX, NULL, 0x0,
7563 { &hf_tn3270_unknown_data,
7564 { "Unknown Data (Possible Mainframe/Emulator Bug)",
7565 "tn3270.unknown_data",
7566 FT_BYTES, BASE_NONE, NULL, 0x0,
7570 /* TN3270E - Header Fields */
7571 { &hf_tn3270_tn3270e_data_type,
7572 { "TN3270E Data Type",
7573 "tn3270.tn3270e_data_type",
7574 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_data_types), 0x0,
7577 { &hf_tn3270_tn3270e_request_flag,
7578 { "TN3270E Request Flag",
7579 "tn3270.tn3270e_request_flag",
7580 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_request_flags), 0x0,
7583 { &hf_tn3270_tn3270e_response_flag_3270_SCS,
7584 { "TN3270E Response Flag",
7585 "tn3270.tn3270e_response_flag",
7586 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_response_flags_3270_SCS), 0x0,
7589 { &hf_tn3270_tn3270e_response_flag_response,
7590 { "TN3270E Response Flag",
7591 "tn3270.tn3270e_response_flag",
7592 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_response_flags_response), 0x0,
7595 { &hf_tn3270_tn3270e_response_flag_unused,
7596 { "TN3270E Response Flag",
7597 "tn3270.tn3270e_response_flag",
7598 FT_UINT8, BASE_HEX, NULL, 0x0,
7601 { &hf_tn3270_tn3270e_seq_number,
7602 { "TN3270E Seq Number",
7603 "tn3270.tn3270e_seq_number",
7604 FT_UINT16, BASE_DEC, NULL, 0x0,
7607 { &hf_tn3270_tn3270e_header_data,
7608 { "TN3270E Header Data",
7609 "tn3270.tn3270e_header_data",
7610 FT_STRING, BASE_NONE, NULL, 0x0,
7615 static gint *ett[] = {
7619 &ett_tn3270_field_attribute,
7620 &ett_tn3270_field_validation,
7621 &ett_tn3270_usable_area_flags1,
7622 &ett_tn3270_usable_area_flags2,
7623 &ett_tn3270_query_reply_alphanumeric_flags,
7624 &ett_tn3270_character_sets_flags1,
7625 &ett_tn3270_character_sets_flags2,
7626 &ett_tn3270_character_sets_form,
7627 &ett_tn3270_cs_descriptor_flags,
7628 &ett_tn3270_color_flags,
7631 &ett_tn3270_msr_state_mask,
7632 &ett_tn3270_data_chain_fields,
7633 &ett_tn3270_query_list
7636 static ei_register_info ei[] = {
7637 { &ei_tn3270_order_code, { "tn3270.order_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7638 { &ei_tn3270_command_code, { "tn3270.command_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7639 { &ei_tn3270_aid, { "tn3270.aid.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7642 expert_module_t* expert_tn3270;
7644 proto_tn3270 = proto_register_protocol("TN3270 Protocol", "TN3270", "tn3270");
7645 register_dissector("tn3270", dissect_tn3270, proto_tn3270);
7646 proto_register_field_array(proto_tn3270, hf, array_length(hf));
7647 proto_register_subtree_array(ett, array_length(ett));
7648 expert_tn3270 = expert_register_protocol(proto_tn3270);
7649 expert_register_field_array(expert_tn3270, ei, array_length(ei));
7659 * indent-tabs-mode: nil
7662 * ex: set shiftwidth=2 tabstop=8 expandtab:
7663 * :indentSize=2:tabSize=8:noTabs=true: