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 * This program is free software; you can redistribute it and/or
32 * modify it under the terms of the GNU General Public License
33 * as published by the Free Software Foundation; either version 2
34 * of the License, or (at your option) any later version.
36 * This program is distributed in the hope that it will be useful,
37 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 * GNU General Public License for more details.
41 * You should have received a copy of the GNU General Public License
42 * along with this program; if not, write to the Free Software
43 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
49 #include <epan/packet.h>
50 #include <epan/conversation.h>
51 #include <epan/expert.h>
53 #include "packet-tn3270.h"
55 void proto_register_tn3270(void);
58 * In the IBM "3270 Information Display System: Data Stream Programmer's Reference"
59 * document, the references to bit numbers in the text and tables
60 * are based upon the "MSB 0" bit numbering scheme.
61 * That is: bits are numbered in a byte from left-to-right:
62 * "Bit 0" is the MSB of the byte
63 * "Bit 7" is the LSB of the byte
68 - better tree display: e.g., separate tree for each order code ....
69 - review 'structured field grouping: 5.2
70 - Telnet uses 0xFF as IAC ["interpret as command"] and thus for
71 telnet: any actual 0xFF bytes in a 3270 data stream will be prefixed with
72 a 0xFF escape. The escapes should be removed from the TVB before the
73 buffer is passed to this dissector. See packet-telnet.c
74 - Show the 'as a fraction" display as xx/yy ?
77 /* Dissection is for EBCDIC 3270 */
79 /* OUTBOUND DATA STREAM (MAINFRAME PROGRAM -> DISPLAY)
81 ________________ _____ __________________
82 | Command Code |WCC | Orders and Data |
83 |________________|_____|__________________|
86 ______ ______________________
87 | WSF | Structured Field(s) |
88 |______|______________________|
92 /*--- 3270 Command Codes - "Local Attachment" ----- */
94 #define CC_LCL_EW 0x05
95 #define CC_LCL_EWA 0x0D
96 #define CC_LCL_EAU 0x0F
97 #define CC_LCL_WSF 0x11
99 #define CC_LCL_RB 0x02
100 #define CC_LCL_RM 0x06
101 #define CC_LCL_RMA 0x0E /* XXX Not valid ?? See 3174 Function Description 2.1.4 */
108 /*--- 3.3 3270 Command Codes - "Remote Attachment" ----- */
109 #define CC_RMT_W 0xF1
110 #define CC_RMT_EW 0xF5
111 #define CC_RMT_EWA 0x7E
112 #define CC_RMT_EAU 0x6F
113 #define CC_RMT_WSF 0xF3
115 #define CC_RMT_RB 0xF2
116 #define CC_RMT_RM 0xF6
117 #define CC_RMT_RMA 0x6E
119 #define CC_SNA_BSC 0xF7 /* local copy in a BSC environment */
121 static const value_string vals_command_codes[] = {
123 { CC_LCL_W, "Write (Local)" },
124 { CC_LCL_EW, "Erase/Write (Local)" },
125 { CC_LCL_EWA, "Erase/Write Alternate (Local)" },
126 { CC_LCL_EAU, "Erase All Unprotected (Local)" },
127 { CC_LCL_WSF, "Write Structured Field (Local)" },
128 { CC_LCL_RB, "Read Buffer (Local)" },
129 { CC_LCL_RM, "Read Modified (Local)" },
130 { CC_LCL_RMA, "Read Modified All (Local)" },
131 { CC_RMT_W, "Write" },
132 { CC_RMT_EW, "Erase/Write" },
133 { CC_RMT_EWA, "Erase/Write Alternate" },
134 { CC_RMT_EAU, "Erase All Unprotected" },
135 { CC_RMT_WSF, "Write Structured Field" },
136 { CC_RMT_RB, "Read Buffer" },
137 { CC_RMT_RM, "Read Modified" },
138 { CC_RMT_RMA, "Read Modified All" },
139 { CC_SNA_BSC, "BSC Copy" },
143 /*--- 3.4 WCC (Write Control Characters) ----- */
144 #define WCC_NOP 0x80 /* "Bit 0" */
145 #define WCC_RESET 0x40 /* "Bit 1" */
146 #define WCC_PRINTER1 0x20 /* "Bit 2" */
147 #define WCC_PRINTER2 0x10 /* "Bit 3" */
148 #define WCC_START_PRINTER 0x08 /* "Bit 4" */
149 #define WCC_SOUND_ALARM 0x04 /* "Bit 5" */
150 #define WCC_KEYBOARD_RESTORE 0x02 /* "Bit 6" */
151 #define WCC_RESET_MDT 0x01 /* "Bit 7" */
153 /*--- 4.3 Order Codes ----- */
167 static const value_string vals_order_codes[] = {
168 { OC_SF, "Start Field (SF)" },
169 { OC_SFE, "Start Field Extended (SFE)" },
170 { OC_SBA, "Set Buffer Address (SBA)" },
171 { OC_SA, "Set Attribute (SA)" },
172 { OC_MF, "Modify Field (MF)" },
173 { OC_IC, "Insert Cursor (IC)" },
174 { OC_PT, "Program Tab (PT)" },
175 { OC_RA, "Repeat to Address (RA)" },
176 { OC_EUA, "Erase Unprotected to Address (EUA)" },
177 { OC_GE, "Graphic Escape (GE)" },
182 /*--- 4.3.11 Format Control Orders ----- */
183 /* Special treatment for display */
194 static const value_string vals_format_control_orders[] = {
196 { FCO_SUB, "Substitute" },
197 { FCO_DUP, "Duplicate" },
198 { FCO_FM, "Field Mark" },
199 { FCO_FF, "Form Feed" },
200 { FCO_CR, "Carriage Return" },
201 { FCO_NL, "New Line" },
202 { FCO_EM, "End of Medium" },
203 { FCO_EO, "Eight Ones" },
208 /*--- 8.7 Copy Control Code ----- */
209 /* Use for "local Copy" in a "BSC [BiSync] Environment" */
211 /* "Coding Bits" are those required such that the */
212 /* complete 8 bit CCC is a valid EBCDIC character */
213 #define CCC_GRAPHIC_CONVERT_MASK 0xC0
215 #define CCC_PRINT_BITS_MASK 0x30
216 #define CCC_PRINT_BITS_POINT_LINE_LENGTH 0x00
217 #define CCC_PRINT_BITS_PRINT_LINE_40 0x01
218 #define CCC_PRINT_BITS_PRINT_LINE_64 0x02
219 #define CCC_PRINT_BITS_PRINT_LINE_80 0x03
221 static const value_string ccc_vals_printout_format[] = {
222 { CCC_PRINT_BITS_POINT_LINE_LENGTH,
223 "The NL, EM, and CR orders in the data stream determine pointline length. "
224 "Provides a 132-print position line when the orders are not present." },
225 { CCC_PRINT_BITS_PRINT_LINE_40,
226 "Specifies a 40-character print line." },
227 { CCC_PRINT_BITS_PRINT_LINE_64,
228 "Specifies a 64-character print line." },
229 { CCC_PRINT_BITS_PRINT_LINE_80,
230 "Specifies an 80-character print line." },
234 #define CCC_START_PRINT 0x08
235 #define CCC_SOUND_ALARM 0x04
237 #define CCC_ATTRIBUTE_BITS_MASK 0x03
238 #define CCC_ATTRIBUTE_BITS_ONLY_ATTRIBUTE_CHARACTERS 0x00
239 #define CCC_ATTRIBUTE_BITS_ATTRIBUTE_CHARACTERS_UNPROTECTED_AN 0x01
240 #define CCC_ATTRIBUTE_BITS_ALL_ATTRIBUTE_PROTECTED 0x02
241 #define CCC_ATTRIBUTE_BITS_ENTIRE_CONTENTS 0x03
243 static const value_string ccc_vals_copytype[] = {
244 { CCC_ATTRIBUTE_BITS_ONLY_ATTRIBUTE_CHARACTERS,
245 "Only attribute characters are copied." },
246 { CCC_ATTRIBUTE_BITS_ATTRIBUTE_CHARACTERS_UNPROTECTED_AN,
247 "Attribute characters and unprotected alphanumeric fields"
248 " (including nulls) are copied. Nulls are transferred for"
249 " the alphanumeric characters not copied from the"
250 " protected fields." },
251 { CCC_ATTRIBUTE_BITS_ALL_ATTRIBUTE_PROTECTED,
252 "All attribute characters and protected alphanumeric fields"
253 " (including nulls) are copied. Nulls are transferred for the alphanumeric characters not"
254 " copied from the unprotected fields." },
255 { CCC_ATTRIBUTE_BITS_ENTIRE_CONTENTS,
256 "The entire contents of the storage buffer (including nulls) are copied." },
260 /*--- 4.4.1 Field Attributes ----- */
261 #define FA_GRAPHIC_CONVERT_MASK 0xC0
263 #define FA_PROTECTED 0x20 /* "Bit 2" */
264 #define FA_NUMERIC 0x10 /* "Bit 3" */
266 #define FA_RESERVED 0x02 /* "Bit 6" */
267 #define FA_MODIFIED 0x01 /* "Bit 7" */
269 #define FA_DISPLAY_BITS_MASK 0x0C /* "Bits 4,5" */
270 #define FA_DISPLAY_BITS_DISPLAY_NOT_SELECTOR_PEN_DETECTABLE 0x00
271 #define FA_DISPLAY_BITS_DISPLAY_SELECTOR_PEN_DETECTABLE 0x01
272 #define FA_DISPLAY_BITS_INTENSIFIED_DISPLAY_SELECTOR_PEN_DETECTABLE 0x02
273 #define FA_DISPLAY_BITS_NON_DISPLAY_NON_DETECTABLE 0x03
275 static const value_string vals_fa_display[] = {
276 { FA_DISPLAY_BITS_DISPLAY_NOT_SELECTOR_PEN_DETECTABLE, "Display/Not Selector Pen Detectable" },
277 { FA_DISPLAY_BITS_DISPLAY_SELECTOR_PEN_DETECTABLE, "Display/Selector Pen Detectable" },
278 { FA_DISPLAY_BITS_INTENSIFIED_DISPLAY_SELECTOR_PEN_DETECTABLE, "Intensified Display/Selector Pen Detectable" },
279 { FA_DISPLAY_BITS_NON_DISPLAY_NON_DETECTABLE, "Non Display, Non Detectable (not printable)" },
283 /*--- 4.4.5 Attribute Types ----- */
284 #define AT_ALL_CHARACTER_ATTRIBUTES 0x00
285 #define AT_T3270_FIELD_ATTRIBUTE 0xC0
286 #define AT_FIELD_VALIDATION 0xC1
287 #define AT_FIELD_OUTLINING 0xC2
288 #define AT_EXTENDED_HIGHLIGHTING 0x41
289 #define AT_FOREGROUND_COLOR 0x42
290 #define AT_CHARACTER_SET 0x43
291 #define AT_BACKGROUND_COLOR 0x45
292 #define AT_TRANSPARENCY 0x46
295 static const value_string vals_attribute_types[] = {
296 { AT_ALL_CHARACTER_ATTRIBUTES, "All character attributes" },
297 { AT_T3270_FIELD_ATTRIBUTE, "3270 Field attribute" },
298 { AT_FIELD_VALIDATION, "Field validation" },
299 { AT_FIELD_OUTLINING, "Field outlining" },
300 { AT_EXTENDED_HIGHLIGHTING, "Extended highlighting" },
301 { AT_FOREGROUND_COLOR, "Foreground color" },
302 { AT_CHARACTER_SET, "Character set" },
303 { AT_BACKGROUND_COLOR, "Background color" },
304 { AT_TRANSPARENCY, "Transparency" },
308 /*--- 4.4.6.3 Extended Highlighting ----- */
309 #define AT_EH_DEFAULT_HIGHLIGHTING 0x00
310 #define AT_EH_NORMAL 0xF0
311 #define AT_EH_BLINK 0xF1
312 #define AT_EH_REVERSE_VIDEO 0xF2
313 #define AT_EH_UNDERSCORE 0xF4
315 static const value_string vals_at_extended_highlighting[] = {
316 { AT_EH_DEFAULT_HIGHLIGHTING, "Default" },
317 { AT_EH_NORMAL, "Normal (as determined by the 3270 field attribute)" },
318 { AT_EH_BLINK, "Blink" },
319 { AT_EH_REVERSE_VIDEO, "Reverse video" },
320 { AT_EH_UNDERSCORE, "Underscore." },
324 /*--- 4.4.6.4 Color Identifications ----- */
325 #define AT_CI_ALL_PLANES 0x00
326 #define AT_CI_BLUE_PLANE 0x01
327 #define AT_CI_RED_PLANE 0x02
328 #define AT_CI_GREEN_PLANE 0x04
329 #define AT_CI_NEUTRAL1 0xF0
330 #define AT_CI_BLUE 0xF1
331 #define AT_CI_RED 0xF2
332 #define AT_CI_PINK 0xF3
333 #define AT_CI_GREEN 0xF4
334 #define AT_CI_TURQUOISE 0xF5
335 #define AT_CI_YELLOW 0xF6
336 #define AT_CI_NEUTRAL2 0xF7
337 #define AT_CI_BLACK 0xF8
338 #define AT_CI_DEEP_BLUE 0xF9
339 #define AT_CI_ORANGE 0xFA
340 #define AT_CI_PURPLE 0xFB
341 #define AT_CI_PALE_GREEN 0xFC
342 #define AT_CI_PALE_TURQUOISE 0xFD
343 #define AT_CI_GREY 0xFE
344 #define AT_CI_WHITE 0xFF
347 static const value_string vals_at_color_identifications[] = {
348 { AT_CI_ALL_PLANES, "ALL PLANES" },
349 { AT_CI_BLUE_PLANE, "BLUE PLANE" },
350 { AT_CI_RED_PLANE, "RED PLANE" },
351 { AT_CI_GREEN_PLANE, "GREEN PLANE" },
352 { AT_CI_NEUTRAL1, "Neutral" },
353 { AT_CI_BLUE, "Blue" },
354 { AT_CI_RED, "Red" },
355 { AT_CI_PINK, "Pink" },
356 { AT_CI_GREEN, "Green" },
357 { AT_CI_TURQUOISE, "Turquoise" },
358 { AT_CI_YELLOW, "Yellow" },
359 { AT_CI_NEUTRAL2, "Neutral" },
360 { AT_CI_BLACK, "Black" },
361 { AT_CI_DEEP_BLUE, "Deep Blue" },
362 { AT_CI_ORANGE, "Orange" },
363 { AT_CI_PURPLE, "Purple" },
364 { AT_CI_PALE_GREEN, "Pale Green" },
365 { AT_CI_PALE_TURQUOISE, "Pale Turquoise" },
366 { AT_CI_GREY, "Grey" },
367 { AT_CI_WHITE, "White" },
371 /*--- 4.4.6.5 Character Set ----- */
372 #define AT_CS_DEFAULT_CHARACTER_SET 0x00
373 #define AT_CS_MIN_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS 0x40
374 #define AT_CS_MAX_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS 0xEF
375 #define AT_CS_MIN_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS 0xF0
376 #define AT_CS_MAX_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS 0xF7
377 #define AT_CS_MIN_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS 0xF8
378 #define AT_CS_MAX_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS 0xFE
380 static const range_string rvals_at_character_set[] = {
381 { AT_CS_DEFAULT_CHARACTER_SET,
382 AT_CS_DEFAULT_CHARACTER_SET,
383 "Default Character Set" },
384 { AT_CS_MIN_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS,
385 AT_CS_MAX_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS,
386 "Local Id For Loadable Character Sets" },
387 { AT_CS_MIN_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS,
388 AT_CS_MAX_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS,
389 "Local Id For Nonloadable Character Sets" },
390 { AT_CS_MIN_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS,
391 AT_CS_MAX_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS,
392 "Local Id For Two Byte Coded Character Sets" },
396 /*--- 4.4.6.6 Field Outlining ----- */
397 #define AT_FO_NO_OUTLINING_LINES 0X00
398 #define AT_FO_UNDERLINE_ONLY 0X01
399 #define AT_FO_RIGHT_VERTICAL_LINE_ONLY 0X02
400 #define AT_FO_OVERLINE_ONLY 0X04
401 #define AT_FO_LEFT_VERTICAL_LINE_ONLY 0X08
402 #define AT_FO_UNDERLINE_AND_RIGHT_VERTICAL_LINE 0X03
403 #define AT_FO_UNDERLINE_AND_OVERLINE 0X05
404 #define AT_FO_UNDERLINE_AND_LEFT_VERTICAL_LINE 0X09
405 #define AT_FO_RIGHT_VERTICAL_LINE_AND_OVERLINE 0X06
406 #define AT_FO_RIGHT_AND_LEFT_VERTICAL_LINES 0X0A
407 #define AT_FO_OVERLINE_AND_LEFT_VERTICAL_LINE 0X0C
408 #define AT_FO_RECTANGLE_MINUS_LEFT_VERTICAL_LINE 0X07
409 #define AT_FO_RECTANGLE_MINUS_OVERLINE 0X0B
410 #define AT_FO_RECTANGLE_MINUS_RIGHT_VERTICAL_LINE 0X0D
411 #define AT_FO_RECTANGLE_MINUS_UNDERLINE 0X0E
412 #define AT_FO_RECTANGLE 0X0F
414 static const value_string vals_at_field_outlining[] = {
415 { AT_FO_NO_OUTLINING_LINES, "No outlining lines" },
416 { AT_FO_UNDERLINE_ONLY, "Underline only" },
417 { AT_FO_RIGHT_VERTICAL_LINE_ONLY, "Right vertical line only" },
418 { AT_FO_OVERLINE_ONLY, "Overline only" },
419 { AT_FO_LEFT_VERTICAL_LINE_ONLY, "Left vertical line only" },
420 { AT_FO_UNDERLINE_AND_RIGHT_VERTICAL_LINE, "Underline and right vertical line" },
421 { AT_FO_UNDERLINE_AND_OVERLINE, "Underline and overline" },
422 { AT_FO_UNDERLINE_AND_LEFT_VERTICAL_LINE, "Underline and left vertical line" },
423 { AT_FO_RIGHT_VERTICAL_LINE_AND_OVERLINE, "Right vertical line and overline" },
424 { AT_FO_RIGHT_AND_LEFT_VERTICAL_LINES, "Right and left vertical lines" },
425 { AT_FO_OVERLINE_AND_LEFT_VERTICAL_LINE, "Overline and left vertical line" },
426 { AT_FO_RECTANGLE_MINUS_LEFT_VERTICAL_LINE, "Rectangle minus left vertical line" },
427 { AT_FO_RECTANGLE_MINUS_OVERLINE, "Rectangle minus overline" },
428 { AT_FO_RECTANGLE_MINUS_RIGHT_VERTICAL_LINE, "Rectangle minus right vertical line" },
429 { AT_FO_RECTANGLE_MINUS_UNDERLINE, "Rectangle minus underline" },
430 { AT_FO_RECTANGLE, "Rectangle" },
434 /*--- 4.4.6.7 Transparency ----- */
435 #define AT_TR_DEFAULT_TRANSPARENCY 0X00
436 #define AT_TR_BACKGROUND_IS_TRANSPARENT_OR 0XF0
437 #define AT_TR_BACKGROUND_IS_TRANSPARENT_XOR 0XF1
438 #define AT_TR_BACKGROUND_IS_OPAQUE 0XFF
440 static const value_string vals_at_transparency[] = {
441 { AT_TR_DEFAULT_TRANSPARENCY, "Default" },
442 { AT_TR_BACKGROUND_IS_TRANSPARENT_OR, "Background is transparent (OR)" },
443 { AT_TR_BACKGROUND_IS_TRANSPARENT_XOR, "Background is transparent (XOR)" },
444 { AT_TR_BACKGROUND_IS_OPAQUE, "Background is opaque (non-transparent)" },
448 /*--- 4.4.6.8 Field Validation ----- */
449 #define AT_FV_MANDATORY_FILL 0x04 /* "Bit 5" */
450 #define AT_FV_MANDATORY_ENTRY 0x02 /* "Bit 6" */
451 #define AT_FV_TRIGGER 0x01 /* "Bit 7" */
453 static const struct true_false_string tn3270_field_validation_mandatory_fill = {
458 static const struct true_false_string tn3270_field_validation_mandatory_entry = {
463 static const struct true_false_string tn3270_field_validation_trigger = {
468 /*--- 5.1 Outbound Structured Fields ----- */
469 #define SF_OB_ACTIVATE_PARTITION 0x0E
470 #define SF_OB_BEGIN_OR_END_OF_FILE 0x0F85
471 #define SF_OB_CREATE_PARTITION 0x0C
472 #define SF_OB_DESTROY_PARTITION 0x0D
473 #define SF_OB_ERASE_OR_RESET 0x03
474 #define SF_OB_LOAD_COLOR_TABLE 0x0F05
475 #define SF_OB_LOAD_FORMAT_STORAGE 0x0F24
476 #define SF_OB_LOAD_LINE_TYPE 0x0F07
477 #define SF_OB_LOAD_PROGRAMMED_SYMBOLS 0x06
478 #define SF_OB_MODIFY_PARTITION 0x0F0A
479 #define SF_OB_OUTBOUND_TEXT_HEADER 0x0F71
480 #define SF_OB_OUTBOUND_3270DS 0x40
481 #define SF_OB_PRESENT_ABSOLUTE_FORMAT 0x4B
482 #define SF_OB_PRESENT_RELATIVE_FORMAT 0x4C
483 #define SF_OB_SET_PARTITION_CHARACTERISTICS 0x0F08
484 #define SF_OB_SET_REPLY_MODE 0x09
485 #define SF_OB_TYPE_1_TEXT_OUTBOUND 0x0FC1
486 #define SF_OB_READ_PARTITION 0x01
487 #define SF_OB_REQUEST_RECOVERY_DATA 0x1030
488 #define SF_OB_RESET_PARTITION 0x00
489 #define SF_OB_RESTART 0x1033
490 #define SF_OB_SCS_DATA 0x41
491 #define SF_OB_SELECT_COLOR_TABLE 0x0F04
492 #define SF_OB_SELECT_FORMAT_GROUP 0x4A
493 #define SF_OB_SET_CHECKPOINT_INTERVAL 0x1032
494 #define SF_OB_SET_MSR_CONTROL 0x0F01
495 #define SF_OB_SET_PRINTER_CHARACTERISTICS 0x0F84
496 #define SF_OB_SET_WINDOW_ORIGIN 0x0B
499 static const value_string vals_outbound_structured_fields[] = {
500 { SF_OB_ACTIVATE_PARTITION, "Activate Partition" },
501 { SF_OB_BEGIN_OR_END_OF_FILE, "Begin Or End Of File" },
502 { SF_OB_CREATE_PARTITION, "Create Partition" },
503 { SF_OB_DESTROY_PARTITION, "Destroy Partition" },
504 { SF_OB_ERASE_OR_RESET, "Erase Or Reset" },
505 { SF_OB_LOAD_COLOR_TABLE, "Load Color Table" },
506 { SF_OB_LOAD_FORMAT_STORAGE, "Load Format Storage" },
507 { SF_OB_LOAD_LINE_TYPE, "Load Line Type" },
508 { SF_OB_LOAD_PROGRAMMED_SYMBOLS, "Load Programmed Symbols" },
509 { SF_OB_MODIFY_PARTITION, "Modify Partition" },
510 { SF_OB_OUTBOUND_TEXT_HEADER, "Outbound Text Header" },
511 { SF_OB_OUTBOUND_3270DS, "Outbound 3270ds" },
512 { SF_OB_PRESENT_ABSOLUTE_FORMAT, "Present Absolute Format" },
513 { SF_OB_PRESENT_RELATIVE_FORMAT, "Present Relative Format" },
514 { SF_OB_SET_PARTITION_CHARACTERISTICS, "Set Partition Characteristics" },
515 { SF_OB_SET_REPLY_MODE, "Set Reply Mode" },
516 { SF_OB_TYPE_1_TEXT_OUTBOUND, "Type 1 Text Outbound" },
517 { SF_OB_READ_PARTITION, "Read Partition" },
518 { SF_OB_REQUEST_RECOVERY_DATA, "Request Recovery Data" },
519 { SF_OB_RESET_PARTITION, "Reset Partition" },
520 { SF_OB_RESTART, "Restart" },
521 { SF_OB_SCS_DATA, "Scs Data" },
522 { SF_OB_SELECT_COLOR_TABLE, "Select Color Table" },
523 { SF_OB_SELECT_FORMAT_GROUP, "Select Format Group" },
524 { SF_OB_SET_CHECKPOINT_INTERVAL, "Set Checkpoint Interval" },
525 { SF_OB_SET_MSR_CONTROL, "Set Msr Control" },
526 { SF_OB_SET_PRINTER_CHARACTERISTICS, "Set Printer Characteristics" },
527 { SF_OB_SET_WINDOW_ORIGIN, "Set Window Origin" },
531 /*--- 5.1 Outbound/Inbound Structured Fields ----- */
532 #define SF_OB_IB_DATA_CHAIN 0x0F21
533 #define SF_OB_IB_DESTINATION_OR_ORIGIN 0x0F02
534 #define SF_OB_IB_OBJECT_CONTROL 0x0F11
535 #define SF_OB_IB_OBJECT_DATA 0x0F0F
536 #define SF_OB_IB_OBJECT_PICTURE 0x0F10
537 #define SF_OB_IB_OEM_DATA 0x0F1F
538 #define SF_OB_IB_SAVE_OR_RESTORE_FORMAT 0x1034
539 #define SF_OB_IB_SELECT_IPDS_MODE 0x0F83
541 static const value_string vals_outbound_inbound_structured_fields[] = {
542 { SF_OB_IB_DATA_CHAIN, "Data Chain" },
543 { SF_OB_IB_DESTINATION_OR_ORIGIN, "Destination/Origin" },
544 { SF_OB_IB_OBJECT_CONTROL, "Object Control" },
545 { SF_OB_IB_OBJECT_DATA, "Object Data" },
546 { SF_OB_IB_OBJECT_PICTURE, "Object Picture" },
547 { SF_OB_IB_OEM_DATA, "OEM Data" },
548 { SF_OB_IB_SAVE_OR_RESTORE_FORMAT, "Save/Restore Format" },
549 { SF_OB_IB_SELECT_IPDS_MODE, "Select IPDS Mode." },
553 /*--- 5.11 Load Format Storage ----- */
554 #define LOAD_FORMAT_STORAGE_OPERAND_ADD 0x01
555 #define LOAD_FORMAT_STORAGE_OPERAND_DELETE_FORMAT 0x02
556 #define LOAD_FORMAT_STORAGE_OPERAND_DELETE_GROUP 0x03
557 #define LOAD_FORMAT_STORAGE_OPERAND_RESET_ALL 0x04
558 #define LOAD_FORMAT_STORAGE_OPERAND_REQUEST_SUMMARY_STATUS 0x05
559 #define LOAD_FORMAT_STORAGE_OPERAND_REQUEST_GROUP_STATUS 0x06
561 static const value_string vals_load_storage_format_operand[] = {
562 { LOAD_FORMAT_STORAGE_OPERAND_ADD, "Add" },
563 { LOAD_FORMAT_STORAGE_OPERAND_DELETE_FORMAT, "Delete Format" },
564 { LOAD_FORMAT_STORAGE_OPERAND_DELETE_GROUP, "Delete Group" },
565 { LOAD_FORMAT_STORAGE_OPERAND_RESET_ALL, "Reset All" },
566 { LOAD_FORMAT_STORAGE_OPERAND_REQUEST_SUMMARY_STATUS, "Request Summary Status" },
567 { LOAD_FORMAT_STORAGE_OPERAND_REQUEST_GROUP_STATUS, "Request Group Status" },
571 /*--- 5.19 Read Partition ----- */
572 #define READ_PARTITION_OPTYPE_QUERY 0x02
573 #define READ_PARTITION_OPTYPE_QUERY_LIST 0x03
574 #define READ_PARTITION_OPTYPE_READ_MODIFIED_ALL 0x6E
575 #define READ_PARTITION_OPTYPE_READ_BUFFER 0xF2
576 #define READ_PARTITION_OPTYPE_READ_MODIFIED 0xF6
578 static const value_string vals_read_partition_operation_type[] = {
579 { READ_PARTITION_OPTYPE_QUERY, "Read Partition Query" },
580 { READ_PARTITION_OPTYPE_QUERY_LIST, "Read Partition Query List" },
581 { READ_PARTITION_OPTYPE_READ_MODIFIED_ALL, "Read Partition Read Modified All" },
582 { READ_PARTITION_OPTYPE_READ_BUFFER, "Read Partition Read Buffer" },
583 { READ_PARTITION_OPTYPE_READ_MODIFIED, "Read Partition Read Modified" },
587 #define READ_PARTITION_REQTYPE_MASK 0xC0
588 static const value_string vals_read_partition_reqtype[] = {
589 { 0x00, "QCODE List" },
590 { 0x01, "Equivalent + QCODE List" },
595 /*--- 5.34 Data Chain ----- */
596 #define DATA_CHAIN_GROUP_MASK 0x60
597 #define DATA_CHAIN_INBOUND_CONTROL_MASK 0x18
599 static const value_string vals_data_chain_group[] = {
600 { 0x00, "Continue" },
607 static const value_string vals_data_chain_inbound_control[] = {
608 { 0x00, "No Change" },
609 { 0x01, "Enable Inbound Data Chaining" },
610 { 0x02, "Disable Inbound Data Chaining" },
611 { 0x03, "Reserved" },
615 /*--- 5.35 Destination or Origin ----- */
616 #define DESTINATION_OR_ORIGIN_FLAGS_INPUT_CONTROL_MASK 0xC0
618 static const value_string vals_destination_or_origin_flags_input_control[] = {
619 { 0x00, "Enable input" },
620 { 0x01, "No Change" },
621 { 0x02, "Disable Input" },
622 { 0x03, "Reserved" },
627 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */
630 ______ _______ ________ _______
632 | AID | Cursor address | Data |
635 |______|_______|________|_______|
637 An inbound data stream can also consist of an AID (X'88') followed by
638 structured fields as follows:
639 ______ __________________ ________ ___________________
641 | AID | Structured Field | ...... | Structured Field |
643 |______|__________________|________|___________________|
648 /*--- 3.5.6 Attention Identification Bytes (AID) ----- */
649 #define AID_NO_AID_GENERATED 0x60
650 #define AID_NO_AID_GENERATED_PRINTER_ONLY 0xE8
651 #define AID_STRUCTURED_FIELD 0x88
652 #define AID_READ_PARTITION_AID 0x61
653 #define AID_TRIGGER_ACTION 0x7F
654 #define AID_TEST_REQ_AND_SYS_REQ 0xF0
655 #define AID_PF1_KEY 0xF1
656 #define AID_PF2_KEY 0xF2
657 #define AID_PF3_KEY 0xF3
658 #define AID_PF4_KEY 0xF4
659 #define AID_PF5_KEY 0xF5
660 #define AID_PF6_KEY 0xF6
661 #define AID_PF7_KEY 0xF7
662 #define AID_PF8_KEY 0xF8
663 #define AID_PF9_KEY 0xF9
664 #define AID_PF10_KEY 0x7A
665 #define AID_PF11_KEY 0x7B
666 #define AID_PF12_KEY 0x7C
667 #define AID_PF13_KEY 0xC1
668 #define AID_PF14_KEY 0xC2
669 #define AID_PF15_KEY 0xC3
670 #define AID_PF16_KEY 0xC4
671 #define AID_PF17_KEY 0xC5
672 #define AID_PF18_KEY 0xC6
673 #define AID_PF19_KEY 0xC7
674 #define AID_PF20_KEY 0xC8
675 #define AID_PF21_KEY 0xC9
676 #define AID_PF22_KEY 0x4A
677 #define AID_PF23_KEY 0x4B
678 #define AID_PF24_KEY 0x4C
679 #define AID_PA1_KEY 0x6C
680 #define AID_PA2_KEY_CNCL 0x6E
681 #define AID_PA3_KEY 0x6B
682 #define AID_CLEAR_KEY 0x6D
683 #define AID_CLEAR_PARTITION_KEY 0x6A
684 #define AID_ENTER_KEY 0x7D
685 #define AID_SELECTOR_PEN_ATTENTION 0x7E
686 #define AID_OPERATOR_ID_READER 0xE6
687 #define AID_MAG_READER_NUMBER 0xE7
689 static const value_string vals_attention_identification_bytes[] = {
690 { AID_NO_AID_GENERATED, "No AID generated" },
691 { AID_NO_AID_GENERATED_PRINTER_ONLY, "No AID generated (printer only)" },
692 { AID_STRUCTURED_FIELD, "Structured field" },
693 { AID_READ_PARTITION_AID, "Read partition" },
694 { AID_TRIGGER_ACTION, "Trigger action" },
695 { AID_TEST_REQ_AND_SYS_REQ, "Test Req and Sys Req" },
696 { AID_PF1_KEY, "PF1 key" },
697 { AID_PF2_KEY, "PF2 key" },
698 { AID_PF3_KEY, "PF3 key" },
699 { AID_PF4_KEY, "PF4 key" },
700 { AID_PF5_KEY, "PF5 key" },
701 { AID_PF6_KEY, "PF6 key" },
702 { AID_PF7_KEY, "PF7 key" },
703 { AID_PF8_KEY, "PF8 key" },
704 { AID_PF9_KEY, "PF9 key" },
705 { AID_PF10_KEY, "PF10 key" },
706 { AID_PF11_KEY, "PF11 key" },
707 { AID_PF12_KEY, "PF12 key" },
708 { AID_PF13_KEY, "PF13 key" },
709 { AID_PF14_KEY, "PF14 key" },
710 { AID_PF15_KEY, "PF15 key" },
711 { AID_PF16_KEY, "PF16 key" },
712 { AID_PF17_KEY, "PF17 key" },
713 { AID_PF18_KEY, "PF18 key" },
714 { AID_PF19_KEY, "PF19 key" },
715 { AID_PF20_KEY, "PF20 key" },
716 { AID_PF21_KEY, "PF21 key" },
717 { AID_PF22_KEY, "PF22 key" },
718 { AID_PF23_KEY, "PF23 key" },
719 { AID_PF24_KEY, "PF24 key" },
720 { AID_PA1_KEY, "PA1 key" },
721 { AID_PA2_KEY_CNCL, "PA2 key (Cncl)" },
722 { AID_PA3_KEY, "PA3 key" },
723 { AID_CLEAR_KEY, "Clear key" },
724 { AID_CLEAR_PARTITION_KEY, "Clear Partition key" },
725 { AID_ENTER_KEY, "Enter key" },
726 { AID_SELECTOR_PEN_ATTENTION, "Selector pen attention" },
727 { AID_OPERATOR_ID_READER, "Operator ID reader" },
728 { AID_MAG_READER_NUMBER, "Mag Reader Number" },
732 /*--- 5.3.6 Object Control ----- */
733 #define OBJC_GRAPHICS 0x00
734 #define OBJC_IMAGE 0x01
736 static const value_string vals_oc_type[] = {
737 { OBJC_GRAPHICS, "Graphics" },
738 { OBJC_IMAGE, "Image)" },
742 /*--- 6.1 Inbound Structured Fields ----- */
743 #define SF_IB_EXCEPTION_OR_STATUS 0x0F22
744 #define SF_IB_INBOUND_TEXT_HEADER 0x0FB1
745 #define SF_IB_INBOUND_3270DS 0x0F80 /* TODO: Check */
746 #define SF_IB_RECOVERY_DATA 0x1031
747 #define SF_IB_TYPE_1_TEXT_INBOUND 0x0FC1
748 #define SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS 0x8184
749 #define SF_IB_QUERY_REPLY_AUXILIARY_DEVICE 0x8199
750 #define SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE 0x819F
751 #define SF_IB_QUERY_REPLY_CHARACTER_SETS 0x8185
752 #define SF_IB_QUERY_REPLY_COLOR 0x8186
753 #define SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR 0x81AB
754 #define SF_IB_QUERY_REPLY_DATA_CHAINING 0x8198
755 #define SF_IB_QUERY_REPLY_DATA_STREAMS 0x81A2
756 #define SF_IB_QUERY_REPLY_DBCS_ASIA 0x8191
757 #define SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS 0x81A0
758 #define SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT 0x8195
759 #define SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE 0x8197
760 #define SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE 0x81B5
761 #define SF_IB_QUERY_REPLY_FIELD_OUTLINING 0x818C
762 #define SF_IB_QUERY_REPLY_FIELD_VALIDATION 0x818A
763 #define SF_IB_QUERY_REPLY_FORMAT_PRESENTATION 0x8190
764 #define SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE 0x8194
765 #define SF_IB_QUERY_REPLY_GRAPHIC_COLOR 0x81B4
766 #define SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS 0x81B6
767 #define SF_IB_QUERY_REPLY_HIGHLIGHTING 0x8187
768 #define SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE 0x819E
769 #define SF_IB_QUERY_REPLY_IMAGE 0x8182
770 #define SF_IB_QUERY_REPLY_IMPLICIT_PARTITION 0x81A6
771 #define SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE 0x81AA
772 #define SF_IB_QUERY_REPLY_LINE_TYPE 0x81B2
773 #define SF_IB_QUERY_REPLY_MSR_CONTROL 0x818B
774 #define SF_IB_QUERY_REPLY_NULL 0x81FF
775 #define SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE 0x818F
776 #define SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES 0x81A7
777 #define SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS 0x818E
778 #define SF_IB_QUERY_REPLY_PORT 0x81B3
779 #define SF_IB_QUERY_REPLY_PROCEDURE 0x81B1
780 #define SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM 0x819C
781 #define SF_IB_QUERY_REPLY_REPLY_MODES 0x8188
782 #define SF_IB_QUERY_REPLY_RPQ_NAMES 0x81A1
783 #define SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT 0x8192
784 #define SF_IB_QUERY_REPLY_SEGMENT 0x81B0
785 #define SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS 0x81A9
786 #define SF_IB_QUERY_REPLY_STORAGE_POOLS 0x8196
787 #define SF_IB_QUERY_REPLY_SUMMARY 0x8180
788 #define SF_IB_QUERY_REPLY_TEXT_PARTITIONS 0x8183
789 #define SF_IB_QUERY_REPLY_TRANSPARENCY 0x81A8
790 #define SF_IB_QUERY_REPLY_USABLE_AREA 0x8181
791 #define SF_IB_QUERY_REPLY_3270_IPDS 0x819A
793 static const value_string vals_inbound_structured_fields[] = {
794 { SF_IB_EXCEPTION_OR_STATUS, "Exception/Status" },
795 { SF_IB_INBOUND_TEXT_HEADER, "Inbound Text Header" },
796 { SF_IB_INBOUND_3270DS, "Inbound 3270DS" },
797 { SF_IB_RECOVERY_DATA, "Recovery Data" },
798 { SF_IB_TYPE_1_TEXT_INBOUND, "Type 1 Text Inbound" },
799 { SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS, "Query Reply (Alphanumeric Partitions)" },
800 { SF_IB_QUERY_REPLY_AUXILIARY_DEVICE, "Query Reply (Auxiliary Device)" },
801 { SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE, "Query Reply (Begin/End of File)" },
802 { SF_IB_QUERY_REPLY_CHARACTER_SETS, "Query Reply (Character Sets)" },
803 { SF_IB_QUERY_REPLY_COLOR, "Query Reply (Color)" },
804 { SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR, "Query Reply (Cooperative Processing Requestor)" },
805 { SF_IB_QUERY_REPLY_DATA_CHAINING, "Query Reply (Data Chaining)" },
806 { SF_IB_QUERY_REPLY_DATA_STREAMS, "Query Reply (Data Streams)" },
807 { SF_IB_QUERY_REPLY_DBCS_ASIA, "Query Reply (DBCS-Asia)" },
808 { SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS, "Query Reply (Device Characteristics)" },
809 { SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT, "Query Reply (Distributed Data Management)" },
810 { SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE, "Query Reply (Document Interchange Architecture)" },
811 { SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE, "Query Reply (Extended Drawing Routine)" },
812 { SF_IB_QUERY_REPLY_FIELD_OUTLINING, "Query Reply (Field Outlining)" },
813 { SF_IB_QUERY_REPLY_FIELD_VALIDATION, "Query Reply (Field Validation)" },
814 { SF_IB_QUERY_REPLY_FORMAT_PRESENTATION, "Query Reply (Format Presentation)" },
815 { SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE, "Query Reply (Format Storage Auxiliary Device)" },
816 { SF_IB_QUERY_REPLY_GRAPHIC_COLOR, "Query Reply (Graphic Color)" },
817 { SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS, "Query Reply (Graphic Symbol Sets)" },
818 { SF_IB_QUERY_REPLY_HIGHLIGHTING, "Query Reply (Highlighting)" },
819 { SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE, "Query Reply (IBM Auxiliary Device)" },
820 { SF_IB_QUERY_REPLY_IMAGE, "Query Reply (Image)" },
821 { SF_IB_QUERY_REPLY_IMPLICIT_PARTITION, "Query Reply (Implicit Partition)" },
822 { SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE, "Query Reply (IOCA Auxiliary Device)" },
823 { SF_IB_QUERY_REPLY_LINE_TYPE, "Query Reply (Line Type)" },
824 { SF_IB_QUERY_REPLY_MSR_CONTROL, "Query Reply (MSR Control)" },
825 { SF_IB_QUERY_REPLY_NULL, "Query Reply (Null)" },
826 { SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE, "Query Reply (OEM Auxiliary Device)" },
827 { SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES, "Query Reply (Paper Feed Techniques)" },
828 { SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS, "Query Reply (Partition Characteristics)" },
829 { SF_IB_QUERY_REPLY_PORT, "Query Reply (Port)" },
830 { SF_IB_QUERY_REPLY_PROCEDURE, "Query Reply (Procedure)" },
831 { SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM, "Query Reply (Product Defined Data Stream)" },
832 { SF_IB_QUERY_REPLY_REPLY_MODES, "Query Reply (Reply Modes)" },
833 { SF_IB_QUERY_REPLY_RPQ_NAMES, "Query Reply (RPQ Names)" },
834 { SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT, "Query Reply (Save/Restore Format)" },
835 { SF_IB_QUERY_REPLY_SEGMENT, "Query Reply (Segment)" },
836 { SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS, "Query Reply (Settable Printer Characteristics)" },
837 { SF_IB_QUERY_REPLY_STORAGE_POOLS, "Query Reply (Storage Pools)" },
838 { SF_IB_QUERY_REPLY_SUMMARY, "Query Reply (Summary)" },
839 { SF_IB_QUERY_REPLY_TEXT_PARTITIONS, "Query Reply (Text Partitions)" },
840 { SF_IB_QUERY_REPLY_TRANSPARENCY, "Query Reply (Transparency)" },
841 { SF_IB_QUERY_REPLY_USABLE_AREA, "Query Reply (Usable Area)" },
842 { SF_IB_QUERY_REPLY_3270_IPDS, "Query Reply (3270 IPDS)." },
846 /*--- 6.2 - Exception/Status ----- */
847 #define SDP_STATCODE_ACKNOWLEDGED 0x0000
848 #define SDP_STATCODE_AUXDEVICEAVAIL 0X0001
850 static const value_string vals_sdp_statcode[] = {
851 { SDP_STATCODE_ACKNOWLEDGED, "Acknowledged. The formats were successfully loaded, and no exception occurred." },
852 { SDP_STATCODE_AUXDEVICEAVAIL, "Auxiliary device available" },
856 #define SDP_EXCODE_INVALID_DOID 0x0801
857 #define SDP_EXCODE_DEVICENOTAVAIL 0X0802
858 #define SDP_EXCODE_RETIRED 0X0803
859 #define SDP_EXCODE_BUFFER_OVERRUN 0X0804
860 #define SDP_EXCODE_STORAGE 0X0805
861 #define SDP_EXCODE_FORMATNOTSPEC 0X0806
862 #define SDP_EXCODE_DATAERROR 0X0807
863 #define SDP_EXCODE_INSUFFRESOURCE 0X084B
864 #define SDP_EXCODE_EXCEEDSLIMIT 0X084C
865 #define SDP_EXCODE_FUNCTNOTSUPP 0X1003
867 static const value_string vals_sdp_excode[] = {
868 { SDP_EXCODE_INVALID_DOID,
869 "Invalid/unrecognized DOID in the Destination/Origin structured field."
870 " AVAILSTAT must be set to B'0'." },
871 { SDP_EXCODE_DEVICENOTAVAIL,
872 "DOID valid, but the auxiliary device is not available because of an"
873 " intervention required condition (for example, out of paper, power"
874 " off, or processing code not resident). Available status is sent"
875 " when the condition clears. AVAILSTAT must be set to B'1'." },
876 { SDP_EXCODE_RETIRED,
878 { SDP_EXCODE_BUFFER_OVERRUN,
880 { SDP_EXCODE_STORAGE,
881 "Insufficient storage. The loading of the formats could not be"
882 " completed because storage was exhausted." },
883 { SDP_EXCODE_FORMATNOTSPEC,
884 "The format or group name was not specified in the Load Format"
885 " Storage structured field." },
886 { SDP_EXCODE_DATAERROR,
888 { SDP_EXCODE_INSUFFRESOURCE,
889 "Temporary insufficient resource. The application does not have"
890 " a buffer available or is busy. The device chooses whether to"
891 " set send status when the condition clears and set AVAILSTAT accordingly." },
892 { SDP_EXCODE_EXCEEDSLIMIT,
893 "The auxiliary device data in the transmission exceeds the limit specified"
894 " in the LIMOUT parameter of the Query Reply for the auxiliary device."
895 " AVAILSTAT must be set to B'0'." },
896 { SDP_EXCODE_FUNCTNOTSUPP,
897 "Function not supported." },
901 /* Query Reply Types */
902 #define SF_QR_ALPHANUMERIC_PARTITIONS 0x84
903 #define SF_QR_AUXILIARY_DEVICE 0x99
904 #define SF_QR_QBEGIN_OR_END_OF_FILE 0x9F
905 #define SF_QR_CHARACTER_SETS 0x85
906 #define SF_QR_COLOR 0x86
907 #define SF_QR_COOPERATIVE_PROCESSING_REQUESTOR 0xAB
908 #define SF_QR_DATA_CHAINING 0x98
909 #define SF_QR_DATA_STREAMS 0xA2
910 #define SF_QR_DBCS_ASIA 0x91
911 #define SF_QR_DEVICE_CHARACTERISTICS 0xA0
912 #define SF_QR_DISTRIBUTED_DATA_MANAGEMENT 0x95
913 #define SF_QR_DOCUMENT_INTERCHANGE_ARCHITECTURE 0x97
914 #define SF_QR_EXTENDED_DRAWING_ROUTINE 0xB5
915 #define SF_QR_QFIELD_OUTLINING 0x8C
916 #define SF_QR_QFIELD_VALIDATION 0x8A
917 #define SF_QR_FORMAT_PRESENTATION 0x90
918 #define SF_QR_FORMAT_STORAGE_AUXILIARY_DEVICE 0x94
919 #define SF_QR_GRAPHIC_COLOR 0xB4
920 #define SF_QR_GRAPHIC_SYMBOL_SETS 0xB6
921 #define SF_QR_HIGHLIGHTING 0x87
922 #define SF_QR_IBM_AUXILIARY_DEVICE 0x9E
923 #define SF_QR_IMAGE 0x82
924 #define SF_QR_IMPLICIT_PARTITION 0xA6
925 #define SF_QR_IOCA_AUXILIARY_DEVICE 0xAA
926 #define SF_QR_LINE_TYPE 0xB2
927 #define SF_QR_MSR_CONTROL 0x8B
928 #define SF_QR_QNULL 0xFF
929 #define SF_QR_OEM_AUXILIARY_DEVICE 0x8F
930 #define SF_QR_PAPER_FEED_TECHNIQUES 0xA7
931 #define SF_QR_PARTITION_CHARACTERISTICS 0x8E
932 #define SF_QR_PORT 0xB3
933 #define SF_QR_PROCEDURE 0xB1
934 #define SF_QR_PRODUCT_DEFINED_DATA_STREAM 0x9C
935 #define SF_QR_REPLY_MODES 0x88
936 #define SF_QR_RPQ_NAMES 0xA1
937 #define SF_QR_QSAVE_OR_RESTORE_FORMAT 0x92
938 #define SF_QR_SEGMENT 0xB0
939 #define SF_QR_SETTABLE_PRINTER_CHARACTERISTICS 0xA9
940 #define SF_QR_STORAGE_POOLS 0x96
941 #define SF_QR_SUMMARY 0x80
942 #define SF_QR_TEXT_PARTITIONS 0x83
943 #define SF_QR_QTRANSPARENCY 0xA8
944 #define SF_QR_USABLE_AREA 0x81
945 #define SF_QR_T3270_IPDS 0x9A
947 static const value_string vals_sf_query_replies[] = {
948 { SF_QR_ALPHANUMERIC_PARTITIONS, "Alphanumeric Partitions" },
949 { SF_QR_AUXILIARY_DEVICE, "Auxiliary Device" },
950 { SF_QR_QBEGIN_OR_END_OF_FILE, "Begin/End of File" },
951 { SF_QR_CHARACTER_SETS, "Character Sets" },
952 { SF_QR_COLOR, "Color" },
953 { SF_QR_COOPERATIVE_PROCESSING_REQUESTOR, "Cooperative Processing Requestor" },
954 { SF_QR_DATA_CHAINING, "Data Chaining" },
955 { SF_QR_DATA_STREAMS, "Data Streams" },
956 { SF_QR_DBCS_ASIA, "DBCS-Asia" },
957 { SF_QR_DEVICE_CHARACTERISTICS, "Device Characteristics" },
958 { SF_QR_DISTRIBUTED_DATA_MANAGEMENT, "Distributed Data Management" },
959 { SF_QR_DOCUMENT_INTERCHANGE_ARCHITECTURE, "Document Interchange Architecture" },
960 { SF_QR_EXTENDED_DRAWING_ROUTINE, "Extended Drawing Routine" },
961 { SF_QR_QFIELD_OUTLINING, "Field Outlining" },
962 { SF_QR_QFIELD_VALIDATION, "Field Validation" },
963 { SF_QR_FORMAT_PRESENTATION, "Format Presentation" },
964 { SF_QR_FORMAT_STORAGE_AUXILIARY_DEVICE, "Format Storage Auxiliary Device" },
965 { SF_QR_GRAPHIC_COLOR, "Graphic Color" },
966 { SF_QR_GRAPHIC_SYMBOL_SETS, "Graphic Symbol Sets" },
967 { SF_QR_HIGHLIGHTING, "Highlighting" },
968 { SF_QR_IBM_AUXILIARY_DEVICE, "IBM Auxiliary Device" },
969 { SF_QR_IMAGE, "Image" },
970 { SF_QR_IMPLICIT_PARTITION, "Implicit Partition" },
971 { SF_QR_IOCA_AUXILIARY_DEVICE, "IOCA Auxiliary Device" },
972 { SF_QR_LINE_TYPE, "Line Type" },
973 { SF_QR_MSR_CONTROL, "MSR Control" },
974 { SF_QR_QNULL, "Null" },
975 { SF_QR_OEM_AUXILIARY_DEVICE, "OEM Auxiliary Device" },
976 { SF_QR_PAPER_FEED_TECHNIQUES, "Paper Feed Techniques" },
977 { SF_QR_PARTITION_CHARACTERISTICS, "Partition Characteristics" },
978 { SF_QR_PORT, "Port" },
979 { SF_QR_PROCEDURE, "Procedure" },
980 { SF_QR_PRODUCT_DEFINED_DATA_STREAM, "Product Defined Data Stream" },
981 { SF_QR_REPLY_MODES, "Reply Modes" },
982 { SF_QR_RPQ_NAMES, "RPQ Names" },
983 { SF_QR_QSAVE_OR_RESTORE_FORMAT, "Save/Restore Format" },
984 { SF_QR_SEGMENT, "Segment" },
985 { SF_QR_SETTABLE_PRINTER_CHARACTERISTICS, "Settable Printer Characteristics" },
986 { SF_QR_STORAGE_POOLS, "Storage Pools" },
987 { SF_QR_SUMMARY, "Summary" },
988 { SF_QR_TEXT_PARTITIONS, "Text Partitions" },
989 { SF_QR_QTRANSPARENCY, "Transparency" },
990 { SF_QR_USABLE_AREA, "Usable Area" },
991 { SF_QR_T3270_IPDS, "3270 IPDS." },
995 /*--- 6.9 Query Reply Alphanumeric Partitions ----- */
996 #define QR_AP_VERTWIN 0x80
997 #define QR_AP_HORWIN 0x40
998 #define QR_AP_APRES1 0x20
999 #define QR_AP_APA_FLG 0x10
1000 #define QR_AP_PROT 0x08
1001 #define QR_AP_LCOPY 0x04
1002 #define QR_AP_MODPART 0x02
1003 #define QR_AP_APRES2 0x01
1005 /*--- 6.12 - Query Reply (Character Sets) ----- */
1006 #define QR_CS_ALT 0x80
1007 #define QR_CS_MULTID 0x40
1008 #define QR_CS_LOADABLE 0x20
1009 #define QR_CS_EXT 0x10
1010 #define QR_CS_MS 0x08
1011 #define QR_CS_CH2 0x04
1012 #define QR_CS_GF 0x02
1013 #define QR_CS_CSRES 0x01
1015 #define QR_CS_CSRES2 0x80
1016 #define QR_CS_PSCS 0x40
1017 #define QR_CS_CSRES3 0x20
1018 #define QR_CS_CF 0x10
1019 #define QR_CS_CSRES4 0x08
1020 #define QR_CS_CSRES5 0x04
1021 #define QR_CS_GCSRES6 0x02
1022 #define QR_CS_CSRES7 0x01
1025 /*--- 6.15 Query Reply (Data Chaining) ----- */
1026 static const value_string vals_data_chaining_dir[] = {
1028 { 0x01, "From device only" },
1029 { 0x02, "To device only" },
1033 /*--- 6.16 Query Reply (Data Streams) ----- */
1034 #define QR_DS_SCS 0x00
1035 #define QR_DS_DCAL2 0x01
1036 #define QR_DS_IPDS 0x02
1038 static const value_string vals_data_streams[] = {
1040 "SCS Base Data Stream with extensions as specified in the BIND request"
1041 " and Device Characteristics Query Reply structured field" },
1043 "Document Content Architecture Level 2" },
1045 "IPDS as defined in related documentation" },
1049 /*--- 6.51 Query Reply Usable Area ----- */
1050 #define QR_UA_RESERVED1 0x80
1051 #define QR_UA_PAGE_PRINTER 0x40
1052 #define QR_UA_RESERVED2 0x20
1053 #define QR_UA_HARD_COPY 0x10
1055 #define QR_UA_ADDR_MODE_MASK 0x0F
1056 #define QR_UA_ADDR_MODE_RESERVED1 0x00
1057 #define QR_UA_ADDR_MODE_TWELVE_FOURTEEN_BIT_OK 0x01
1058 #define QR_UA_ADDR_MODE_RESERVED2 0x02
1059 #define QR_UA_ADDR_MODE_TWELVE_FOURTEEN_SXTN_BIT_OK 0x03
1060 #define QR_UA_ADDR_MODE_UNMAPPED 0x0F
1062 static const value_string vals_usable_area_addr_mode[] = {
1063 { QR_UA_ADDR_MODE_RESERVED1, "Reserved" },
1064 { QR_UA_ADDR_MODE_TWELVE_FOURTEEN_BIT_OK, "Twelve/Fourteen Bit Addressing Allowed" },
1065 { QR_UA_ADDR_MODE_RESERVED2, "Reserved" },
1066 { QR_UA_ADDR_MODE_TWELVE_FOURTEEN_SXTN_BIT_OK , "Twelve/Fourteen/Sixteen Bit Addressing Allowed" },
1067 { QR_UA_ADDR_MODE_UNMAPPED, "Unmapped" },
1071 #define QR_UA_VARIABLE_CELLS 0x80
1072 #define QR_UA_CHARACTERS 0x40
1073 #define QR_UA_CELL_UNITS 0x20
1075 static const struct true_false_string tn3270_tfs_ua_variable_cells = {
1080 static const struct true_false_string tn3270_tfs_ua_characters = {
1081 "Non-matrix character",
1085 static const struct true_false_string tn3270_tfs_ua_cell_units = {
1091 #define QR_UA_UOM_INCHES 0x00
1092 #define QR_UA_UOM_MILLIMETERS 0x01
1094 static const value_string vals_usable_area_uom[] = {
1095 { QR_UA_UOM_INCHES, "Inches" },
1096 { QR_UA_UOM_MILLIMETERS, "Millimeters" },
1100 /*--- 6.42 - Query reply (Reply Modes) ----- */
1101 /* Also for: 5.30 - Set Reply Mode */
1103 #define RM_REPLY_FIELD_MODE 0x00
1104 #define RM_REPLY_EXTENDED_FIELD_MODE 0x01
1105 #define RM_REPLY_CHARACTER_MODE 0x02
1107 static const value_string vals_reply_modes[] = {
1108 { RM_REPLY_FIELD_MODE, "Field Mode" },
1109 { RM_REPLY_EXTENDED_FIELD_MODE, "Extended Field Mode" },
1110 { RM_REPLY_CHARACTER_MODE, "Character Mode" },
1114 /*--- 6.19 - Query Reply (Distributed Data Management) ----- */
1115 #define QR_DDM_COPY_SUBSET_1 0x01
1117 static const value_string vals_qr_ddm[] = {
1118 { QR_DDM_COPY_SUBSET_1, "DDM Copy Subset 1" },
1122 /*--- 6.20 - Query Reply (Document Interchange Architecture) ----- */
1123 #define QR_DIA_FILE_SERVER 0x01
1124 #define QR_DIA_FILE_REQ 0x02
1125 #define QR_DIA_FILE_SERVER_REQ 0x03
1127 static const value_string vals_qr_dia[] = {
1128 { QR_DIA_FILE_SERVER, "File Server" },
1129 { QR_DIA_FILE_REQ, "File Requestor" },
1130 { QR_DIA_FILE_SERVER_REQ, "Both File Server and File Requestor" },
1134 /*--- 6.31 - Query Reply (Implicit Partitions) ----- */
1135 #define QR_IP_SDP_DISPLAY 0x01
1136 #define QR_IP_SDP_PRINTER 0x02
1137 #define QR_IP_SDP_CHARACTER 0x03
1140 static const value_string vals_qr_ip[] = {
1141 { QR_IP_SDP_DISPLAY, "Display Devices" },
1142 { QR_IP_SDP_PRINTER, "Printer Devices" },
1143 { QR_IP_SDP_CHARACTER, "Character Devices" },
1148 /*--- 6.41 - Query Reply (Product Defined Data Streams) ----- */
1149 #define QR_PDDS_REFID_GRAPH5080 0x01
1150 #define QR_PDDS_REFID_WHIPAPI 0x02
1152 static const value_string vals_qr_pdds_refid[] = {
1153 { QR_PDDS_REFID_GRAPH5080, "Supports the 5080 Graphics System" },
1154 { QR_PDDS_REFID_WHIPAPI, "Supports the WHIP API data stream" },
1158 #define QR_PDDS_SSID_HFGD 0x01
1159 #define QR_PDDS_SSID_RS232 0x02
1161 static const value_string vals_qr_pdds_ssid[] = {
1162 { QR_PDDS_SSID_HFGD , "5080 HFGD Graphics Subset" },
1163 { QR_PDDS_SSID_RS232, "5080 RS232 Ports Subset" },
1167 /*--- 6.47 - Query Reply (Storage Pools) ----- */
1168 #define QR_SP_OBJ_SEGMENT1 0x0001
1169 #define QR_SP_OBJ_PROCEDURE1 0x0002
1170 #define QR_SP_OBJ_EXTENDED_DRAWING 0x0003
1171 #define QR_SP_OBJ_DATA_UNIT 0x0004
1172 #define QR_SP_OBJ_TEMPORARY 0x0005
1173 #define QR_SP_OBJ_LINE_TYPE1 0x0006
1174 #define QR_SP_OBJ_SYMBOL_SET 0x0007
1176 static const value_string vals_sp_objlist[] = {
1177 { QR_SP_OBJ_SEGMENT1, "Segment" },
1178 { QR_SP_OBJ_PROCEDURE1, "Procedure" },
1179 { QR_SP_OBJ_EXTENDED_DRAWING, "Extended drawing routine" },
1180 { QR_SP_OBJ_DATA_UNIT, "Data unit" },
1181 { QR_SP_OBJ_TEMPORARY, "Temporary" },
1182 { QR_SP_OBJ_LINE_TYPE1, "Line type" },
1183 { QR_SP_OBJ_SYMBOL_SET, "Symbol set" },
1187 /* TN3270E Header - Data Type */
1188 #define TN3270E_3270_DATA 0x00
1189 #define TN3270E_BIND_IMAGE 0x03
1190 #define TN3270E_NVT_DATA 0x05
1191 #define TN3270E_REQUEST 0x06
1192 #define TN3270E_RESPONSE 0x02
1193 #define TN3270E_SCS_DATA 0x01
1194 #define TN3270E_SSCP_LU_DATA 0x07
1195 #define TN3270E_UNBIND 0x04
1197 static const value_string vals_tn3270_header_data_types[] = {
1198 { TN3270E_3270_DATA, "3270_DATA" },
1199 { TN3270E_BIND_IMAGE, "BIND_IMAGE" },
1200 { TN3270E_NVT_DATA, "NVT_DATA" },
1201 { TN3270E_REQUEST, "REQUEST" },
1202 { TN3270E_RESPONSE, "RESPONSE" },
1203 { TN3270E_SCS_DATA, "SCS_DATA" },
1204 { TN3270E_SSCP_LU_DATA, "SSCP_LU_DATA" },
1205 { TN3270E_UNBIND, "UNBIND" },
1210 /* TN3270E Header - Request Flags */
1211 #define TN3270E_COND_CLEARED 0x00
1213 static const value_string vals_tn3270_header_request_flags[] = {
1214 { TN3270E_COND_CLEARED, "Condition Cleared" },
1218 /* TN3270E Header - Response Flags - Data Type 3270 and SCS */
1219 #define TN3270E_NO_RESPONSE 0x00
1220 #define TN3270E_ERROR_RESPONSE 0x01
1221 #define TN3270E_ALWAYS_RESPONSE 0x02
1223 static const value_string vals_tn3270_header_response_flags_3270_SCS[] = {
1224 { TN3270E_NO_RESPONSE, "No-Response" },
1225 { TN3270E_ERROR_RESPONSE, "Error-Response" },
1226 { TN3270E_ALWAYS_RESPONSE, "Always-Response" },
1230 /* TN3270E Header _ Response Flags - Data Type Response */
1231 #define TN3270E_POSITIVE_RESPONSE 0x00
1232 #define TN3270E_NEGATIVE_RESPONSE 0x01
1234 static const value_string vals_tn3270_header_response_flags_response[] = {
1235 { TN3270E_POSITIVE_RESPONSE, "Positive-Response" },
1236 { TN3270E_NEGATIVE_RESPONSE, "Negative-Response" },
1241 * Data structure attached to a conversation, giving authentication
1242 * information from a bind request.
1244 typedef struct tn3270_conv_info_t {
1245 address outbound_addr;
1246 guint32 outbound_port;
1247 address inbound_addr;
1248 guint32 inbound_port;
1254 } tn3270_conv_info_t;
1257 static int proto_tn3270 = -1;
1259 static int hf_tn3270_fa_display = -1;
1260 static int hf_tn3270_fa_graphic_convert = -1;
1261 static int hf_tn3270_fa_modified = -1;
1262 static int hf_tn3270_fa_numeric = -1;
1263 static int hf_tn3270_fa_protected = -1;
1264 static int hf_tn3270_fa_reserved = -1;
1265 static int hf_tn3270_field_attribute = -1;
1266 static int hf_tn3270_aid = -1;
1267 static int hf_tn3270_all_character_attributes = -1;
1268 static int hf_tn3270_attribute_type = -1;
1269 static int hf_tn3270_begin_end_flags1 = -1;
1270 static int hf_tn3270_begin_end_flags2 = -1;
1271 static int hf_tn3270_bsc = -1;
1272 static int hf_tn3270_buffer_address = -1;
1273 static int hf_tn3270_c_cav = -1;
1274 static int hf_tn3270_cc = -1;
1275 static int hf_tn3270_character_code = -1;
1276 static int hf_tn3270_character_set = -1;
1277 static int hf_tn3270_charset = -1;
1278 static int hf_tn3270_checkpoint = -1;
1279 static int hf_tn3270_c_ci = -1;
1280 static int hf_tn3270_c_offset = -1;
1281 static int hf_tn3270_color = -1;
1282 static int hf_tn3270_color_command = -1;
1283 static int hf_tn3270_color_flags = -1;
1284 static int hf_tn3270_command_code = -1;
1285 static int hf_tn3270_cro = -1;
1286 static int hf_tn3270_c_scsoff = -1;
1287 static int hf_tn3270_c_seqoff = -1;
1288 static int hf_tn3270_c_sequence = -1;
1289 static int hf_tn3270_cursor_address = -1;
1290 static int hf_tn3270_cw = -1;
1291 static int hf_tn3270_data_chain_fields = -1;
1292 static int hf_tn3270_data_chain_group = -1;
1293 static int hf_tn3270_data_chain_inbound_control = -1;
1294 static int hf_tn3270_destination_or_origin_flags_input_control = -1;
1295 static int hf_tn3270_destination_or_origin_doid = -1;
1296 static int hf_tn3270_erase_flags = -1;
1297 static int hf_tn3270_exception_or_status_flags = -1;
1298 static int hf_tn3270_extended_highlighting = -1;
1299 static int hf_tn3270_extended_ps_color = -1;
1300 static int hf_tn3270_extended_ps_echar = -1;
1301 static int hf_tn3270_extended_ps_flags = -1;
1302 static int hf_tn3270_extended_ps_length = -1;
1303 static int hf_tn3270_extended_ps_lw = -1;
1304 static int hf_tn3270_extended_ps_lh = -1;
1305 static int hf_tn3270_extended_ps_nh = -1;
1306 static int hf_tn3270_extended_ps_nw = -1;
1307 static int hf_tn3270_extended_ps_res = -1;
1308 static int hf_tn3270_extended_ps_stsubs = -1;
1309 static int hf_tn3270_extended_ps_subsn = -1;
1310 static int hf_tn3270_featl = -1;
1311 static int hf_tn3270_feats = -1;
1312 static int hf_tn3270_field_data = -1;
1313 static int hf_tn3270_field_outlining = -1;
1314 static int hf_tn3270_field_validation_mandatory_entry = -1;
1315 static int hf_tn3270_field_validation_mandatory_fill = -1;
1316 static int hf_tn3270_field_validation_trigger = -1;
1317 static int hf_tn3270_format_group = -1;
1318 static int hf_tn3270_format_name = -1;
1319 static int hf_tn3270_fov = -1;
1320 static int hf_tn3270_fpc = -1;
1321 static int hf_tn3270_hilite = -1;
1322 static int hf_tn3270_h_length = -1;
1323 static int hf_tn3270_h_offset = -1;
1324 static int hf_tn3270_horizon = -1;
1325 static int hf_tn3270_h_sequence = -1;
1326 static int hf_tn3270_hw = -1;
1327 static int hf_tn3270_interval = -1;
1328 static int hf_tn3270_limin = -1;
1329 static int hf_tn3270_limout = -1;
1330 static int hf_tn3270_lines = -1;
1331 static int hf_tn3270_load_color_command = -1;
1332 static int hf_tn3270_load_format_storage_flags1 = -1;
1333 static int hf_tn3270_load_format_storage_flags2 = -1;
1334 static int hf_tn3270_load_format_storage_format_data = -1;
1335 static int hf_tn3270_load_format_storage_localname = -1;
1336 static int hf_tn3270_load_format_storage_operand = -1;
1337 static int hf_tn3270_load_line_type_command = -1;
1338 static int hf_tn3270_lvl = -1;
1339 static int hf_tn3270_mode = -1;
1340 static int hf_tn3270_msr_ind_mask = -1;
1341 static int hf_tn3270_msr_ind_value = -1;
1342 static int hf_tn3270_msr_state_mask = -1;
1343 static int hf_tn3270_msr_state_value = -1;
1344 static int hf_tn3270_msr_type = -1;
1345 static int hf_tn3270_ap_na = -1;
1346 static int hf_tn3270_ap_m = -1;
1347 static int hf_tn3270_ap_vertical_scrolling = -1;
1348 static int hf_tn3270_ap_horizontal_scrolling = -1;
1349 static int hf_tn3270_ap_apres1 = -1;
1350 static int hf_tn3270_ap_apa = -1;
1351 static int hf_tn3270_ap_pp = -1;
1352 static int hf_tn3270_ap_lc = -1;
1353 static int hf_tn3270_ap_mp = -1;
1354 static int hf_tn3270_ap_apres2 = -1;
1355 static int hf_tn3270_c_np = -1;
1356 static int hf_tn3270_number_of_attributes = -1;
1357 static int hf_tn3270_object_control_flags = -1;
1358 static int hf_tn3270_object_type = -1;
1359 static int hf_tn3270_order_code = -1;
1360 static int hf_tn3270_outbound_text_header_operation_type = -1;
1361 static int hf_tn3270_outbound_text_header_hdr = -1;
1362 static int hf_tn3270_outbound_text_header_lhdr = -1;
1363 static int hf_tn3270_pages = -1;
1364 static int hf_tn3270_partition_command = -1;
1365 static int hf_tn3270_partition_cv = -1;
1366 static int hf_tn3270_partition_cw = -1;
1367 static int hf_tn3270_partition_flags = -1;
1368 static int hf_tn3270_partition_height = -1;
1369 static int hf_tn3270_partition_hv = -1;
1370 static int hf_tn3270_partition_id = -1;
1371 static int hf_tn3270_partition_ph = -1;
1372 static int hf_tn3270_partition_pw = -1;
1373 static int hf_tn3270_partition_res = -1;
1374 static int hf_tn3270_partition_rs = -1;
1375 static int hf_tn3270_partition_rv = -1;
1376 static int hf_tn3270_partition_rw = -1;
1377 static int hf_tn3270_partition_uom = -1;
1378 static int hf_tn3270_partition_width = -1;
1379 static int hf_tn3270_partition_wv = -1;
1380 static int hf_tn3270_prime = -1;
1381 static int hf_tn3270_printer_flags = -1;
1382 static int hf_tn3270_ps_char = -1;
1383 static int hf_tn3270_ps_flags = -1;
1384 static int hf_tn3270_ps_lcid = -1;
1385 static int hf_tn3270_ps_rws = -1;
1386 static int hf_tn3270_query_reply_alphanumeric_flags = -1;
1387 static int hf_tn3270_recovery_data_flags = -1;
1388 static int hf_tn3270_reply_mode_attr_list = -1;
1389 static int hf_tn3270_read_partition_operation_type = -1;
1390 static int hf_tn3270_read_partition_reqtyp = -1;
1391 static int hf_tn3270_resbyte = -1;
1392 static int hf_tn3270_resbytes = -1;
1393 static int hf_tn3270_res_twobytes = -1;
1394 static int hf_tn3270_rw = -1;
1395 static int hf_tn3270_save_or_restore_format_flags = -1;
1396 static int hf_tn3270_scs_data = -1;
1397 static int hf_tn3270_sf_single_byte_id = -1;
1398 static int hf_tn3270_sf_double_byte_id = -1;
1399 static int hf_tn3270_sf_length = -1;
1400 static int hf_tn3270_sf_query_reply = -1;
1401 static int hf_tn3270_sld = -1;
1402 static int hf_tn3270_spd = -1;
1403 static int hf_tn3270_start_line = -1;
1404 static int hf_tn3270_start_page = -1;
1405 static int hf_tn3270_stop_address = -1;
1406 static int hf_tn3270_transparency = -1;
1407 static int hf_tn3270_type_1_text_outbound_data = -1;
1408 static int hf_tn3270_vertical = -1;
1409 static int hf_tn3270_v_length = -1;
1410 static int hf_tn3270_v_offset = -1;
1411 static int hf_tn3270_v_sequence = -1;
1412 static int hf_tn3270_wcc_nop = -1;
1413 static int hf_tn3270_wcc_reset = -1;
1414 static int hf_tn3270_wcc_printer1 = -1;
1415 static int hf_tn3270_wcc_printer2 = -1;
1416 static int hf_tn3270_wcc_start_printer = -1;
1417 static int hf_tn3270_wcc_sound_alarm = -1;
1418 static int hf_tn3270_wcc_keyboard_restore = -1;
1419 static int hf_tn3270_wcc_reset_mdt = -1;
1420 static int hf_tn3270_ww = -1;
1421 static int hf_tn3270_tn3270e_data_type = -1;
1422 static int hf_tn3270_tn3270e_request_flag = -1;
1423 static int hf_tn3270_tn3270e_response_flag_3270_SCS = -1;
1424 static int hf_tn3270_tn3270e_response_flag_response = -1;
1425 static int hf_tn3270_tn3270e_response_flag_unused = -1;
1426 static int hf_tn3270_tn3270e_seq_number = -1;
1427 static int hf_tn3270_tn3270e_header_data = -1;
1428 static int hf_tn3270_ua_cell_units = -1;
1429 static int hf_tn3270_ua_characters = -1;
1430 static int hf_tn3270_ua_hard_copy = -1;
1431 static int hf_tn3270_ua_page_printer = -1;
1432 static int hf_tn3270_ua_reserved1 = -1;
1433 static int hf_tn3270_ua_reserved2 = -1;
1434 static int hf_tn3270_ua_variable_cells = -1;
1435 static int hf_tn3270_usable_area_flags1 = -1;
1436 static int hf_tn3270_usable_area_flags2 = -1;
1437 static int hf_tn3270_ua_addressing = -1;
1438 static int hf_tn3270_ua_width_cells_pels = -1;
1439 static int hf_tn3270_ua_height_cells_pels = -1;
1440 static int hf_tn3270_ua_uom_cells_pels = -1;
1441 static int hf_tn3270_ua_xr = -1;
1442 static int hf_tn3270_ua_yr = -1;
1443 static int hf_tn3270_ua_aw = -1;
1444 static int hf_tn3270_ua_ah = -1;
1445 static int hf_tn3270_ua_buffsz = -1;
1446 static int hf_tn3270_ua_xmin = -1;
1447 static int hf_tn3270_ua_ymin = -1;
1448 static int hf_tn3270_ua_xmax = -1;
1449 static int hf_tn3270_ua_ymax = -1;
1450 static int hf_tn3270_cs_ge = -1;
1451 static int hf_tn3270_cs_mi = -1;
1452 static int hf_tn3270_cs_lps = -1;
1453 static int hf_tn3270_cs_lpse = -1;
1454 static int hf_tn3270_cs_ms = -1;
1455 static int hf_tn3270_cs_ch2 = -1;
1456 static int hf_tn3270_cs_gf = -1;
1457 static int hf_tn3270_cs_res = -1;
1458 static int hf_tn3270_cs_res2 = -1;
1459 static int hf_tn3270_cs_pscs = -1;
1460 static int hf_tn3270_cs_res3 = -1;
1461 static int hf_tn3270_cs_cf = -1;
1462 static int hf_tn3270_cs_form_type1 = -1;
1463 static int hf_tn3270_cs_form_type2 = -1;
1464 static int hf_tn3270_cs_form_type3 = -1;
1465 static int hf_tn3270_cs_form_type4 = -1;
1466 static int hf_tn3270_cs_form_type5 = -1;
1467 static int hf_tn3270_cs_form_type6 = -1;
1468 static int hf_tn3270_cs_form_type8 = -1;
1469 static int hf_tn3270_cs_ds_load = -1;
1470 static int hf_tn3270_cs_ds_triple = -1;
1471 static int hf_tn3270_cs_ds_char = -1;
1472 static int hf_tn3270_cs_ds_cb = -1;
1473 static int hf_tn3270_character_sets_flags1 = -1;
1474 static int hf_tn3270_character_sets_flags2 = -1;
1475 static int hf_tn3270_sdw = -1;
1476 static int hf_tn3270_sdh = -1;
1477 static int hf_tn3270_form = -1;
1478 static int hf_tn3270_formres = -1;
1479 static int hf_tn3270_cs_dl = -1;
1480 static int hf_tn3270_cs_descriptor_set = -1;
1481 static int hf_tn3270_cs_descriptor_flags = -1;
1482 static int hf_tn3270_lcid = -1;
1483 static int hf_tn3270_sw = -1;
1484 static int hf_tn3270_sh = -1;
1485 static int hf_tn3270_ssubsn = -1;
1486 static int hf_tn3270_esubsn = -1;
1487 static int hf_tn3270_ccsgid = -1;
1488 static int hf_tn3270_ccsid = -1;
1489 static int hf_tn3270_c_prtblk = -1;
1490 static int hf_tn3270_h_np = -1;
1491 static int hf_tn3270_h_vi = -1;
1492 static int hf_tn3270_h_ai = -1;
1493 static int hf_tn3270_ddm_flags = -1;
1494 static int hf_tn3270_ddm_limin = -1;
1495 static int hf_tn3270_ddm_limout = -1;
1496 static int hf_tn3270_ddm_nss = -1;
1497 static int hf_tn3270_ddm_ddmss = -1;
1498 static int hf_tn3270_rpq_device = -1;
1499 static int hf_tn3270_rpq_mid = -1;
1500 static int hf_tn3270_rpq_rpql = -1;
1501 static int hf_tn3270_rpq_name = -1;
1502 static int hf_tn3270_ip_flags = -1;
1503 static int hf_tn3270_ipdd_wd = -1;
1504 static int hf_tn3270_ipdd_hd = -1;
1505 static int hf_tn3270_ipdd_wa = -1;
1506 static int hf_tn3270_ipdd_ha = -1;
1507 static int hf_tn3270_ippd_dpbs = -1;
1508 static int hf_tn3270_ippd_apbs = -1;
1509 static int hf_tn3270_ipccd_wcd = -1;
1510 static int hf_tn3270_ipccd_hcd = -1;
1511 static int hf_tn3270_ipccd_wca = -1;
1512 static int hf_tn3270_ipccd_hca = -1;
1513 static int hf_tn3270_dc_dir = -1;
1514 static int hf_tn3270_oem_dsref = -1;
1515 static int hf_tn3270_oem_dtype = -1;
1516 static int hf_tn3270_oem_uname = -1;
1517 static int hf_tn3270_sdp_daid = -1;
1518 static int hf_tn3270_oem_sdp_ll_limin = -1;
1519 static int hf_tn3270_oem_sdp_ll_limout = -1;
1520 static int hf_tn3270_oem_sdp_pclk_vers = -1;
1521 static int hf_tn3270_null = -1;
1522 static int hf_tn3270_unknown_data = -1;
1523 static int hf_tn3270_ds_default_sfid = -1;
1524 static int hf_tn3270_ds_sfid = -1;
1525 static int hf_tn3270_asia_sdp_sosi_soset = -1;
1526 static int hf_tn3270_asia_sdp_ic_func = -1;
1527 static int hf_tn3270_ccc = -1;
1528 static int hf_tn3270_ccc_coding = -1;
1529 static int hf_tn3270_ccc_printout = -1;
1530 static int hf_tn3270_ccc_start_print = -1;
1531 static int hf_tn3270_ccc_sound_alarm = -1;
1532 static int hf_tn3270_ccc_copytype = -1;
1533 static int hf_tn3270_msr_user = -1;
1534 static int hf_tn3270_msr_locked = -1;
1535 static int hf_tn3270_msr_auto = -1;
1536 static int hf_tn3270_msr_ind1 = -1;
1537 static int hf_tn3270_msr_ind2 = -1;
1538 static int hf_tn3270_spc_sdp_ot = -1;
1539 static int hf_tn3270_spc_sdp_ob = -1;
1540 static int hf_tn3270_spc_sdp_ol = -1;
1541 static int hf_tn3270_spc_sdp_or = -1;
1542 static int hf_tn3270_spc_sdp_eucflags = -1;
1543 static int hf_tn3270_spc_sdp_srepc = -1;
1544 static int hf_tn3270_srf_fpcb = -1;
1545 static int hf_tn3270_sdp_statcode = -1;
1546 static int hf_tn3270_sdp_excode = -1;
1547 static int hf_tn3270_sdp_ngl = -1;
1548 static int hf_tn3270_sdp_nml = -1;
1549 static int hf_tn3270_sdp_nlml = -1;
1550 static int hf_tn3270_sdp_stor = -1;
1551 static int hf_tn3270_ap_cm = -1;
1552 static int hf_tn3270_ap_ro = -1;
1553 static int hf_tn3270_ap_co = -1;
1554 static int hf_tn3270_ap_fo = -1;
1555 static int hf_tn3270_sdp_ln = -1;
1556 static int hf_tn3270_sdp_id = -1;
1557 static int hf_tn3270_db_cavdef = -1;
1558 static int hf_tn3270_db_cidef = -1;
1559 static int hf_tn3270_dia_flags = -1;
1560 static int hf_tn3270_dia_limin = -1;
1561 static int hf_tn3270_dia_limout = -1;
1562 static int hf_tn3270_dia_nfs = -1;
1563 static int hf_tn3270_dia_diafs = -1;
1564 static int hf_tn3270_dia_diafn = -1;
1565 static int hf_tn3270_fo_flags = -1;
1566 static int hf_tn3270_fo_vpos = -1;
1567 static int hf_tn3270_fo_hpos = -1;
1568 static int hf_tn3270_fo_hpos0 = -1;
1569 static int hf_tn3270_fo_hpos1 = -1;
1570 static int hf_tn3270_fsad_flags = -1;
1571 static int hf_tn3270_fsad_limin = -1;
1572 static int hf_tn3270_fsad_limout = -1;
1573 static int hf_tn3270_fsad_size = -1;
1574 static int hf_tn3270_ibm_flags = -1;
1575 static int hf_tn3270_ibm_limin = -1;
1576 static int hf_tn3270_ibm_limout = -1;
1577 static int hf_tn3270_ibm_type = -1;
1578 static int hf_tn3270_msr_nd = -1;
1579 static int hf_tn3270_pft_flags = -1;
1580 static int hf_tn3270_pft_tmo = -1;
1581 static int hf_tn3270_pft_bmo = -1;
1582 static int hf_tn3270_ioca_limin = -1;
1583 static int hf_tn3270_ioca_limout = -1;
1584 static int hf_tn3270_ioca_type = -1;
1585 static int hf_tn3270_pc_vo_thickness = -1;
1586 static int hf_tn3270_pdds_ssid = -1;
1587 static int hf_tn3270_pdds_refid = -1;
1588 static int hf_tn3270_srf_fpcbl = -1;
1589 static int hf_tn3270_spc_epc_flags = -1;
1590 static int hf_tn3270_sp_spid = -1;
1591 static int hf_tn3270_sp_size = -1;
1592 static int hf_tn3270_sp_space = -1;
1593 static int hf_tn3270_sp_objlist = -1;
1594 static int hf_tn3270_tp_nt = -1;
1595 static int hf_tn3270_tp_m = -1;
1596 static int hf_tn3270_tp_flags = -1;
1597 static int hf_tn3270_tp_ntt = -1;
1598 static int hf_tn3270_tp_tlist = -1;
1599 static int hf_tn3270_t_np = -1;
1600 static int hf_tn3270_t_vi = -1;
1601 static int hf_tn3270_t_ai = -1;
1602 static int hf_tn3270_3270_tranlim = -1;
1604 static gint ett_tn3270 = -1;
1605 static gint ett_tn3270e_hdr = -1;
1606 static gint ett_sf = -1;
1607 static gint ett_tn3270_field_attribute = -1;
1608 static gint ett_tn3270_field_validation = -1;
1609 static gint ett_tn3270_wcc = -1;
1610 static gint ett_tn3270_usable_area_flags1 = -1;
1611 static gint ett_tn3270_usable_area_flags2 = -1;
1612 static gint ett_tn3270_query_reply_alphanumeric_flags = -1;
1613 static gint ett_tn3270_character_sets_flags1 = -1;
1614 static gint ett_tn3270_character_sets_flags2 = -1;
1615 static gint ett_tn3270_character_sets_form = -1;
1616 static gint ett_tn3270_cs_descriptor_flags = -1;
1617 static gint ett_tn3270_color_flags = -1;
1618 static gint ett_tn3270_ccc = -1;
1619 static gint ett_tn3270_msr_state_mask = -1;
1620 static gint ett_tn3270_data_chain_fields = -1;
1621 static gint ett_tn3270_query_list = -1;
1623 static expert_field ei_tn3270_order_code = EI_INIT;
1624 static expert_field ei_tn3270_command_code = EI_INIT;
1625 static expert_field ei_tn3270_aid = EI_INIT;
1627 static gint dissect_orders_and_data(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info);
1628 static gint dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint hf, tn3270_conv_info_t *tn3270_info);
1630 typedef struct hf_items {
1632 gint *bitmask_ett_idx_p;
1634 const gint **bitmask;
1635 const gint encoding;
1638 /* Utility Functions */
1641 tn3270_add_hf_items(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
1642 const hf_items *fields)
1644 gint start = offset;
1647 for (i = 0; fields[i].hf_idx_p; i++) {
1648 if (fields[i].bitmask == 0) {
1649 proto_tree_add_item(tn3270_tree,
1650 *fields[i].hf_idx_p,
1653 fields[i].encoding);
1656 proto_tree_add_bitmask(tn3270_tree, tvb, offset, *fields[i].hf_idx_p,
1657 *fields[i].bitmask_ett_idx_p, fields[i].bitmask, ENC_BIG_ENDIAN);
1659 offset += fields[i].length;
1662 return (offset - start);
1666 * offset; tvb offset of next byte of data (first byte of unprocessed data);
1667 * start: tvb offset of beginning of data;
1668 * data_length: total length of data;
1671 dissect_unknown_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint start,
1676 len_left = (data_length) - (offset - start);
1679 proto_tree_add_item(tn3270_tree, hf_tn3270_unknown_data,
1680 tvb, offset, len_left,
1689 add_data_until_next_order_code(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1692 gint length_remaining = tvb_reported_length_remaining(tvb, offset);
1695 * "All order codes have an EBCDIC value in the range of hexadecimal 00
1696 * (X'00') through hexadecimal 3F (X'3F'). Order codes with values in this
1697 * range but not defined in this chapter are rejected."
1698 * However, the code (as originally committed) treats a '0' order code as data.
1701 while (datalen < length_remaining) {
1703 order_code = tvb_get_guint8(tvb, offset + datalen);
1704 if ((order_code > 0) && (order_code <= OC_MAX))
1710 /* XXX: Need to handle "Format Control Orders" ?? */
1711 proto_tree_add_item(tn3270_tree, hf_tn3270_field_data, tvb, offset,
1712 datalen, ENC_EBCDIC|ENC_NA);
1719 dissect_query_reply_resbytes(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
1720 gint sf_body_length)
1722 gint start = offset;
1724 static const hf_items fields[] = {
1725 { &hf_tn3270_res_twobytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
1726 { NULL, NULL, 0, NULL, 0 }
1730 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1733 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1735 return (offset - start);
1739 dissect_wcc(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1742 static const gint *wcc_fields[] = {
1744 &hf_tn3270_wcc_reset,
1745 &hf_tn3270_wcc_printer1,
1746 &hf_tn3270_wcc_printer2,
1747 &hf_tn3270_wcc_start_printer,
1748 &hf_tn3270_wcc_sound_alarm,
1749 &hf_tn3270_wcc_keyboard_restore,
1750 &hf_tn3270_wcc_reset_mdt,
1754 /* Qualifier and DeviceType */
1755 proto_tree_add_bitmask_text(tn3270_tree, tvb, offset, 1, "Write Control Character: ", "None",
1756 ett_tn3270_wcc, wcc_fields, ENC_BIG_ENDIAN, 0);
1762 dissect_3270_field_validation(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1764 gint start = offset;
1766 static const gint *byte[] = {
1767 &hf_tn3270_field_validation_mandatory_fill,
1768 &hf_tn3270_field_validation_mandatory_entry,
1769 &hf_tn3270_field_validation_trigger,
1773 proto_tree_add_bitmask_text(tn3270_tree, tvb, 1, 1, "Field Validation: ",
1774 "None", ett_tn3270_field_validation, byte, ENC_BIG_ENDIAN, 0);
1778 return (offset - start);
1783 dissect_3270_field_attribute(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1785 gint start = offset;
1787 static const gint *byte[] = {
1788 &hf_tn3270_fa_graphic_convert,
1789 &hf_tn3270_fa_protected,
1790 &hf_tn3270_fa_numeric,
1791 &hf_tn3270_fa_display,
1792 &hf_tn3270_fa_reserved,
1793 &hf_tn3270_fa_modified,
1798 proto_tree_add_bitmask(tn3270_tree, tvb, offset, hf_tn3270_field_attribute,
1799 ett_tn3270_field_attribute, byte, ENC_BIG_ENDIAN);
1803 return (offset - start);
1806 /* 8.7 - Copy Control Code */
1808 dissect_ccc(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1810 gint start = offset;
1812 static const gint *byte[] = {
1813 &hf_tn3270_ccc_coding,
1814 &hf_tn3270_ccc_printout,
1815 &hf_tn3270_ccc_start_print,
1816 &hf_tn3270_ccc_sound_alarm,
1817 &hf_tn3270_ccc_copytype,
1821 proto_tree_add_bitmask(tn3270_tree, tvb, offset, hf_tn3270_ccc,
1822 ett_tn3270_ccc, byte, ENC_BIG_ENDIAN);
1826 return (offset - start);
1829 /* End - Utility Functions */
1831 /* Start: Handle Structured Fields */
1833 /* --------------------------------------------------- */
1834 /* 5.0 Outbound/Inbound and Outbound Structured Fields */
1835 /* --------------------------------------------------- */
1837 /* 5.5 Activate Partition - Search for ACTIVATE_PARTITION */
1838 /* 5.6 Begin/End of File - Search for BEGIN_OR_END_OF_FILE */
1839 /* 5.7 Create Partition */
1841 dissect_create_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1843 gint start = offset;
1845 static const hf_items fields[] = {
1846 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
1847 { &hf_tn3270_partition_uom, NULL, 1, NULL, ENC_BIG_ENDIAN },
1848 { &hf_tn3270_partition_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1849 { &hf_tn3270_partition_height, NULL, 2, NULL, ENC_BIG_ENDIAN },
1850 { &hf_tn3270_partition_width, NULL, 2, NULL, ENC_BIG_ENDIAN },
1851 { &hf_tn3270_partition_rv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1852 { &hf_tn3270_partition_cv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1853 { &hf_tn3270_partition_hv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1854 { &hf_tn3270_partition_wv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1855 { &hf_tn3270_partition_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1856 { &hf_tn3270_partition_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1857 { &hf_tn3270_partition_rs, NULL, 2, NULL, ENC_BIG_ENDIAN },
1858 { &hf_tn3270_partition_res, NULL, 2, NULL, ENC_BIG_ENDIAN },
1859 { &hf_tn3270_partition_pw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1860 { &hf_tn3270_partition_ph, NULL, 2, NULL, ENC_BIG_ENDIAN },
1861 { NULL, NULL, 0, NULL, 0 }
1865 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1868 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1870 return (offset - start);
1873 /* 5.7 Create Partition - Search for CREATE_PARTITION */
1874 /* 5.8 Destroy Partition - Search for DESTROY_PARTITION */
1875 /* 5.9 Erase/Reset - Search for ERASE_OR_RESET */
1876 /* 5.10 Load Color Table - Search for LOAD_COLOR_TABLE */
1878 /* 5.11 Load Format Storage */
1880 dissect_load_format_storage(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1882 gint start = offset;
1885 static const hf_items fields[] = {
1886 { &hf_tn3270_load_format_storage_flags1, NULL, 1, NULL, ENC_BIG_ENDIAN },
1887 { &hf_tn3270_load_format_storage_flags2, NULL, 1, NULL, ENC_BIG_ENDIAN },
1888 { &hf_tn3270_load_format_storage_operand, NULL, 1, NULL, ENC_BIG_ENDIAN },
1889 { &hf_tn3270_load_format_storage_localname, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
1890 { &hf_tn3270_format_group, NULL, 6, NULL, ENC_EBCDIC|ENC_NA },
1891 { &hf_tn3270_format_name, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
1892 { NULL, NULL, 0, NULL, 0 }
1895 operand = tvb_get_guint8(tvb, offset+2);
1897 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1900 if (operand == LOAD_FORMAT_STORAGE_OPERAND_ADD) {
1901 gint fmtln = sf_body_length - (offset - start);
1902 proto_tree_add_item(tn3270_tree, hf_tn3270_load_format_storage_format_data,
1903 tvb, offset, fmtln, ENC_EBCDIC|ENC_NA);
1907 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1909 return (offset - start);
1912 /* 5.12 Load Line Type - Search for LOAD_LINE_TYPE */
1914 /* 5.13 Load Programmed Symbols (Load PS) */
1916 dissect_load_programmed_symbols(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1918 gint start = offset, i;
1920 gint8 extended_ps_length;
1922 static const hf_items ps_fields[] = {
1923 { &hf_tn3270_ps_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1924 { &hf_tn3270_ps_lcid, NULL, 1, NULL, ENC_BIG_ENDIAN },
1925 { &hf_tn3270_ps_char, NULL, 1, NULL, ENC_BIG_ENDIAN },
1926 { &hf_tn3270_ps_rws, NULL, 1, NULL, ENC_BIG_ENDIAN },
1927 { NULL, NULL, 0, NULL, 0 }
1930 static const hf_items extended_ps_fields[] = {
1931 { &hf_tn3270_extended_ps_lw, NULL, 1, NULL, ENC_BIG_ENDIAN },
1932 { &hf_tn3270_extended_ps_lh, NULL, 1, NULL, ENC_BIG_ENDIAN },
1933 { &hf_tn3270_extended_ps_subsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
1934 { &hf_tn3270_extended_ps_color, NULL, 1, NULL, ENC_BIG_ENDIAN },
1935 { &hf_tn3270_extended_ps_stsubs, NULL, 1, NULL, ENC_BIG_ENDIAN },
1936 { &hf_tn3270_extended_ps_echar, NULL, 1, NULL, ENC_BIG_ENDIAN },
1937 { &hf_tn3270_extended_ps_nw, NULL, 1, NULL, ENC_BIG_ENDIAN },
1938 { &hf_tn3270_extended_ps_nh, NULL, 1, NULL, ENC_BIG_ENDIAN },
1939 { &hf_tn3270_extended_ps_res, NULL, 1, NULL, ENC_BIG_ENDIAN },
1940 { NULL, NULL, 0, NULL, 0 }
1943 flags = tvb_get_guint8(tvb, offset);
1944 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1947 /*If extended flag not set return */
1948 if (!(flags & 0x80)) {
1949 return (offset - start);
1952 extended_ps_length = tvb_get_guint8(tvb, offset);
1953 proto_tree_add_item(tn3270_tree, hf_tn3270_extended_ps_length,
1954 tvb, offset, 1, ENC_BIG_ENDIAN);
1956 proto_tree_add_item(tn3270_tree, hf_tn3270_extended_ps_flags,
1957 tvb, offset, 1, ENC_BIG_ENDIAN);
1960 for (i = 0; i < extended_ps_length; ++i) {
1961 if (extended_ps_fields[i].hf_idx_p == NULL) {
1962 break; /* Malformed (Bad value for extended_ps_length) ! ToDo: 'expert' */
1964 proto_tree_add_item(tn3270_tree, *extended_ps_fields[i].hf_idx_p,
1965 tvb, offset, extended_ps_fields[i].length,
1966 extended_ps_fields[i].encoding);
1967 offset += extended_ps_fields[i].length;
1971 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1973 return (offset - start);
1976 /* 5.14 Modify Partition) */
1978 dissect_modify_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1980 gint start = offset;
1982 static const hf_items fields[] = {
1983 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1984 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
1985 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1986 { &hf_tn3270_partition_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1987 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1988 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
1989 { &hf_tn3270_partition_rv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1990 { &hf_tn3270_partition_cv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1991 { &hf_tn3270_partition_hv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1992 { &hf_tn3270_partition_wv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1993 { &hf_tn3270_partition_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1994 { &hf_tn3270_partition_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1995 { &hf_tn3270_partition_rs, NULL, 2, NULL, ENC_BIG_ENDIAN },
1996 { &hf_tn3270_partition_res, NULL, 2, NULL, ENC_BIG_ENDIAN },
1997 { &hf_tn3270_partition_pw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1998 { &hf_tn3270_partition_ph, NULL, 2, NULL, ENC_BIG_ENDIAN },
1999 { NULL, NULL, 0, NULL, 0 }
2003 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2006 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2008 return (offset - start);
2011 /* 5.15 Outbound Text Header */
2013 dissect_outbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2014 gint sf_body_length)
2016 gint start = offset;
2019 static const hf_items outbound_text_header_fields1[] = {
2020 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2021 { &hf_tn3270_outbound_text_header_operation_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2022 { NULL, NULL, 0, NULL, 0 }
2025 static const hf_items outbound_text_header_fields2[] = {
2026 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2027 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2028 { &hf_tn3270_lvl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2029 { &hf_tn3270_cro, NULL, 2, NULL, ENC_BIG_ENDIAN },
2030 { &hf_tn3270_cc, NULL, 2, NULL, ENC_BIG_ENDIAN },
2031 { NULL, NULL, 0, NULL, 0 }
2034 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2035 outbound_text_header_fields1);
2036 offset += dissect_wcc(tn3270_tree, tvb, offset);
2037 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2038 outbound_text_header_fields2);
2040 hdr_length = tvb_get_ntohs(tvb, offset);
2042 proto_tree_add_item(tn3270_tree, hf_tn3270_outbound_text_header_lhdr,
2043 tvb, offset, 2, ENC_BIG_ENDIAN);
2046 proto_tree_add_item(tn3270_tree, hf_tn3270_outbound_text_header_hdr,
2047 tvb, offset, hdr_length, ENC_NA);
2048 offset += hdr_length;
2050 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2052 return (offset - start);
2055 /* 5.16 Outbound 3270DS */
2057 dissect_outbound_3270ds(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
2058 tn3270_conv_info_t *tn3270_info, gint sf_body_length )
2060 gint start = offset;
2063 proto_tree_add_item(tn3270_tree,
2064 hf_tn3270_partition_id,
2070 cmd = tvb_get_guint8(tvb, offset);
2071 proto_tree_add_item(tn3270_tree,
2072 hf_tn3270_partition_command,
2080 /* FIXME: the spec is ambiguous at best about what to expect here,
2081 need a live sample to validate. */
2082 offset += dissect_ccc(tn3270_tree, tvb, offset);
2083 proto_tree_add_item(tn3270_tree,
2090 /* XXX: are "local" commands valid for Outbound 3270DS ? */
2100 if ((offset - start) < sf_body_length)
2101 offset += dissect_wcc(tn3270_tree, tvb, offset);
2102 if ((offset - start) < sf_body_length)
2103 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
2109 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2111 return (offset - start);
2114 /* 5.17 Present Absolute Format */
2116 dissect_present_absolute_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2117 gint sf_body_length)
2119 gint start = offset;
2121 proto_tree_add_item(tn3270_tree,
2122 hf_tn3270_partition_id,
2128 proto_tree_add_item(tn3270_tree,
2135 offset += dissect_wcc(tn3270_tree, tvb, offset);
2137 proto_tree_add_item(tn3270_tree,
2138 hf_tn3270_format_name,
2140 sf_body_length - (offset - start),
2142 offset += (sf_body_length - (offset - start));
2144 return (offset - start);
2147 /* 5.18 Present Relative Format */
2149 dissect_present_relative_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2150 gint sf_body_length)
2152 gint start = offset;
2154 proto_tree_add_item(tn3270_tree,
2155 hf_tn3270_partition_id,
2161 proto_tree_add_item(tn3270_tree,
2168 proto_tree_add_item(tn3270_tree,
2175 offset += dissect_wcc(tn3270_tree, tvb, offset);
2177 proto_tree_add_item(tn3270_tree,
2178 hf_tn3270_format_name,
2180 sf_body_length - (offset - start),
2182 offset += (sf_body_length - (offset - start));
2184 return (offset - start);
2187 /* 5.19 Read Partition */
2189 dissect_read_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2190 gint sf_body_length)
2192 gint start = offset;
2194 proto_tree *query_list_tree;
2195 gint qcode_list_len, i;
2197 proto_tree_add_item(tn3270_tree,
2198 hf_tn3270_partition_id,
2204 type = tvb_get_guint8(tvb, offset);
2205 if (type == 0xFF) { /* Partition ID of 0xFF is escaped with another 0xFF */
2206 /* XXX: removing tn3270 IAX escapes should be handled in the telnet dissector ! */
2208 type = tvb_get_guint8(tvb, offset);
2211 proto_tree_add_item(tn3270_tree,
2212 hf_tn3270_read_partition_operation_type,
2218 if (type == READ_PARTITION_OPTYPE_QUERY_LIST) { /* 'Query List' */
2219 proto_tree_add_item(tn3270_tree,
2220 hf_tn3270_read_partition_reqtyp,
2226 if (sf_body_length > (offset - start)) {
2227 qcode_list_len = sf_body_length - (offset - start);
2228 query_list_tree = proto_tree_add_subtree(tn3270_tree, tvb, offset, qcode_list_len,
2229 ett_tn3270_query_list, NULL, "Query List");
2230 for (i = 0; i < qcode_list_len; i++) {
2231 proto_tree_add_item(query_list_tree,
2232 hf_tn3270_sf_query_reply,
2233 tvb, offset, 1, ENC_BIG_ENDIAN);
2239 return (offset - start);
2242 /*5.20 Request Recovery Data - Search for REQUEST_RECOVERY_DATA*/
2243 /*5.21 Reset Partition - Search for RESET_PARTITION */
2247 dissect_restart(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2248 gint sf_body_length)
2250 gint start = offset;
2252 proto_tree_add_item(tn3270_tree,
2259 proto_tree_add_item(tn3270_tree,
2260 hf_tn3270_start_page,
2266 proto_tree_add_item(tn3270_tree,
2267 hf_tn3270_start_line,
2274 proto_tree_add_item(tn3270_tree,
2277 sf_body_length - (offset - start),
2279 offset += (sf_body_length - (offset - start));
2281 return (offset - start);
2284 /* 5.23 SCS Data - Search for SCS_DATA */
2285 /* 5.24 Color Table - Search for COLOR_TABLE */
2286 /* 5.25 Format Group - Search for FORMAT_GROUP */
2287 /* 5.26 Set Checkpoint Interval - Search for CHECKPOINT_INTERVAL */
2289 /* 5.27 Set MSR Control */
2291 dissect_set_msr_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2292 gint sf_body_length)
2294 gint start = offset;
2296 static const gint *byte[] = {
2297 &hf_tn3270_msr_user,
2298 &hf_tn3270_msr_locked,
2299 &hf_tn3270_msr_auto,
2300 &hf_tn3270_msr_ind1,
2301 &hf_tn3270_msr_ind2,
2305 static const hf_items outbound_text_header_fields[] = {
2306 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2307 { &hf_tn3270_msr_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2308 { &hf_tn3270_msr_state_mask, &ett_tn3270_msr_state_mask, 1, byte, 0 },
2309 { &hf_tn3270_msr_state_value, NULL, 1, NULL, ENC_BIG_ENDIAN },
2310 { &hf_tn3270_msr_ind_mask, NULL, 1, NULL, ENC_BIG_ENDIAN },
2311 { &hf_tn3270_msr_ind_value, NULL, 1, NULL, ENC_BIG_ENDIAN },
2312 { NULL, NULL, 0, NULL, 0 }
2316 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2317 outbound_text_header_fields);
2319 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2321 return (offset - start);
2324 /* 5.28 Set Partition Characteristics */
2326 dissect_set_partition_characteristics_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2329 gint start = offset;
2332 static const hf_items sdp1[] = {
2333 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2334 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2335 { &hf_tn3270_spc_sdp_ot, NULL, 1, NULL, ENC_BIG_ENDIAN },
2336 { &hf_tn3270_spc_sdp_ob, NULL, 1, NULL, ENC_BIG_ENDIAN },
2337 { &hf_tn3270_spc_sdp_ol, NULL, 1, NULL, ENC_BIG_ENDIAN },
2338 { &hf_tn3270_spc_sdp_or, NULL, 1, NULL, ENC_BIG_ENDIAN },
2339 { NULL, NULL, 0, NULL, 0 }
2342 static const hf_items sdp2[] = {
2343 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2344 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2345 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2346 { NULL, NULL, 0, NULL, 0 }
2349 static const hf_items sdp3[] = {
2350 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2351 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2352 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2353 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2354 { NULL, NULL, 0, NULL, 0 }
2358 sdp = tvb_get_ntohs(tvb, offset);
2361 case 0x0601: /*View Outport*/
2362 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2365 case 0x0304: /*Enable User Call Up*/
2366 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2369 case 0x0405: /*Select Base Character Set*/
2370 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2377 return (offset - start);
2382 dissect_set_partition_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2383 gint sf_body_length)
2386 gint start = offset;
2389 static const hf_items fields[] = {
2390 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2391 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
2392 { NULL, NULL, 0, NULL, 0 }
2396 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2399 for (i = 0; i < 3; i++) {
2400 offset += dissect_set_partition_characteristics_sd_parms(tn3270_tree, tvb, offset);
2401 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2405 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2407 return (offset - start);
2410 /* 5.29 Set Printer Characteristics */
2412 dissect_set_printer_characteristics_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2415 gint start = offset;
2418 static const hf_items sdp1[] = {
2419 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2420 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2421 { &hf_tn3270_spc_sdp_srepc, NULL, 1, NULL, ENC_BIG_ENDIAN },
2422 { NULL, NULL, 0, NULL, 0 }
2425 sdp = tvb_get_ntohs(tvb, offset);
2428 case 0x0301: /*Early Print Complete*/
2429 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2436 return (offset - start);
2441 dissect_set_printer_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2442 gint sf_body_length)
2445 gint start = offset;
2448 static const hf_items fields[] = {
2449 { &hf_tn3270_printer_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2450 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2451 { NULL, NULL, 0, NULL, 0 }
2454 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2457 for (i = 0; i < 3; i++) {
2458 offset += dissect_set_printer_characteristics_sd_parms(tn3270_tree, tvb, offset);
2459 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2463 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2465 return (offset - start);
2469 /* 5.30 Set Reply Mode */
2471 dissect_set_reply_mode(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2472 gint sf_body_length)
2474 gint start = offset;
2478 static const hf_items fields[] = {
2479 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2480 { &hf_tn3270_mode, NULL, 1, NULL, ENC_BIG_ENDIAN },
2481 { NULL, NULL, 0, NULL, 0 }
2484 type = tvb_get_guint8(tvb, offset+1);
2486 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2489 if (type == 0x02) { /* 'Query List' */
2490 for (i = 0; i < (sf_body_length-(offset-start)); i++) {
2491 proto_tree_add_item(tn3270_tree,
2492 hf_tn3270_reply_mode_attr_list,
2493 tvb, offset, 1, ENC_BIG_ENDIAN);
2498 return (offset - start);
2501 /* 5.31 Set Window Origin - Search for SET_WINDOW_ORIGIN */
2502 /* 6.6 Type 1 Text Inbound
2503 5.32 Type 1 Text Outbound */
2505 dissect_type_1_text(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2506 gint sf_body_length)
2508 gint start = offset;
2510 static const hf_items fields[] = {
2511 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2512 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
2513 { NULL, NULL, 0, NULL, 0 }
2516 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2518 proto_tree_add_item(tn3270_tree,
2519 hf_tn3270_field_data,
2521 sf_body_length - (offset - start),
2523 offset += (sf_body_length - (offset - start));
2525 return (offset - start);
2528 /* 5.34 Data Chain */
2530 dissect_data_chain(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2531 gint sf_body_length)
2533 gint start = offset;
2535 static const gint *byte[] = {
2536 &hf_tn3270_data_chain_group,
2537 &hf_tn3270_data_chain_inbound_control,
2541 static const hf_items data_chain_fields[] = {
2542 { &hf_tn3270_data_chain_fields, &ett_tn3270_data_chain_fields, 1, byte, 0 },
2543 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2544 { NULL, NULL, 0, NULL, 0 }
2547 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2550 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2552 return (offset - start);
2555 /* 5.35 Destination/Origin - Search for DESTINATION_OR_ORIGIN*/
2557 /* 5.36 Object Control */
2559 dissect_object_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2560 gint sf_body_length)
2562 gint start = offset;
2564 static const hf_items fields[] = {
2565 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2566 { &hf_tn3270_object_control_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2567 { &hf_tn3270_object_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2568 { NULL, NULL, 0, NULL, 0 }
2571 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2574 proto_tree_add_item(tn3270_tree,
2575 hf_tn3270_type_1_text_outbound_data,
2577 sf_body_length - (offset - start),
2579 offset += (sf_body_length - (offset - start));
2581 return (offset - start);
2584 /* 5.37 Object Data - Search for OBJECT_DATA*/
2585 /* 5.38 Object Picture - Search for OBJECT_PICTURE */
2586 /* 5.39 OEM Data - Search for OEM_DATA */
2588 /* 5.40 Save/Restore Format */
2590 dissect_save_or_restore_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2591 gint sf_body_length)
2593 gint start = offset;
2595 hf_items fields[] = {
2596 { &hf_tn3270_save_or_restore_format_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2597 { &hf_tn3270_srf_fpcb, NULL, sf_body_length-1, NULL, ENC_NA },
2598 { NULL, NULL, 0, NULL, 0 }
2601 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2604 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2606 return (offset - start);
2609 /* 5.41 Select Intelligent Printer Data Stream (IPDS) Mode - Search for SELECT_IPDS_MODE*/
2611 /* -----------------------------------------*/
2612 /* 6.0 CHAPTER 6. INBOUND STRUCTURED FIELDS */
2613 /* -----------------------------------------*/
2615 /* 6.2 Exception/Status */
2617 dissect_exception_or_status_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2620 gint start = offset;
2623 static const hf_items sdp1[] = {
2624 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2625 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2626 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2627 { &hf_tn3270_sdp_excode, NULL, 2, NULL, ENC_BIG_ENDIAN },
2628 { NULL, NULL, 0, NULL, 0 }
2631 static const hf_items sdp2[] = {
2632 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2633 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2634 { &hf_tn3270_sdp_statcode, NULL, 2, NULL, ENC_BIG_ENDIAN },
2635 { NULL, NULL, 0, NULL, 0 }
2638 static const hf_items sdp3[] = {
2639 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2640 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2641 { &hf_tn3270_format_group, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2642 { &hf_tn3270_format_name, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2643 { NULL, NULL, 0, NULL, 0 }
2646 static const hf_items sdp4[] = {
2647 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2648 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2649 { &hf_tn3270_sdp_ngl, NULL, 2, NULL, ENC_BIG_ENDIAN },
2650 { &hf_tn3270_sdp_nml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2651 { &hf_tn3270_sdp_nlml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2652 { &hf_tn3270_sdp_stor, NULL, 4, NULL, ENC_BIG_ENDIAN },
2653 { NULL, NULL, 0, NULL, 0 }
2656 static const hf_items sdp5[] = {
2657 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2658 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2659 { &hf_tn3270_format_group, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2660 { &hf_tn3270_sdp_nml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2661 { NULL, NULL, 0, NULL, 0 }
2664 sdp = tvb_get_ntohs(tvb, offset);
2667 case 0x0601: /*Auxiliary Device Exception*/
2668 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2671 case 0x0402: /*Auxiliary Device status*/
2672 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2675 case 0x2203: /*Failing Format status*/
2676 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2679 case 0x0C04: /*Format status*/
2680 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2683 case 0x1405: /*Group status*/
2684 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2691 return (offset - start);
2696 dissect_exception_or_status(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2697 gint sf_body_length)
2699 gint start = offset, i;
2701 static const hf_items fields[] = {
2702 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2703 { &hf_tn3270_exception_or_status_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2704 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2705 { NULL, NULL, 0, NULL, 0 }
2708 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2711 for (i = 0; i < 5; i++) {
2712 offset += dissect_exception_or_status_sd_parms(tn3270_tree, tvb, offset);
2713 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2717 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2719 return (offset - start);
2722 /* 6.3 Inbound Text Header */
2724 dissect_inbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2725 gint sf_body_length)
2727 gint start = offset;
2729 static const hf_items outbound_text_header_fields[] = {
2730 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2731 { &hf_tn3270_aid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2732 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2733 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2734 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2735 { &hf_tn3270_lvl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2736 { &hf_tn3270_cro, NULL, 2, NULL, ENC_BIG_ENDIAN },
2737 { &hf_tn3270_cc, NULL, 2, NULL, ENC_BIG_ENDIAN },
2738 { &hf_tn3270_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2739 { &hf_tn3270_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2740 { &hf_tn3270_hw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2741 { &hf_tn3270_ww, NULL, 2, NULL, ENC_BIG_ENDIAN },
2742 { NULL, NULL, 0, NULL, 0 }
2746 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2747 outbound_text_header_fields);
2749 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2751 return (offset - start);
2754 /* 6.4 Inbound 3270DS */
2756 dissect_inbound_3270ds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2757 tn3270_conv_info_t *tn3270_info, gint sf_body_length)
2759 gint start = offset;
2761 static const hf_items fields1[] = {
2762 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2763 { &hf_tn3270_aid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2764 { NULL, NULL, 0, NULL, 0 }
2767 hf_items fields2[] = {
2768 { &hf_tn3270_field_data, NULL, sf_body_length - 4, NULL, ENC_EBCDIC|ENC_NA },
2769 { NULL, NULL, 0, NULL, 0 }
2772 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset, fields1);
2773 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info);
2774 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset, fields2);
2776 return (offset - start);
2781 /* 6.5 Recovery Data */
2783 dissect_recovery_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2784 gint sf_body_length)
2786 gint start = offset;
2789 static const hf_items fields[] = {
2790 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2791 { &hf_tn3270_recovery_data_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2792 { &hf_tn3270_sld, NULL, 1, NULL, ENC_BIG_ENDIAN },
2793 { &hf_tn3270_charset, NULL, 1, NULL, ENC_BIG_ENDIAN },
2794 { &hf_tn3270_vertical, NULL, 2, NULL, ENC_BIG_ENDIAN },
2795 { &hf_tn3270_v_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2796 { &hf_tn3270_v_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2797 { &hf_tn3270_v_length, NULL, 2, NULL, ENC_BIG_ENDIAN },
2798 { &hf_tn3270_spd, NULL, 2, NULL, ENC_BIG_ENDIAN },
2799 { &hf_tn3270_horizon, NULL, 2, NULL, ENC_BIG_ENDIAN },
2800 { &hf_tn3270_h_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2801 { &hf_tn3270_h_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2802 { &hf_tn3270_h_length, NULL, 2, NULL, ENC_BIG_ENDIAN },
2803 { &hf_tn3270_color, NULL, 1, NULL, ENC_BIG_ENDIAN },
2804 { &hf_tn3270_hilite, NULL, 1, NULL, ENC_BIG_ENDIAN },
2805 { &hf_tn3270_pages, NULL, 2, NULL, ENC_BIG_ENDIAN },
2806 { &hf_tn3270_lines, NULL, 2, NULL, ENC_BIG_ENDIAN },
2807 { &hf_tn3270_checkpoint, NULL, 2, NULL, ENC_BIG_ENDIAN },
2808 { &hf_tn3270_c_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2809 { &hf_tn3270_c_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2810 { &hf_tn3270_c_seqoff, NULL, 2, NULL, ENC_BIG_ENDIAN },
2811 { &hf_tn3270_c_scsoff, NULL, 2, NULL, ENC_BIG_ENDIAN },
2812 { &hf_tn3270_prime, NULL, 1, NULL, ENC_BIG_ENDIAN },
2813 { NULL, NULL, 0, NULL, 0 }
2817 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2820 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2822 return (offset - start);
2825 /* 6.6 Query Reply (Type 1 Text Inbound) - See above*/
2826 /* 6.7 and 6.8 Query Reply - Introductory Matter */
2828 /* 6.9 Query Reply (Alphanumeric Partitions) */
2830 dissect_query_reply_alphanumeric_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2833 gint start = offset;
2836 static const hf_items sdp1[] = {
2837 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2838 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2839 { &hf_tn3270_ap_cm, NULL, 1, NULL, ENC_BIG_ENDIAN },
2840 { &hf_tn3270_ap_ro, NULL, 1, NULL, ENC_BIG_ENDIAN },
2841 { &hf_tn3270_ap_co, NULL, 1, NULL, ENC_BIG_ENDIAN },
2842 { &hf_tn3270_ap_fo, NULL, 2, NULL, ENC_BIG_ENDIAN },
2843 { NULL, NULL, 0, NULL, 0 }
2847 sdp = tvb_get_ntohs(tvb, offset);
2850 case 0x0702: /*Buffer Allocation*/
2851 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2858 return (offset - start);
2863 dissect_query_reply_alphanumeric(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2864 gint sf_body_length)
2866 gint start = offset;
2868 static const gint *byte[] = {
2869 &hf_tn3270_ap_vertical_scrolling,
2870 &hf_tn3270_ap_horizontal_scrolling,
2871 &hf_tn3270_ap_apres1,
2876 &hf_tn3270_ap_apres2,
2880 static const hf_items fields[] = {
2881 { &hf_tn3270_ap_na, NULL, 1, NULL, ENC_BIG_ENDIAN },
2882 { &hf_tn3270_ap_m, NULL, 2, NULL, ENC_BIG_ENDIAN },
2883 { &hf_tn3270_query_reply_alphanumeric_flags, &ett_tn3270_query_reply_alphanumeric_flags, 1, byte, 0 },
2884 { NULL, NULL, 0, NULL, 0 }
2887 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2890 offset += dissect_query_reply_alphanumeric_sd_parms(tn3270_tree, tvb, offset);
2892 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2894 return (offset - start);
2897 /* 6.10 Query Reply (Auxiliary Device) - Search for QUERY_REPLY_AUXILIARY_DEVICE */
2898 /* 6.11 Query Reply (BEGIN/End of File ) - Search for QUERY_REPLY_BEGIN_OR_END_OF_FILE */
2900 /* 6.12 Query Reply (Character Sets) */
2902 dissect_query_reply_character_sets(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2903 gint sf_body_length)
2905 gint start = offset;
2906 gint flagbyte1, flagbyte2;
2908 static const gint *byte1[] = {
2920 static const gint *byte2[] = {
2928 static const gint *byte3[] = {
2929 &hf_tn3270_cs_form_type1,
2930 &hf_tn3270_cs_form_type2,
2931 &hf_tn3270_cs_form_type3,
2932 &hf_tn3270_cs_form_type4,
2933 &hf_tn3270_cs_form_type5,
2934 &hf_tn3270_cs_form_type6,
2935 &hf_tn3270_cs_form_type8,
2939 static const gint *byte4[] = {
2940 &hf_tn3270_cs_ds_load,
2941 &hf_tn3270_cs_ds_triple,
2942 &hf_tn3270_cs_ds_char,
2943 &hf_tn3270_cs_ds_cb,
2948 static const hf_items fields[] = {
2949 { &hf_tn3270_character_sets_flags1, &ett_tn3270_character_sets_flags1, 1, byte1, 0 },
2950 { &hf_tn3270_character_sets_flags2, &ett_tn3270_character_sets_flags2, 1, byte2, 0 },
2951 { &hf_tn3270_sdw, NULL, 1, NULL, ENC_BIG_ENDIAN },
2952 { &hf_tn3270_sdh, NULL, 1, NULL, ENC_BIG_ENDIAN },
2953 { &hf_tn3270_form, &ett_tn3270_character_sets_form, 1, byte3, 0 },
2954 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2955 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2956 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2957 { &hf_tn3270_cs_dl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2958 { NULL, NULL, 0, NULL, 0 }
2961 static const hf_items descriptors[] = {
2962 { &hf_tn3270_cs_descriptor_set, NULL, 1, NULL, ENC_BIG_ENDIAN },
2963 { &hf_tn3270_cs_descriptor_flags, &ett_tn3270_cs_descriptor_flags, 1, byte4, 0 },
2964 { &hf_tn3270_lcid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2965 { NULL, NULL, 0, NULL, 0 }
2968 static const hf_items sw_sh[] = {
2969 { &hf_tn3270_sw, NULL, 1, NULL, ENC_BIG_ENDIAN },
2970 { &hf_tn3270_sh, NULL, 1, NULL, ENC_BIG_ENDIAN },
2971 { NULL, NULL, 0, NULL, 0 }
2974 static const hf_items subsn[] = {
2975 { &hf_tn3270_ssubsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
2976 { &hf_tn3270_esubsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
2977 { NULL, NULL, 0, NULL, 0 }
2980 static const hf_items gf[] = {
2981 { &hf_tn3270_ccsgid, NULL, 4, NULL, ENC_BIG_ENDIAN },
2982 { NULL, NULL, 0, NULL, 0 }
2985 static const hf_items cf[] = {
2986 { &hf_tn3270_ccsid, NULL, 2, NULL, ENC_BIG_ENDIAN },
2987 { NULL, NULL, 0, NULL, 0 }
2990 flagbyte1 = tvb_get_guint8(tvb, offset);
2991 flagbyte2 = tvb_get_guint8(tvb, offset+1);
2993 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2996 while ((offset - start) < sf_body_length) {
2998 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3001 if (flagbyte1 & QR_CS_MS) {
3002 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3006 if (flagbyte1 & QR_CS_CH2) {
3007 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3011 if (flagbyte1 & QR_CS_GF) {
3012 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3016 if (flagbyte2 & QR_CS_CF) {
3017 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3021 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3023 return (offset - start);
3026 /* 6.13 Query Reply (Color) */
3028 dissect_query_reply_color_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3031 gint start = offset;
3034 static const hf_items sdp1[] = {
3035 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3036 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3037 { &hf_tn3270_db_cavdef, NULL, 1, NULL, ENC_BIG_ENDIAN },
3038 { &hf_tn3270_db_cidef, NULL, 1, NULL, ENC_BIG_ENDIAN },
3039 { NULL, NULL, 0, NULL, 0 }
3043 sdp = tvb_get_ntohs(tvb, offset);
3046 case 0x0402: /*Default Background Color*/
3047 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3054 return (offset - start);
3059 dissect_query_reply_color(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3060 gint sf_body_length)
3062 gint start = offset;
3066 static const gint *byte[] = {
3067 &hf_tn3270_c_prtblk,
3071 static const hf_items fields[] = {
3072 { &hf_tn3270_color_flags, &ett_tn3270_color_flags, 1, byte, 0 },
3073 { &hf_tn3270_c_np, NULL, 1, NULL, ENC_BIG_ENDIAN },
3074 { NULL, NULL, 0, NULL, 0 }
3078 np = tvb_get_guint8(tvb, offset +1);
3079 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3082 for (i=0; i < np; i++) {
3083 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3086 proto_tree_add_item(tn3270_tree,
3092 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3095 proto_tree_add_item(tn3270_tree,
3102 offset += dissect_query_reply_color_sd_parms(tn3270_tree, tvb, offset);
3104 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3106 return (offset - start);
3110 /* 6.36 - Query Reply (OEM Auxiliary Device) Self-Defining Parameters */
3112 dissect_daid_sd_parm(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3115 gint start = offset;
3117 static const hf_items sdp1[] = {
3118 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3119 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3120 { &hf_tn3270_sdp_daid, NULL, 2, NULL, ENC_BIG_ENDIAN },
3121 { NULL, NULL, 0, NULL, 0 }
3124 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3126 return (offset - start);
3131 dissect_pclk_sd_parm(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3134 gint start = offset;
3136 static const hf_items sdp1[] = {
3137 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3138 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3139 { &hf_tn3270_oem_sdp_pclk_vers, NULL, 2, NULL, ENC_BIG_ENDIAN },
3140 { NULL, NULL, 0, NULL, 0 }
3143 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3145 return (offset - start);
3150 dissect_query_reply_oem_auxiliary_device_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3153 gint start = offset;
3157 static const hf_items sdp1[] = {
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_sdp_daid, NULL, 2, NULL, ENC_BIG_ENDIAN },
3161 { NULL, NULL, 0, NULL, 0 }
3164 static const hf_items sdp2[] = {
3165 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3166 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3167 { &hf_tn3270_oem_sdp_ll_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3168 { &hf_tn3270_oem_sdp_ll_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3170 { NULL, NULL, 0, NULL, 0 }
3173 static const hf_items sdp3[] = {
3174 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3175 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3176 { &hf_tn3270_oem_sdp_pclk_vers, NULL, 2, NULL, ENC_BIG_ENDIAN },
3177 { NULL, NULL, 0, NULL, 0 }
3181 sdp_len = tvb_get_guint8(tvb, offset);
3182 if ((sdp_len != 0x04) && (sdp_len != 0x06)) {
3186 sdp = tvb_get_guint8(tvb, offset+1);
3190 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3194 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3198 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3205 return (offset - start);
3209 /* 6.14 - Query Reply (Cooperative Processing Requestor) */
3211 dissect_query_reply_cooperative(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3212 gint sf_body_length)
3214 gint start = offset;
3216 static const hf_items fields[] = {
3217 { &hf_tn3270_res_twobytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3218 { &hf_tn3270_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3219 { &hf_tn3270_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3220 { &hf_tn3270_featl, NULL, 1, NULL, ENC_BIG_ENDIAN },
3221 { &hf_tn3270_feats, NULL, 2, NULL, ENC_BIG_ENDIAN },
3222 { NULL, NULL, 0, NULL, 0 }
3226 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3230 /*FIXME: Need to see this in action to dissect in detail */
3231 proto_tree_add_item(tn3270_tree,
3232 hf_tn3270_field_data,
3234 sf_body_length - (offset-start),
3236 offset += (sf_body_length - (offset - start));
3238 /* Uses same Self-Defining Parm as OEM Auxiliary Device */
3239 offset += dissect_query_reply_oem_auxiliary_device_sd_parms(tn3270_tree, tvb, offset);
3242 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3244 return (offset - start);
3247 /* 6.15 - Query Reply (Data Chaining) */
3249 dissect_query_reply_data_chaining(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3250 gint sf_body_length)
3252 gint start = offset;
3254 static const hf_items fields[] = {
3255 { &hf_tn3270_dc_dir, NULL, 1, NULL, ENC_BIG_ENDIAN },
3256 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3257 { NULL, NULL, 0, NULL, 0 }
3260 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3263 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3265 return (offset - start);
3268 /* 6.16 - Query Reply (Data Streams) */
3271 dissect_query_reply_data_streams(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3272 gint sf_body_length)
3274 gint start = offset;
3277 proto_tree_add_item(tn3270_tree, hf_tn3270_ds_default_sfid, tvb, offset, 1,
3281 for (i=0; i < (sf_body_length-(offset-start)); i++) {
3282 proto_tree_add_item(tn3270_tree,
3289 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3291 return (offset - start);
3294 /* 6.17 - Query Reply (DBCS Asia) */
3297 dissect_query_reply_dbcs_asia_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3300 gint start = offset;
3304 static const hf_items sdp1[] = {
3305 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3306 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3307 { &hf_tn3270_asia_sdp_sosi_soset, NULL, 1, NULL, ENC_BIG_ENDIAN },
3308 { NULL, NULL, 0, NULL, 0 }
3311 static const hf_items sdp2[] = {
3312 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3313 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3314 { &hf_tn3270_asia_sdp_ic_func, NULL, 1, NULL, ENC_BIG_ENDIAN },
3315 { NULL, NULL, 0, NULL, 0 }
3318 sdp_len = tvb_get_guint8(tvb, offset);
3319 if (sdp_len != 0x03) {
3323 sdp = tvb_get_guint8(tvb, offset+1);
3326 case 0x01: /*SO/SI*/
3327 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3330 case 0x02: /*Input Control*/
3331 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3338 return (offset - start);
3343 dissect_query_reply_dbcs_asia(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3344 gint sf_body_length)
3347 gint start = offset;
3350 static const hf_items fields[] = {
3351 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3352 { NULL, NULL, 0, NULL, 0 }
3356 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3359 for (i = 0; i < 3; i++) {
3360 offset += dissect_query_reply_dbcs_asia_sd_parms(tn3270_tree, tvb, offset);
3361 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3365 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3367 return (offset - start);
3370 /* 6.18 - Query Reply (Device Characteristics) */
3372 dissect_query_reply_device_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb,
3373 gint offset, gint sf_body_length)
3375 gint start = offset;
3377 #if 0 /* XXX: I don't think this is correct (i.e., this field is not part of this message) .... */
3378 proto_tree_add_item(tn3270_tree,
3379 hf_tn3270_sf_outbound_id,
3386 /* TODO: dissect descriptors */
3387 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3389 return (offset - start);
3392 /* 6.19 - Query Reply (Distributed Data Management) */
3394 dissect_query_reply_distributed_data_management(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3395 gint sf_body_length)
3397 gint start = offset, i;
3399 gboolean done = FALSE;
3401 static const hf_items fields[] = {
3402 { &hf_tn3270_ddm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3403 { &hf_tn3270_ddm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3404 { &hf_tn3270_ddm_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3405 { &hf_tn3270_ddm_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3406 { &hf_tn3270_ddm_nss, NULL, 1, NULL, ENC_BIG_ENDIAN },
3407 { &hf_tn3270_ddm_ddmss, NULL, 1, NULL, ENC_BIG_ENDIAN },
3408 { NULL, NULL, 0, NULL, 0 }
3411 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3414 for (i = 0; i < 3; i++) {
3415 sdp = tvb_get_guint8(tvb, offset+1);
3419 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, tvb_get_guint8(tvb,offset));
3422 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3425 offset += dissect_pclk_sd_parm(tn3270_tree, tvb, offset);
3431 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3435 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3437 return (offset - start);
3440 /* 6.20 - Query Reply (Document Interchange Architecture) */
3442 dissect_query_reply_document_interchange_architecture(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3443 gint sf_body_length)
3445 gint start = offset, sdp, ln, i;
3447 static const hf_items fields[] = {
3448 { &hf_tn3270_dia_flags, NULL, 2, NULL, ENC_BIG_ENDIAN },
3449 { &hf_tn3270_dia_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3450 { &hf_tn3270_dia_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3451 { NULL, NULL, 0, NULL, 0 }
3454 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3457 ln = tvb_get_guint8(tvb, offset);
3458 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_nfs, tvb, offset, 1, ENC_BIG_ENDIAN);
3460 for (i=0; i < ln; i++) {
3461 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_diafs, tvb, offset, 1,
3464 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_diafn, tvb, offset, 2,
3469 sdp = tvb_get_guint8(tvb, offset+1);
3470 if (sdp == 0x01) { /*DAID*/
3471 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3474 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3476 return (offset - start);
3479 /* 6.21 - Query Reply (Extended Drawing Routine) */
3481 dissect_query_reply_extended_drawing_routine(proto_tree *tn3270_tree, tvbuff_t *tvb,
3482 gint offset, gint sf_body_length)
3484 gint start = offset;
3486 proto_tree_add_item(tn3270_tree, hf_tn3270_field_data ,tvb, offset,
3487 sf_body_length, ENC_EBCDIC|ENC_NA);
3489 offset += sf_body_length;
3491 return (offset - start);
3494 /* 6.22 - Query Reply (Field Outlining) */
3496 dissect_query_reply_field_outlining(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3497 gint sf_body_length)
3499 gint start = offset;
3501 static const hf_items fields[] = {
3502 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3503 { &hf_tn3270_fo_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3504 { &hf_tn3270_fo_vpos, NULL, 1, NULL, ENC_BIG_ENDIAN },
3505 { &hf_tn3270_fo_hpos, NULL, 1, NULL, ENC_BIG_ENDIAN },
3506 { &hf_tn3270_fo_hpos0, NULL, 1, NULL, ENC_BIG_ENDIAN },
3507 { &hf_tn3270_fo_hpos1, NULL, 1, NULL, ENC_BIG_ENDIAN },
3508 { NULL, NULL, 0, NULL, 0 }
3511 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3514 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3516 return (offset - start);
3519 /* 6.23 - Query Reply (Field Validation) - Search for FIELD_VALIDATION*/
3520 /* 6.24 - Query Reply (Format Presentation) - Search for FORMAT_PRESENTATION*/
3522 /* 6.25 - Query Reply (Format Storage Auxiliary Device)*/
3524 dissect_query_reply_format_storage_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3525 gint sf_body_length)
3527 gint start = offset, sdp;
3529 static const hf_items fields[] = {
3530 { &hf_tn3270_fsad_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3531 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3532 { &hf_tn3270_fsad_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3533 { &hf_tn3270_fsad_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3534 { NULL, NULL, 0, NULL, 0 }
3537 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3540 sdp = tvb_get_guint8(tvb, offset+1);
3541 if (sdp == 0x01) { /*DAID*/
3542 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3543 proto_tree_add_item(tn3270_tree, hf_tn3270_fsad_size ,tvb, offset,
3548 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3550 return (offset - start);
3553 /* 6.26 - Query Reply (Graphic Color) - Search for GRAPHIC_COLOR*/
3554 /* 6.27 - Query Reply (Graphic Symbol Sets) - Search for GRAPHIC_SYMBOL_SETS*/
3556 /* 6.28 - Query Reply (Highlighting) */
3558 dissect_query_reply_highlighting(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3559 gint sf_body_length)
3561 gint start = offset;
3565 static const hf_items fields[] = {
3566 { &hf_tn3270_h_np, NULL, 1, NULL, ENC_BIG_ENDIAN },
3567 { NULL, NULL, 0, NULL, 0 }
3571 np = tvb_get_guint8(tvb, offset);
3572 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3575 for (i=0; i < np; i++) {
3576 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3579 proto_tree_add_item(tn3270_tree,
3585 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3588 proto_tree_add_item(tn3270_tree,
3596 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3598 return (offset - start);
3601 /* 6.29 - Query Reply (IBM Auxiliary Device) */
3603 dissect_query_reply_ibm_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3604 gint sf_body_length)
3606 gint start = offset, i, sdp;
3607 gboolean done = FALSE;
3609 static const hf_items fields[] = {
3610 { &hf_tn3270_ibm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3611 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3612 { &hf_tn3270_ibm_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3613 { &hf_tn3270_ibm_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3614 { &hf_tn3270_ibm_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3615 { NULL, NULL, 0, NULL, 0 }
3618 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3621 for (i = 0; i < 3; i++) {
3622 sdp = tvb_get_guint8(tvb, offset+1);
3624 case 0x02: /*Printer Name*/
3625 /*TODO: Printer Name */
3626 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, tvb_get_guint8(tvb,offset));
3629 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3632 offset += dissect_pclk_sd_parm(tn3270_tree, tvb, offset);
3638 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3642 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3644 return (offset - start);
3647 /* 6.30 - Query Reply (Image) */
3649 /* 6.31 - Query Reply (Implicit Partitions) */
3651 dissect_query_reply_implicit_partitions_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3654 gint start = offset;
3658 static const hf_items sdp1[] = {
3659 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3660 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3661 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3662 { &hf_tn3270_ipdd_wd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3663 { &hf_tn3270_ipdd_hd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3664 { &hf_tn3270_ipdd_wa, NULL, 2, NULL, ENC_BIG_ENDIAN },
3665 { &hf_tn3270_ipdd_ha, NULL, 2, NULL, ENC_BIG_ENDIAN },
3666 { NULL, NULL, 0, NULL, 0 }
3669 static const hf_items sdp2[] = {
3670 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3671 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3672 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3673 { &hf_tn3270_ippd_dpbs, NULL, 4, NULL, ENC_BIG_ENDIAN },
3674 { &hf_tn3270_ippd_apbs, NULL, 4, NULL, ENC_BIG_ENDIAN },
3675 { NULL, NULL, 0, NULL, 0 }
3678 static const hf_items sdp3[] = {
3679 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3680 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3681 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3682 { &hf_tn3270_ipccd_wcd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3683 { &hf_tn3270_ipccd_hcd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3684 { &hf_tn3270_ipccd_wca, NULL, 2, NULL, ENC_BIG_ENDIAN },
3685 { &hf_tn3270_ipccd_hca, NULL, 2, NULL, ENC_BIG_ENDIAN },
3686 { NULL, NULL, 0, NULL, 0 }
3689 sdp_len = tvb_get_guint8(tvb, offset);
3690 if (sdp_len != 0x0B) {
3694 sdp = tvb_get_guint8(tvb, offset+1);
3697 case QR_IP_SDP_DISPLAY:
3698 /* XXX: Save default and alternate screen size info as reported ? */
3699 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3702 case QR_IP_SDP_PRINTER:
3703 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3706 case QR_IP_SDP_CHARACTER:
3707 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3714 return (offset - start);
3719 dissect_query_reply_implicit_partitions(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3720 gint sf_body_length)
3722 gint start = offset;
3725 static const hf_items fields[] = {
3726 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3727 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3728 { NULL, NULL, 0, NULL, 0 }
3731 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3734 for (i = 0; i < 3; i++) {
3736 len = dissect_query_reply_implicit_partitions_sd_parms(tn3270_tree, tvb, offset);
3737 if ((len == 0) || (tvb_reported_length_remaining(tvb, offset) <= 0))
3742 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3744 return (offset - start);
3747 /* 6.32 - Query Reply (IOCA Auxiliary Device) */
3749 dissect_query_reply_ioca_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3750 gint sf_body_length)
3752 gint start = offset;
3754 static const hf_items fields[] = {
3755 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3756 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3757 { &hf_tn3270_ioca_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3758 { &hf_tn3270_ioca_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3759 { &hf_tn3270_ioca_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3760 { NULL, NULL, 0, NULL, 0 }
3763 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3766 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3768 return (offset - start);
3771 /* 6.33 - Query Reply (Line Type) - Search for LINE_TYPE*/
3773 /* 6.34 - Query Reply (MSR Control) */
3775 dissect_query_reply_msr_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3776 gint sf_body_length)
3778 gint start = offset;
3780 static const hf_items fields[] = {
3781 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3782 { &hf_tn3270_msr_nd, NULL, 1, NULL, ENC_BIG_ENDIAN },
3783 { &hf_tn3270_msr_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3784 { NULL, NULL, 0, NULL, 0 }
3787 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3789 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3791 return (offset - start);
3794 /* 6.35 - Query Reply (Null) - Search for QUERY_REPLY_NULL */
3796 /* 6.36 - Query Reply (OEM Auxiliary Device) */
3798 dissect_query_reply_oem_auxiliary_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3799 gint sf_body_length)
3801 gint start = offset;
3804 static const hf_items fields[] = {
3805 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3806 { &hf_tn3270_oem_dsref, NULL, 1, NULL, ENC_BIG_ENDIAN },
3807 { &hf_tn3270_oem_dtype, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
3808 { &hf_tn3270_oem_uname, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
3809 { NULL, NULL, 0, NULL, 0 }
3812 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3815 for (i = 0; i < 3; i++) {
3816 offset += dissect_query_reply_oem_auxiliary_device_sd_parms(tn3270_tree, tvb, offset);
3817 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3821 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3823 return (offset - start);
3826 /* 6.37 - Query Reply (Paper Feed Techniques) */
3828 dissect_query_reply_paper_feed_techniques(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3829 gint sf_body_length)
3831 gint start = offset;
3833 static const hf_items fields[] = {
3834 { &hf_tn3270_pft_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3835 { &hf_tn3270_pft_tmo, NULL, 2, NULL, ENC_BIG_ENDIAN },
3836 { &hf_tn3270_pft_bmo, NULL, 2, NULL, ENC_BIG_ENDIAN },
3837 { NULL, NULL, 0, NULL, 0 }
3840 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3842 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3844 return (offset - start);
3847 /* 6.38 - Query Reply (Partition Characteristics) */
3849 dissect_query_reply_partition_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3850 gint sf_body_length)
3852 gint start = offset, i, sdp;
3853 gboolean done = FALSE;
3855 static const hf_items fields[] = {
3856 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3857 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3858 { NULL, NULL, 0, NULL, 0 }
3861 for (i = 0; i < 2; i++) {
3862 sdp = tvb_get_guint8(tvb, offset+1);
3864 case 0x01: /*Viewport Outline*/
3865 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3867 proto_tree_add_item(tn3270_tree, hf_tn3270_pc_vo_thickness,
3868 tvb, offset, 1, ENC_BIG_ENDIAN);
3871 case 0x03: /*Enable User Call-Up*/
3872 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3879 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3883 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3885 return (offset - start);
3888 /* 6.39 - Query Reply (Port) - Search for QUERY_REPLY_PORT */
3889 /* 6.40 - Query Reply (Procedure) - Search for QUERY_REPLY_PROCEDURE */
3891 /* 6.41 - Query Reply ((Product Defined Data Stream) */
3893 dissect_query_reply_product_defined_data_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3894 gint sf_body_length)
3896 gint start = offset, sdp;
3898 static const hf_items fields[] = {
3899 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3900 { &hf_tn3270_pdds_refid, NULL, 1, NULL, ENC_BIG_ENDIAN },
3901 { &hf_tn3270_pdds_ssid, NULL, 1, NULL, ENC_BIG_ENDIAN },
3902 { NULL, NULL, 0, NULL, 0 }
3905 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3908 sdp = tvb_get_guint8(tvb, offset+1);
3909 if (sdp == 0x01) { /*DAID*/
3910 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3913 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3915 return (offset - start);
3918 /* 6.42 - Query Reply (Modes) */
3920 dissect_query_reply_modes(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3921 gint sf_body_length)
3923 gint start = offset;
3926 for (i=0; i < sf_body_length; i++) {
3927 proto_tree_add_item(tn3270_tree,
3935 return (offset - start);
3938 /* 6.43 - Query Reply (RPQ Names) */
3940 dissect_query_reply_rpq_names(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3941 gint sf_body_length)
3943 gint start = offset;
3946 static const hf_items fields[] = {
3947 { &hf_tn3270_rpq_device, NULL, 4, NULL, ENC_EBCDIC|ENC_NA },
3948 { &hf_tn3270_rpq_mid, NULL, 4, NULL, ENC_BIG_ENDIAN },
3949 { NULL, NULL, 0, NULL, 0 }
3952 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3955 rpql = tvb_get_guint8(tvb, offset);
3957 proto_tree_add_item(tn3270_tree,
3964 proto_tree_add_item(tn3270_tree,
3971 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3973 return (offset - start);
3976 /* 6.44 - Query Reply (Save/Restore Format) */
3978 dissect_query_reply_save_or_restore_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3979 gint sf_body_length)
3981 gint start = offset;
3983 static const hf_items fields[] = {
3984 { &hf_tn3270_srf_fpcbl, NULL, 1, NULL, ENC_NA },
3985 { NULL, NULL, 0, NULL, 0 }
3988 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3991 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3993 return (offset - start);
3996 /* 6.45 - Query Reply (Segment) - Search for QUERY_REPLY_SEGMENT */
3998 /* 6.46 - Query Reply ((Settable Printer Characteristics) */
4000 dissect_query_reply_settable_printer_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4001 gint sf_body_length)
4003 gint start = offset, sdp;
4005 static const hf_items fields[] = {
4006 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
4007 { NULL, NULL, 0, NULL, 0 }
4010 static const hf_items fields2[] = {
4011 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
4012 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
4013 { NULL, NULL, 0, NULL, 0 }
4016 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4019 sdp = tvb_get_guint8(tvb, offset+1);
4020 if (sdp == 0x01) { /*Early Print Complete*/
4021 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4023 proto_tree_add_item(tn3270_tree, hf_tn3270_spc_epc_flags, tvb, offset,
4028 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4030 return (offset - start);
4033 /* 6.47 - Query Reply (Storage Pools) */
4035 dissect_query_reply_storage_pools(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4036 gint sf_body_length)
4038 gint start = offset, sdp, i;
4040 static const hf_items fields2[] = {
4041 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
4042 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
4043 { &hf_tn3270_sp_spid, NULL, 1, NULL, ENC_BIG_ENDIAN },
4044 { &hf_tn3270_sp_size, NULL, 4, NULL, ENC_BIG_ENDIAN },
4045 { &hf_tn3270_sp_space, NULL, 4, NULL, ENC_BIG_ENDIAN },
4046 { NULL, NULL, 0, NULL, 0 }
4049 sdp = tvb_get_guint8(tvb, offset+1);
4050 if (sdp == 0x01) { /* Storage Pool Characteristics */
4051 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4053 for (i=0; i < (sf_body_length-(offset-start)); i+=2) {
4054 proto_tree_add_item(tn3270_tree, hf_tn3270_sp_objlist,
4055 tvb, offset, 2, ENC_BIG_ENDIAN);
4060 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4062 return (offset - start);
4065 /* 6.48 - Query Reply (Summary) */
4067 dissect_query_reply_summary(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4068 gint sf_body_length)
4072 gint length_remaining = tvb_reported_length_remaining(tvb, offset);
4074 for (i=0; i < sf_body_length; i++) {
4075 if (datalen >= length_remaining) {
4078 proto_tree_add_item(tn3270_tree,
4079 hf_tn3270_sf_query_reply,
4080 tvb, offset + datalen,
4085 datalen += dissect_unknown_data(tn3270_tree, tvb, offset+datalen, offset, sf_body_length);
4090 /* 6.49 - Query Reply (Text Partitions) */
4092 dissect_query_reply_text_partitions(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4093 gint sf_body_length)
4095 gint start = offset, len, i;
4097 static const hf_items fields[] = {
4098 { &hf_tn3270_tp_nt, NULL, 1, NULL, ENC_BIG_ENDIAN },
4099 { &hf_tn3270_tp_m, NULL, 2, NULL, ENC_BIG_ENDIAN },
4100 { &hf_tn3270_tp_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
4101 { NULL, NULL, 0, NULL, 0 }
4104 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4107 len = tvb_get_guint8(tvb, offset);
4108 proto_tree_add_item(tn3270_tree, hf_tn3270_tp_ntt, tvb, offset, 1, ENC_BIG_ENDIAN);
4111 for (i=0; i < len; i++) {
4112 proto_tree_add_item(tn3270_tree, hf_tn3270_tp_tlist,
4113 tvb, offset, 1, ENC_BIG_ENDIAN);
4117 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4119 return (offset - start);
4122 /* 6.50 - Query Reply (Transparency) */
4124 dissect_query_reply_transparency(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4125 gint sf_body_length)
4127 gint start = offset, i, len;
4129 len = tvb_get_guint8(tvb, offset);
4130 proto_tree_add_item(tn3270_tree, hf_tn3270_t_np, tvb, offset, 1, ENC_BIG_ENDIAN);
4133 for (i=0; i < len; i+=2) {
4134 proto_tree_add_item(tn3270_tree, hf_tn3270_t_vi,
4135 tvb, offset, 1, ENC_BIG_ENDIAN);
4137 proto_tree_add_item(tn3270_tree, hf_tn3270_t_ai,
4138 tvb, offset, 1, ENC_BIG_ENDIAN);
4142 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4144 return (offset - start);
4147 /* 6.51 - Query Reply Usable Area */
4149 dissect_query_reply_usable_area(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4150 gint sf_body_length)
4152 gint start = offset;
4155 static const gint *byte1[] = {
4156 &hf_tn3270_ua_reserved1,
4157 &hf_tn3270_ua_page_printer,
4158 &hf_tn3270_ua_reserved2,
4159 &hf_tn3270_ua_hard_copy,
4160 &hf_tn3270_ua_addressing,
4164 static const gint *byte2[] = {
4165 &hf_tn3270_ua_variable_cells,
4166 &hf_tn3270_ua_characters,
4167 &hf_tn3270_ua_cell_units,
4171 static const hf_items fields[] = {
4172 { &hf_tn3270_usable_area_flags1, &ett_tn3270_usable_area_flags1, 1, byte1, 0 },
4173 { &hf_tn3270_usable_area_flags2, &ett_tn3270_usable_area_flags1, 1, byte2, 0 },
4174 { &hf_tn3270_ua_width_cells_pels, NULL, 2, NULL, ENC_BIG_ENDIAN },
4175 { &hf_tn3270_ua_height_cells_pels, NULL, 2, NULL, ENC_BIG_ENDIAN },
4176 { &hf_tn3270_ua_uom_cells_pels, NULL, 1, NULL, ENC_BIG_ENDIAN },
4177 { &hf_tn3270_ua_xr, NULL, 4, NULL, ENC_BIG_ENDIAN },
4178 { &hf_tn3270_ua_yr, NULL, 4, NULL, ENC_BIG_ENDIAN },
4179 { &hf_tn3270_ua_aw, NULL, 1, NULL, ENC_BIG_ENDIAN },
4180 { &hf_tn3270_ua_ah, NULL, 1, NULL, ENC_BIG_ENDIAN },
4181 { &hf_tn3270_ua_buffsz, NULL, 2, NULL, ENC_BIG_ENDIAN },
4182 { NULL, NULL, 0, NULL, 0 }
4185 static const hf_items fields2[] = {
4186 { &hf_tn3270_ua_xmin, NULL, 1, NULL, ENC_BIG_ENDIAN },
4187 { &hf_tn3270_ua_ymin, NULL, 1, NULL, ENC_BIG_ENDIAN },
4188 { &hf_tn3270_ua_xmax, NULL, 1, NULL, ENC_BIG_ENDIAN },
4189 { &hf_tn3270_ua_ymax, NULL, 1, NULL, ENC_BIG_ENDIAN },
4190 { NULL, NULL, 0, NULL, 0 }
4193 vcp = tvb_get_guint8(tvb, offset+1);
4195 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4198 if ((vcp & QR_UA_VARIABLE_CELLS) != 0) {
4199 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4203 /*TODO: self defining parms */
4204 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4206 return (offset - start);
4209 /* 6.52 - Query Reply 3270 IPDS */
4211 dissect_query_reply_3270_ipds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4212 gint sf_body_length)
4214 gint start = offset;
4216 static const hf_items fields[] = {
4217 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
4218 { &hf_tn3270_3270_tranlim, NULL, 2, NULL, ENC_BIG_ENDIAN },
4219 { NULL, NULL, 0, NULL, 0 }
4222 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4224 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4226 return (offset - start);
4229 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4230 /* call only with valid sf_id */
4232 process_inbound_structured_field(proto_tree *sf_tree, tvbuff_t *tvb, gint offset,
4233 tn3270_conv_info_t *tn3270_info, guint sf_id, gint sf_body_length)
4235 gint start = offset; /* start of structured field param(s) */
4238 case SF_IB_EXCEPTION_OR_STATUS:
4239 offset += dissect_exception_or_status(sf_tree, tvb, offset, sf_body_length);
4241 case SF_IB_INBOUND_TEXT_HEADER:
4242 offset += dissect_inbound_text_header(sf_tree, tvb, offset, sf_body_length);
4244 case SF_IB_INBOUND_3270DS:
4245 offset += dissect_inbound_3270ds(sf_tree, tvb, offset, tn3270_info, sf_body_length);
4247 case SF_IB_RECOVERY_DATA:
4248 offset += dissect_recovery_data(sf_tree, tvb, offset, sf_body_length);
4250 case SF_IB_TYPE_1_TEXT_INBOUND:
4251 offset += dissect_type_1_text(sf_tree, tvb, offset, sf_body_length);
4253 case SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS:
4254 offset += dissect_query_reply_alphanumeric(sf_tree, tvb, offset, sf_body_length);
4256 case SF_IB_QUERY_REPLY_AUXILIARY_DEVICE:
4257 case SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE:
4258 offset += dissect_query_reply_resbytes(sf_tree, tvb, offset, sf_body_length);
4260 case SF_IB_QUERY_REPLY_CHARACTER_SETS:
4261 offset += dissect_query_reply_character_sets(sf_tree, tvb, offset, sf_body_length);
4263 case SF_IB_QUERY_REPLY_COLOR:
4264 offset += dissect_query_reply_color(sf_tree, tvb, offset, sf_body_length);
4266 case SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR:
4267 offset += dissect_query_reply_cooperative(sf_tree, tvb, offset, sf_body_length);
4269 case SF_IB_QUERY_REPLY_DATA_CHAINING:
4270 offset += dissect_query_reply_data_chaining(sf_tree, tvb, offset, sf_body_length);
4272 case SF_IB_QUERY_REPLY_DATA_STREAMS:
4273 offset += dissect_query_reply_data_streams(sf_tree, tvb, offset, sf_body_length);
4275 case SF_IB_QUERY_REPLY_DBCS_ASIA:
4276 offset += dissect_query_reply_dbcs_asia(sf_tree, tvb, offset, sf_body_length);
4278 case SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS:
4279 /*TODO: implement this beast */
4280 offset += dissect_query_reply_device_characteristics(sf_tree, tvb, offset, sf_body_length);
4282 case SF_IB_QUERY_REPLY_SUMMARY:
4283 offset += dissect_query_reply_summary(sf_tree, tvb, offset, sf_body_length);
4285 case SF_IB_QUERY_REPLY_USABLE_AREA:
4286 offset += dissect_query_reply_usable_area(sf_tree, tvb, offset, sf_body_length);
4288 case SF_IB_QUERY_REPLY_HIGHLIGHTING:
4289 offset += dissect_query_reply_highlighting(sf_tree, tvb, offset, sf_body_length);
4291 case SF_IB_QUERY_REPLY_REPLY_MODES:
4292 offset += dissect_query_reply_modes(sf_tree, tvb, offset, sf_body_length);
4294 case SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT:
4295 offset += dissect_query_reply_distributed_data_management(sf_tree, tvb, offset, sf_body_length);
4297 case SF_IB_QUERY_REPLY_RPQ_NAMES:
4298 offset += dissect_query_reply_rpq_names(sf_tree, tvb, offset, sf_body_length);
4300 case SF_IB_QUERY_REPLY_IMPLICIT_PARTITION:
4301 offset += dissect_query_reply_implicit_partitions(sf_tree, tvb, offset, sf_body_length);
4303 case SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE:
4304 offset += dissect_query_reply_oem_auxiliary_device(sf_tree, tvb, offset, sf_body_length);
4306 case SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE:
4307 offset += dissect_query_reply_document_interchange_architecture(sf_tree, tvb, offset, sf_body_length);
4309 case SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE:
4310 offset += dissect_query_reply_extended_drawing_routine(sf_tree, tvb, offset, sf_body_length);
4312 case SF_IB_QUERY_REPLY_FIELD_OUTLINING:
4313 offset += dissect_query_reply_field_outlining(sf_tree, tvb, offset, sf_body_length);
4315 case SF_IB_QUERY_REPLY_FIELD_VALIDATION:
4316 offset += dissect_3270_field_validation(sf_tree, tvb, offset);
4318 case SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE:
4319 offset += dissect_query_reply_format_storage_aux_device(sf_tree, tvb, offset, sf_body_length);
4321 case SF_IB_QUERY_REPLY_GRAPHIC_COLOR:
4322 case SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS:
4323 case SF_IB_QUERY_REPLY_IMAGE:
4324 case SF_IB_QUERY_REPLY_LINE_TYPE:
4325 case SF_IB_QUERY_REPLY_PROCEDURE:
4326 case SF_IB_QUERY_REPLY_SEGMENT:
4327 /* Not an error - just has a data field like 'extended drawing'*/
4328 offset += dissect_query_reply_extended_drawing_routine(sf_tree, tvb, offset, sf_body_length);
4330 case SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE:
4331 offset += dissect_query_reply_ibm_aux_device(sf_tree, tvb, offset, sf_body_length);
4333 case SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE:
4334 offset += dissect_query_reply_ioca_aux_device(sf_tree, tvb, offset, sf_body_length);
4336 case SF_IB_QUERY_REPLY_MSR_CONTROL:
4337 offset += dissect_query_reply_msr_control(sf_tree, tvb, offset, sf_body_length);
4339 case SF_IB_QUERY_REPLY_FORMAT_PRESENTATION:
4340 case SF_IB_QUERY_REPLY_NULL:
4341 case SF_IB_QUERY_REPLY_PORT:
4342 /* This field is always empty */
4344 case SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES:
4345 offset += dissect_query_reply_paper_feed_techniques(sf_tree, tvb, offset, sf_body_length);
4347 case SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS:
4348 offset += dissect_query_reply_partition_characteristics(sf_tree, tvb, offset, sf_body_length);
4350 case SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM:
4351 offset += dissect_query_reply_product_defined_data_stream(sf_tree, tvb, offset, sf_body_length);
4353 case SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT:
4354 offset += dissect_query_reply_save_or_restore_format(sf_tree, tvb, offset, sf_body_length);
4356 case SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS:
4357 offset += dissect_query_reply_settable_printer_characteristics(sf_tree, tvb, offset, sf_body_length);
4359 case SF_IB_QUERY_REPLY_STORAGE_POOLS:
4360 offset += dissect_query_reply_storage_pools(sf_tree, tvb, offset, sf_body_length);
4362 case SF_IB_QUERY_REPLY_TEXT_PARTITIONS:
4363 offset += dissect_query_reply_text_partitions(sf_tree, tvb, offset, sf_body_length);
4365 case SF_IB_QUERY_REPLY_TRANSPARENCY:
4366 offset += dissect_query_reply_transparency(sf_tree, tvb, offset, sf_body_length);
4368 case SF_IB_QUERY_REPLY_3270_IPDS:
4369 offset += dissect_query_reply_3270_ipds(sf_tree, tvb, offset, sf_body_length);
4372 DISSECTOR_ASSERT_NOT_REACHED();
4376 return (offset - start);
4380 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4381 /* call only with valid sf_id */
4383 process_outbound_structured_field(proto_tree *sf_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
4384 tn3270_conv_info_t *tn3270_info, guint sf_id, gint sf_body_length)
4386 gint start = offset; /* start of structured field param(s) */
4389 case SF_OB_READ_PARTITION:
4390 offset += dissect_read_partition(sf_tree, tvb, offset, sf_body_length);
4392 case SF_OB_ACTIVATE_PARTITION:
4393 case SF_OB_DESTROY_PARTITION:
4394 case SF_OB_RESET_PARTITION:
4395 proto_tree_add_item(sf_tree,
4396 hf_tn3270_partition_id,
4402 case SF_OB_CREATE_PARTITION:
4403 offset += dissect_create_partition(sf_tree, tvb, offset, sf_body_length);
4405 case SF_OB_ERASE_OR_RESET:
4406 /* Bit 0: 0= Use default screen size; 1= use alternate screen size */
4407 /* XXX: Not really valid: See comment under dissect_outbound_stream(). */
4408 if ((tvb_get_guint8(tvb, offset) & 0x80) != 0) {
4409 tn3270_info->rows = tn3270_info->altrows;
4410 tn3270_info->cols = tn3270_info->altcols;
4413 tn3270_info->rows = 24;
4414 tn3270_info->cols = 80;
4416 proto_tree_add_bits_item(sf_tree,
4417 hf_tn3270_erase_flags,
4423 case SF_OB_LOAD_PROGRAMMED_SYMBOLS:
4424 offset += dissect_load_programmed_symbols(sf_tree, tvb, offset, sf_body_length);
4426 case SF_OB_OUTBOUND_3270DS:
4427 offset += dissect_outbound_3270ds(sf_tree, pinfo, tvb, offset, tn3270_info, sf_body_length);
4429 case SF_OB_PRESENT_ABSOLUTE_FORMAT:
4430 offset += dissect_present_absolute_format(sf_tree, tvb, offset, sf_body_length);
4432 case SF_OB_PRESENT_RELATIVE_FORMAT:
4433 offset += dissect_present_relative_format(sf_tree, tvb, offset, sf_body_length);
4435 case SF_OB_SCS_DATA:
4436 proto_tree_add_item(sf_tree,
4437 hf_tn3270_partition_id,
4442 proto_tree_add_item(sf_tree,
4445 (sf_body_length - (offset - start)),
4447 offset += (sf_body_length - (offset - start));
4449 case SF_OB_SET_REPLY_MODE:
4450 offset += dissect_set_reply_mode(sf_tree, tvb, offset, sf_body_length);
4452 case SF_OB_SELECT_FORMAT_GROUP:
4453 proto_tree_add_item(sf_tree,
4454 hf_tn3270_partition_id,
4459 proto_tree_add_item(sf_tree,
4460 hf_tn3270_format_group,
4462 (sf_body_length - (offset - start)),
4464 offset += (sf_body_length - (offset - start));
4466 case SF_OB_SET_WINDOW_ORIGIN:
4467 proto_tree_add_item(sf_tree,
4468 hf_tn3270_partition_id,
4473 proto_tree_add_item(sf_tree,
4474 hf_tn3270_partition_rw,
4479 proto_tree_add_item(sf_tree,
4480 hf_tn3270_partition_cw,
4486 case SF_OB_BEGIN_OR_END_OF_FILE:
4487 proto_tree_add_item(sf_tree,
4488 hf_tn3270_partition_id,
4493 /*TODO: use bits_text */
4494 proto_tree_add_bits_item(sf_tree,
4495 hf_tn3270_begin_end_flags1,
4500 proto_tree_add_item(sf_tree,
4501 hf_tn3270_begin_end_flags2,
4507 case SF_OB_LOAD_COLOR_TABLE:
4508 /* Refer to related graphics docs !*/
4509 proto_tree_add_item(sf_tree,
4510 hf_tn3270_load_color_command,
4514 offset += sf_body_length;
4516 case SF_OB_LOAD_FORMAT_STORAGE:
4517 offset += dissect_load_format_storage(sf_tree, tvb, offset, sf_body_length);
4519 case SF_OB_LOAD_LINE_TYPE:
4520 /* Refer to related graphics docs !*/
4521 proto_tree_add_item(sf_tree,
4522 hf_tn3270_load_line_type_command,
4526 offset += sf_body_length;
4528 case SF_OB_MODIFY_PARTITION:
4529 offset += dissect_modify_partition(sf_tree, tvb, offset, sf_body_length);
4531 case SF_OB_OUTBOUND_TEXT_HEADER:
4532 offset += dissect_outbound_text_header(sf_tree, tvb, offset, sf_body_length);
4534 case SF_OB_REQUEST_RECOVERY_DATA:
4535 proto_tree_add_item(sf_tree,
4543 offset += dissect_restart(sf_tree, tvb, offset, sf_body_length);
4545 case SF_OB_SELECT_COLOR_TABLE:
4546 proto_tree_add_item(sf_tree,
4547 hf_tn3270_color_command,
4553 case SF_OB_SET_CHECKPOINT_INTERVAL:
4554 proto_tree_add_item(sf_tree,
4560 proto_tree_add_item(sf_tree,
4567 case SF_OB_SET_MSR_CONTROL:
4568 offset += dissect_set_msr_control(sf_tree, tvb, offset, sf_body_length);
4570 case SF_OB_SET_PARTITION_CHARACTERISTICS:
4571 offset += dissect_set_partition_characteristics(sf_tree, tvb, offset, sf_body_length);
4573 case SF_OB_SET_PRINTER_CHARACTERISTICS:
4574 offset += dissect_set_printer_characteristics(sf_tree, tvb, offset, sf_body_length);
4576 case SF_OB_TYPE_1_TEXT_OUTBOUND:
4577 offset += dissect_type_1_text(sf_tree, tvb, offset, sf_body_length);
4580 DISSECTOR_ASSERT_NOT_REACHED();
4584 return (offset - start);
4587 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4588 /* call only with valid sf_id */
4590 process_outbound_inbound_structured_field(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4591 tn3270_conv_info_t *tn3270_info _U_, guint sf_id, gint sf_body_length)
4593 gint start = offset;
4596 case SF_OB_IB_DATA_CHAIN:
4597 offset += dissect_data_chain(tn3270_tree, tvb, offset, sf_body_length);
4599 case SF_OB_IB_DESTINATION_OR_ORIGIN:
4600 proto_tree_add_item(tn3270_tree,
4601 hf_tn3270_destination_or_origin_flags_input_control,
4606 proto_tree_add_item(tn3270_tree,
4612 proto_tree_add_item(tn3270_tree,
4613 hf_tn3270_destination_or_origin_doid,
4619 case SF_OB_IB_OBJECT_DATA:
4620 case SF_OB_IB_OBJECT_CONTROL:
4621 case SF_OB_IB_OBJECT_PICTURE:
4622 case SF_OB_IB_OEM_DATA: /* FIXME: Not really but same layout */
4623 offset += dissect_object_control(tn3270_tree, tvb, offset, sf_body_length);
4625 case SF_OB_IB_SAVE_OR_RESTORE_FORMAT:
4626 offset += dissect_save_or_restore_format(tn3270_tree, tvb, offset, sf_body_length);
4628 case SF_OB_IB_SELECT_IPDS_MODE:
4629 proto_tree_add_item(tn3270_tree,
4637 DISSECTOR_ASSERT_NOT_REACHED();
4641 return (offset - start);
4645 display_sf_hdr(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4646 gint sf_length, guint sf_id, guint sf_id_len, const gchar *sf_id_str)
4648 proto_tree *sf_tree;
4650 sf_tree = proto_tree_add_subtree_format(tn3270_tree, tvb, offset, sf_length,
4651 ett_sf, NULL, "Structured Field: %s", sf_id_str);
4653 proto_tree_add_item(sf_tree,
4654 hf_tn3270_sf_length,
4659 proto_tree_add_uint_format_value(sf_tree,
4660 (sf_id_len == 1) ? hf_tn3270_sf_single_byte_id : hf_tn3270_sf_double_byte_id,
4661 tvb, offset+2, sf_id_len,
4662 sf_id, "%s (0x%0*x)", sf_id_str, sf_id_len*2, sf_id);
4668 dissect_structured_fields(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
4669 tn3270_conv_info_t *tn3270_info, gboolean direction_inbound)
4671 proto_tree *sf_tree;
4676 const gchar *sf_id_str;
4680 while (tvb_reported_length_remaining(tvb, offset) >= 2) {
4682 /* Handle NULL bytes until we find a length value */
4683 /* XXX: An earlier version of the code for structured field */
4684 /* processing did this check only for inbound structured */
4685 /* fields. Should the same be done in this code which */
4686 /* combines handling for both inbound and outbound */
4687 /* structured fields ? */
4688 if ((sf_length = tvb_get_ntohs(tvb, offset)) == 0) {
4689 proto_tree_add_item(tn3270_tree,
4698 sf_id = tvb_get_guint8(tvb, offset+2);
4700 if ((sf_id == 0x0F) ||
4703 sf_id = (sf_id << 8) + tvb_get_guint8(tvb, offset+3);
4707 sf_id_str = try_val_to_str(sf_id, direction_inbound ?
4708 vals_inbound_structured_fields : vals_outbound_structured_fields);
4709 if (sf_id_str != NULL) {
4710 sf_tree = display_sf_hdr(tn3270_tree, tvb, offset,
4711 sf_length, sf_id, sf_id_len, sf_id_str);
4712 offset += (sf_id_len + 2);
4713 if (direction_inbound) {
4714 offset += process_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4717 offset += process_outbound_structured_field(sf_tree, pinfo, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4722 /* Not found above: See if an "outbound-inbound" field */
4723 sf_id_str = try_val_to_str(sf_id, vals_outbound_inbound_structured_fields);
4724 if (sf_id_str != NULL) {
4725 sf_tree = display_sf_hdr(tn3270_tree, tvb, offset,
4726 sf_length, sf_id, sf_id_len, sf_id_str);
4727 offset += (sf_id_len + 2);
4728 offset += process_outbound_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4733 sf_id_str = wmem_strdup_printf(wmem_packet_scope(), "Unknown [%0*x]", sf_id_len*2, sf_id);
4734 display_sf_hdr(tn3270_tree, tvb, offset, sf_length,
4735 sf_length, sf_id_len, sf_id_str);
4736 offset += sf_length;
4739 return (offset - start);
4743 /* Start: Handle WCC, Orders and Data */
4746 dissect_stop_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4748 gint start = offset;
4751 proto_tree_add_item(tn3270_tree,
4752 hf_tn3270_stop_address,
4757 is_oc_ge = tvb_get_guint8(tvb, offset);
4758 if (is_oc_ge != OC_GE) {
4759 proto_tree_add_item(tn3270_tree,
4760 hf_tn3270_character_code,
4767 return (offset - start);
4771 * From section "4.3.3 Set Buffer Address (SBA)" of the IBM document
4778 * XXX - what about 16-bit addressing?
4780 #define SBA_ADDRESS_FORMAT_MASK 0xC000
4781 #define SBA_ADDRESS_MASK_SHIFT 14
4782 #define SBA_ADDRESS_FORMAT(address) (((address) & SBA_ADDRESS_FORMAT_MASK) >> SBA_ADDRESS_MASK_SHIFT)
4784 #define SBA_ADDRESS_VALUE_MASK 0x3FFF
4785 #define SBA_ADDRESS_VALUE(address) ((address) & SBA_ADDRESS_VALUE_MASK)
4787 #define SBA_14_BIT_BINARY 0x0
4788 #define SBA_12_BIT_CODED_1 0x1
4789 #define SBA_RESERVED 0x2
4790 #define SBA_12_BIT_CODED_2 0x3
4793 dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint hf, tn3270_conv_info_t *tn3270_info)
4795 gint start = offset;
4796 guint16 buffer_addr;
4797 guint16 address_format, address_value;
4799 guint8 rowsx = tn3270_info->rows;
4800 guint8 colsx = tn3270_info->cols;
4802 buffer_addr = tvb_get_ntohs(tvb, offset);
4803 address_format = SBA_ADDRESS_FORMAT(buffer_addr);
4804 address_value = SBA_ADDRESS_VALUE(buffer_addr);
4807 * XXX - put the address format and address value into the protocol
4808 * tree as bitfields under these items?
4810 switch (address_format) {
4812 case SBA_14_BIT_BINARY:
4813 proto_tree_add_uint_format_value(tn3270_tree,
4817 "14-bit address, %u = row %u, column %u [assuming a %ux%u display] (0x%04x)",
4819 (address_value / colsx) + 1,
4820 (address_value % colsx) + 1,
4825 case SBA_12_BIT_CODED_1:
4826 case SBA_12_BIT_CODED_2:
4828 * This is a wacky encoding. At least as I read the IBM document
4829 * in question, the lower 6 bits of the first byte of the SBA
4830 * address, and the lower 6 bits of the second byte of the SBA
4831 * address, are combined into a 12-bit binary address. The upper
4832 * 2 bits of the first byte are the address format; the upper 2
4833 * bits of the second byte are ignored.
4835 b1 = (address_value >> 8) & 0x3F;
4836 b2 = (address_value >> 0) & 0x3F;
4837 address_value = (b1 << 6) | b2;
4838 proto_tree_add_uint_format_value(tn3270_tree,
4842 "12-bit address, %u = row %u, column %u [assuming a %ux%u display] (0x%04x)",
4844 (address_value / colsx) + 1,
4845 (address_value % colsx) + 1,
4851 proto_tree_add_uint_format_value(tn3270_tree,
4855 "Reserved (0x%04x)",
4861 return (offset - start);
4865 dissect_field_attribute_pair(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4867 gint start = offset;
4868 gint attribute_type;
4870 attribute_type = tvb_get_guint8(tvb, offset);
4871 proto_tree_add_item(tn3270_tree,
4872 hf_tn3270_attribute_type,
4877 switch (attribute_type) {
4878 case AT_ALL_CHARACTER_ATTRIBUTES:
4879 proto_tree_add_item(tn3270_tree,
4880 hf_tn3270_all_character_attributes,
4886 case AT_T3270_FIELD_ATTRIBUTE:
4887 offset += dissect_3270_field_attribute(tn3270_tree, tvb, offset);
4889 case AT_EXTENDED_HIGHLIGHTING:
4890 proto_tree_add_item(tn3270_tree,
4891 hf_tn3270_extended_highlighting,
4897 case AT_FOREGROUND_COLOR:
4898 case AT_BACKGROUND_COLOR:
4899 proto_tree_add_item(tn3270_tree,
4906 case AT_CHARACTER_SET:
4907 proto_tree_add_item(tn3270_tree,
4908 hf_tn3270_character_set,
4914 case AT_FIELD_OUTLINING:
4915 proto_tree_add_item(tn3270_tree,
4916 hf_tn3270_field_outlining,
4922 case AT_TRANSPARENCY:
4923 proto_tree_add_item(tn3270_tree,
4924 hf_tn3270_transparency,
4930 case AT_FIELD_VALIDATION:
4931 offset += dissect_3270_field_validation(tn3270_tree, tvb, offset);
4935 return (offset - start);
4939 dissect_field_attribute_pairs(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4941 gint start = offset;
4945 no_of_pairs = tvb_get_guint8(tvb, offset);
4946 proto_tree_add_item(tn3270_tree,
4947 hf_tn3270_number_of_attributes,
4953 for (i=0; i < no_of_pairs; i++) {
4954 offset += dissect_field_attribute_pair(tn3270_tree, tvb, offset);
4957 return (offset - start);
4961 dissect_orders_and_data(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
4963 gint start = offset;
4969 /* XXX: '0' is treated as data; See comment under add_data_until_next_order_code() */
4970 while (tvb_reported_length_remaining(tvb, offset) > 0) {
4971 order_code = tvb_get_guint8(tvb, offset);
4972 if ((order_code > 0) && (order_code <= OC_MAX)) { /* XXX: also 0xFF ?? */
4973 item = proto_tree_add_item(tn3270_tree,
4974 hf_tn3270_order_code,
4980 switch (order_code) {
4982 offset += dissect_3270_field_attribute(tn3270_tree, tvb, offset);
4986 offset += dissect_field_attribute_pairs(tn3270_tree, tvb, offset);
4989 offset += dissect_field_attribute_pair(tn3270_tree, tvb, offset);
4993 offset += dissect_stop_address(tn3270_tree, tvb, offset);
4996 proto_tree_add_item(tn3270_tree,
4997 hf_tn3270_character_code,
5004 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_buffer_address, tn3270_info);
5006 case OC_PT: /* XXX: This case was previously commented out; I don't know why */
5010 expert_add_info(pinfo, item, &ei_tn3270_order_code);
5015 offset += add_data_until_next_order_code(tn3270_tree, tvb, offset);
5019 return (offset - start);
5022 /* End: Handle WCC, Orders and Data */
5026 dissect_tn3270e_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
5029 proto_tree *tn3270e_hdr_tree;
5030 gint start = offset;
5033 static const hf_items fields[] = {
5034 { &hf_tn3270_tn3270e_data_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
5035 { &hf_tn3270_tn3270e_request_flag, NULL, 1, NULL, ENC_BIG_ENDIAN },
5036 { NULL, NULL, 0, NULL, 0 }
5039 data_type = tvb_get_guint8(tvb, offset);
5041 tn3270e_hdr_tree = proto_tree_add_subtree_format(tn3270_tree, tvb, offset, -1,
5042 ett_tn3270e_hdr, &pi, "TN3270E Header (Data Type: %s)",
5043 val_to_str_const(data_type, vals_tn3270_header_data_types, "Unknown"));
5045 offset += tn3270_add_hf_items(tn3270e_hdr_tree, tvb, offset,
5048 case TN3270E_3270_DATA:
5049 case TN3270E_SCS_DATA:
5050 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_3270_SCS, tvb, offset, 1, ENC_BIG_ENDIAN);
5052 case TN3270E_RESPONSE:
5053 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_response, tvb, offset, 1, ENC_BIG_ENDIAN);
5055 case TN3270E_BIND_IMAGE:
5056 case TN3270E_NVT_DATA:
5057 case TN3270E_REQUEST:
5058 case TN3270E_SSCP_LU_DATA:
5059 case TN3270E_UNBIND:
5061 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_unused, tvb, offset, 1, ENC_BIG_ENDIAN);
5066 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN);
5069 switch (data_type) {
5070 case TN3270E_BIND_IMAGE:
5071 case TN3270E_NVT_DATA:
5072 case TN3270E_REQUEST:
5073 case TN3270E_RESPONSE:
5074 case TN3270E_SCS_DATA:
5075 case TN3270E_SSCP_LU_DATA:
5076 case TN3270E_UNBIND:
5077 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_header_data, tvb, offset, -1, ENC_EBCDIC|ENC_NA);
5078 offset += tvb_reported_length_remaining(tvb, offset);
5084 proto_item_set_len(pi, offset - start);
5086 return (offset - start);
5089 /* Detect and Handle Direction of Stream */
5091 dissect_outbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
5094 gint start = offset;
5098 command_code = tvb_get_guint8(tvb, offset);
5100 /* XXX: Storing rows/cols each time they change is not valid */
5101 /* since packets can (will be) randomly selected for dissection */
5102 /* after the initial dissection pass. In actuality screen size */
5103 /* "state" needs to be associated in some manner with each */
5104 /* frame of a conversation. */
5105 switch (command_code) {
5108 tn3270_info->rows = 24;
5109 tn3270_info->cols = 80;
5113 tn3270_info->rows = tn3270_info->altrows;
5114 tn3270_info->cols = tn3270_info->altcols;
5120 item = proto_tree_add_item(tn3270_tree,
5121 hf_tn3270_command_code,
5127 switch (command_code) {
5137 offset += dissect_wcc(tn3270_tree, tvb, offset);
5138 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5142 offset += dissect_structured_fields(tn3270_tree, pinfo, tvb, offset, tn3270_info, FALSE);
5152 expert_add_info(pinfo, item, &ei_tn3270_command_code);
5156 return (offset - start);
5160 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */
5161 /* Dissect tvb as inbound */
5163 dissect_inbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
5165 gint start = offset;
5170 aid = tvb_get_guint8(tvb, offset);
5171 item = proto_tree_add_item(tn3270_tree,
5178 case AID_STRUCTURED_FIELD:
5179 offset += dissect_structured_fields(tn3270_tree, pinfo, tvb, offset, tn3270_info, TRUE);
5182 case AID_PA2_KEY_CNCL:
5185 /* Certain AID bytes need not be followed by anything */
5186 /* XXX: Is this the correct/complete set of AID bytes for this case ? */
5187 if (tvb_reported_length_remaining(tvb, offset) <= 0)
5189 /* fall into next */
5190 case AID_READ_PARTITION_AID:
5191 case AID_NO_AID_GENERATED:
5192 case AID_NO_AID_GENERATED_PRINTER_ONLY:
5193 case AID_TRIGGER_ACTION:
5194 case AID_TEST_REQ_AND_SYS_REQ:
5219 case AID_CLEAR_PARTITION_KEY:
5221 case AID_SELECTOR_PEN_ATTENTION:
5222 case AID_OPERATOR_ID_READER:
5223 case AID_MAG_READER_NUMBER:
5224 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info);
5225 offset += dissect_orders_and_data(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5228 expert_add_info(pinfo, item, &ei_tn3270_aid);
5233 return (offset - start);
5238 dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
5240 proto_tree *tn3270_tree;
5243 conversation_t *conversation;
5244 tn3270_conv_info_t *tn3270_info = NULL;
5246 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TN3270");
5248 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
5250 /* Do we have a conversation for this connection? */
5251 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5252 pinfo->ptype, pinfo->srcport,
5253 pinfo->destport, 0);
5254 if (conversation != NULL) {
5255 /* Do we already have a type and mechanism? */
5256 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5259 if (tn3270_info == NULL)
5262 pi = proto_tree_add_item(tree, proto_tn3270, tvb, offset, -1, ENC_NA);
5263 tn3270_tree = proto_item_add_subtree(pi, ett_tn3270);
5264 col_clear(pinfo->cinfo, COL_INFO);
5266 if (tn3270_info->extended) {
5267 offset += dissect_tn3270e_header(tn3270_tree, tvb, offset);
5270 if (tvb_reported_length_remaining(tvb, offset) <= 0)
5273 if (pinfo->srcport == tn3270_info->outbound_port) {
5274 col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data from Mainframe");
5277 col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data to Mainframe");
5281 while (tvb_reported_length_remaining(tvb, offset) > 0) {
5282 if (pinfo->srcport == tn3270_info->outbound_port) {
5283 offset += dissect_outbound_stream(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5286 offset += dissect_inbound_stream(tn3270_tree, pinfo, tvb, offset, tn3270_info);
5294 add_tn3270_conversation(packet_info *pinfo, int tn3270e, gint model)
5296 conversation_t *conversation;
5297 tn3270_conv_info_t *tn3270_info;
5299 conversation = find_or_create_conversation(pinfo);
5302 * Do we already have a type and mechanism?
5304 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5305 if (tn3270_info == NULL) {
5306 /* No. Attach that information to the conversation, and add
5307 * it to the list of information structures.
5309 tn3270_info = wmem_new(wmem_file_scope(), tn3270_conv_info_t);
5311 copy_address(&(tn3270_info->outbound_addr), &(pinfo->dst));
5312 tn3270_info->outbound_port = pinfo->destport;
5314 copy_address(&(tn3270_info->inbound_addr), &(pinfo->src));
5315 tn3270_info->inbound_port = pinfo->srcport;
5317 conversation_add_proto_data(conversation, proto_tn3270, tn3270_info);
5320 /* The maximum rows/cols is tied to the 3270 model number */
5324 tn3270_info->altrows = 24;
5325 tn3270_info->altcols = 80;
5328 tn3270_info->altrows = 32;
5329 tn3270_info->altcols = 80;
5332 tn3270_info->altrows = 43;
5333 tn3270_info->altcols = 80;
5336 tn3270_info->altrows = 27;
5337 tn3270_info->altcols = 132;
5340 tn3270_info->rows = 24;
5341 tn3270_info->cols = 80;
5343 tn3270_info->extended = tn3270e;
5348 find_tn3270_conversation(packet_info *pinfo)
5350 conversation_t *conversation = NULL;
5351 tn3270_conv_info_t *tn3270_info = NULL;
5354 * Do we have a conversation for this connection?
5356 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5357 pinfo->ptype, pinfo->srcport,
5358 pinfo->destport, 0);
5359 if (conversation != NULL) {
5360 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5361 if (tn3270_info != NULL) {
5363 * Do we already have a type and mechanism?
5372 proto_register_tn3270(void)
5374 static hf_register_info hf[] = {
5375 { &hf_tn3270_command_code,
5377 "tn3270.command_code",
5378 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5381 { &hf_tn3270_sf_length,
5382 { "Structured Field Length",
5384 FT_UINT16, BASE_DEC, NULL, 0x0,
5388 /* 3.4 Write Control Characters */
5389 { &hf_tn3270_wcc_nop,
5392 FT_BOOLEAN, 8, NULL, WCC_NOP,
5395 { &hf_tn3270_wcc_reset,
5398 FT_BOOLEAN, 8, NULL, WCC_RESET,
5401 { &hf_tn3270_wcc_printer1,
5403 "tn3270.wcc.printer1",
5404 FT_BOOLEAN, 8, NULL, WCC_PRINTER1,
5407 { &hf_tn3270_wcc_printer2,
5409 "tn3270.wcc.printer2",
5410 FT_BOOLEAN, 8, NULL, WCC_PRINTER2,
5413 { &hf_tn3270_wcc_start_printer,
5414 { "WCC Start Printer",
5415 "tn3270.wcc.start_printer",
5416 FT_BOOLEAN, 8, NULL, WCC_START_PRINTER,
5419 { &hf_tn3270_wcc_sound_alarm,
5420 { "WCC Sound Alarm",
5421 "tn3270.wcc.sound_alarm",
5422 FT_BOOLEAN, 8, NULL, WCC_SOUND_ALARM,
5425 { &hf_tn3270_wcc_keyboard_restore,
5426 { "WCC Keyboard Restore",
5427 "tn3270.wcc.keyboard_restore",
5428 FT_BOOLEAN, 8, NULL, WCC_KEYBOARD_RESTORE,
5431 { &hf_tn3270_wcc_reset_mdt,
5433 "tn3270.wcc.reset_mdt",
5434 FT_BOOLEAN, 8, NULL, WCC_RESET_MDT,
5438 /* 8.7 Copy Control Codes (CCC) */
5440 { "Copy Control Code",
5442 FT_UINT8, BASE_HEX, NULL, 0,
5445 { &hf_tn3270_ccc_coding,
5447 "tn3270.ccc_coding",
5448 FT_UINT8, BASE_HEX, NULL, CCC_GRAPHIC_CONVERT_MASK,
5451 { &hf_tn3270_ccc_printout,
5452 { "Printout Format",
5453 "tn3270.ccc_printout",
5454 FT_UINT8, BASE_HEX, VALS(ccc_vals_printout_format), CCC_PRINT_BITS_MASK,
5457 { &hf_tn3270_ccc_start_print,
5458 { "The start-print bit",
5459 "tn3270.ccc_start_print",
5460 FT_BOOLEAN, 8, NULL, CCC_START_PRINT,
5463 { &hf_tn3270_ccc_sound_alarm,
5464 { "The sound-alarm bit",
5465 "tn3270.ccc_sound_alarm",
5466 FT_BOOLEAN, 8, NULL, CCC_SOUND_ALARM,
5469 { &hf_tn3270_ccc_copytype,
5470 { "Type of Data to be Copied",
5471 "tn3270.ccc_copytype",
5472 FT_UINT8, BASE_HEX, VALS(ccc_vals_copytype), CCC_ATTRIBUTE_BITS_MASK,
5476 /* 4.4.1 Field Attributes */
5477 { &hf_tn3270_field_attribute,
5478 { "3270 Field Attribute",
5479 "tn3270.field_attribute",
5480 FT_UINT8, BASE_HEX, NULL, 0,
5483 { &hf_tn3270_fa_graphic_convert,
5484 { "Graphic Convert",
5485 "tn3270.fa.graphic_convert",
5486 FT_UINT8, BASE_HEX, NULL, FA_GRAPHIC_CONVERT_MASK,
5489 { &hf_tn3270_fa_protected,
5491 "tn3270.fa.protected",
5492 FT_BOOLEAN, 8, NULL, FA_PROTECTED,
5495 { &hf_tn3270_fa_numeric,
5497 "tn3270.fa.numeric",
5498 FT_BOOLEAN, 8, NULL, FA_NUMERIC,
5501 { &hf_tn3270_fa_display,
5503 "tn3270.fa.display",
5504 FT_UINT8, BASE_HEX, VALS(vals_fa_display), FA_DISPLAY_BITS_MASK,
5507 { &hf_tn3270_fa_reserved,
5509 "tn3270.fa.reserved",
5510 FT_BOOLEAN, 8, NULL, FA_RESERVED,
5513 { &hf_tn3270_fa_modified,
5515 "tn3270.fa.modified",
5516 FT_BOOLEAN, 8, NULL, FA_MODIFIED,
5521 { &hf_tn3270_order_code,
5523 "tn3270.order_code",
5524 FT_UINT8, BASE_HEX, VALS(vals_order_codes), 0x0,
5527 { &hf_tn3270_character_code,
5529 "tn3270.character_code",
5530 FT_UINT8, BASE_HEX, NULL, 0x0,
5533 { &hf_tn3270_stop_address,
5535 "tn3270.stop_address",
5536 FT_UINT16, BASE_DEC, NULL, 0x0,
5539 { &hf_tn3270_attribute_type,
5541 "tn3270.attribute_type",
5542 FT_UINT8, BASE_HEX, VALS(vals_attribute_types), 0x0,
5545 { &hf_tn3270_extended_highlighting,
5546 { "Extended Highlighting",
5547 "tn3270.extended_highlighting",
5548 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
5554 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
5557 { &hf_tn3270_character_set,
5559 "tn3270.character_set",
5560 FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(rvals_at_character_set), 0x0,
5563 { &hf_tn3270_field_outlining,
5564 { "Field Outlining",
5565 "tn3270.field_outlining",
5566 FT_UINT8, BASE_HEX, VALS(vals_at_field_outlining), 0x0,
5569 { &hf_tn3270_transparency,
5571 "tn3270.transparency",
5572 FT_UINT8, BASE_HEX, VALS(vals_at_transparency), 0x0,
5576 { &hf_tn3270_field_validation_mandatory_fill,
5577 { "3270 Field validation_mandatory_fill",
5578 "tn3270.field_validation_mandatory_fill",
5579 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_mandatory_fill), AT_FV_MANDATORY_FILL,
5582 { &hf_tn3270_field_validation_mandatory_entry,
5583 { "3270 Field validation_mandatory_entry",
5584 "tn3270.field_validation_mandatory_entry",
5585 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_mandatory_entry), AT_FV_MANDATORY_ENTRY,
5588 { &hf_tn3270_field_validation_trigger,
5589 { "3270 Field validation_trigger",
5590 "tn3270.field_validation_trigger",
5591 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_trigger), AT_FV_TRIGGER,
5595 { &hf_tn3270_all_character_attributes,
5596 { "all_character_attributes",
5597 "tn3270.all_character_attributes",
5598 FT_UINT8, BASE_HEX, NULL, 0x0,
5602 { "Attention Identification",
5604 FT_UINT8, BASE_HEX, VALS(vals_attention_identification_bytes), 0x0,
5608 { &hf_tn3270_buffer_address,
5610 "tn3270.buffer_address",
5611 FT_UINT16, BASE_HEX, NULL, 0x0,
5615 /* Self Defining Parameters */
5616 { &hf_tn3270_sdp_ln,
5617 { "Length of this Self-Defining Parameter",
5619 FT_UINT8, BASE_DEC, NULL, 0x0,
5622 { &hf_tn3270_sdp_id,
5623 { "Self-Defining Parameter ID",
5625 FT_UINT8, BASE_HEX, NULL, 0x0,
5628 /* Self Defining Parameters */
5630 /* 5.6 - Begin/End of File */
5631 { &hf_tn3270_begin_end_flags1,
5632 { "Begin End Flags1",
5633 "tn3270.begin_end_flags1",
5634 FT_UINT8, BASE_HEX, NULL, 0x0,
5637 { &hf_tn3270_begin_end_flags2,
5638 { "Begin End Flags2",
5639 "tn3270.begin_end_flags2",
5640 FT_UINT8, BASE_HEX, NULL, 0x0,
5643 /* END - 5.6 - Begin/End of File */
5645 /* 5.7 - Create Partition */
5646 { &hf_tn3270_partition_id,
5648 "tn3270.partition_id",
5649 FT_UINT8, BASE_HEX, NULL, 0x0,
5652 { &hf_tn3270_partition_uom,
5653 { "The unit of measure and address mode",
5654 "tn3270.partition_uom",
5655 FT_UINT8, BASE_HEX, NULL, 0x0,
5658 { &hf_tn3270_partition_flags,
5660 "tn3270.partition_flags",
5661 FT_UINT8, BASE_HEX, NULL, 0x0,
5664 { &hf_tn3270_partition_height,
5665 { "The height of the presentation space",
5666 "tn3270.partition_height",
5667 FT_UINT16, BASE_DEC, NULL, 0x0,
5670 { &hf_tn3270_partition_width,
5671 { "The width of the presentation space",
5672 "tn3270.partition_width",
5673 FT_UINT16, BASE_DEC, NULL, 0x0,
5676 { &hf_tn3270_partition_rv,
5677 { "The y, or row, origin of the viewport relative to the top edge of the usable area",
5678 "tn3270.partition_rv",
5679 FT_UINT16, BASE_DEC, NULL, 0x0,
5682 { &hf_tn3270_partition_cv,
5683 { "The x, or column, origin of the viewport relative to the left side of the usable area",
5684 "tn3270.partition_cv",
5685 FT_UINT16, BASE_DEC, NULL, 0x0,
5688 { &hf_tn3270_partition_hv,
5689 { "The height of the viewport",
5690 "tn3270.partition_hv",
5691 FT_UINT16, BASE_DEC, NULL, 0x0,
5694 { &hf_tn3270_partition_wv,
5695 { "The width of the viewport",
5696 "tn3270.partition_wv",
5697 FT_UINT16, BASE_DEC, NULL, 0x0,
5700 { &hf_tn3270_partition_rw,
5701 { "The y, or row, origin of the window relative to the top edge of the presentation space",
5702 "tn3270.partition_rw",
5703 FT_UINT16, BASE_DEC, NULL, 0x0,
5706 { &hf_tn3270_partition_cw,
5707 { "The x, or column, origin of the window relative to the left edge of the presentation space",
5708 "tn3270.partition_cw",
5709 FT_UINT16, BASE_DEC, NULL, 0x0,
5712 { &hf_tn3270_partition_rs,
5713 { "The number of units to be scrolled in a vertical multiple scroll",
5714 "tn3270.partition_rs",
5715 FT_UINT16, BASE_DEC, NULL, 0x0,
5718 { &hf_tn3270_partition_res,
5720 "tn3270.partition_res",
5721 FT_UINT16, BASE_DEC, NULL, 0x0,
5724 { &hf_tn3270_partition_pw,
5725 { "The number of points in the horizontal direction in a character cell in this presentation space",
5726 "tn3270.partition_pw",
5727 FT_UINT8, BASE_HEX, NULL, 0x0,
5730 { &hf_tn3270_partition_ph,
5731 { "The number of points in the vertical direction in a character cell in this presentation space",
5732 "tn3270.partition_ph",
5733 FT_UINT16, BASE_DEC, NULL, 0x0,
5737 { &hf_tn3270_partition_command,
5738 { "Partition Command",
5739 "tn3270.partition_command",
5740 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5743 /* End - 5.7 - Create Partition */
5745 /* 5.9 - Erase/Reset */
5746 { &hf_tn3270_erase_flags,
5748 "tn3270.erase_flags",
5749 FT_UINT8, BASE_HEX, NULL, 0x0,
5752 /* End - 5.9 - Erase/Reset */
5754 /* 5.10 - Load Color Table */
5755 { &hf_tn3270_load_color_command,
5757 "tn3270.load_color_command",
5758 FT_BYTES, BASE_NONE, NULL, 0x0,
5761 /* End - 5.10 - Load Color Table */
5763 /* 5.11 - Load Format Storage */
5764 { &hf_tn3270_load_format_storage_flags1,
5766 "tn3270.load_format_storage_flags1",
5767 FT_UINT8, BASE_HEX, NULL, 0x0,
5770 { &hf_tn3270_load_format_storage_flags2,
5771 { "Flags (Reserved)",
5772 "tn3270.load_format_storage_flags2",
5773 FT_UINT8, BASE_HEX, NULL, 0x0,
5776 { &hf_tn3270_load_format_storage_operand,
5778 "tn3270.load_format_storage_operand",
5779 FT_UINT8, BASE_HEX, VALS(vals_load_storage_format_operand), 0x0,
5782 { &hf_tn3270_load_format_storage_localname,
5783 { "Local name for user selectable formats",
5784 "tn3270.load_format_storage_localname",
5785 FT_STRING, BASE_NONE, NULL, 0x0,
5788 { &hf_tn3270_format_group,
5789 { "Format Group name",
5790 "tn3270.format_group_name",
5791 FT_STRING, BASE_NONE, NULL, 0x0,
5794 { &hf_tn3270_format_name,
5796 "tn3270.format_name",
5797 FT_STRING, BASE_NONE, NULL, 0x0,
5800 { &hf_tn3270_load_format_storage_format_data,
5802 "tn3270.load_format_storage_format_data",
5803 FT_STRING, BASE_NONE, NULL, 0x0,
5805 /* END - 5.11 - Load Format Storage */
5807 /* 5.12 - Load Line Type */
5808 { &hf_tn3270_load_line_type_command,
5809 { "Line Type Command",
5810 "tn3270.load_line_type_command",
5811 FT_BYTES, BASE_NONE, NULL, 0x0,
5815 /* 5.13 - Load Programmed Symbols */
5816 { &hf_tn3270_ps_flags,
5819 FT_UINT8, BASE_HEX, NULL, 0x0,
5822 { &hf_tn3270_ps_lcid,
5823 { "Local character set ID",
5825 FT_UINT8, BASE_HEX, NULL, 0x0,
5828 { &hf_tn3270_ps_char,
5829 { "Beginning code point X'41' through X'FE'",
5831 FT_UINT8, BASE_HEX, NULL, 0x0,
5834 { &hf_tn3270_ps_rws,
5835 { "Loadable Character Set RWS Number",
5837 FT_UINT8, BASE_HEX, NULL, 0x0,
5840 { &hf_tn3270_extended_ps_length,
5841 { "Length of parameters for extended form, including the length parameter",
5842 "tn3270.extended_ps_length",
5843 FT_UINT8, BASE_HEX, NULL, 0x0,
5846 { &hf_tn3270_extended_ps_flags,
5848 "tn3270.extended_ps_flags",
5849 FT_UINT8, BASE_HEX, NULL, 0x0,
5852 { &hf_tn3270_extended_ps_lw,
5853 { "Number of X-units in character cell (width of character matrixes)",
5854 "tn3270.extended_ps_lw",
5855 FT_UINT8, BASE_HEX, NULL, 0x0,
5858 { &hf_tn3270_extended_ps_lh,
5859 { "Number of Y-units in character cell (depth ofcharacter matrixes)",
5860 "tn3270.extended_ps_lh",
5861 FT_UINT8, BASE_HEX, NULL, 0x0,
5864 { &hf_tn3270_extended_ps_subsn,
5866 "tn3270.extended_ps_subsn",
5867 FT_UINT8, BASE_HEX, NULL, 0x0,
5870 { &hf_tn3270_extended_ps_color,
5872 "tn3270.extended_ps_color",
5873 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
5876 { &hf_tn3270_extended_ps_stsubs,
5877 { "Starting Subsection Identifier",
5878 "tn3270.extended_ps_stsubs",
5879 FT_UINT8, BASE_HEX, NULL, 0x0,
5882 { &hf_tn3270_extended_ps_echar,
5883 { "Ending code point",
5884 "tn3270.extended_ps_echar",
5885 FT_UINT8, BASE_HEX, NULL, 0x0,
5888 { &hf_tn3270_extended_ps_nw,
5889 { "Number of width pairs",
5890 "tn3270.extended_ps_nw",
5891 FT_UINT8, BASE_HEX, NULL, 0x0,
5894 { &hf_tn3270_extended_ps_nh,
5895 { "Number of height pairs",
5896 "tn3270.extended_ps_nh",
5897 FT_UINT8, BASE_HEX, NULL, 0x0,
5900 { &hf_tn3270_extended_ps_res,
5902 "tn3270.extended_ps_res",
5903 FT_UINT8, BASE_HEX, NULL, 0x0,
5906 /* END - 5.13 - Load Programmed Symbols */
5908 /* 5.15 - Outbound Text Header */
5909 /* Note: some of these entries multiply used */
5910 { &hf_tn3270_outbound_text_header_operation_type,
5911 { "Outbound Text Operation Type",
5912 "tn3270.outbound_text_operation_type",
5913 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5919 FT_UINT8, BASE_HEX, NULL, 0x0,
5923 { "Cursor row offset",
5925 FT_UINT16, BASE_DEC, NULL, 0x0,
5929 { "Cursor column offset",
5931 FT_UINT16, BASE_DEC, NULL, 0x0,
5934 { &hf_tn3270_outbound_text_header_lhdr,
5935 { "Header length includes itself",
5936 "tn3270.outbound_text_header_lhdr",
5937 FT_UINT16, BASE_DEC, NULL, 0x0,
5940 { &hf_tn3270_outbound_text_header_hdr,
5941 { "Initial format controls",
5942 "tn3270.outbound_text_header_hdr",
5943 FT_BYTES, BASE_NONE, NULL, 0x0,
5946 /* END - 5.15 - Outbound Text Header */
5948 /* 5.16 - Outbound 3270DS */
5952 FT_UINT8, BASE_HEX, NULL, 0x0,
5955 /* END - 5.16 - Outbound 3270DS */
5957 /* 5.17 - Present Absolute Format */
5959 { "Format Presentation Command",
5961 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5964 /* END - 5.17 - Present Absolute Format */
5966 /* 5.18 - Present Relative Format */
5968 { "Format Offset Value",
5970 FT_UINT16, BASE_DEC, NULL, 0x0,
5973 /* End - 5.18 - Present Relative Format */
5975 /* 5.19 - Read Partition */
5976 { &hf_tn3270_read_partition_operation_type,
5977 { "Read Partition Operation Type",
5978 "tn3270.read_partition_reqtyp",
5979 FT_UINT8, BASE_HEX, VALS(vals_read_partition_operation_type), 0x0,
5982 { &hf_tn3270_read_partition_reqtyp,
5983 { "Read Partition Request Type",
5984 "tn3270.read_partition_reqtyp",
5985 FT_UINT8, BASE_HEX, VALS(vals_read_partition_reqtype), READ_PARTITION_REQTYPE_MASK,
5988 /* End - 5.19 - Read Partition */
5990 /* 5.22 - Restart */
5991 { &hf_tn3270_start_page,
5992 { "Number of pages to skip on restart",
5993 "tn3270.start_page",
5994 FT_UINT16, BASE_DEC, NULL, 0x0,
5997 { &hf_tn3270_start_line,
5998 { "Number of lines to skip on page for restart",
5999 "tn3270.start_line",
6000 FT_UINT16, BASE_DEC, NULL, 0x0,
6003 { &hf_tn3270_scs_data,
6004 { "SCS data (noncompressed and noncompacted) to set up for restart",
6006 FT_BYTES, BASE_NONE, NULL, 0x0,
6009 /* End - 5.22 - Restart */
6011 /* 5.24 - Select Color Table */
6012 { &hf_tn3270_color_command,
6014 "tn3270.color_command",
6015 FT_UINT16, BASE_HEX, NULL, 0x0,
6018 /* 5.24 - Select Color Table */
6020 /* 5.26 - Set Checkpoint Interval */
6021 { &hf_tn3270_interval,
6022 { "Checkpoint interval",
6024 FT_UINT8, BASE_HEX, NULL, 0x0,
6025 "Specifies the number of pages in the interval between terminal checkpoints", HFILL }
6027 /* End - 5.26 - Set Checkpoint Interval */
6029 /* 5.27 - Set MSR Interval */
6030 { &hf_tn3270_msr_type,
6033 FT_UINT8, BASE_HEX, NULL, 0x0,
6036 { &hf_tn3270_msr_state_mask,
6038 "tn3270.msr_state_mask",
6039 FT_UINT8, BASE_HEX, NULL, 0x0,
6042 { &hf_tn3270_msr_user,
6045 FT_BOOLEAN, 8, NULL, 0x80,
6048 { &hf_tn3270_msr_locked,
6050 "tn3270.msr.locked",
6051 FT_BOOLEAN, 8, NULL, 0x40,
6054 { &hf_tn3270_msr_auto,
6057 FT_BOOLEAN, 8, NULL, 0x20,
6060 { &hf_tn3270_msr_ind1,
6061 { "Audible Ind 1 Suppress",
6063 FT_BOOLEAN, 8, NULL, 0x10,
6066 { &hf_tn3270_msr_ind2,
6067 { "Audible Ind 2 Suppress",
6069 FT_BOOLEAN, 8, NULL, 0x08,
6072 { &hf_tn3270_msr_state_value,
6073 { "State Value", "tn3270.msr_state_value",
6074 FT_UINT8, BASE_HEX, NULL, 0x0,
6077 { &hf_tn3270_msr_ind_mask,
6079 "tn3270.msr_ind_mask",
6080 FT_UINT8, BASE_HEX, NULL, 0x0,
6083 { &hf_tn3270_msr_ind_value,
6084 { "Indicator Value",
6085 "tn3270.msr_ind_value",
6086 FT_UINT8, BASE_HEX, NULL, 0x0,
6089 /* END - 5.27 - Set MSR Interval */
6091 /* 5.28 - Set Partition Characteristics */
6092 { &hf_tn3270_spc_sdp_ot,
6093 { "Top edge outline thickness",
6094 "tn3270.spc_sdp_ot",
6095 FT_UINT8, BASE_DEC, NULL, 0x0,
6098 { &hf_tn3270_spc_sdp_ob,
6099 { "Bottom edge outline thickness",
6100 "tn3270.spc_sdp_ob",
6101 FT_UINT8, BASE_DEC, NULL, 0x0,
6104 { &hf_tn3270_spc_sdp_ol,
6105 { "Left edge outline thickness",
6106 "tn3270.spc_sdp_ol",
6107 FT_UINT8, BASE_DEC, NULL, 0x0,
6110 { &hf_tn3270_spc_sdp_or,
6111 { "Right edge outline thickness",
6112 "tn3270.spc_sdp_or",
6113 FT_UINT8, BASE_DEC, NULL, 0x0,
6116 { &hf_tn3270_spc_sdp_eucflags,
6118 "tn3270.spc_sdp_eucflags",
6119 FT_UINT8, BASE_HEX, NULL, 0x0,
6122 /* END - 5.28 - Set Partition Characteristics */
6124 /* 5.29 - Set Printer Characteristics */
6125 { &hf_tn3270_printer_flags,
6127 "tn3270.printer_flags",
6128 FT_UINT8, BASE_HEX, NULL, 0x0,
6131 { &hf_tn3270_spc_sdp_srepc,
6132 { "Set/Reset Early Print Complete",
6133 "tn3270.spc_sdp_srepc",
6134 FT_UINT8, BASE_HEX, NULL, 0x0,
6137 /* END - 5.29 - Set Printer Characteristics */
6139 /* 5.30 - Set Reply Mode */
6140 /* hf_tn3270_mode also used for 6.42: Query Reply (modes) */
6144 FT_UINT8, BASE_HEX, VALS(vals_reply_modes), 0x0,
6147 { &hf_tn3270_reply_mode_attr_list,
6148 { "Type codes for the attribute types",
6149 "tn3270.reply_mode_attr_list",
6150 FT_UINT8, BASE_HEX, VALS(vals_attribute_types), 0x0,
6153 /* END - 5.30 - Set Reply Mode */
6155 /* 5.34 - Data Chain */
6156 { &hf_tn3270_data_chain_fields,
6157 { "Data Chain Fields",
6158 "tn3270.data_chain_fields",
6159 FT_UINT8, BASE_HEX, NULL, 0x0,
6162 { &hf_tn3270_data_chain_group,
6163 { "Data Chain Group",
6164 "tn3270.data_chain_group",
6165 FT_UINT8, BASE_HEX, VALS(vals_data_chain_group), DATA_CHAIN_GROUP_MASK,
6168 { &hf_tn3270_data_chain_inbound_control,
6169 { "Data Chain Inbound Control",
6170 "tn3270.data_chain_inbound_control",
6171 FT_UINT8, BASE_HEX, VALS(vals_data_chain_inbound_control), DATA_CHAIN_INBOUND_CONTROL_MASK,
6174 /* END - 5.34 - Data Chain */
6176 /* 5.35 - Destination/Origin */
6177 { &hf_tn3270_destination_or_origin_flags_input_control,
6179 "tn3270.destination_or_origin_flags_input_control",
6180 FT_UINT8, BASE_HEX, VALS(vals_destination_or_origin_flags_input_control), DESTINATION_OR_ORIGIN_FLAGS_INPUT_CONTROL_MASK,
6183 { &hf_tn3270_destination_or_origin_doid,
6185 "tn3270.destination_or_origin_doid",
6186 FT_UINT16, BASE_HEX, NULL, 0x0,
6189 /* END - 5.35 - Destination/Origin */
6192 /* 5.36 - Object Control */
6193 { &hf_tn3270_object_control_flags,
6195 "tn3270.object_control_flags",
6196 FT_UINT8, BASE_HEX, NULL, 0x0,
6199 { &hf_tn3270_object_type,
6201 "tn3270.object_type",
6202 FT_UINT8, BASE_HEX, VALS(vals_oc_type), 0x0,
6205 /* END - 5.36 - Object Control */
6207 /* 5.40 - Save/Restore Format */
6208 { &hf_tn3270_save_or_restore_format_flags,
6210 "tn3270.save_or_restore_format_flags",
6211 FT_UINT8, BASE_HEX, NULL, 0x0,
6214 { &hf_tn3270_srf_fpcb,
6215 { "Contents of the FPCB that is to be saved or restored",
6217 FT_BYTES, BASE_NONE, NULL, 0x0,
6221 /* 5.40 - Save/Restore Format */
6222 { &hf_tn3270_type_1_text_outbound_data,
6223 { "Type 1 text outbound data",
6224 "tn3270.type_1_text_outbound_data",
6225 FT_BYTES, BASE_NONE, NULL, 0x0,
6229 /* 6.2 - Exception/Status */
6230 { &hf_tn3270_exception_or_status_flags,
6232 "tn3270.exception_or_status_flags",
6233 FT_UINT8, BASE_HEX, NULL, 0x0,
6236 { &hf_tn3270_sdp_excode,
6238 "tn3270.sdp_excode",
6239 FT_UINT16, BASE_DEC, VALS(vals_sdp_excode), 0x0,
6242 { &hf_tn3270_sdp_statcode,
6244 "tn3270.sdp_statcode",
6245 FT_UINT16, BASE_DEC, VALS(vals_sdp_statcode), 0x0,
6248 { &hf_tn3270_sdp_ngl,
6249 { "Number of groups currently assigned",
6251 FT_UINT16, BASE_DEC, NULL, 0x0,
6254 { &hf_tn3270_sdp_nml,
6255 { "Number of formats currently loaded",
6257 FT_UINT16, BASE_DEC, NULL, 0x0,
6260 { &hf_tn3270_sdp_nlml,
6261 { "Number of local names used",
6263 FT_UINT16, BASE_DEC, NULL, 0x0,
6266 { &hf_tn3270_sdp_stor,
6267 { "Amount of format storage space available (KB)",
6269 FT_UINT32, BASE_DEC, NULL, 0x0,
6272 /* 6.2 - Exception/Status */
6274 /* 6.3 - Inbound Text Header */
6278 FT_UINT16, BASE_DEC, NULL, 0x0,
6282 { "Row offset of window origin",
6284 FT_UINT16, BASE_DEC, NULL, 0x0,
6290 FT_UINT16, BASE_DEC, NULL, 0x0,
6294 { "Column Offset of Window Origin",
6296 FT_UINT16, BASE_DEC, NULL, 0x0,
6299 /* END - 6.3 - Inbound Text Header */
6301 /* 6.4 Inbound 3270DS */
6302 { &hf_tn3270_cursor_address,
6304 "tn3270.cursor_address",
6305 FT_UINT16, BASE_HEX, NULL, 0x0,
6308 /* END - 6.4 Inbound 3270DS */
6310 /* 6.5 - Recovery Data */
6311 { &hf_tn3270_recovery_data_flags,
6313 "tn3270.recovery_data_flags",
6314 FT_UINT8, BASE_HEX, NULL, 0x0,
6318 { "SLD -- Set line density parameter in effect at the checkpoint",
6320 FT_UINT8, BASE_HEX, NULL, 0x0,
6323 { &hf_tn3270_charset,
6324 { "Character set parameter of Set Attribute control in effect at the checkpoint",
6326 FT_UINT8, BASE_HEX, NULL, 0x0,
6329 { &hf_tn3270_vertical,
6330 { "Byte offset from Checkpoint Interval structured field to the Set Vertical Format control in effect for the checkpoint",
6332 FT_UINT32, BASE_DEC, NULL, 0x0,
6335 { &hf_tn3270_v_offset,
6336 { "Byte offset within the string control byte string or the SVF character",
6338 FT_UINT16, BASE_DEC, NULL, 0x0,
6341 { &hf_tn3270_v_sequence,
6342 { "RU sequence number",
6343 "tn3270.v_sequence",
6344 FT_UINT16, BASE_DEC, NULL, 0x0,
6347 { &hf_tn3270_v_length,
6348 { "Length of the SVF character string required for restart",
6350 FT_UINT16, BASE_DEC, NULL, 0x0,
6354 { "Set Primary Density parameter in effect at the checkpoint",
6356 FT_UINT16, BASE_HEX, NULL, 0x0,
6359 { &hf_tn3270_horizon,
6360 { "Byte offset from Checkpoint Interval structured field to the Set Horizontal Format control in effect for the checkpoint",
6362 FT_UINT32, BASE_DEC, NULL, 0x0,
6365 { &hf_tn3270_h_offset,
6366 { "Byte offset from Checkpoint Interval structured field to the Set Horizontal Format control in effect for the checkpoint",
6368 FT_UINT32, BASE_DEC, NULL, 0x0,
6371 { &hf_tn3270_h_sequence,
6372 { "RU sequence number",
6373 "tn3270.h_sequence",
6374 FT_UINT16, BASE_DEC, NULL, 0x0,
6377 { &hf_tn3270_h_length,
6378 { "Length of the SHF character string required for restart",
6380 FT_UINT16, BASE_DEC, NULL, 0x0,
6383 { &hf_tn3270_hilite,
6386 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
6390 { "Number of pages printed since the checkpoint",
6392 FT_UINT16, BASE_DEC, NULL, 0x0,
6396 { "Number of lines printed since the checkpoint",
6398 FT_UINT16, BASE_DEC, NULL, 0x0,
6401 { &hf_tn3270_checkpoint,
6402 { "Byte offset from Set Checkpoint Interval structured field to the first"
6403 " character afterhe code point or character that caused an eject to the"
6404 " checkpointed page",
6405 "tn3270.checkpoint",
6406 FT_UINT32, BASE_DEC, NULL, 0x0,
6409 { &hf_tn3270_c_offset,
6410 { "Byte offset within the String Control Byte string or structured field of"
6411 " the checkpointed character",
6413 FT_UINT16, BASE_DEC, NULL, 0x0,
6416 { &hf_tn3270_c_sequence,
6417 { "RU sequence number of the RU containing the checkpoint character",
6418 "tn3270.c_sequence",
6419 FT_UINT16, BASE_DEC, NULL, 0x0,
6422 { &hf_tn3270_c_seqoff,
6423 { "Byte offset within the RU of the checkpointed character",
6425 FT_UINT16, BASE_DEC, NULL, 0x0,
6428 { &hf_tn3270_c_scsoff,
6429 { "Byte offset within the parameterized SCS control code (for example, TRN) of the checkpointed character.",
6431 FT_UINT16, BASE_DEC, NULL, 0x0,
6435 { "Prime compression character",
6437 FT_UINT8, BASE_HEX, NULL, 0x0,
6440 /* END - 6.5 - Recovery Data */
6442 /* 6.9 - Query Reply (Alphanumeric Partitions) */
6444 { "Max number of alphanumeric partitions",
6446 FT_UINT8, BASE_DEC, NULL, 0x0,
6450 { "Total available partition storage",
6452 FT_UINT16, BASE_DEC, NULL, 0x0,
6455 { &hf_tn3270_query_reply_alphanumeric_flags,
6458 FT_UINT8, BASE_HEX, NULL, 0x0,
6461 { &hf_tn3270_ap_vertical_scrolling,
6462 { "Vertical Scrolling Supported",
6463 "tn3270.ap_vertical_scrolling",
6464 FT_BOOLEAN, 8, NULL, QR_AP_VERTWIN,
6467 { &hf_tn3270_ap_horizontal_scrolling,
6468 { "Horizontal Scrolling Supported",
6469 "tn3270.ap_horizontal_scrolling",
6470 FT_BOOLEAN, 8, NULL, QR_AP_HORWIN,
6473 { &hf_tn3270_ap_apres1,
6476 FT_BOOLEAN, 8, NULL, QR_AP_APRES1,
6479 { &hf_tn3270_ap_apa,
6480 { "All Points addressability supported",
6482 FT_BOOLEAN, 8, NULL, QR_AP_APA_FLG,
6486 { "Partition protection supported",
6488 FT_BOOLEAN, 8, NULL, QR_AP_PROT,
6492 { "Presentation space local copy supported",
6494 FT_BOOLEAN, 8, NULL, QR_AP_LCOPY,
6498 { "Modify Partition supported",
6500 FT_BOOLEAN, 8, NULL, QR_AP_MODPART,
6503 { &hf_tn3270_ap_apres2,
6506 FT_BOOLEAN, 8, NULL, QR_AP_APRES2,
6511 { "Character multiplier",
6513 FT_UINT8, BASE_DEC, NULL, 0x0,
6519 FT_UINT8, BASE_DEC, NULL, 0x0,
6523 { "Column overhead",
6525 FT_UINT8, BASE_DEC, NULL, 0x0,
6531 FT_UINT16, BASE_DEC, NULL, 0x0,
6534 /* END - 6.9 - Query Reply (Alphanumeric Partitions) */
6536 /* 6.12 - Query Reply (Character Sets) */
6537 { &hf_tn3270_character_sets_flags1,
6539 "tn3270.character_sets_flags1",
6540 FT_UINT8, BASE_HEX, NULL, 0x0,
6544 { "Graphic Escape supported",
6546 FT_BOOLEAN, 8, NULL, QR_CS_ALT,
6550 { "Multiple LCIDs are supported",
6552 FT_BOOLEAN, 8, NULL, QR_CS_MULTID,
6555 { &hf_tn3270_cs_lps,
6556 { "Load PSSF is supported",
6558 FT_BOOLEAN, 8, NULL, QR_CS_LOADABLE,
6561 { &hf_tn3270_cs_lpse,
6562 { "Load PS EXTENDED is supported",
6564 FT_BOOLEAN, 8, NULL, QR_CS_EXT,
6568 { "More than one size of character slot is supported",
6570 FT_BOOLEAN, 8, NULL, QR_CS_MS,
6573 { &hf_tn3270_cs_ch2,
6574 { "Two-byte coded character sets are supported",
6576 FT_BOOLEAN, 8, NULL, QR_CS_CH2,
6580 { "CGCSGID is present",
6582 FT_BOOLEAN, 8, NULL, QR_CS_GF,
6585 { &hf_tn3270_cs_res,
6588 FT_BOOLEAN, 8, NULL, QR_CS_CSRES,
6592 { &hf_tn3270_character_sets_flags2,
6594 "tn3270.character_sets_flags2",
6595 FT_UINT8, BASE_HEX, NULL, 0x0,
6598 { &hf_tn3270_cs_res2,
6601 FT_BOOLEAN, 8, NULL, QR_CS_CSRES2,
6604 { &hf_tn3270_cs_pscs,
6605 { "Load PS slot size match not required",
6607 FT_BOOLEAN, 8, NULL, QR_CS_PSCS,
6610 { &hf_tn3270_cs_res3,
6613 FT_BOOLEAN, 8, NULL, QR_CS_CSRES3,
6619 FT_BOOLEAN, 8, NULL, QR_CS_CF,
6624 { "Default character slot width",
6626 FT_UINT8, BASE_HEX, NULL, 0x0,
6630 { "Default character slot height",
6632 FT_UINT8, BASE_HEX, NULL, 0x0,
6638 FT_UINT8, BASE_HEX, NULL, 0x0,
6641 { &hf_tn3270_formres,
6642 { "Form Types (Reserved)",
6644 FT_UINT8, BASE_HEX, NULL, 0x0,
6647 { &hf_tn3270_cs_form_type1,
6649 "tn3270.cs_form_type1",
6650 FT_BOOLEAN, 8, NULL, 0x80,
6651 "the first 2 bytes contain a 16-bit vertical slice,"
6652 " the following 16 bytes contain 8-bit horizontal slices. For a 9"
6653 " x 12 character matrix the last 4 bytes contain binary zero.", HFILL }
6655 { &hf_tn3270_cs_form_type2,
6656 { "18-byte form (COMPRESSED)",
6657 "tn3270.cs_form_type2",
6658 FT_BOOLEAN, 8, NULL, 0x40,
6659 "the first 2 bytes contain a 16-bit vertical slice,"
6660 " the following 16 bytes contain 8-bit horizontal slices. For a 9"
6661 " x 12 character matrix the last 4 bytes contain binary zero. (COMPRESSED)", HFILL }
6663 { &hf_tn3270_cs_form_type3,
6664 { "Row loading (from top to bottom)",
6665 "tn3270.cs_form_type3",
6666 FT_BOOLEAN, 8, NULL, 0x20,
6669 { &hf_tn3270_cs_form_type4,
6670 { "Row loading (from top to bottom) (Compressed)",
6671 "tn3270.cs_form_type4",
6672 FT_BOOLEAN, 8, NULL, 0x10,
6675 { &hf_tn3270_cs_form_type5,
6676 { "Column loading (from left to right)",
6677 "tn3270.cs_form_type5",
6678 FT_BOOLEAN, 8, NULL, 0x08,
6681 { &hf_tn3270_cs_form_type6,
6682 { "Column loading (from left to right) (Compressed)",
6683 "tn3270.cs_form_type6",
6684 FT_BOOLEAN, 8, NULL, 0x04,
6687 { &hf_tn3270_cs_form_type8,
6689 "tn3270.cs_form_type8",
6690 FT_BOOLEAN, 8, NULL, 0x02,
6694 { "Length of each descriptor",
6696 FT_UINT8, BASE_DEC, NULL, 0x0,
6700 { &hf_tn3270_cs_descriptor_set,
6701 { "Device Specific Character Set ID (PS store No.)",
6702 "tn3270.cs_descriptor_set",
6703 FT_UINT8, BASE_DEC, NULL, 0x0,
6706 { &hf_tn3270_cs_descriptor_flags,
6708 "tn3270.cs_descriptor_flags",
6709 FT_UINT8, BASE_HEX, NULL, 0x0,
6712 { &hf_tn3270_cs_ds_load,
6713 { "Loadable character set",
6714 "tn3270.cs_ds_load",
6715 FT_BOOLEAN, 8, NULL, 0x80,
6718 { &hf_tn3270_cs_ds_triple,
6719 { "Triple-plane character set",
6720 "tn3270.cs_ds_triple",
6721 FT_BOOLEAN, 8, NULL, 0x40,
6724 { &hf_tn3270_cs_ds_char,
6725 { "Double-Byte coded character set",
6726 "tn3270.cs_ds_char",
6727 FT_BOOLEAN, 8, NULL, 0x20,
6730 { &hf_tn3270_cs_ds_cb,
6731 { "No LCID compare",
6733 FT_BOOLEAN, 8, NULL, 0x10,
6738 { "Local character set ID (alias)",
6740 FT_UINT8, BASE_HEX, NULL, 0x0,
6744 { "Width of the character slots in this characterset.",
6746 FT_UINT8, BASE_HEX, NULL, 0x0,
6750 { "Height of the character slots in this character set.",
6752 FT_UINT8, BASE_HEX, NULL, 0x0,
6755 { &hf_tn3270_ssubsn,
6756 { "Starting subsection.",
6758 FT_UINT8, BASE_HEX, NULL, 0x0,
6761 { &hf_tn3270_esubsn,
6762 { "Ending subsection.",
6764 FT_UINT8, BASE_HEX, NULL, 0x0,
6767 { &hf_tn3270_ccsgid,
6768 { "Coded Graphic Character Set Identifier.",
6770 FT_UINT64, BASE_HEX, NULL, 0x0,
6774 { "Coded Character Set Identifier.",
6776 FT_UINT64, BASE_HEX, NULL, 0x0,
6779 /* END - 6.12 - Query Reply (Character Sets) */
6781 /* 6.13 - Query Reply (Color) */
6782 { &hf_tn3270_color_flags,
6784 "tn3270.color_flags",
6785 FT_UINT8, BASE_HEX, NULL, 0x0,
6788 { &hf_tn3270_c_prtblk,
6789 { "Printer only - black ribbon is loaded",
6791 FT_BOOLEAN, 8, NULL, 0x40,
6795 { "Length of color attribute list",
6797 FT_UINT8, BASE_DEC, NULL, 0x0,
6801 { "Color attribute value accepted by the device",
6803 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6807 { "Color identifier",
6809 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6812 { &hf_tn3270_db_cavdef,
6813 { "Default color attribute value",
6815 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6818 { &hf_tn3270_db_cidef,
6819 { "Default background color identifier",
6821 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6824 /* END - 6.13 - Query Reply (Color) */
6826 /* 6.14 - Query Reply (Cooperative Processing Requestor) */
6828 { "Maximum CPR bytes/transmission allowed inbound",
6830 FT_UINT16, BASE_DEC, NULL, 0x0,
6833 { &hf_tn3270_limout,
6834 { "Maximum CPR bytes/transmission allowed outbound",
6836 FT_UINT16, BASE_DEC, NULL, 0x0,
6840 { "Length (in bytes) of feature information that follows",
6842 FT_UINT8, BASE_DEC, NULL, 0x0,
6846 { "CPR length and feature flags",
6848 FT_UINT16, BASE_DEC, NULL, 0x0,
6851 /* END - 6.14 - Query Reply (Cooperative Processing Requestor) */
6853 /* 6.15 - Query Reply (Data Chaining) */
6854 { &hf_tn3270_dc_dir,
6855 { "Indicates which direction can use the Data Chain structured field.",
6857 FT_UINT8, BASE_HEX, VALS(vals_data_chaining_dir), 0xC0,
6860 /* END - 6.15 - Query Reply (Data Chaining) */
6862 /* 6.16 - Query Reply (Data Streams) */
6863 { &hf_tn3270_ds_default_sfid,
6864 { "Default Data Stream",
6865 "tn3270.ds_default_sfid",
6866 FT_UINT8, BASE_HEX, VALS(vals_data_streams), 0x0,
6869 { &hf_tn3270_ds_sfid,
6870 { "Supported Data Stream",
6872 FT_UINT8, BASE_HEX, VALS(vals_data_streams), 0x0,
6875 /* END - 6.16 - Query Reply (Data Streams) */
6877 /* 6.17 - Query Reply (DBCS Asia) */
6878 { &hf_tn3270_asia_sdp_sosi_soset,
6879 { "Set ID of the Shift Out (SO) character set",
6880 "tn3270.asia_sdp_sosi_soset",
6881 FT_UINT8, BASE_HEX, NULL, 0x0,
6884 { &hf_tn3270_asia_sdp_ic_func,
6885 { "SO/SI Creation supported",
6886 "tn3270.asia_sdp_ic_func",
6887 FT_BOOLEAN, 8, NULL, 0x01,
6890 /* END - 6.17 - Query Reply (DBCS Asia) */
6892 /* 6.19 - Query Reply (Distributed Data Management) */
6893 { &hf_tn3270_ddm_flags,
6894 { "Flags (Reserved)",
6896 FT_UINT8, BASE_HEX, NULL, 0x0,
6899 { &hf_tn3270_ddm_limin,
6900 { "Maximum DDM bytes/transmission allowed inbound",
6902 FT_UINT16, BASE_DEC, NULL, 0x0,
6905 { &hf_tn3270_ddm_limout,
6906 { "Maximum DDM bytes/transmission allowed outbound",
6907 "tn3270.ddm_limout",
6908 FT_UINT16, BASE_DEC, NULL, 0x0,
6911 { &hf_tn3270_ddm_nss,
6912 { "Number of subsets supported",
6914 FT_UINT8, BASE_HEX, NULL, 0x0,
6917 { &hf_tn3270_ddm_ddmss,
6918 { "DDM subset identifier",
6920 FT_UINT8, BASE_HEX, VALS(vals_qr_ddm), 0x0,
6923 /* END - 6.19 - Query Reply (Distributed Data Management) */
6925 /* 6.20 - Query Reply (Document Interchange Architecture) */
6926 { &hf_tn3270_dia_flags,
6927 { "Flags (Reserved)",
6929 FT_UINT16, BASE_HEX, NULL, 0x0,
6932 { &hf_tn3270_dia_limin,
6933 { "Maximum DIA bytes/transmission allowed inbound",
6935 FT_UINT16, BASE_DEC, NULL, 0x0,
6938 { &hf_tn3270_dia_limout,
6939 { "Maximum DIA bytes/transmission allowed outbound",
6940 "tn3270.dia_limout",
6941 FT_UINT16, BASE_DEC, NULL, 0x0,
6944 { &hf_tn3270_dia_nfs,
6945 { "Number of subsets supported",
6947 FT_UINT8, BASE_HEX, NULL, 0x0,
6950 { &hf_tn3270_dia_diafs,
6951 { "DIA function set identifier",
6953 FT_UINT8, BASE_HEX, VALS(vals_qr_dia), 0x0,
6956 { &hf_tn3270_dia_diafn,
6957 { "DIA function set number",
6959 FT_UINT16, BASE_DEC, NULL, 0x0,
6962 /* END - 6.20 - Query Reply (Document Interchange Architecture) */
6964 /* 6.22 - Query Reply (Field Outlining) */
6965 { &hf_tn3270_fo_flags,
6968 FT_UINT8, BASE_HEX, NULL, 0x0,
6971 { &hf_tn3270_fo_vpos,
6972 { "Location of vertical line",
6974 FT_UINT8, BASE_DEC, NULL, 0x0,
6977 { &hf_tn3270_fo_hpos,
6978 { "Location of overline/underline",
6980 FT_UINT8, BASE_DEC, NULL, 0x0,
6983 { &hf_tn3270_fo_hpos0,
6984 { "Location of overline in case of separation",
6986 FT_UINT8, BASE_DEC, NULL, 0x0,
6989 { &hf_tn3270_fo_hpos1,
6990 { "Location of underline in case of separation",
6992 FT_UINT8, BASE_DEC, NULL, 0x0,
6995 /* END - 6.22 - Query Reply (Field Outlining) */
6997 /* 6.25 - Query Reply (Format Storage Auxiliary Device) */
6998 { &hf_tn3270_fsad_flags,
7000 "tn3270.fsad_flags",
7001 FT_UINT8, BASE_HEX, NULL, 0x0,
7004 { &hf_tn3270_fsad_limin,
7005 { "Reserved for LIMIN parameter. Must be set to zeros.",
7006 "tn3270.fsad_limin",
7007 FT_UINT16, BASE_DEC, NULL, 0x0,
7010 { &hf_tn3270_fsad_limout,
7011 { "Maximum bytes of format storage data per transmission allowed outbound.",
7012 "tn3270.fsad_limout",
7013 FT_UINT16, BASE_DEC, NULL, 0x0,
7016 { &hf_tn3270_fsad_size,
7017 { "Size of the format storage space",
7019 FT_UINT16, BASE_DEC, NULL, 0x0,
7022 /* END - 6.25 - Query Reply (Format Storage Auxiliary Device) */
7024 /* 6.28 - Query Reply (Highlighting) */
7026 { "Number of attribute-value/action pairs",
7028 FT_UINT8, BASE_DEC, NULL, 0x0,
7032 { "Data stream attribute value accepted",
7034 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
7038 { "Data stream action",
7040 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
7043 /* END - Query Reply (Highlighting) */
7045 /* 6.29 - Query Reply (IBM Auxiliary Device) */
7046 { &hf_tn3270_ibm_flags,
7049 FT_UINT8, BASE_HEX, NULL, 0x0,
7052 { &hf_tn3270_ibm_limin,
7053 { "Inbound message size limit",
7055 FT_UINT16, BASE_DEC, NULL, 0x0,
7058 { &hf_tn3270_ibm_limout,
7059 { "Outbound message size limit",
7060 "tn3270.ibm_limout",
7061 FT_UINT16, BASE_DEC, NULL, 0x0,
7064 { &hf_tn3270_ibm_type,
7065 { "Type of IBM Auxiliary Device",
7067 FT_UINT16, BASE_DEC, NULL, 0x0,
7070 /* END - 6.29 - Query Reply (IBM Auxiliary Device) */
7072 /* 6.31 - Query Reply (Implicit Partitions) */
7073 { &hf_tn3270_ip_flags,
7074 { "Flags (Reserved)",
7076 FT_UINT8, BASE_HEX, NULL, 0x0,
7079 { &hf_tn3270_ipdd_wd,
7080 { "Width of the Implicit Partition default screen size (in character cells)",
7082 FT_UINT16, BASE_DEC, NULL, 0x0,
7085 { &hf_tn3270_ipdd_hd,
7086 { "Height of the Implicit Partition default screen size",
7088 FT_UINT16, BASE_DEC, NULL, 0x0,
7091 { &hf_tn3270_ipdd_wa,
7092 { "Width of the Implicit Partition alternate screen size",
7094 FT_UINT16, BASE_DEC, NULL, 0x0,
7097 { &hf_tn3270_ipdd_ha,
7098 { "Height of the Implicit Partition alternate screen size",
7100 FT_UINT16, BASE_DEC, NULL, 0x0,
7103 { &hf_tn3270_ippd_dpbs,
7104 { "Default printer buffer size (in character cells)",
7106 FT_UINT64, BASE_DEC, NULL, 0x0,
7109 { &hf_tn3270_ippd_apbs,
7110 { "Default printer buffer size (in character cells)",
7112 FT_UINT64, BASE_DEC, NULL, 0x0,
7115 { &hf_tn3270_ipccd_wcd,
7116 { "Width of the character cell for the Implicit Partition default screen size",
7118 FT_UINT16, BASE_DEC, NULL, 0x0,
7121 { &hf_tn3270_ipccd_hcd,
7122 { "Height of the character cell for the Implicit Partition default screen size",
7124 FT_UINT16, BASE_DEC, NULL, 0x0,
7127 { &hf_tn3270_ipccd_wca,
7128 { "Width of the character cell for the Implicit Partition alternate screen size",
7130 FT_UINT16, BASE_DEC, NULL, 0x0,
7133 { &hf_tn3270_ipccd_hca,
7134 { "Height of the character cell for the Implicit Partition alternate screen size",
7136 FT_UINT16, BASE_DEC, NULL, 0x0,
7139 /* END - Query Reply (Implicit Partitions) */
7141 /* 6.32 - Query Reply (IOCA Auxiliary Device) */
7142 { &hf_tn3270_ioca_limin,
7143 { "Max IOCA bytes/inbound transmission",
7144 "tn3270.ioca_limin",
7145 FT_UINT16, BASE_DEC, NULL, 0x0,
7148 { &hf_tn3270_ioca_limout,
7149 { "Max IOCA bytes/outbound transmission",
7150 "tn3270.ioca_limout",
7151 FT_UINT16, BASE_DEC, NULL, 0x0,
7154 { &hf_tn3270_ioca_type,
7155 { "Type of IOCA Auxiliary Device",
7157 FT_UINT16, BASE_DEC, NULL, 0x0,
7160 /* END - 6.32 - Query Reply (IOCA Auxiliary Device) */
7162 /* 6.34 - Query Reply (MSR Control) */
7163 { &hf_tn3270_msr_nd,
7164 { "Number of MSR device types",
7166 FT_UINT8, BASE_DEC, NULL, 0x0,
7169 /* END - 6.34 - Query Reply (MSR Control) */
7171 /* 6.36 - Query Reply (OEM Auxiliary Device) */
7172 { &hf_tn3270_oem_dsref,
7173 { "Data stream reference identifier",
7175 FT_UINT8, BASE_HEX, NULL, 0x0,
7178 { &hf_tn3270_oem_dtype,
7181 FT_STRING, BASE_NONE, NULL, 0x0,
7184 { &hf_tn3270_oem_uname,
7185 { "User assigned name",
7187 FT_STRING, BASE_NONE, NULL, 0x0,
7190 { &hf_tn3270_sdp_daid,
7191 { "Destination/Origin ID",
7192 "tn3270.oem_sdp_daid_doid",
7193 FT_UINT16, BASE_DEC, NULL, 0x0,
7196 { &hf_tn3270_oem_sdp_ll_limin,
7197 { "Maximum OEM dsf bytes/transmission allowed inbound",
7198 "tn3270.oem_sdp_ll_limin",
7199 FT_UINT16, BASE_DEC, NULL, 0x0,
7202 { &hf_tn3270_oem_sdp_ll_limout,
7203 { "Maximum OEM dsf bytes/transmission allowed outbound",
7204 "tn3270.oem_sdp_ll_limout",
7205 FT_UINT16, BASE_DEC, NULL, 0x0,
7208 { &hf_tn3270_oem_sdp_pclk_vers,
7209 { "Protocol version",
7210 "tn3270.oem_sdp_pclk_vers",
7211 FT_UINT16, BASE_DEC, NULL, 0x0,
7214 /* END - 6.36 - Query Reply (OEM Auxiliary Device) */
7216 /* 6.37 - Query Reply (Paper Feed Techniques) */
7217 { &hf_tn3270_pft_flags,
7220 FT_UINT8, BASE_HEX, NULL, 0x0,
7223 { &hf_tn3270_pft_tmo,
7224 { "Top margin offset in 1/1440ths of an inch",
7226 FT_UINT16, BASE_DEC, NULL, 0x0,
7229 { &hf_tn3270_pft_bmo,
7230 { "Bottom margin offset in 1/1440ths of an inch",
7232 FT_UINT16, BASE_DEC, NULL, 0x0,
7235 /* END - 6.37 - Query Reply (Paper Feed Techniques) */
7237 /* 6.38 - Query Reply (Partition Characteristics) */
7238 { &hf_tn3270_pc_vo_thickness,
7240 "tn3270.pc_vo_thickness",
7241 FT_UINT8, BASE_DEC, NULL, 0x0,
7244 /* END- 6.38 - Query Reply (Partition Characteristics) */
7246 /* 6.41 - Query Reply (Product Defined Data Stream) */
7247 { &hf_tn3270_pdds_refid,
7248 { "Reference identifier",
7249 "tn3270.pdds_refid",
7250 FT_UINT8, BASE_HEX, VALS(vals_qr_pdds_refid), 0x0,
7253 { &hf_tn3270_pdds_ssid,
7254 { "Subset identifier",
7256 FT_UINT8, BASE_HEX, VALS(vals_qr_pdds_ssid), 0x0,
7259 /* END - 6.41 - Query Reply (Product Defined Data Stream) */
7261 /* 6.43 - Query Reply (RPQ Names) */
7262 { &hf_tn3270_rpq_device,
7263 { "Device type identifier",
7264 "tn3270.rpq_device",
7265 FT_STRING, BASE_NONE, NULL, 0x0,
7268 { &hf_tn3270_rpq_mid,
7269 { "Model type identifier",
7271 FT_UINT64, BASE_DEC, NULL, 0x0,
7274 { &hf_tn3270_rpq_rpql,
7275 { "Length of RPQ name (including this byte)",
7277 FT_UINT8, BASE_DEC, NULL, 0x0,
7280 { &hf_tn3270_rpq_name,
7283 FT_STRING, BASE_NONE, NULL, 0x0,
7286 /* END - Query Reply (Names) */
7288 /* 6.44 - Query Reply (Save or Restore Format) */
7289 { &hf_tn3270_srf_fpcbl,
7290 { "Format parameter control block length",
7292 FT_UINT16, BASE_DEC, NULL, 0x0,
7295 /* END - 6.44 - Query Reply (Save or Restore Format) */
7297 /* 6.45 - Query Reply (Settable Printer Characteristics) */
7298 { &hf_tn3270_spc_epc_flags,
7300 "tn3270.spc_epc_flags",
7301 FT_UINT8, BASE_HEX, NULL, 0x0,
7304 /* END - 6.45 - Query Reply (Settable Printer Characteristics) */
7306 /* 6.47 - Query Reply (Storage Pools) */
7307 { &hf_tn3270_sp_spid,
7308 { "Storage pool identity",
7310 FT_UINT8, BASE_HEX, NULL, 0x0,
7313 { &hf_tn3270_sp_size,
7314 { "Size of this storage pool when empty",
7316 FT_UINT32, BASE_DEC, NULL, 0x0,
7319 { &hf_tn3270_sp_space,
7320 { "Space available in this storage pool",
7322 FT_UINT32, BASE_DEC, NULL, 0x0,
7325 { &hf_tn3270_sp_objlist,
7326 { "Identifiers of objects housed in this storage pool",
7327 "tn3270.sp_objlist",
7328 FT_UINT16, BASE_HEX, VALS(vals_sp_objlist), 0x0,
7331 /* END - 6.47 - Query Reply (Storage Pools) */
7333 /* 6.49 - Query Reply (Text Partitions) */
7335 { "Maximum number of text partitions",
7337 FT_UINT8, BASE_DEC, NULL, 0x0,
7341 { "Maximum partition size",
7343 FT_UINT16, BASE_DEC, NULL, 0x0,
7346 { &hf_tn3270_tp_flags,
7349 FT_UINT8, BASE_HEX, NULL, 0x0,
7352 { &hf_tn3270_tp_ntt,
7353 { "Number of text types supported",
7355 FT_UINT8, BASE_DEC, NULL, 0x0,
7358 { &hf_tn3270_tp_tlist,
7359 { "List of types supported",
7361 FT_UINT8, BASE_HEX, NULL, 0x0,
7364 /* END - 6.49 - Query Reply (Text Partitions) */
7366 /* 6.50 - Query Reply (Transparency) */
7368 { "Number of pairs",
7370 FT_UINT8, BASE_DEC, NULL, 0x0,
7374 { "Data stream attribute value accepted",
7376 FT_UINT8, BASE_HEX, NULL, 0x0,
7380 { "Associated action value",
7382 FT_UINT8, BASE_HEX, NULL, 0x0,
7385 /* END - 6.50 - Query Reply (Transparency) */
7387 /* 6.51 Query Reply Usable Area */
7388 { &hf_tn3270_usable_area_flags1,
7389 {"Usable Area Flags",
7390 "tn3270.query_reply_usable_area_flags1",
7391 FT_UINT8, BASE_HEX, NULL, 0,
7394 { &hf_tn3270_ua_reserved1,
7397 FT_BOOLEAN, 8, NULL, QR_UA_RESERVED1,
7400 { &hf_tn3270_ua_page_printer,
7402 "tn3270.ua_page_printer",
7403 FT_BOOLEAN, 8, NULL, QR_UA_PAGE_PRINTER,
7406 { &hf_tn3270_ua_reserved2,
7409 FT_BOOLEAN, 8, NULL, QR_UA_RESERVED2,
7412 { &hf_tn3270_ua_hard_copy,
7414 "tn3270.ua_hard_copy",
7415 FT_BOOLEAN, 8, NULL, QR_UA_HARD_COPY,
7418 { &hf_tn3270_ua_addressing,
7419 { "Usable Area Addressing",
7420 "tn3270.ua_addressing",
7421 FT_UINT8, BASE_HEX, VALS(vals_usable_area_addr_mode), QR_UA_ADDR_MODE_MASK,
7424 { &hf_tn3270_usable_area_flags2,
7425 { "Usable Area Flags",
7426 "tn3270.query_reply_usable_area_flags2",
7427 FT_UINT8, BASE_HEX, NULL, 0x0,
7430 { &hf_tn3270_ua_variable_cells,
7432 "tn3270.ua_variable_cells",
7433 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_variable_cells), QR_UA_VARIABLE_CELLS,
7436 { &hf_tn3270_ua_characters,
7438 "tn3270.ua_characters",
7439 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_characters), QR_UA_CHARACTERS,
7442 { &hf_tn3270_ua_cell_units,
7444 "tn3270.ua_cell_units",
7445 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_cell_units), QR_UA_CELL_UNITS,
7448 { &hf_tn3270_ua_width_cells_pels,
7449 { "Width of usable area in cells/pels",
7450 "tn3270.ua_width_cells_pels",
7451 FT_UINT16, BASE_DEC, NULL, 0x0,
7454 { &hf_tn3270_ua_height_cells_pels,
7455 { "Height of usable area in cells/pels",
7456 "tn3270.ua_height_cells_pels",
7457 FT_UINT16, BASE_DEC, NULL, 0x0,
7460 { &hf_tn3270_ua_uom_cells_pels,
7461 { "Units of measure for cells/pels",
7462 "tn3270.ua_uom_cells_pels",
7463 FT_UINT8, BASE_HEX, VALS(vals_usable_area_uom), 0x0,
7467 { "Distance between points in X direction as a fraction",
7469 FT_UINT32, BASE_HEX, NULL, 0x0,
7470 "measured in UNITS, with 2-byte numerator and 2-byte denominator", HFILL }
7473 { "Distance between points in Y direction as a fraction",
7475 FT_UINT32, BASE_HEX, NULL, 0x0,
7476 "measured in UNITS, with 2-byte numerator and 2-byte denominator", HFILL }
7479 { "Number of X units in default cell",
7481 FT_UINT8, BASE_DEC, NULL, 0x0,
7485 { "Number of Y units in default cell",
7487 FT_UINT8, BASE_DEC, NULL, 0x0,
7490 { &hf_tn3270_ua_buffsz,
7491 { "Character buffer size (bytes)",
7493 FT_UINT16, BASE_DEC, NULL, 0x0,
7496 { &hf_tn3270_ua_xmin,
7497 { "Minimum number of X units in variable cell",
7499 FT_UINT8, BASE_DEC, NULL, 0x0,
7502 { &hf_tn3270_ua_ymin,
7503 { "Minimum number of Y units in variable cell",
7505 FT_UINT8, BASE_DEC, NULL, 0x0,
7508 { &hf_tn3270_ua_xmax,
7509 { "Maximum number of X units in variable cell",
7511 FT_UINT8, BASE_DEC, NULL, 0x0,
7514 { &hf_tn3270_ua_ymax,
7515 { "Maximum number of Y units in variable cell",
7517 FT_UINT8, BASE_DEC, NULL, 0x0,
7520 /* End - 6.51 Query Reply Usable Area */
7522 /* 6.52 - Query Reply (3270 IPDS) */
7523 { &hf_tn3270_3270_tranlim,
7524 { "Maximum transmission size allowed outbound",
7525 "tn3270.3270_tranlim",
7526 FT_UINT16, BASE_DEC, NULL, 0x0,
7529 /* END - 6.52 - Query Reply (3270 IPDS) */
7532 { &hf_tn3270_field_data,
7534 "tn3270.field_data",
7535 FT_STRING, BASE_NONE, NULL, 0x0,
7536 "tn3270.field_data", HFILL }
7538 { &hf_tn3270_number_of_attributes,
7539 { "Number of Attributes",
7540 "tn3270.number_of_attributes",
7541 FT_UINT8, BASE_HEX, NULL, 0x0,
7544 { &hf_tn3270_resbyte,
7545 { "Flags (Reserved)",
7547 FT_UINT8, BASE_HEX, NULL, 0x0,
7550 { &hf_tn3270_resbytes,
7551 { "Flags (Reserved)",
7553 FT_UINT8, BASE_HEX, NULL, 0x0,
7556 { &hf_tn3270_res_twobytes,
7557 { "Flags (Reserved)",
7558 "tn3270.res_twobytes",
7559 FT_UINT16, BASE_HEX, NULL, 0x0,
7562 { &hf_tn3270_sf_single_byte_id,
7563 { "Structured Field",
7565 FT_UINT8, BASE_HEX, NULL, 0x0,
7568 { &hf_tn3270_sf_double_byte_id,
7569 { "Structured Field",
7571 FT_UINT16, BASE_HEX, NULL, 0x0,
7574 { &hf_tn3270_sf_query_reply,
7576 "tn3270.sf_query_reply",
7577 FT_UINT8, BASE_HEX, VALS(vals_sf_query_replies), 0x0,
7581 { "Trailing Null (Possible Mainframe/Emulator Bug)",
7583 FT_UINT8, BASE_HEX, NULL, 0x0,
7586 { &hf_tn3270_unknown_data,
7587 { "Unknown Data (Possible Mainframe/Emulator Bug)",
7588 "tn3270.unknown_data",
7589 FT_BYTES, BASE_NONE, NULL, 0x0,
7593 /* TN3270E - Header Fields */
7594 { &hf_tn3270_tn3270e_data_type,
7595 { "TN3270E Data Type",
7596 "tn3270.tn3270e_data_type",
7597 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_data_types), 0x0,
7600 { &hf_tn3270_tn3270e_request_flag,
7601 { "TN3270E Request Flag",
7602 "tn3270.tn3270e_request_flag",
7603 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_request_flags), 0x0,
7606 { &hf_tn3270_tn3270e_response_flag_3270_SCS,
7607 { "TN3270E Response Flag",
7608 "tn3270.tn3270e_response_flag",
7609 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_response_flags_3270_SCS), 0x0,
7612 { &hf_tn3270_tn3270e_response_flag_response,
7613 { "TN3270E Response Flag",
7614 "tn3270.tn3270e_response_flag",
7615 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_response_flags_response), 0x0,
7618 { &hf_tn3270_tn3270e_response_flag_unused,
7619 { "TN3270E Response Flag",
7620 "tn3270.tn3270e_response_flag",
7621 FT_UINT8, BASE_HEX, NULL, 0x0,
7624 { &hf_tn3270_tn3270e_seq_number,
7625 { "TN3270E Seq Number",
7626 "tn3270.tn3270e_seq_number",
7627 FT_UINT16, BASE_DEC, NULL, 0x0,
7630 { &hf_tn3270_tn3270e_header_data,
7631 { "TN3270E Header Data",
7632 "tn3270.tn3270e_header_data",
7633 FT_STRING, BASE_NONE, NULL, 0x0,
7638 static gint *ett[] = {
7642 &ett_tn3270_field_attribute,
7643 &ett_tn3270_field_validation,
7644 &ett_tn3270_usable_area_flags1,
7645 &ett_tn3270_usable_area_flags2,
7646 &ett_tn3270_query_reply_alphanumeric_flags,
7647 &ett_tn3270_character_sets_flags1,
7648 &ett_tn3270_character_sets_flags2,
7649 &ett_tn3270_character_sets_form,
7650 &ett_tn3270_cs_descriptor_flags,
7651 &ett_tn3270_color_flags,
7654 &ett_tn3270_msr_state_mask,
7655 &ett_tn3270_data_chain_fields,
7656 &ett_tn3270_query_list
7659 static ei_register_info ei[] = {
7660 { &ei_tn3270_order_code, { "tn3270.order_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7661 { &ei_tn3270_command_code, { "tn3270.command_code.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7662 { &ei_tn3270_aid, { "tn3270.aid.bogus", PI_PROTOCOL, PI_WARN, "Bogus value", EXPFILL }},
7665 expert_module_t* expert_tn3270;
7667 proto_tn3270 = proto_register_protocol("TN3270 Protocol", "TN3270", "tn3270");
7668 register_dissector("tn3270", dissect_tn3270, proto_tn3270);
7669 proto_register_field_array(proto_tn3270, hf, array_length(hf));
7670 proto_register_subtree_array(ett, array_length(ett));
7671 expert_tn3270 = expert_register_protocol(proto_tn3270);
7672 expert_register_field_array(expert_tn3270, ei, array_length(ei));
7682 * indent-tabs-mode: nil
7685 * ex: set shiftwidth=2 tabstop=8 expandtab:
7686 * :indentSize=2:tabSize=8:noTabs=true: