MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / epan / dissectors / packet-tn3270.c
blob35777e2b50e07b84e78c9eae8219a82defefcdc0
1 /* packet-tn3270.c
2 * Routines for tn3270.packet dissection
4 * References:
5 * 3270 Information Display System: Data Stream Programmer's Reference
6 * GA23-0059-07
7 * http://publib.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CN7P4000
8 * (Paragraph references in the comments in this file (e.g., 6.15) are to the above document)
10 * 3174 Establishment Controller Functional Description
11 * GA23-0218-11
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 * $Id$
29 * Wireshark - Network traffic analyzer
30 * By Gerald Combs <gerald@wireshark.org>
31 * Copyright 1998 Gerald Combs
33 * This program is free software; you can redistribute it and/or
34 * modify it under the terms of the GNU General Public License
35 * as published by the Free Software Foundation; either version 2
36 * of the License, or (at your option) any later version.
38 * This program is distributed in the hope that it will be useful,
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 * GNU General Public License for more details.
43 * You should have received a copy of the GNU General Public License
44 * along with this program; if not, write to the Free Software
45 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
48 #include "config.h"
50 #include <string.h>
52 #include <glib.h>
54 #include <epan/packet.h>
55 #include <epan/address.h>
56 #include <epan/wmem/wmem.h>
57 #include <epan/conversation.h>
58 #include <epan/strutil.h>
60 #include "packet-tn3270.h"
62 /* Note well:
63 * In the IBM "3270 Information Display System: Data Stream Programmer's Reference"
64 * document, the references to bit numbers in the text and tables
65 * are based upon the "MSB 0" bit numbering scheme.
66 * That is: bits are numbered in a byte from left-to-right:
67 * "Bit 0" is the MSB of the byte
68 * "Bit 7" is the LSB of the byte
72 ToDo:
73 - better tree display: e.g., separate tree for each order code ....
74 - review 'structured field grouping: 5.2
75 - Telnet uses 0xFF as IAC ["interpret as command"] and thus for
76 telnet: any actual 0xFF bytes in a 3270 data stream will be prefixed with
77 a 0xFF escape. The escapes should be removed from the TVB before the
78 buffer is passed to this dissector. See packet-telnet.c
79 - Show the 'as a fraction" display as xx/yy ?
82 /* Dissection is for EBCDIC 3270 */
84 /* OUTBOUND DATA STREAM (MAINFRAME PROGRAM -> DISPLAY)
86 ________________ _____ __________________
87 | Command Code |WCC | Orders and Data |
88 |________________|_____|__________________|
91 ______ ______________________
92 | WSF | Structured Field(s) |
93 |______|______________________|
97 /*--- 3270 Command Codes - "Local Attachment" ----- */
98 #define CC_LCL_W 0x01
99 #define CC_LCL_EW 0x05
100 #define CC_LCL_EWA 0x0D
101 #define CC_LCL_EAU 0x0F
102 #define CC_LCL_WSF 0x11
104 #define CC_LCL_RB 0x02
105 #define CC_LCL_RM 0x06
106 #define CC_LCL_RMA 0x0E /* XXX Not valid ?? See 3174 Function Description 2.1.4 */
108 #if 0 /* ??? */
109 #define CC_NOP 0x03
110 #endif
113 /*--- 3.3 3270 Command Codes - "Remote Attachment" ----- */
114 #define CC_RMT_W 0xF1
115 #define CC_RMT_EW 0xF5
116 #define CC_RMT_EWA 0x7E
117 #define CC_RMT_EAU 0x6F
118 #define CC_RMT_WSF 0xF3
120 #define CC_RMT_RB 0xF2
121 #define CC_RMT_RM 0xF6
122 #define CC_RMT_RMA 0x6E
124 #define CC_SNA_BSC 0xF7 /* local copy in a BSC environment */
126 static const value_string vals_command_codes[] = {
128 { CC_LCL_W, "Write (Local)" },
129 { CC_LCL_EW, "Erase/Write (Local)" },
130 { CC_LCL_EWA, "Erase/Write Alternate (Local)" },
131 { CC_LCL_EAU, "Erase All Unprotected (Local)" },
132 { CC_LCL_WSF, "Write Structured Field (Local)" },
133 { CC_LCL_RB, "Read Buffer (Local)" },
134 { CC_LCL_RM, "Read Modified (Local)" },
135 { CC_LCL_RMA, "Read Modified All (Local)" },
136 { CC_RMT_W, "Write" },
137 { CC_RMT_EW, "Erase/Write" },
138 { CC_RMT_EWA, "Erase/Write Alternate" },
139 { CC_RMT_EAU, "Erase All Unprotected" },
140 { CC_RMT_WSF, "Write Structured Field" },
141 { CC_RMT_RB, "Read Buffer" },
142 { CC_RMT_RM, "Read Modified" },
143 { CC_RMT_RMA, "Read Modified All" },
144 { CC_SNA_BSC, "BSC Copy" },
145 { 0x00, NULL }
148 /*--- 3.4 WCC (Write Control Characters) ----- */
149 #define WCC_NOP 0x80 /* "Bit 0" */
150 #define WCC_RESET 0x40 /* "Bit 1" */
151 #define WCC_PRINTER1 0x20 /* "Bit 2" */
152 #define WCC_PRINTER2 0x10 /* "Bit 3" */
153 #define WCC_START_PRINTER 0x08 /* "Bit 4" */
154 #define WCC_SOUND_ALARM 0x04 /* "Bit 5" */
155 #define WCC_KEYBOARD_RESTORE 0x02 /* "Bit 6" */
156 #define WCC_RESET_MDT 0x01 /* "Bit 7" */
158 /*--- 4.3 Order Codes ----- */
159 #define OC_MAX 0x3F
161 #define OC_SF 0x1D
162 #define OC_SFE 0x29
163 #define OC_SBA 0x11
164 #define OC_SA 0x28
165 #define OC_MF 0x2C
166 #define OC_IC 0x13
167 #define OC_PT 0x05
168 #define OC_RA 0x3C
169 #define OC_EUA 0x12
170 #define OC_GE 0x08
172 static const value_string vals_order_codes[] = {
173 { OC_SF, "Start Field (SF)" },
174 { OC_SFE, "Start Field Extended (SFE)" },
175 { OC_SBA, "Set Buffer Address (SBA)" },
176 { OC_SA, "Set Attribute (SA)" },
177 { OC_MF, "Modify Field (MF)" },
178 { OC_IC, "Insert Cursor (IC)" },
179 { OC_PT, "Program Tab (PT)" },
180 { OC_RA, "Repeat to Address (RA)" },
181 { OC_EUA, "Erase Unprotected to Address (EUA)" },
182 { OC_GE, "Graphic Escape (GE)" },
183 { 0x00, NULL }
186 #if 0 /* Not used */
187 /*--- 4.3.11 Format Control Orders ----- */
188 /* Special treatment for display */
189 #define FCO_NUL 0x00
190 #define FCO_SUB 0x3F
191 #define FCO_DUP 0x1C
192 #define FCO_FM 0x1E
193 #define FCO_FF 0x0C
194 #define FCO_CR 0x0D
195 #define FCO_NL 0x15
196 #define FCO_EM 0x19
197 #define FCO_EO 0xFF
199 static const value_string vals_format_control_orders[] = {
200 { FCO_NUL, "Null" },
201 { FCO_SUB, "Substitute" },
202 { FCO_DUP, "Duplicate" },
203 { FCO_FM, "Field Mark" },
204 { FCO_FF, "Form Feed" },
205 { FCO_CR, "Carriage Return" },
206 { FCO_NL, "New Line" },
207 { FCO_EM, "End of Medium" },
208 { FCO_EO, "Eight Ones" },
209 { 0x00, NULL }
211 #endif
213 /*--- 8.7 Copy Control Code ----- */
214 /* Use for "local Copy" in a "BSC [BiSync] Environment" */
216 /* "Coding Bits" are those required such that the */
217 /* complete 8 bit CCC is a valid EBCDIC character */
218 #define CCC_GRAPHIC_CONVERT_MASK 0xC0
220 #define CCC_PRINT_BITS_MASK 0x30
221 #define CCC_PRINT_BITS_POINT_LINE_LENGTH 0x00
222 #define CCC_PRINT_BITS_PRINT_LINE_40 0x01
223 #define CCC_PRINT_BITS_PRINT_LINE_64 0x02
224 #define CCC_PRINT_BITS_PRINT_LINE_80 0x03
226 static const value_string ccc_vals_printout_format[] = {
227 { CCC_PRINT_BITS_POINT_LINE_LENGTH,
228 "The NL, EM, and CR orders in the data stream determine pointline length. "
229 "Provides a 132-print position line when the orders are not present." },
230 { CCC_PRINT_BITS_PRINT_LINE_40,
231 "Specifies a 40-character print line." },
232 { CCC_PRINT_BITS_PRINT_LINE_64,
233 "Specifies a 64-character print line." },
234 { CCC_PRINT_BITS_PRINT_LINE_80,
235 "Specifies an 80-character print line." },
236 { 0x00, NULL }
239 #define CCC_START_PRINT 0x08
240 #define CCC_SOUND_ALARM 0x04
242 #define CCC_ATTRIBUTE_BITS_MASK 0x03
243 #define CCC_ATTRIBUTE_BITS_ONLY_ATTRIBUTE_CHARACTERS 0x00
244 #define CCC_ATTRIBUTE_BITS_ATTRIBUTE_CHARACTERS_UNPROTECTED_AN 0x01
245 #define CCC_ATTRIBUTE_BITS_ALL_ATTRIBUTE_PROTECTED 0x02
246 #define CCC_ATTRIBUTE_BITS_ENTIRE_CONTENTS 0x03
248 static const value_string ccc_vals_copytype[] = {
249 { CCC_ATTRIBUTE_BITS_ONLY_ATTRIBUTE_CHARACTERS,
250 "Only attribute characters are copied." },
251 { CCC_ATTRIBUTE_BITS_ATTRIBUTE_CHARACTERS_UNPROTECTED_AN,
252 "Attribute characters and unprotected alphanumeric fields"
253 " (including nulls) are copied. Nulls are transferred for"
254 " the alphanumeric characters not copied from the"
255 " protected fields." },
256 { CCC_ATTRIBUTE_BITS_ALL_ATTRIBUTE_PROTECTED,
257 "All attribute characters and protected alphanumeric fields"
258 " (including nulls) are copied. Nulls are transferred for the alphanumeric characters not"
259 " copied from the unprotected fields." },
260 { CCC_ATTRIBUTE_BITS_ENTIRE_CONTENTS,
261 "The entire contents of the storage buffer (including nulls) are copied." },
262 { 0x00, NULL }
265 /*--- 4.4.1 Field Attributes ----- */
266 #define FA_GRAPHIC_CONVERT_MASK 0xC0
268 #define FA_PROTECTED 0x20 /* "Bit 2" */
269 #define FA_NUMERIC 0x10 /* "Bit 3" */
271 #define FA_RESERVED 0x02 /* "Bit 6" */
272 #define FA_MODIFIED 0x01 /* "Bit 7" */
274 #define FA_DISPLAY_BITS_MASK 0x0C /* "Bits 4,5" */
275 #define FA_DISPLAY_BITS_DISPLAY_NOT_SELECTOR_PEN_DETECTABLE 0x00
276 #define FA_DISPLAY_BITS_DISPLAY_SELECTOR_PEN_DETECTABLE 0x01
277 #define FA_DISPLAY_BITS_INTENSIFIED_DISPLAY_SELECTOR_PEN_DETECTABLE 0x02
278 #define FA_DISPLAY_BITS_NON_DISPLAY_NON_DETECTABLE 0x03
280 static const value_string vals_fa_display[] = {
281 { FA_DISPLAY_BITS_DISPLAY_NOT_SELECTOR_PEN_DETECTABLE, "Display/Not Selector Pen Detectable" },
282 { FA_DISPLAY_BITS_DISPLAY_SELECTOR_PEN_DETECTABLE, "Display/Selector Pen Detectable" },
283 { FA_DISPLAY_BITS_INTENSIFIED_DISPLAY_SELECTOR_PEN_DETECTABLE, "Intensified Display/Selector Pen Detectable" },
284 { FA_DISPLAY_BITS_NON_DISPLAY_NON_DETECTABLE, "Non Display, Non Detectable (not printable)" },
285 { 0x00, NULL }
288 /*--- 4.4.5 Attribute Types ----- */
289 #define AT_ALL_CHARACTER_ATTRIBUTES 0x00
290 #define AT_T3270_FIELD_ATTRIBUTE 0xC0
291 #define AT_FIELD_VALIDATION 0xC1
292 #define AT_FIELD_OUTLINING 0xC2
293 #define AT_EXTENDED_HIGHLIGHTING 0x41
294 #define AT_FOREGROUND_COLOR 0x42
295 #define AT_CHARACTER_SET 0x43
296 #define AT_BACKGROUND_COLOR 0x45
297 #define AT_TRANSPARENCY 0x46
300 static const value_string vals_attribute_types[] = {
301 { AT_ALL_CHARACTER_ATTRIBUTES, "All character attributes" },
302 { AT_T3270_FIELD_ATTRIBUTE, "3270 Field attribute" },
303 { AT_FIELD_VALIDATION, "Field validation" },
304 { AT_FIELD_OUTLINING, "Field outlining" },
305 { AT_EXTENDED_HIGHLIGHTING, "Extended highlighting" },
306 { AT_FOREGROUND_COLOR, "Foreground color" },
307 { AT_CHARACTER_SET, "Character set" },
308 { AT_BACKGROUND_COLOR, "Background color" },
309 { AT_TRANSPARENCY, "Transparency" },
310 { 0x00, NULL }
313 /*--- 4.4.6.3 Extended Highlighting ----- */
314 #define AT_EH_DEFAULT_HIGHLIGHTING 0x00
315 #define AT_EH_NORMAL 0xF0
316 #define AT_EH_BLINK 0xF1
317 #define AT_EH_REVERSE_VIDEO 0xF2
318 #define AT_EH_UNDERSCORE 0xF4
320 static const value_string vals_at_extended_highlighting[] = {
321 { AT_EH_DEFAULT_HIGHLIGHTING, "Default" },
322 { AT_EH_NORMAL, "Normal (as determined by the 3270 field attribute)" },
323 { AT_EH_BLINK, "Blink" },
324 { AT_EH_REVERSE_VIDEO, "Reverse video" },
325 { AT_EH_UNDERSCORE, "Underscore." },
326 { 0x00, NULL }
329 /*--- 4.4.6.4 Color Identifications ----- */
330 #define AT_CI_ALL_PLANES 0x00
331 #define AT_CI_BLUE_PLANE 0x01
332 #define AT_CI_RED_PLANE 0x02
333 #define AT_CI_GREEN_PLANE 0x04
334 #define AT_CI_NEUTRAL1 0xF0
335 #define AT_CI_BLUE 0xF1
336 #define AT_CI_RED 0xF2
337 #define AT_CI_PINK 0xF3
338 #define AT_CI_GREEN 0xF4
339 #define AT_CI_TURQUOISE 0xF5
340 #define AT_CI_YELLOW 0xF6
341 #define AT_CI_NEUTRAL2 0xF7
342 #define AT_CI_BLACK 0xF8
343 #define AT_CI_DEEP_BLUE 0xF9
344 #define AT_CI_ORANGE 0xFA
345 #define AT_CI_PURPLE 0xFB
346 #define AT_CI_PALE_GREEN 0xFC
347 #define AT_CI_PALE_TURQUOISE 0xFD
348 #define AT_CI_GREY 0xFE
349 #define AT_CI_WHITE 0xFF
352 static const value_string vals_at_color_identifications[] = {
353 { AT_CI_ALL_PLANES, "ALL PLANES" },
354 { AT_CI_BLUE_PLANE, "BLUE PLANE" },
355 { AT_CI_RED_PLANE, "RED PLANE" },
356 { AT_CI_GREEN_PLANE, "GREEN PLANE" },
357 { AT_CI_NEUTRAL1, "Neutral" },
358 { AT_CI_BLUE, "Blue" },
359 { AT_CI_RED, "Red" },
360 { AT_CI_PINK, "Pink" },
361 { AT_CI_GREEN, "Green" },
362 { AT_CI_TURQUOISE, "Turquoise" },
363 { AT_CI_YELLOW, "Yellow" },
364 { AT_CI_NEUTRAL2, "Neutral" },
365 { AT_CI_BLACK, "Black" },
366 { AT_CI_DEEP_BLUE, "Deep Blue" },
367 { AT_CI_ORANGE, "Orange" },
368 { AT_CI_PURPLE, "Purple" },
369 { AT_CI_PALE_GREEN, "Pale Green" },
370 { AT_CI_PALE_TURQUOISE, "Pale Turquoise" },
371 { AT_CI_GREY, "Grey" },
372 { AT_CI_WHITE, "White" },
373 { 0x00, NULL }
376 /*--- 4.4.6.5 Character Set ----- */
377 #define AT_CS_DEFAULT_CHARACTER_SET 0x00
378 #define AT_CS_MIN_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS 0x40
379 #define AT_CS_MAX_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS 0xEF
380 #define AT_CS_MIN_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS 0xF0
381 #define AT_CS_MAX_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS 0xF7
382 #define AT_CS_MIN_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS 0xF8
383 #define AT_CS_MAX_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS 0xFE
385 static const range_string rvals_at_character_set[] = {
386 { AT_CS_DEFAULT_CHARACTER_SET,
387 AT_CS_DEFAULT_CHARACTER_SET,
388 "Default Character Set" },
389 { AT_CS_MIN_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS,
390 AT_CS_MAX_LOCAL_ID_FOR_LOADABLE_CHARACTER_SETS,
391 "Local Id For Loadable Character Sets" },
392 { AT_CS_MIN_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS,
393 AT_CS_MAX_LOCAL_ID_FOR_NONLOADABLE_CHARACTER_SETS,
394 "Local Id For Nonloadable Character Sets" },
395 { AT_CS_MIN_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS,
396 AT_CS_MAX_LOCAL_ID_FOR_TWO_BYTE_CODED_CHARACTER_SETS,
397 "Local Id For Two Byte Coded Character Sets" },
398 { 0, 0, NULL }
401 /*--- 4.4.6.6 Field Outlining ----- */
402 #define AT_FO_NO_OUTLINING_LINES 0X00
403 #define AT_FO_UNDERLINE_ONLY 0X01
404 #define AT_FO_RIGHT_VERTICAL_LINE_ONLY 0X02
405 #define AT_FO_OVERLINE_ONLY 0X04
406 #define AT_FO_LEFT_VERTICAL_LINE_ONLY 0X08
407 #define AT_FO_UNDERLINE_AND_RIGHT_VERTICAL_LINE 0X03
408 #define AT_FO_UNDERLINE_AND_OVERLINE 0X05
409 #define AT_FO_UNDERLINE_AND_LEFT_VERTICAL_LINE 0X09
410 #define AT_FO_RIGHT_VERTICAL_LINE_AND_OVERLINE 0X06
411 #define AT_FO_RIGHT_AND_LEFT_VERTICAL_LINES 0X0A
412 #define AT_FO_OVERLINE_AND_LEFT_VERTICAL_LINE 0X0C
413 #define AT_FO_RECTANGLE_MINUS_LEFT_VERTICAL_LINE 0X07
414 #define AT_FO_RECTANGLE_MINUS_OVERLINE 0X0B
415 #define AT_FO_RECTANGLE_MINUS_RIGHT_VERTICAL_LINE 0X0D
416 #define AT_FO_RECTANGLE_MINUS_UNDERLINE 0X0E
417 #define AT_FO_RECTANGLE 0X0F
419 static const value_string vals_at_field_outlining[] = {
420 { AT_FO_NO_OUTLINING_LINES, "No outlining lines" },
421 { AT_FO_UNDERLINE_ONLY, "Underline only" },
422 { AT_FO_RIGHT_VERTICAL_LINE_ONLY, "Right vertical line only" },
423 { AT_FO_OVERLINE_ONLY, "Overline only" },
424 { AT_FO_LEFT_VERTICAL_LINE_ONLY, "Left vertical line only" },
425 { AT_FO_UNDERLINE_AND_RIGHT_VERTICAL_LINE, "Underline and right vertical line" },
426 { AT_FO_UNDERLINE_AND_OVERLINE, "Underline and overline" },
427 { AT_FO_UNDERLINE_AND_LEFT_VERTICAL_LINE, "Underline and left vertical line" },
428 { AT_FO_RIGHT_VERTICAL_LINE_AND_OVERLINE, "Right vertical line and overline" },
429 { AT_FO_RIGHT_AND_LEFT_VERTICAL_LINES, "Right and left vertical lines" },
430 { AT_FO_OVERLINE_AND_LEFT_VERTICAL_LINE, "Overline and left vertical line" },
431 { AT_FO_RECTANGLE_MINUS_LEFT_VERTICAL_LINE, "Rectangle minus left vertical line" },
432 { AT_FO_RECTANGLE_MINUS_OVERLINE, "Rectangle minus overline" },
433 { AT_FO_RECTANGLE_MINUS_RIGHT_VERTICAL_LINE, "Rectangle minus right vertical line" },
434 { AT_FO_RECTANGLE_MINUS_UNDERLINE, "Rectangle minus underline" },
435 { AT_FO_RECTANGLE, "Rectangle" },
436 { 0x00, NULL }
439 /*--- 4.4.6.7 Transparency ----- */
440 #define AT_TR_DEFAULT_TRANSPARENCY 0X00
441 #define AT_TR_BACKGROUND_IS_TRANSPARENT_OR 0XF0
442 #define AT_TR_BACKGROUND_IS_TRANSPARENT_XOR 0XF1
443 #define AT_TR_BACKGROUND_IS_OPAQUE 0XFF
445 static const value_string vals_at_transparency[] = {
446 { AT_TR_DEFAULT_TRANSPARENCY, "Default" },
447 { AT_TR_BACKGROUND_IS_TRANSPARENT_OR, "Background is transparent (OR)" },
448 { AT_TR_BACKGROUND_IS_TRANSPARENT_XOR, "Background is transparent (XOR)" },
449 { AT_TR_BACKGROUND_IS_OPAQUE, "Background is opaque (non-transparent)" },
450 { 0x00, NULL }
453 /*--- 4.4.6.8 Field Validation ----- */
454 #define AT_FV_MANDATORY_FILL 0x04 /* "Bit 5" */
455 #define AT_FV_MANDATORY_ENTRY 0x02 /* "Bit 6" */
456 #define AT_FV_TRIGGER 0x01 /* "Bit 7" */
458 static const struct true_false_string tn3270_field_validation_mandatory_fill = {
459 "Mandatory fill",
463 static const struct true_false_string tn3270_field_validation_mandatory_entry = {
464 "Mandatory entry",
468 static const struct true_false_string tn3270_field_validation_trigger = {
469 "Trigger",
473 /*--- 5.1 Outbound Structured Fields ----- */
474 #define SF_OB_ACTIVATE_PARTITION 0x0E
475 #define SF_OB_BEGIN_OR_END_OF_FILE 0x0F85
476 #define SF_OB_CREATE_PARTITION 0x0C
477 #define SF_OB_DESTROY_PARTITION 0x0D
478 #define SF_OB_ERASE_OR_RESET 0x03
479 #define SF_OB_LOAD_COLOR_TABLE 0x0F05
480 #define SF_OB_LOAD_FORMAT_STORAGE 0x0F24
481 #define SF_OB_LOAD_LINE_TYPE 0x0F07
482 #define SF_OB_LOAD_PROGRAMMED_SYMBOLS 0x06
483 #define SF_OB_MODIFY_PARTITION 0x0F0A
484 #define SF_OB_OUTBOUND_TEXT_HEADER 0x0F71
485 #define SF_OB_OUTBOUND_3270DS 0x40
486 #define SF_OB_PRESENT_ABSOLUTE_FORMAT 0x4B
487 #define SF_OB_PRESENT_RELATIVE_FORMAT 0x4C
488 #define SF_OB_SET_PARTITION_CHARACTERISTICS 0x0F08
489 #define SF_OB_SET_REPLY_MODE 0x09
490 #define SF_OB_TYPE_1_TEXT_OUTBOUND 0x0FC1
491 #define SF_OB_READ_PARTITION 0x01
492 #define SF_OB_REQUEST_RECOVERY_DATA 0x1030
493 #define SF_OB_RESET_PARTITION 0x00
494 #define SF_OB_RESTART 0x1033
495 #define SF_OB_SCS_DATA 0x41
496 #define SF_OB_SELECT_COLOR_TABLE 0x0F04
497 #define SF_OB_SELECT_FORMAT_GROUP 0x4A
498 #define SF_OB_SET_CHECKPOINT_INTERVAL 0x1032
499 #define SF_OB_SET_MSR_CONTROL 0x0F01
500 #define SF_OB_SET_PRINTER_CHARACTERISTICS 0x0F84
501 #define SF_OB_SET_WINDOW_ORIGIN 0x0B
504 static const value_string vals_outbound_structured_fields[] = {
505 { SF_OB_ACTIVATE_PARTITION, "Activate Partition" },
506 { SF_OB_BEGIN_OR_END_OF_FILE, "Begin Or End Of File" },
507 { SF_OB_CREATE_PARTITION, "Create Partition" },
508 { SF_OB_DESTROY_PARTITION, "Destroy Partition" },
509 { SF_OB_ERASE_OR_RESET, "Erase Or Reset" },
510 { SF_OB_LOAD_COLOR_TABLE, "Load Color Table" },
511 { SF_OB_LOAD_FORMAT_STORAGE, "Load Format Storage" },
512 { SF_OB_LOAD_LINE_TYPE, "Load Line Type" },
513 { SF_OB_LOAD_PROGRAMMED_SYMBOLS, "Load Programmed Symbols" },
514 { SF_OB_MODIFY_PARTITION, "Modify Partition" },
515 { SF_OB_OUTBOUND_TEXT_HEADER, "Outbound Text Header" },
516 { SF_OB_OUTBOUND_3270DS, "Outbound 3270ds" },
517 { SF_OB_PRESENT_ABSOLUTE_FORMAT, "Present Absolute Format" },
518 { SF_OB_PRESENT_RELATIVE_FORMAT, "Present Relative Format" },
519 { SF_OB_SET_PARTITION_CHARACTERISTICS, "Set Partition Characteristics" },
520 { SF_OB_SET_REPLY_MODE, "Set Reply Mode" },
521 { SF_OB_TYPE_1_TEXT_OUTBOUND, "Type 1 Text Outbound" },
522 { SF_OB_READ_PARTITION, "Read Partition" },
523 { SF_OB_REQUEST_RECOVERY_DATA, "Request Recovery Data" },
524 { SF_OB_RESET_PARTITION, "Reset Partition" },
525 { SF_OB_RESTART, "Restart" },
526 { SF_OB_SCS_DATA, "Scs Data" },
527 { SF_OB_SELECT_COLOR_TABLE, "Select Color Table" },
528 { SF_OB_SELECT_FORMAT_GROUP, "Select Format Group" },
529 { SF_OB_SET_CHECKPOINT_INTERVAL, "Set Checkpoint Interval" },
530 { SF_OB_SET_MSR_CONTROL, "Set Msr Control" },
531 { SF_OB_SET_PRINTER_CHARACTERISTICS, "Set Printer Characteristics" },
532 { SF_OB_SET_WINDOW_ORIGIN, "Set Window Origin" },
533 { 0x00, NULL }
536 /*--- 5.1 Outbound/Inbound Structured Fields ----- */
537 #define SF_OB_IB_DATA_CHAIN 0x0F21
538 #define SF_OB_IB_DESTINATION_OR_ORIGIN 0x0F02
539 #define SF_OB_IB_OBJECT_CONTROL 0x0F11
540 #define SF_OB_IB_OBJECT_DATA 0x0F0F
541 #define SF_OB_IB_OBJECT_PICTURE 0x0F10
542 #define SF_OB_IB_OEM_DATA 0x0F1F
543 #define SF_OB_IB_SAVE_OR_RESTORE_FORMAT 0x1034
544 #define SF_OB_IB_SELECT_IPDS_MODE 0x0F83
546 static const value_string vals_outbound_inbound_structured_fields[] = {
547 { SF_OB_IB_DATA_CHAIN, "Data Chain" },
548 { SF_OB_IB_DESTINATION_OR_ORIGIN, "Destination/Origin" },
549 { SF_OB_IB_OBJECT_CONTROL, "Object Control" },
550 { SF_OB_IB_OBJECT_DATA, "Object Data" },
551 { SF_OB_IB_OBJECT_PICTURE, "Object Picture" },
552 { SF_OB_IB_OEM_DATA, "OEM Data" },
553 { SF_OB_IB_SAVE_OR_RESTORE_FORMAT, "Save/Restore Format" },
554 { SF_OB_IB_SELECT_IPDS_MODE, "Select IPDS Mode." },
555 { 0x00, NULL }
558 /*--- 5.11 Load Format Storage ----- */
559 #define LOAD_FORMAT_STORAGE_OPERAND_ADD 0x01
560 #define LOAD_FORMAT_STORAGE_OPERAND_DELETE_FORMAT 0x02
561 #define LOAD_FORMAT_STORAGE_OPERAND_DELETE_GROUP 0x03
562 #define LOAD_FORMAT_STORAGE_OPERAND_RESET_ALL 0x04
563 #define LOAD_FORMAT_STORAGE_OPERAND_REQUEST_SUMMARY_STATUS 0x05
564 #define LOAD_FORMAT_STORAGE_OPERAND_REQUEST_GROUP_STATUS 0x06
566 static const value_string vals_load_storage_format_operand[] = {
567 { LOAD_FORMAT_STORAGE_OPERAND_ADD, "Add" },
568 { LOAD_FORMAT_STORAGE_OPERAND_DELETE_FORMAT, "Delete Format" },
569 { LOAD_FORMAT_STORAGE_OPERAND_DELETE_GROUP, "Delete Group" },
570 { LOAD_FORMAT_STORAGE_OPERAND_RESET_ALL, "Reset All" },
571 { LOAD_FORMAT_STORAGE_OPERAND_REQUEST_SUMMARY_STATUS, "Request Summary Status" },
572 { LOAD_FORMAT_STORAGE_OPERAND_REQUEST_GROUP_STATUS, "Request Group Status" },
573 { 0x00, NULL }
576 /*--- 5.19 Read Partition ----- */
577 #define READ_PARTITION_OPTYPE_QUERY 0x02
578 #define READ_PARTITION_OPTYPE_QUERY_LIST 0x03
579 #define READ_PARTITION_OPTYPE_READ_MODIFIED_ALL 0x6E
580 #define READ_PARTITION_OPTYPE_READ_BUFFER 0xF2
581 #define READ_PARTITION_OPTYPE_READ_MODIFIED 0xF6
583 static const value_string vals_read_partition_operation_type[] = {
584 { READ_PARTITION_OPTYPE_QUERY, "Read Partition Query" },
585 { READ_PARTITION_OPTYPE_QUERY_LIST, "Read Partition Query List" },
586 { READ_PARTITION_OPTYPE_READ_MODIFIED_ALL, "Read Partition Read Modified All" },
587 { READ_PARTITION_OPTYPE_READ_BUFFER, "Read Partition Read Buffer" },
588 { READ_PARTITION_OPTYPE_READ_MODIFIED, "Read Partition Read Modified" },
589 { 0x00, NULL }
592 #define READ_PARTITION_REQTYPE_MASK 0xC0
593 static const value_string vals_read_partition_reqtype[] = {
594 { 0x00, "QCODE List" },
595 { 0x01, "Equivalent + QCODE List" },
596 { 0x02, "All" },
597 { 0x00, NULL }
600 /*--- 5.34 Data Chain ----- */
601 #define DATA_CHAIN_GROUP_MASK 0x60
602 #define DATA_CHAIN_INBOUND_CONTROL_MASK 0x18
604 static const value_string vals_data_chain_group[] = {
605 { 0x00, "Continue" },
606 { 0x01, "End" },
607 { 0x02, "Begin" },
608 { 0x03, "Only" },
609 { 0x00, NULL }
612 static const value_string vals_data_chain_inbound_control[] = {
613 { 0x00, "No Change" },
614 { 0x01, "Enable Inbound Data Chaining" },
615 { 0x02, "Disable Inbound Data Chaining" },
616 { 0x03, "Reserved" },
617 { 0x00, NULL }
620 /*--- 5.35 Destination or Origin ----- */
621 #define DESTINATION_OR_ORIGIN_FLAGS_INPUT_CONTROL_MASK 0xC0
623 static const value_string vals_destination_or_origin_flags_input_control[] = {
624 { 0x00, "Enable input" },
625 { 0x01, "No Change" },
626 { 0x02, "Disable Input" },
627 { 0x03, "Reserved" },
628 { 0x00, NULL }
632 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */
635 ______ _______ ________ _______
636 | | | | |
637 | AID | Cursor address | Data |
638 | | (2 bytes) | |
639 | | | | |
640 |______|_______|________|_______|
642 An inbound data stream can also consist of an AID (X'88') followed by
643 structured fields as follows:
644 ______ __________________ ________ ___________________
645 | | | | |
646 | AID | Structured Field | ...... | Structured Field |
647 | 0x88 | | | |
648 |______|__________________|________|___________________|
653 /*--- 3.5.6 Attention Identification Bytes (AID) ----- */
654 #define AID_NO_AID_GENERATED 0x60
655 #define AID_NO_AID_GENERATED_PRINTER_ONLY 0xE8
656 #define AID_STRUCTURED_FIELD 0x88
657 #define AID_READ_PARTITION_AID 0x61
658 #define AID_TRIGGER_ACTION 0x7F
659 #define AID_TEST_REQ_AND_SYS_REQ 0xF0
660 #define AID_PF1_KEY 0xF1
661 #define AID_PF2_KEY 0xF2
662 #define AID_PF3_KEY 0xF3
663 #define AID_PF4_KEY 0xF4
664 #define AID_PF5_KEY 0xF5
665 #define AID_PF6_KEY 0xF6
666 #define AID_PF7_KEY 0xF7
667 #define AID_PF8_KEY 0xF8
668 #define AID_PF9_KEY 0xF9
669 #define AID_PF10_KEY 0x7A
670 #define AID_PF11_KEY 0x7B
671 #define AID_PF12_KEY 0x7C
672 #define AID_PF13_KEY 0xC1
673 #define AID_PF14_KEY 0xC2
674 #define AID_PF15_KEY 0xC3
675 #define AID_PF16_KEY 0xC4
676 #define AID_PF17_KEY 0xC5
677 #define AID_PF18_KEY 0xC6
678 #define AID_PF19_KEY 0xC7
679 #define AID_PF20_KEY 0xC8
680 #define AID_PF21_KEY 0xC9
681 #define AID_PF22_KEY 0x4A
682 #define AID_PF23_KEY 0x4B
683 #define AID_PF24_KEY 0x4C
684 #define AID_PA1_KEY 0x6C
685 #define AID_PA2_KEY_CNCL 0x6E
686 #define AID_PA3_KEY 0x6B
687 #define AID_CLEAR_KEY 0x6D
688 #define AID_CLEAR_PARTITION_KEY 0x6A
689 #define AID_ENTER_KEY 0x7D
690 #define AID_SELECTOR_PEN_ATTENTION 0x7E
691 #define AID_OPERATOR_ID_READER 0xE6
692 #define AID_MAG_READER_NUMBER 0xE7
694 static const value_string vals_attention_identification_bytes[] = {
695 { AID_NO_AID_GENERATED, "No AID generated" },
696 { AID_NO_AID_GENERATED_PRINTER_ONLY, "No AID generated (printer only)" },
697 { AID_STRUCTURED_FIELD, "Structured field" },
698 { AID_READ_PARTITION_AID, "Read partition" },
699 { AID_TRIGGER_ACTION, "Trigger action" },
700 { AID_TEST_REQ_AND_SYS_REQ, "Test Req and Sys Req" },
701 { AID_PF1_KEY, "PF1 key" },
702 { AID_PF2_KEY, "PF2 key" },
703 { AID_PF3_KEY, "PF3 key" },
704 { AID_PF4_KEY, "PF4 key" },
705 { AID_PF5_KEY, "PF5 key" },
706 { AID_PF6_KEY, "PF6 key" },
707 { AID_PF7_KEY, "PF7 key" },
708 { AID_PF8_KEY, "PF8 key" },
709 { AID_PF9_KEY, "PF9 key" },
710 { AID_PF10_KEY, "PF10 key" },
711 { AID_PF11_KEY, "PF11 key" },
712 { AID_PF12_KEY, "PF12 key" },
713 { AID_PF13_KEY, "PF13 key" },
714 { AID_PF14_KEY, "PF14 key" },
715 { AID_PF15_KEY, "PF15 key" },
716 { AID_PF16_KEY, "PF16 key" },
717 { AID_PF17_KEY, "PF17 key" },
718 { AID_PF18_KEY, "PF18 key" },
719 { AID_PF19_KEY, "PF19 key" },
720 { AID_PF20_KEY, "PF20 key" },
721 { AID_PF21_KEY, "PF21 key" },
722 { AID_PF22_KEY, "PF22 key" },
723 { AID_PF23_KEY, "PF23 key" },
724 { AID_PF24_KEY, "PF24 key" },
725 { AID_PA1_KEY, "PA1 key" },
726 { AID_PA2_KEY_CNCL, "PA2 key (Cncl)" },
727 { AID_PA3_KEY, "PA3 key" },
728 { AID_CLEAR_KEY, "Clear key" },
729 { AID_CLEAR_PARTITION_KEY, "Clear Partition key" },
730 { AID_ENTER_KEY, "Enter key" },
731 { AID_SELECTOR_PEN_ATTENTION, "Selector pen attention" },
732 { AID_OPERATOR_ID_READER, "Operator ID reader" },
733 { AID_MAG_READER_NUMBER, "Mag Reader Number" },
734 { 0x00, NULL }
737 /*--- 5.3.6 Object Control ----- */
738 #define OBJC_GRAPHICS 0x00
739 #define OBJC_IMAGE 0x01
741 static const value_string vals_oc_type[] = {
742 { OBJC_GRAPHICS, "Graphics" },
743 { OBJC_IMAGE, "Image)" },
744 { 0x00, NULL }
747 /*--- 6.1 Inbound Structured Fields ----- */
748 #define SF_IB_EXCEPTION_OR_STATUS 0x0F22
749 #define SF_IB_INBOUND_TEXT_HEADER 0x0FB1
750 #define SF_IB_INBOUND_3270DS 0x0F80 /* TODO: Check */
751 #define SF_IB_RECOVERY_DATA 0x1031
752 #define SF_IB_TYPE_1_TEXT_INBOUND 0x0FC1
753 #define SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS 0x8184
754 #define SF_IB_QUERY_REPLY_AUXILIARY_DEVICE 0x8199
755 #define SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE 0x819F
756 #define SF_IB_QUERY_REPLY_CHARACTER_SETS 0x8185
757 #define SF_IB_QUERY_REPLY_COLOR 0x8186
758 #define SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR 0x81AB
759 #define SF_IB_QUERY_REPLY_DATA_CHAINING 0x8198
760 #define SF_IB_QUERY_REPLY_DATA_STREAMS 0x81A2
761 #define SF_IB_QUERY_REPLY_DBCS_ASIA 0x8191
762 #define SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS 0x81A0
763 #define SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT 0x8195
764 #define SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE 0x8197
765 #define SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE 0x81B5
766 #define SF_IB_QUERY_REPLY_FIELD_OUTLINING 0x818C
767 #define SF_IB_QUERY_REPLY_FIELD_VALIDATION 0x818A
768 #define SF_IB_QUERY_REPLY_FORMAT_PRESENTATION 0x8190
769 #define SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE 0x8194
770 #define SF_IB_QUERY_REPLY_GRAPHIC_COLOR 0x81B4
771 #define SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS 0x81B6
772 #define SF_IB_QUERY_REPLY_HIGHLIGHTING 0x8187
773 #define SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE 0x819E
774 #define SF_IB_QUERY_REPLY_IMAGE 0x8182
775 #define SF_IB_QUERY_REPLY_IMPLICIT_PARTITION 0x81A6
776 #define SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE 0x81AA
777 #define SF_IB_QUERY_REPLY_LINE_TYPE 0x81B2
778 #define SF_IB_QUERY_REPLY_MSR_CONTROL 0x818B
779 #define SF_IB_QUERY_REPLY_NULL 0x81FF
780 #define SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE 0x818F
781 #define SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES 0x81A7
782 #define SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS 0x818E
783 #define SF_IB_QUERY_REPLY_PORT 0x81B3
784 #define SF_IB_QUERY_REPLY_PROCEDURE 0x81B1
785 #define SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM 0x819C
786 #define SF_IB_QUERY_REPLY_REPLY_MODES 0x8188
787 #define SF_IB_QUERY_REPLY_RPQ_NAMES 0x81A1
788 #define SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT 0x8192
789 #define SF_IB_QUERY_REPLY_SEGMENT 0x81B0
790 #define SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS 0x81A9
791 #define SF_IB_QUERY_REPLY_STORAGE_POOLS 0x8196
792 #define SF_IB_QUERY_REPLY_SUMMARY 0x8180
793 #define SF_IB_QUERY_REPLY_TEXT_PARTITIONS 0x8183
794 #define SF_IB_QUERY_REPLY_TRANSPARENCY 0x81A8
795 #define SF_IB_QUERY_REPLY_USABLE_AREA 0x8181
796 #define SF_IB_QUERY_REPLY_3270_IPDS 0x819A
798 static const value_string vals_inbound_structured_fields[] = {
799 { SF_IB_EXCEPTION_OR_STATUS, "Exception/Status" },
800 { SF_IB_INBOUND_TEXT_HEADER, "Inbound Text Header" },
801 { SF_IB_INBOUND_3270DS, "Inbound 3270DS" },
802 { SF_IB_RECOVERY_DATA, "Recovery Data" },
803 { SF_IB_TYPE_1_TEXT_INBOUND, "Type 1 Text Inbound" },
804 { SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS, "Query Reply (Alphanumeric Partitions)" },
805 { SF_IB_QUERY_REPLY_AUXILIARY_DEVICE, "Query Reply (Auxiliary Device)" },
806 { SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE, "Query Reply (Begin/End of File)" },
807 { SF_IB_QUERY_REPLY_CHARACTER_SETS, "Query Reply (Character Sets)" },
808 { SF_IB_QUERY_REPLY_COLOR, "Query Reply (Color)" },
809 { SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR, "Query Reply (Cooperative Processing Requestor)" },
810 { SF_IB_QUERY_REPLY_DATA_CHAINING, "Query Reply (Data Chaining)" },
811 { SF_IB_QUERY_REPLY_DATA_STREAMS, "Query Reply (Data Streams)" },
812 { SF_IB_QUERY_REPLY_DBCS_ASIA, "Query Reply (DBCS-Asia)" },
813 { SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS, "Query Reply (Device Characteristics)" },
814 { SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT, "Query Reply (Distributed Data Management)" },
815 { SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE, "Query Reply (Document Interchange Architecture)" },
816 { SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE, "Query Reply (Extended Drawing Routine)" },
817 { SF_IB_QUERY_REPLY_FIELD_OUTLINING, "Query Reply (Field Outlining)" },
818 { SF_IB_QUERY_REPLY_FIELD_VALIDATION, "Query Reply (Field Validation)" },
819 { SF_IB_QUERY_REPLY_FORMAT_PRESENTATION, "Query Reply (Format Presentation)" },
820 { SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE, "Query Reply (Format Storage Auxiliary Device)" },
821 { SF_IB_QUERY_REPLY_GRAPHIC_COLOR, "Query Reply (Graphic Color)" },
822 { SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS, "Query Reply (Graphic Symbol Sets)" },
823 { SF_IB_QUERY_REPLY_HIGHLIGHTING, "Query Reply (Highlighting)" },
824 { SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE, "Query Reply (IBM Auxiliary Device)" },
825 { SF_IB_QUERY_REPLY_IMAGE, "Query Reply (Image)" },
826 { SF_IB_QUERY_REPLY_IMPLICIT_PARTITION, "Query Reply (Implicit Partition)" },
827 { SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE, "Query Reply (IOCA Auxiliary Device)" },
828 { SF_IB_QUERY_REPLY_LINE_TYPE, "Query Reply (Line Type)" },
829 { SF_IB_QUERY_REPLY_MSR_CONTROL, "Query Reply (MSR Control)" },
830 { SF_IB_QUERY_REPLY_NULL, "Query Reply (Null)" },
831 { SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE, "Query Reply (OEM Auxiliary Device)" },
832 { SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES, "Query Reply (Paper Feed Techniques)" },
833 { SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS, "Query Reply (Partition Characteristics)" },
834 { SF_IB_QUERY_REPLY_PORT, "Query Reply (Port)" },
835 { SF_IB_QUERY_REPLY_PROCEDURE, "Query Reply (Procedure)" },
836 { SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM, "Query Reply (Product Defined Data Stream)" },
837 { SF_IB_QUERY_REPLY_REPLY_MODES, "Query Reply (Reply Modes)" },
838 { SF_IB_QUERY_REPLY_RPQ_NAMES, "Query Reply (RPQ Names)" },
839 { SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT, "Query Reply (Save/Restore Format)" },
840 { SF_IB_QUERY_REPLY_SEGMENT, "Query Reply (Segment)" },
841 { SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS, "Query Reply (Settable Printer Characteristics)" },
842 { SF_IB_QUERY_REPLY_STORAGE_POOLS, "Query Reply (Storage Pools)" },
843 { SF_IB_QUERY_REPLY_SUMMARY, "Query Reply (Summary)" },
844 { SF_IB_QUERY_REPLY_TEXT_PARTITIONS, "Query Reply (Text Partitions)" },
845 { SF_IB_QUERY_REPLY_TRANSPARENCY, "Query Reply (Transparency)" },
846 { SF_IB_QUERY_REPLY_USABLE_AREA, "Query Reply (Usable Area)" },
847 { SF_IB_QUERY_REPLY_3270_IPDS, "Query Reply (3270 IPDS)." },
848 { 0x00, NULL }
851 /*--- 6.2 - Exception/Status ----- */
852 #define SDP_STATCODE_ACKNOWLEDGED 0x0000
853 #define SDP_STATCODE_AUXDEVICEAVAIL 0X0001
855 static const value_string vals_sdp_statcode[] = {
856 { SDP_STATCODE_ACKNOWLEDGED, "Acknowledged. The formats were successfully loaded, and no exception occurred." },
857 { SDP_STATCODE_AUXDEVICEAVAIL, "Auxiliary device available" },
858 { 0x00, NULL }
861 #define SDP_EXCODE_INVALID_DOID 0x0801
862 #define SDP_EXCODE_DEVICENOTAVAIL 0X0802
863 #define SDP_EXCODE_RETIRED 0X0803
864 #define SDP_EXCODE_BUFFER_OVERRUN 0X0804
865 #define SDP_EXCODE_STORAGE 0X0805
866 #define SDP_EXCODE_FORMATNOTSPEC 0X0806
867 #define SDP_EXCODE_DATAERROR 0X0807
868 #define SDP_EXCODE_INSUFFRESOURCE 0X084B
869 #define SDP_EXCODE_EXCEEDSLIMIT 0X084C
870 #define SDP_EXCODE_FUNCTNOTSUPP 0X1003
872 static const value_string vals_sdp_excode[] = {
873 { SDP_EXCODE_INVALID_DOID,
874 "Invalid/unrecognized DOID in the Destination/Origin structured field."
875 " AVAILSTAT must be set to B'0'." },
876 { SDP_EXCODE_DEVICENOTAVAIL,
877 "DOID valid, but the auxiliary device is not available because of an"
878 " intervention required condition (for example, out of paper, power"
879 " off, or processing code not resident). Available status is sent"
880 " when the condition clears. AVAILSTAT must be set to B'1'." },
881 { SDP_EXCODE_RETIRED,
882 "Retired." },
883 { SDP_EXCODE_BUFFER_OVERRUN,
884 "Buffer overrun." },
885 { SDP_EXCODE_STORAGE,
886 "Insufficient storage. The loading of the formats could not be"
887 " completed because storage was exhausted." },
888 { SDP_EXCODE_FORMATNOTSPEC,
889 "The format or group name was not specified in the Load Format"
890 " Storage structured field." },
891 { SDP_EXCODE_DATAERROR,
892 "Data error." },
893 { SDP_EXCODE_INSUFFRESOURCE,
894 "Temporary insufficient resource. The application does not have"
895 " a buffer available or is busy. The device chooses whether to"
896 " set send status when the condition clears and set AVAILSTAT accordingly." },
897 { SDP_EXCODE_EXCEEDSLIMIT,
898 "The auxiliary device data in the transmission exceeds the limit specified"
899 " in the LIMOUT parameter of the Query Reply for the auxiliary device."
900 " AVAILSTAT must be set to B'0'." },
901 { SDP_EXCODE_FUNCTNOTSUPP,
902 "Function not supported." },
903 { 0x00, NULL }
906 /* Query Reply Types */
907 #define SF_QR_ALPHANUMERIC_PARTITIONS 0x84
908 #define SF_QR_AUXILIARY_DEVICE 0x99
909 #define SF_QR_QBEGIN_OR_END_OF_FILE 0x9F
910 #define SF_QR_CHARACTER_SETS 0x85
911 #define SF_QR_COLOR 0x86
912 #define SF_QR_COOPERATIVE_PROCESSING_REQUESTOR 0xAB
913 #define SF_QR_DATA_CHAINING 0x98
914 #define SF_QR_DATA_STREAMS 0xA2
915 #define SF_QR_DBCS_ASIA 0x91
916 #define SF_QR_DEVICE_CHARACTERISTICS 0xA0
917 #define SF_QR_DISTRIBUTED_DATA_MANAGEMENT 0x95
918 #define SF_QR_DOCUMENT_INTERCHANGE_ARCHITECTURE 0x97
919 #define SF_QR_EXTENDED_DRAWING_ROUTINE 0xB5
920 #define SF_QR_QFIELD_OUTLINING 0x8C
921 #define SF_QR_QFIELD_VALIDATION 0x8A
922 #define SF_QR_FORMAT_PRESENTATION 0x90
923 #define SF_QR_FORMAT_STORAGE_AUXILIARY_DEVICE 0x94
924 #define SF_QR_GRAPHIC_COLOR 0xB4
925 #define SF_QR_GRAPHIC_SYMBOL_SETS 0xB6
926 #define SF_QR_HIGHLIGHTING 0x87
927 #define SF_QR_IBM_AUXILIARY_DEVICE 0x9E
928 #define SF_QR_IMAGE 0x82
929 #define SF_QR_IMPLICIT_PARTITION 0xA6
930 #define SF_QR_IOCA_AUXILIARY_DEVICE 0xAA
931 #define SF_QR_LINE_TYPE 0xB2
932 #define SF_QR_MSR_CONTROL 0x8B
933 #define SF_QR_QNULL 0xFF
934 #define SF_QR_OEM_AUXILIARY_DEVICE 0x8F
935 #define SF_QR_PAPER_FEED_TECHNIQUES 0xA7
936 #define SF_QR_PARTITION_CHARACTERISTICS 0x8E
937 #define SF_QR_PORT 0xB3
938 #define SF_QR_PROCEDURE 0xB1
939 #define SF_QR_PRODUCT_DEFINED_DATA_STREAM 0x9C
940 #define SF_QR_REPLY_MODES 0x88
941 #define SF_QR_RPQ_NAMES 0xA1
942 #define SF_QR_QSAVE_OR_RESTORE_FORMAT 0x92
943 #define SF_QR_SEGMENT 0xB0
944 #define SF_QR_SETTABLE_PRINTER_CHARACTERISTICS 0xA9
945 #define SF_QR_STORAGE_POOLS 0x96
946 #define SF_QR_SUMMARY 0x80
947 #define SF_QR_TEXT_PARTITIONS 0x83
948 #define SF_QR_QTRANSPARENCY 0xA8
949 #define SF_QR_USABLE_AREA 0x81
950 #define SF_QR_T3270_IPDS 0x9A
952 static const value_string vals_sf_query_replies[] = {
953 { SF_QR_ALPHANUMERIC_PARTITIONS, "Alphanumeric Partitions" },
954 { SF_QR_AUXILIARY_DEVICE, "Auxiliary Device" },
955 { SF_QR_QBEGIN_OR_END_OF_FILE, "Begin/End of File" },
956 { SF_QR_CHARACTER_SETS, "Character Sets" },
957 { SF_QR_COLOR, "Color" },
958 { SF_QR_COOPERATIVE_PROCESSING_REQUESTOR, "Cooperative Processing Requestor" },
959 { SF_QR_DATA_CHAINING, "Data Chaining" },
960 { SF_QR_DATA_STREAMS, "Data Streams" },
961 { SF_QR_DBCS_ASIA, "DBCS-Asia" },
962 { SF_QR_DEVICE_CHARACTERISTICS, "Device Characteristics" },
963 { SF_QR_DISTRIBUTED_DATA_MANAGEMENT, "Distributed Data Management" },
964 { SF_QR_DOCUMENT_INTERCHANGE_ARCHITECTURE, "Document Interchange Architecture" },
965 { SF_QR_EXTENDED_DRAWING_ROUTINE, "Extended Drawing Routine" },
966 { SF_QR_QFIELD_OUTLINING, "Field Outlining" },
967 { SF_QR_QFIELD_VALIDATION, "Field Validation" },
968 { SF_QR_FORMAT_PRESENTATION, "Format Presentation" },
969 { SF_QR_FORMAT_STORAGE_AUXILIARY_DEVICE, "Format Storage Auxiliary Device" },
970 { SF_QR_GRAPHIC_COLOR, "Graphic Color" },
971 { SF_QR_GRAPHIC_SYMBOL_SETS, "Graphic Symbol Sets" },
972 { SF_QR_HIGHLIGHTING, "Highlighting" },
973 { SF_QR_IBM_AUXILIARY_DEVICE, "IBM Auxiliary Device" },
974 { SF_QR_IMAGE, "Image" },
975 { SF_QR_IMPLICIT_PARTITION, "Implicit Partition" },
976 { SF_QR_IOCA_AUXILIARY_DEVICE, "IOCA Auxiliary Device" },
977 { SF_QR_LINE_TYPE, "Line Type" },
978 { SF_QR_MSR_CONTROL, "MSR Control" },
979 { SF_QR_QNULL, "Null" },
980 { SF_QR_OEM_AUXILIARY_DEVICE, "OEM Auxiliary Device" },
981 { SF_QR_PAPER_FEED_TECHNIQUES, "Paper Feed Techniques" },
982 { SF_QR_PARTITION_CHARACTERISTICS, "Partition Characteristics" },
983 { SF_QR_PORT, "Port" },
984 { SF_QR_PROCEDURE, "Procedure" },
985 { SF_QR_PRODUCT_DEFINED_DATA_STREAM, "Product Defined Data Stream" },
986 { SF_QR_REPLY_MODES, "Reply Modes" },
987 { SF_QR_RPQ_NAMES, "RPQ Names" },
988 { SF_QR_QSAVE_OR_RESTORE_FORMAT, "Save/Restore Format" },
989 { SF_QR_SEGMENT, "Segment" },
990 { SF_QR_SETTABLE_PRINTER_CHARACTERISTICS, "Settable Printer Characteristics" },
991 { SF_QR_STORAGE_POOLS, "Storage Pools" },
992 { SF_QR_SUMMARY, "Summary" },
993 { SF_QR_TEXT_PARTITIONS, "Text Partitions" },
994 { SF_QR_QTRANSPARENCY, "Transparency" },
995 { SF_QR_USABLE_AREA, "Usable Area" },
996 { SF_QR_T3270_IPDS, "3270 IPDS." },
997 { 0x00, NULL }
1000 /*--- 6.9 Query Reply Alphanumeric Partitions ----- */
1001 #define QR_AP_VERTWIN 0x80
1002 #define QR_AP_HORWIN 0x40
1003 #define QR_AP_APRES1 0x20
1004 #define QR_AP_APA_FLG 0x10
1005 #define QR_AP_PROT 0x08
1006 #define QR_AP_LCOPY 0x04
1007 #define QR_AP_MODPART 0x02
1008 #define QR_AP_APRES2 0x01
1010 /*--- 6.12 - Query Reply (Character Sets) ----- */
1011 #define QR_CS_ALT 0x80
1012 #define QR_CS_MULTID 0x40
1013 #define QR_CS_LOADABLE 0x20
1014 #define QR_CS_EXT 0x10
1015 #define QR_CS_MS 0x08
1016 #define QR_CS_CH2 0x04
1017 #define QR_CS_GF 0x02
1018 #define QR_CS_CSRES 0x01
1020 #define QR_CS_CSRES2 0x80
1021 #define QR_CS_PSCS 0x40
1022 #define QR_CS_CSRES3 0x20
1023 #define QR_CS_CF 0x10
1024 #define QR_CS_CSRES4 0x08
1025 #define QR_CS_CSRES5 0x04
1026 #define QR_CS_GCSRES6 0x02
1027 #define QR_CS_CSRES7 0x01
1030 /*--- 6.15 Query Reply (Data Chaining) ----- */
1031 static const value_string vals_data_chaining_dir[] = {
1032 { 0x00, "Both" },
1033 { 0x01, "From device only" },
1034 { 0x02, "To device only" },
1035 { 0x00, NULL }
1038 /*--- 6.16 Query Reply (Data Streams) ----- */
1039 #define QR_DS_SCS 0x00
1040 #define QR_DS_DCAL2 0x01
1041 #define QR_DS_IPDS 0x02
1043 static const value_string vals_data_streams[] = {
1044 { QR_DS_SCS,
1045 "SCS Base Data Stream with extensions as specified in the BIND request"
1046 " and Device Characteristics Query Reply structured field" },
1047 { QR_DS_DCAL2,
1048 "Document Content Architecture Level 2" },
1049 { QR_DS_IPDS,
1050 "IPDS as defined in related documentation" },
1051 { 0x00, NULL }
1054 /*--- 6.51 Query Reply Usable Area ----- */
1055 #define QR_UA_RESERVED1 0x80
1056 #define QR_UA_PAGE_PRINTER 0x40
1057 #define QR_UA_RESERVED2 0x20
1058 #define QR_UA_HARD_COPY 0x10
1060 #define QR_UA_ADDR_MODE_MASK 0x0F
1061 #define QR_UA_ADDR_MODE_RESERVED1 0x00
1062 #define QR_UA_ADDR_MODE_TWELVE_FOURTEEN_BIT_OK 0x01
1063 #define QR_UA_ADDR_MODE_RESERVED2 0x02
1064 #define QR_UA_ADDR_MODE_TWELVE_FOURTEEN_SXTN_BIT_OK 0x03
1065 #define QR_UA_ADDR_MODE_UNMAPPED 0x0F
1067 static const value_string vals_usable_area_addr_mode[] = {
1068 { QR_UA_ADDR_MODE_RESERVED1, "Reserved" },
1069 { QR_UA_ADDR_MODE_TWELVE_FOURTEEN_BIT_OK, "Twelve/Fourteen Bit Addressing Allowed" },
1070 { QR_UA_ADDR_MODE_RESERVED2, "Reserved" },
1071 { QR_UA_ADDR_MODE_TWELVE_FOURTEEN_SXTN_BIT_OK , "Twelve/Fourteen/Sixteen Bit Addressing Allowed" },
1072 { QR_UA_ADDR_MODE_UNMAPPED, "Unmapped" },
1073 { 0x00, NULL }
1076 #define QR_UA_VARIABLE_CELLS 0x80
1077 #define QR_UA_CHARACTERS 0x40
1078 #define QR_UA_CELL_UNITS 0x20
1080 static const struct true_false_string tn3270_tfs_ua_variable_cells = {
1081 "Supported",
1082 "Not supported"
1085 static const struct true_false_string tn3270_tfs_ua_characters = {
1086 "Non-matrix character",
1087 "Matrix character"
1090 static const struct true_false_string tn3270_tfs_ua_cell_units = {
1091 "Pels",
1092 "Cells"
1096 #define QR_UA_UOM_INCHES 0x00
1097 #define QR_UA_UOM_MILLIMETERS 0x01
1099 static const value_string vals_usable_area_uom[] = {
1100 { QR_UA_UOM_INCHES, "Inches" },
1101 { QR_UA_UOM_MILLIMETERS, "Millimeters" },
1102 { 0x00, NULL }
1105 /*--- 6.42 - Query reply (Reply Modes) ----- */
1106 /* Also for: 5.30 - Set Reply Mode */
1108 #define RM_REPLY_FIELD_MODE 0x00
1109 #define RM_REPLY_EXTENDED_FIELD_MODE 0x01
1110 #define RM_REPLY_CHARACTER_MODE 0x02
1112 static const value_string vals_reply_modes[] = {
1113 { RM_REPLY_FIELD_MODE, "Field Mode" },
1114 { RM_REPLY_EXTENDED_FIELD_MODE, "Extended Field Mode" },
1115 { RM_REPLY_CHARACTER_MODE, "Character Mode" },
1116 { 0x00, NULL }
1119 /*--- 6.19 - Query Reply (Distributed Data Management) ----- */
1120 #define QR_DDM_COPY_SUBSET_1 0x01
1122 static const value_string vals_qr_ddm[] = {
1123 { QR_DDM_COPY_SUBSET_1, "DDM Copy Subset 1" },
1124 { 0x00, NULL }
1127 /*--- 6.20 - Query Reply (Document Interchange Architecture) ----- */
1128 #define QR_DIA_FILE_SERVER 0x01
1129 #define QR_DIA_FILE_REQ 0x02
1130 #define QR_DIA_FILE_SERVER_REQ 0x03
1132 static const value_string vals_qr_dia[] = {
1133 { QR_DIA_FILE_SERVER, "File Server" },
1134 { QR_DIA_FILE_REQ, "File Requestor" },
1135 { QR_DIA_FILE_SERVER_REQ, "Both File Server and File Requestor" },
1136 { 0x00, NULL }
1139 /*--- 6.31 - Query Reply (Implicit Partitions) ----- */
1140 #define QR_IP_SDP_DISPLAY 0x01
1141 #define QR_IP_SDP_PRINTER 0x02
1142 #define QR_IP_SDP_CHARACTER 0x03
1144 #if 0
1145 static const value_string vals_qr_ip[] = {
1146 { QR_IP_SDP_DISPLAY, "Display Devices" },
1147 { QR_IP_SDP_PRINTER, "Printer Devices" },
1148 { QR_IP_SDP_CHARACTER, "Character Devices" },
1149 { 0x00, NULL }
1151 #endif
1153 /*--- 6.41 - Query Reply (Product Defined Data Streams) ----- */
1154 #define QR_PDDS_REFID_GRAPH5080 0x01
1155 #define QR_PDDS_REFID_WHIPAPI 0x02
1157 static const value_string vals_qr_pdds_refid[] = {
1158 { QR_PDDS_REFID_GRAPH5080, "Supports the 5080 Graphics System" },
1159 { QR_PDDS_REFID_WHIPAPI, "Supports the WHIP API data stream" },
1160 { 0x00, NULL }
1163 #define QR_PDDS_SSID_HFGD 0x01
1164 #define QR_PDDS_SSID_RS232 0x02
1166 static const value_string vals_qr_pdds_ssid[] = {
1167 { QR_PDDS_SSID_HFGD , "5080 HFGD Graphics Subset" },
1168 { QR_PDDS_SSID_RS232, "5080 RS232 Ports Subset" },
1169 { 0x00, NULL }
1172 /*--- 6.47 - Query Reply (Storage Pools) ----- */
1173 #define QR_SP_OBJ_SEGMENT1 0x0001
1174 #define QR_SP_OBJ_PROCEDURE1 0x0002
1175 #define QR_SP_OBJ_EXTENDED_DRAWING 0x0003
1176 #define QR_SP_OBJ_DATA_UNIT 0x0004
1177 #define QR_SP_OBJ_TEMPORARY 0x0005
1178 #define QR_SP_OBJ_LINE_TYPE1 0x0006
1179 #define QR_SP_OBJ_SYMBOL_SET 0x0007
1181 static const value_string vals_sp_objlist[] = {
1182 { QR_SP_OBJ_SEGMENT1, "Segment" },
1183 { QR_SP_OBJ_PROCEDURE1, "Procedure" },
1184 { QR_SP_OBJ_EXTENDED_DRAWING, "Extended drawing routine" },
1185 { QR_SP_OBJ_DATA_UNIT, "Data unit" },
1186 { QR_SP_OBJ_TEMPORARY, "Temporary" },
1187 { QR_SP_OBJ_LINE_TYPE1, "Line type" },
1188 { QR_SP_OBJ_SYMBOL_SET, "Symbol set" },
1189 { 0x00, NULL }
1192 /* TN3270E Header - Data Type */
1193 #define TN3270E_3270_DATA 0x00
1194 #define TN3270E_BIND_IMAGE 0x03
1195 #define TN3270E_NVT_DATA 0x05
1196 #define TN3270E_REQUEST 0x06
1197 #define TN3270E_RESPONSE 0x02
1198 #define TN3270E_SCS_DATA 0x01
1199 #define TN3270E_SSCP_LU_DATA 0x07
1200 #define TN3270E_UNBIND 0x04
1202 static const value_string vals_tn3270_header_data_types[] = {
1203 { TN3270E_3270_DATA, "3270_DATA" },
1204 { TN3270E_BIND_IMAGE, "BIND_IMAGE" },
1205 { TN3270E_NVT_DATA, "NVT_DATA" },
1206 { TN3270E_REQUEST, "REQUEST" },
1207 { TN3270E_RESPONSE, "RESPONSE" },
1208 { TN3270E_SCS_DATA, "SCS_DATA" },
1209 { TN3270E_SSCP_LU_DATA, "SSCP_LU_DATA" },
1210 { TN3270E_UNBIND, "UNBIND" },
1211 { 0x00, NULL }
1215 /* TN3270E Header - Request Flags */
1216 #define TN3270E_COND_CLEARED 0x00
1218 static const value_string vals_tn3270_header_request_flags[] = {
1219 { TN3270E_COND_CLEARED, "Condition Cleared" },
1220 { 0x00, NULL }
1223 /* TN3270E Header - Response Flags - Data Type 3270 and SCS */
1224 #define TN3270E_NO_RESPONSE 0x00
1225 #define TN3270E_ERROR_RESPONSE 0x01
1226 #define TN3270E_ALWAYS_RESPONSE 0x02
1228 static const value_string vals_tn3270_header_response_flags_3270_SCS[] = {
1229 { TN3270E_NO_RESPONSE, "No-Response" },
1230 { TN3270E_ERROR_RESPONSE, "Error-Response" },
1231 { TN3270E_ALWAYS_RESPONSE, "Always-Response" },
1232 { 0x00, NULL }
1235 /* TN3270E Header _ Response Flags - Data Type Response */
1236 #define TN3270E_POSITIVE_RESPONSE 0x00
1237 #define TN3270E_NEGATIVE_RESPONSE 0x01
1239 static const value_string vals_tn3270_header_response_flags_response[] = {
1240 { TN3270E_POSITIVE_RESPONSE, "Positive-Response" },
1241 { TN3270E_NEGATIVE_RESPONSE, "Negative-Response" },
1242 { 0x00, NULL }
1246 * Data structure attached to a conversation, giving authentication
1247 * information from a bind request.
1249 typedef struct tn3270_conv_info_t {
1250 address outbound_addr;
1251 guint32 outbound_port;
1252 address inbound_addr;
1253 guint32 inbound_port;
1254 gint extended;
1255 guint8 altrows;
1256 guint8 altcols;
1257 guint8 rows;
1258 guint8 cols;
1259 } tn3270_conv_info_t;
1262 static int proto_tn3270 = -1;
1264 static int hf_tn3270_fa_display = -1;
1265 static int hf_tn3270_fa_graphic_convert = -1;
1266 static int hf_tn3270_fa_modified = -1;
1267 static int hf_tn3270_fa_numeric = -1;
1268 static int hf_tn3270_fa_protected = -1;
1269 static int hf_tn3270_fa_reserved = -1;
1270 static int hf_tn3270_field_attribute = -1;
1271 static int hf_tn3270_aid = -1;
1272 static int hf_tn3270_all_character_attributes = -1;
1273 static int hf_tn3270_attribute_type = -1;
1274 static int hf_tn3270_begin_end_flags1 = -1;
1275 static int hf_tn3270_begin_end_flags2 = -1;
1276 static int hf_tn3270_bsc = -1;
1277 static int hf_tn3270_buffer_address = -1;
1278 static int hf_tn3270_c_cav = -1;
1279 static int hf_tn3270_cc = -1;
1280 static int hf_tn3270_character_code = -1;
1281 static int hf_tn3270_character_set = -1;
1282 static int hf_tn3270_charset = -1;
1283 static int hf_tn3270_checkpoint = -1;
1284 static int hf_tn3270_c_ci = -1;
1285 static int hf_tn3270_c_offset = -1;
1286 static int hf_tn3270_color = -1;
1287 static int hf_tn3270_color_command = -1;
1288 static int hf_tn3270_color_flags = -1;
1289 static int hf_tn3270_command_code = -1;
1290 static int hf_tn3270_cro = -1;
1291 static int hf_tn3270_c_scsoff = -1;
1292 static int hf_tn3270_c_seqoff = -1;
1293 static int hf_tn3270_c_sequence = -1;
1294 static int hf_tn3270_cursor_address = -1;
1295 static int hf_tn3270_cw = -1;
1296 static int hf_tn3270_data_chain_fields = -1;
1297 static int hf_tn3270_data_chain_group = -1;
1298 static int hf_tn3270_data_chain_inbound_control = -1;
1299 static int hf_tn3270_destination_or_origin_flags_input_control = -1;
1300 static int hf_tn3270_destination_or_origin_doid = -1;
1301 static int hf_tn3270_erase_flags = -1;
1302 static int hf_tn3270_exception_or_status_flags = -1;
1303 static int hf_tn3270_extended_highlighting = -1;
1304 static int hf_tn3270_extended_ps_color = -1;
1305 static int hf_tn3270_extended_ps_echar = -1;
1306 static int hf_tn3270_extended_ps_flags = -1;
1307 static int hf_tn3270_extended_ps_length = -1;
1308 static int hf_tn3270_extended_ps_lw = -1;
1309 static int hf_tn3270_extended_ps_lh = -1;
1310 static int hf_tn3270_extended_ps_nh = -1;
1311 static int hf_tn3270_extended_ps_nw = -1;
1312 static int hf_tn3270_extended_ps_res = -1;
1313 static int hf_tn3270_extended_ps_stsubs = -1;
1314 static int hf_tn3270_extended_ps_subsn = -1;
1315 static int hf_tn3270_featl = -1;
1316 static int hf_tn3270_feats = -1;
1317 static int hf_tn3270_field_data = -1;
1318 static int hf_tn3270_field_outlining = -1;
1319 static int hf_tn3270_field_validation_mandatory_entry = -1;
1320 static int hf_tn3270_field_validation_mandatory_fill = -1;
1321 static int hf_tn3270_field_validation_trigger = -1;
1322 static int hf_tn3270_format_group = -1;
1323 static int hf_tn3270_format_name = -1;
1324 static int hf_tn3270_fov = -1;
1325 static int hf_tn3270_fpc = -1;
1326 static int hf_tn3270_hilite = -1;
1327 static int hf_tn3270_h_length = -1;
1328 static int hf_tn3270_h_offset = -1;
1329 static int hf_tn3270_horizon = -1;
1330 static int hf_tn3270_h_sequence = -1;
1331 static int hf_tn3270_hw = -1;
1332 static int hf_tn3270_interval = -1;
1333 static int hf_tn3270_limin = -1;
1334 static int hf_tn3270_limout = -1;
1335 static int hf_tn3270_lines = -1;
1336 static int hf_tn3270_load_color_command = -1;
1337 static int hf_tn3270_load_format_storage_flags1 = -1;
1338 static int hf_tn3270_load_format_storage_flags2 = -1;
1339 static int hf_tn3270_load_format_storage_format_data = -1;
1340 static int hf_tn3270_load_format_storage_localname = -1;
1341 static int hf_tn3270_load_format_storage_operand = -1;
1342 static int hf_tn3270_load_line_type_command = -1;
1343 static int hf_tn3270_lvl = -1;
1344 static int hf_tn3270_mode = -1;
1345 static int hf_tn3270_msr_ind_mask = -1;
1346 static int hf_tn3270_msr_ind_value = -1;
1347 static int hf_tn3270_msr_state_mask = -1;
1348 static int hf_tn3270_msr_state_value = -1;
1349 static int hf_tn3270_msr_type = -1;
1350 static int hf_tn3270_ap_na = -1;
1351 static int hf_tn3270_ap_m = -1;
1352 static int hf_tn3270_ap_vertical_scrolling = -1;
1353 static int hf_tn3270_ap_horizontal_scrolling = -1;
1354 static int hf_tn3270_ap_apres1 = -1;
1355 static int hf_tn3270_ap_apa = -1;
1356 static int hf_tn3270_ap_pp = -1;
1357 static int hf_tn3270_ap_lc = -1;
1358 static int hf_tn3270_ap_mp = -1;
1359 static int hf_tn3270_ap_apres2 = -1;
1360 static int hf_tn3270_c_np = -1;
1361 static int hf_tn3270_number_of_attributes = -1;
1362 static int hf_tn3270_object_control_flags = -1;
1363 static int hf_tn3270_object_type = -1;
1364 static int hf_tn3270_order_code = -1;
1365 static int hf_tn3270_outbound_text_header_operation_type = -1;
1366 static int hf_tn3270_outbound_text_header_hdr = -1;
1367 static int hf_tn3270_outbound_text_header_lhdr = -1;
1368 static int hf_tn3270_pages = -1;
1369 static int hf_tn3270_partition_command = -1;
1370 static int hf_tn3270_partition_cv = -1;
1371 static int hf_tn3270_partition_cw = -1;
1372 static int hf_tn3270_partition_flags = -1;
1373 static int hf_tn3270_partition_height = -1;
1374 static int hf_tn3270_partition_hv = -1;
1375 static int hf_tn3270_partition_id = -1;
1376 static int hf_tn3270_partition_ph = -1;
1377 static int hf_tn3270_partition_pw = -1;
1378 static int hf_tn3270_partition_res = -1;
1379 static int hf_tn3270_partition_rs = -1;
1380 static int hf_tn3270_partition_rv = -1;
1381 static int hf_tn3270_partition_rw = -1;
1382 static int hf_tn3270_partition_uom = -1;
1383 static int hf_tn3270_partition_width = -1;
1384 static int hf_tn3270_partition_wv = -1;
1385 static int hf_tn3270_prime = -1;
1386 static int hf_tn3270_printer_flags = -1;
1387 static int hf_tn3270_ps_char = -1;
1388 static int hf_tn3270_ps_flags = -1;
1389 static int hf_tn3270_ps_lcid = -1;
1390 static int hf_tn3270_ps_rws = -1;
1391 static int hf_tn3270_query_reply_alphanumeric_flags = -1;
1392 static int hf_tn3270_recovery_data_flags = -1;
1393 static int hf_tn3270_reply_mode_attr_list = -1;
1394 static int hf_tn3270_read_partition_operation_type = -1;
1395 static int hf_tn3270_read_partition_reqtyp = -1;
1396 static int hf_tn3270_resbyte = -1;
1397 static int hf_tn3270_resbytes = -1;
1398 static int hf_tn3270_res_twobytes = -1;
1399 static int hf_tn3270_rw = -1;
1400 static int hf_tn3270_save_or_restore_format_flags = -1;
1401 static int hf_tn3270_scs_data = -1;
1402 static int hf_tn3270_sf_single_byte_id = -1;
1403 static int hf_tn3270_sf_double_byte_id = -1;
1404 static int hf_tn3270_sf_length = -1;
1405 static int hf_tn3270_sf_query_reply = -1;
1406 static int hf_tn3270_sld = -1;
1407 static int hf_tn3270_spd = -1;
1408 static int hf_tn3270_start_line = -1;
1409 static int hf_tn3270_start_page = -1;
1410 static int hf_tn3270_stop_address = -1;
1411 static int hf_tn3270_transparency = -1;
1412 static int hf_tn3270_type_1_text_outbound_data = -1;
1413 static int hf_tn3270_vertical = -1;
1414 static int hf_tn3270_v_length = -1;
1415 static int hf_tn3270_v_offset = -1;
1416 static int hf_tn3270_v_sequence = -1;
1417 static int hf_tn3270_wcc_nop = -1;
1418 static int hf_tn3270_wcc_reset = -1;
1419 static int hf_tn3270_wcc_printer1 = -1;
1420 static int hf_tn3270_wcc_printer2 = -1;
1421 static int hf_tn3270_wcc_start_printer = -1;
1422 static int hf_tn3270_wcc_sound_alarm = -1;
1423 static int hf_tn3270_wcc_keyboard_restore = -1;
1424 static int hf_tn3270_wcc_reset_mdt = -1;
1425 static int hf_tn3270_ww = -1;
1426 static int hf_tn3270_tn3270e_data_type = -1;
1427 static int hf_tn3270_tn3270e_request_flag = -1;
1428 static int hf_tn3270_tn3270e_response_flag_3270_SCS = -1;
1429 static int hf_tn3270_tn3270e_response_flag_response = -1;
1430 static int hf_tn3270_tn3270e_response_flag_unused = -1;
1431 static int hf_tn3270_tn3270e_seq_number = -1;
1432 static int hf_tn3270_tn3270e_header_data = -1;
1433 static int hf_tn3270_ua_cell_units = -1;
1434 static int hf_tn3270_ua_characters = -1;
1435 static int hf_tn3270_ua_hard_copy = -1;
1436 static int hf_tn3270_ua_page_printer = -1;
1437 static int hf_tn3270_ua_reserved1 = -1;
1438 static int hf_tn3270_ua_reserved2 = -1;
1439 static int hf_tn3270_ua_variable_cells = -1;
1440 static int hf_tn3270_usable_area_flags1 = -1;
1441 static int hf_tn3270_usable_area_flags2 = -1;
1442 static int hf_tn3270_ua_addressing = -1;
1443 static int hf_tn3270_ua_width_cells_pels = -1;
1444 static int hf_tn3270_ua_height_cells_pels = -1;
1445 static int hf_tn3270_ua_uom_cells_pels = -1;
1446 static int hf_tn3270_ua_xr = -1;
1447 static int hf_tn3270_ua_yr = -1;
1448 static int hf_tn3270_ua_aw = -1;
1449 static int hf_tn3270_ua_ah = -1;
1450 static int hf_tn3270_ua_buffsz = -1;
1451 static int hf_tn3270_ua_xmin = -1;
1452 static int hf_tn3270_ua_ymin = -1;
1453 static int hf_tn3270_ua_xmax = -1;
1454 static int hf_tn3270_ua_ymax = -1;
1455 static int hf_tn3270_cs_ge = -1;
1456 static int hf_tn3270_cs_mi = -1;
1457 static int hf_tn3270_cs_lps = -1;
1458 static int hf_tn3270_cs_lpse = -1;
1459 static int hf_tn3270_cs_ms = -1;
1460 static int hf_tn3270_cs_ch2 = -1;
1461 static int hf_tn3270_cs_gf = -1;
1462 static int hf_tn3270_cs_res = -1;
1463 static int hf_tn3270_cs_res2 = -1;
1464 static int hf_tn3270_cs_pscs = -1;
1465 static int hf_tn3270_cs_res3 = -1;
1466 static int hf_tn3270_cs_cf = -1;
1467 static int hf_tn3270_cs_form_type1 = -1;
1468 static int hf_tn3270_cs_form_type2 = -1;
1469 static int hf_tn3270_cs_form_type3 = -1;
1470 static int hf_tn3270_cs_form_type4 = -1;
1471 static int hf_tn3270_cs_form_type5 = -1;
1472 static int hf_tn3270_cs_form_type6 = -1;
1473 static int hf_tn3270_cs_form_type8 = -1;
1474 static int hf_tn3270_cs_ds_load = -1;
1475 static int hf_tn3270_cs_ds_triple = -1;
1476 static int hf_tn3270_cs_ds_char = -1;
1477 static int hf_tn3270_cs_ds_cb = -1;
1478 static int hf_tn3270_character_sets_flags1 = -1;
1479 static int hf_tn3270_character_sets_flags2 = -1;
1480 static int hf_tn3270_sdw = -1;
1481 static int hf_tn3270_sdh = -1;
1482 static int hf_tn3270_form = -1;
1483 static int hf_tn3270_formres = -1;
1484 static int hf_tn3270_cs_dl = -1;
1485 static int hf_tn3270_cs_descriptor_set = -1;
1486 static int hf_tn3270_cs_descriptor_flags = -1;
1487 static int hf_tn3270_lcid = -1;
1488 static int hf_tn3270_sw = -1;
1489 static int hf_tn3270_sh = -1;
1490 static int hf_tn3270_ssubsn = -1;
1491 static int hf_tn3270_esubsn = -1;
1492 static int hf_tn3270_ccsgid = -1;
1493 static int hf_tn3270_ccsid = -1;
1494 static int hf_tn3270_c_prtblk = -1;
1495 static int hf_tn3270_h_np = -1;
1496 static int hf_tn3270_h_vi = -1;
1497 static int hf_tn3270_h_ai = -1;
1498 static int hf_tn3270_ddm_flags = -1;
1499 static int hf_tn3270_ddm_limin = -1;
1500 static int hf_tn3270_ddm_limout = -1;
1501 static int hf_tn3270_ddm_nss = -1;
1502 static int hf_tn3270_ddm_ddmss = -1;
1503 static int hf_tn3270_rpq_device = -1;
1504 static int hf_tn3270_rpq_mid = -1;
1505 static int hf_tn3270_rpq_rpql = -1;
1506 static int hf_tn3270_rpq_name = -1;
1507 static int hf_tn3270_ip_flags = -1;
1508 static int hf_tn3270_ipdd_wd = -1;
1509 static int hf_tn3270_ipdd_hd = -1;
1510 static int hf_tn3270_ipdd_wa = -1;
1511 static int hf_tn3270_ipdd_ha = -1;
1512 static int hf_tn3270_ippd_dpbs = -1;
1513 static int hf_tn3270_ippd_apbs = -1;
1514 static int hf_tn3270_ipccd_wcd = -1;
1515 static int hf_tn3270_ipccd_hcd = -1;
1516 static int hf_tn3270_ipccd_wca = -1;
1517 static int hf_tn3270_ipccd_hca = -1;
1518 static int hf_tn3270_dc_dir = -1;
1519 static int hf_tn3270_oem_dsref = -1;
1520 static int hf_tn3270_oem_dtype = -1;
1521 static int hf_tn3270_oem_uname = -1;
1522 static int hf_tn3270_sdp_daid = -1;
1523 static int hf_tn3270_oem_sdp_ll_limin = -1;
1524 static int hf_tn3270_oem_sdp_ll_limout = -1;
1525 static int hf_tn3270_oem_sdp_pclk_vers = -1;
1526 static int hf_tn3270_null = -1;
1527 static int hf_tn3270_unknown_data = -1;
1528 static int hf_tn3270_ds_default_sfid = -1;
1529 static int hf_tn3270_ds_sfid = -1;
1530 static int hf_tn3270_asia_sdp_sosi_soset = -1;
1531 static int hf_tn3270_asia_sdp_ic_func = -1;
1532 static int hf_tn3270_ccc = -1;
1533 static int hf_tn3270_ccc_coding = -1;
1534 static int hf_tn3270_ccc_printout = -1;
1535 static int hf_tn3270_ccc_start_print = -1;
1536 static int hf_tn3270_ccc_sound_alarm = -1;
1537 static int hf_tn3270_ccc_copytype = -1;
1538 static int hf_tn3270_msr_user = -1;
1539 static int hf_tn3270_msr_locked = -1;
1540 static int hf_tn3270_msr_auto = -1;
1541 static int hf_tn3270_msr_ind1 = -1;
1542 static int hf_tn3270_msr_ind2 = -1;
1543 static int hf_tn3270_spc_sdp_ot = -1;
1544 static int hf_tn3270_spc_sdp_ob = -1;
1545 static int hf_tn3270_spc_sdp_ol = -1;
1546 static int hf_tn3270_spc_sdp_or = -1;
1547 static int hf_tn3270_spc_sdp_eucflags = -1;
1548 static int hf_tn3270_spc_sdp_srepc = -1;
1549 static int hf_tn3270_srf_fpcb = -1;
1550 static int hf_tn3270_sdp_statcode = -1;
1551 static int hf_tn3270_sdp_excode = -1;
1552 static int hf_tn3270_sdp_ngl = -1;
1553 static int hf_tn3270_sdp_nml = -1;
1554 static int hf_tn3270_sdp_nlml = -1;
1555 static int hf_tn3270_sdp_stor = -1;
1556 static int hf_tn3270_ap_cm = -1;
1557 static int hf_tn3270_ap_ro = -1;
1558 static int hf_tn3270_ap_co = -1;
1559 static int hf_tn3270_ap_fo = -1;
1560 static int hf_tn3270_sdp_ln = -1;
1561 static int hf_tn3270_sdp_id = -1;
1562 static int hf_tn3270_db_cavdef = -1;
1563 static int hf_tn3270_db_cidef = -1;
1564 static int hf_tn3270_dia_flags = -1;
1565 static int hf_tn3270_dia_limin = -1;
1566 static int hf_tn3270_dia_limout = -1;
1567 static int hf_tn3270_dia_nfs = -1;
1568 static int hf_tn3270_dia_diafs = -1;
1569 static int hf_tn3270_dia_diafn = -1;
1570 static int hf_tn3270_fo_flags = -1;
1571 static int hf_tn3270_fo_vpos = -1;
1572 static int hf_tn3270_fo_hpos = -1;
1573 static int hf_tn3270_fo_hpos0 = -1;
1574 static int hf_tn3270_fo_hpos1 = -1;
1575 static int hf_tn3270_fsad_flags = -1;
1576 static int hf_tn3270_fsad_limin = -1;
1577 static int hf_tn3270_fsad_limout = -1;
1578 static int hf_tn3270_fsad_size = -1;
1579 static int hf_tn3270_ibm_flags = -1;
1580 static int hf_tn3270_ibm_limin = -1;
1581 static int hf_tn3270_ibm_limout = -1;
1582 static int hf_tn3270_ibm_type = -1;
1583 static int hf_tn3270_msr_nd = -1;
1584 static int hf_tn3270_pft_flags = -1;
1585 static int hf_tn3270_pft_tmo = -1;
1586 static int hf_tn3270_pft_bmo = -1;
1587 static int hf_tn3270_ioca_limin = -1;
1588 static int hf_tn3270_ioca_limout = -1;
1589 static int hf_tn3270_ioca_type = -1;
1590 static int hf_tn3270_pc_vo_thickness = -1;
1591 static int hf_tn3270_pdds_ssid = -1;
1592 static int hf_tn3270_pdds_refid = -1;
1593 static int hf_tn3270_srf_fpcbl = -1;
1594 static int hf_tn3270_spc_epc_flags = -1;
1595 static int hf_tn3270_sp_spid = -1;
1596 static int hf_tn3270_sp_size = -1;
1597 static int hf_tn3270_sp_space = -1;
1598 static int hf_tn3270_sp_objlist = -1;
1599 static int hf_tn3270_tp_nt = -1;
1600 static int hf_tn3270_tp_m = -1;
1601 static int hf_tn3270_tp_flags = -1;
1602 static int hf_tn3270_tp_ntt = -1;
1603 static int hf_tn3270_tp_tlist = -1;
1604 static int hf_tn3270_t_np = -1;
1605 static int hf_tn3270_t_vi = -1;
1606 static int hf_tn3270_t_ai = -1;
1607 static int hf_tn3270_3270_tranlim = -1;
1609 static gint ett_tn3270 = -1;
1610 static gint ett_tn3270e_hdr = -1;
1611 static gint ett_sf = -1;
1612 static gint ett_tn3270_field_attribute = -1;
1613 static gint ett_tn3270_field_validation = -1;
1614 static gint ett_tn3270_wcc = -1;
1615 static gint ett_tn3270_usable_area_flags1 = -1;
1616 static gint ett_tn3270_usable_area_flags2 = -1;
1617 static gint ett_tn3270_query_reply_alphanumeric_flags = -1;
1618 static gint ett_tn3270_character_sets_flags1 = -1;
1619 static gint ett_tn3270_character_sets_flags2 = -1;
1620 static gint ett_tn3270_character_sets_form = -1;
1621 static gint ett_tn3270_cs_descriptor_flags = -1;
1622 static gint ett_tn3270_color_flags = -1;
1623 static gint ett_tn3270_ccc = -1;
1624 static gint ett_tn3270_msr_state_mask = -1;
1625 static gint ett_tn3270_data_chain_fields = -1;
1626 static gint ett_tn3270_query_list = -1;
1628 static gint dissect_orders_and_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info);
1629 static gint dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint hf, tn3270_conv_info_t *tn3270_info);
1631 typedef struct hf_items {
1632 int *hf_idx_p;
1633 gint *bitmask_ett_idx_p;
1634 gint length;
1635 const gint **bitmask;
1636 const gint encoding;
1637 } hf_items;
1639 /* Utility Functions */
1641 static gint
1642 tn3270_add_hf_items(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
1643 const hf_items *fields)
1645 gint start = offset;
1646 gint i;
1648 for (i = 0; fields[i].hf_idx_p; i++) {
1649 if (fields[i].bitmask == 0) {
1650 proto_tree_add_item(tn3270_tree,
1651 *fields[i].hf_idx_p,
1652 tvb, offset,
1653 fields[i].length,
1654 fields[i].encoding);
1656 else {
1657 proto_tree_add_bitmask(tn3270_tree, tvb, offset, *fields[i].hf_idx_p,
1658 *fields[i].bitmask_ett_idx_p, fields[i].bitmask, ENC_BIG_ENDIAN);
1660 offset += fields[i].length;
1663 return (offset - start);
1667 * offset; tvb offset of next byte of data (first byte of unprocessed data);
1668 * start: tvb offset of beginning of data;
1669 * data_length: total length of data;
1671 static gint
1672 dissect_unknown_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint start,
1673 gint data_length)
1675 gint len_left;
1677 len_left = (data_length) - (offset - start);
1679 if (len_left > 0) {
1680 proto_tree_add_item(tn3270_tree, hf_tn3270_unknown_data,
1681 tvb, offset, len_left,
1682 ENC_NA);
1683 return len_left;
1686 return 0;
1689 static gint
1690 add_data_until_next_order_code(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1692 gint datalen = 0;
1693 gint length_remaining = tvb_reported_length_remaining(tvb, offset);
1695 /* XXX: From 4.3:
1696 * "All order codes have an EBCDIC value in the range of hexadecimal 00
1697 * (X'00') through hexadecimal 3F (X'3F'). Order codes with values in this
1698 * range but not defined in this chapter are rejected."
1699 * However, the code (as originally committed) treats a '0' order code as data.
1702 while (datalen < length_remaining) {
1703 guint order_code;
1704 order_code = tvb_get_guint8(tvb, offset + datalen);
1705 if ((order_code > 0) && (order_code <= OC_MAX))
1706 break;
1707 datalen += 1;
1710 if (datalen > 0) {
1711 /* XXX: Need to handle "Format Control Orders" ?? */
1712 proto_tree_add_item(tn3270_tree, hf_tn3270_field_data, tvb, offset,
1713 datalen, ENC_EBCDIC|ENC_NA);
1716 return datalen;
1719 static gint
1720 dissect_query_reply_resbytes(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
1721 gint sf_body_length)
1723 gint start = offset;
1725 static const hf_items fields[] = {
1726 { &hf_tn3270_res_twobytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
1727 { NULL, NULL, 0, NULL, 0 }
1731 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1732 fields);
1734 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1736 return (offset - start);
1739 static gint
1740 dissect_wcc(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1743 static const gint *wcc_fields[] = {
1744 &hf_tn3270_wcc_nop,
1745 &hf_tn3270_wcc_reset,
1746 &hf_tn3270_wcc_printer1,
1747 &hf_tn3270_wcc_printer2,
1748 &hf_tn3270_wcc_start_printer,
1749 &hf_tn3270_wcc_sound_alarm,
1750 &hf_tn3270_wcc_keyboard_restore,
1751 &hf_tn3270_wcc_reset_mdt,
1752 NULL
1755 /* Qualifier and DeviceType */
1756 proto_tree_add_bitmask_text(tn3270_tree, tvb, offset, 1, "Write Control Character: ", "None",
1757 ett_tn3270_wcc, wcc_fields, ENC_BIG_ENDIAN, 0);
1758 return 1;
1762 static gint
1763 dissect_3270_field_validation(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1765 gint start = offset;
1767 static const gint *byte[] = {
1768 &hf_tn3270_field_validation_mandatory_fill,
1769 &hf_tn3270_field_validation_mandatory_entry,
1770 &hf_tn3270_field_validation_trigger,
1771 NULL
1774 proto_tree_add_bitmask_text(tn3270_tree, tvb, 1, 1, "Field Validation: ",
1775 "None", ett_tn3270_field_validation, byte, ENC_BIG_ENDIAN, 0);
1777 offset += 1;
1779 return (offset - start);
1783 static gint
1784 dissect_3270_field_attribute(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1786 gint start = offset;
1788 static const gint *byte[] = {
1789 &hf_tn3270_fa_graphic_convert,
1790 &hf_tn3270_fa_protected,
1791 &hf_tn3270_fa_numeric,
1792 &hf_tn3270_fa_display,
1793 &hf_tn3270_fa_reserved,
1794 &hf_tn3270_fa_modified,
1795 NULL
1799 proto_tree_add_bitmask(tn3270_tree, tvb, offset, hf_tn3270_field_attribute,
1800 ett_tn3270_field_attribute, byte, ENC_BIG_ENDIAN);
1802 offset += 1;
1804 return (offset - start);
1807 /* 8.7 - Copy Control Code */
1808 static gint
1809 dissect_ccc(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
1811 gint start = offset;
1813 static const gint *byte[] = {
1814 &hf_tn3270_ccc_coding,
1815 &hf_tn3270_ccc_printout,
1816 &hf_tn3270_ccc_start_print,
1817 &hf_tn3270_ccc_sound_alarm,
1818 &hf_tn3270_ccc_copytype,
1819 NULL
1822 proto_tree_add_bitmask(tn3270_tree, tvb, offset, hf_tn3270_ccc,
1823 ett_tn3270_ccc, byte, ENC_BIG_ENDIAN);
1825 offset += 1;
1827 return (offset - start);
1830 /* End - Utility Functions */
1832 /* Start: Handle Structured Fields */
1834 /* --------------------------------------------------- */
1835 /* 5.0 Outbound/Inbound and Outbound Structured Fields */
1836 /* --------------------------------------------------- */
1838 /* 5.5 Activate Partition - Search for ACTIVATE_PARTITION */
1839 /* 5.6 Begin/End of File - Search for BEGIN_OR_END_OF_FILE */
1840 /* 5.7 Create Partition */
1841 static gint
1842 dissect_create_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1844 gint start = offset;
1846 static const hf_items fields[] = {
1847 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
1848 { &hf_tn3270_partition_uom, NULL, 1, NULL, ENC_BIG_ENDIAN },
1849 { &hf_tn3270_partition_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1850 { &hf_tn3270_partition_height, NULL, 2, NULL, ENC_BIG_ENDIAN },
1851 { &hf_tn3270_partition_width, NULL, 2, NULL, ENC_BIG_ENDIAN },
1852 { &hf_tn3270_partition_rv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1853 { &hf_tn3270_partition_cv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1854 { &hf_tn3270_partition_hv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1855 { &hf_tn3270_partition_wv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1856 { &hf_tn3270_partition_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1857 { &hf_tn3270_partition_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1858 { &hf_tn3270_partition_rs, NULL, 2, NULL, ENC_BIG_ENDIAN },
1859 { &hf_tn3270_partition_res, NULL, 2, NULL, ENC_BIG_ENDIAN },
1860 { &hf_tn3270_partition_pw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1861 { &hf_tn3270_partition_ph, NULL, 2, NULL, ENC_BIG_ENDIAN },
1862 { NULL, NULL, 0, NULL, 0 }
1866 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1867 fields);
1869 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1871 return (offset - start);
1874 /* 5.7 Create Partition - Search for CREATE_PARTITION */
1875 /* 5.8 Destroy Partition - Search for DESTROY_PARTITION */
1876 /* 5.9 Erase/Reset - Search for ERASE_OR_RESET */
1877 /* 5.10 Load Color Table - Search for LOAD_COLOR_TABLE */
1879 /* 5.11 Load Format Storage */
1880 static gint
1881 dissect_load_format_storage(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1883 gint start = offset;
1884 gint operand;
1886 static const hf_items fields[] = {
1887 { &hf_tn3270_load_format_storage_flags1, NULL, 1, NULL, ENC_BIG_ENDIAN },
1888 { &hf_tn3270_load_format_storage_flags2, NULL, 1, NULL, ENC_BIG_ENDIAN },
1889 { &hf_tn3270_load_format_storage_operand, NULL, 1, NULL, ENC_BIG_ENDIAN },
1890 { &hf_tn3270_load_format_storage_localname, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
1891 { &hf_tn3270_format_group, NULL, 6, NULL, ENC_EBCDIC|ENC_NA },
1892 { &hf_tn3270_format_name, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
1893 { NULL, NULL, 0, NULL, 0 }
1896 operand = tvb_get_guint8(tvb, offset+2);
1898 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1899 fields);
1901 if (operand == LOAD_FORMAT_STORAGE_OPERAND_ADD) {
1902 gint fmtln = sf_body_length - (offset - start);
1903 proto_tree_add_item(tn3270_tree, hf_tn3270_load_format_storage_format_data,
1904 tvb, offset, fmtln, ENC_EBCDIC|ENC_NA);
1905 offset += fmtln;
1908 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1910 return (offset - start);
1913 /* 5.12 Load Line Type - Search for LOAD_LINE_TYPE */
1915 /* 5.13 Load Programmed Symbols (Load PS) */
1916 static gint
1917 dissect_load_programmed_symbols(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1919 gint start = offset, i;
1920 gint8 flags;
1921 gint8 extended_ps_length;
1923 static const hf_items ps_fields[] = {
1924 { &hf_tn3270_ps_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1925 { &hf_tn3270_ps_lcid, NULL, 1, NULL, ENC_BIG_ENDIAN },
1926 { &hf_tn3270_ps_char, NULL, 1, NULL, ENC_BIG_ENDIAN },
1927 { &hf_tn3270_ps_rws, NULL, 1, NULL, ENC_BIG_ENDIAN },
1928 { NULL, NULL, 0, NULL, 0 }
1931 static const hf_items extended_ps_fields[] = {
1932 { &hf_tn3270_extended_ps_lw, NULL, 1, NULL, ENC_BIG_ENDIAN },
1933 { &hf_tn3270_extended_ps_lh, NULL, 1, NULL, ENC_BIG_ENDIAN },
1934 { &hf_tn3270_extended_ps_subsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
1935 { &hf_tn3270_extended_ps_color, NULL, 1, NULL, ENC_BIG_ENDIAN },
1936 { &hf_tn3270_extended_ps_stsubs, NULL, 1, NULL, ENC_BIG_ENDIAN },
1937 { &hf_tn3270_extended_ps_echar, NULL, 1, NULL, ENC_BIG_ENDIAN },
1938 { &hf_tn3270_extended_ps_nw, NULL, 1, NULL, ENC_BIG_ENDIAN },
1939 { &hf_tn3270_extended_ps_nh, NULL, 1, NULL, ENC_BIG_ENDIAN },
1940 { &hf_tn3270_extended_ps_res, NULL, 1, NULL, ENC_BIG_ENDIAN },
1941 { NULL, NULL, 0, NULL, 0 }
1944 flags = tvb_get_guint8(tvb, offset);
1945 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
1946 ps_fields);
1948 /*If extended flag not set return */
1949 if (!(flags & 0x80)) {
1950 return (offset - start);
1953 extended_ps_length = tvb_get_guint8(tvb, offset);
1954 proto_tree_add_item(tn3270_tree, hf_tn3270_extended_ps_length,
1955 tvb, offset, 1, ENC_BIG_ENDIAN);
1956 offset += 1;
1957 proto_tree_add_item(tn3270_tree, hf_tn3270_extended_ps_flags,
1958 tvb, offset, 1, ENC_BIG_ENDIAN);
1959 offset += 1;
1961 for (i = 0; i < extended_ps_length; ++i) {
1962 if (extended_ps_fields[i].hf_idx_p == NULL) {
1963 break; /* Malformed (Bad value for extended_ps_length) ! ToDo: 'expert' */
1965 proto_tree_add_item(tn3270_tree, *extended_ps_fields[i].hf_idx_p,
1966 tvb, offset, extended_ps_fields[i].length,
1967 extended_ps_fields[i].encoding);
1968 offset += extended_ps_fields[i].length;
1972 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
1974 return (offset - start);
1977 /* 5.14 Modify Partition) */
1978 static gint
1979 dissect_modify_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint sf_body_length)
1981 gint start = offset;
1983 static const hf_items fields[] = {
1984 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1985 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
1986 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1987 { &hf_tn3270_partition_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
1988 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
1989 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
1990 { &hf_tn3270_partition_rv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1991 { &hf_tn3270_partition_cv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1992 { &hf_tn3270_partition_hv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1993 { &hf_tn3270_partition_wv, NULL, 2, NULL, ENC_BIG_ENDIAN },
1994 { &hf_tn3270_partition_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1995 { &hf_tn3270_partition_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1996 { &hf_tn3270_partition_rs, NULL, 2, NULL, ENC_BIG_ENDIAN },
1997 { &hf_tn3270_partition_res, NULL, 2, NULL, ENC_BIG_ENDIAN },
1998 { &hf_tn3270_partition_pw, NULL, 2, NULL, ENC_BIG_ENDIAN },
1999 { &hf_tn3270_partition_ph, NULL, 2, NULL, ENC_BIG_ENDIAN },
2000 { NULL, NULL, 0, NULL, 0 }
2004 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2005 fields);
2007 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2009 return (offset - start);
2012 /* 5.15 Outbound Text Header */
2013 static gint
2014 dissect_outbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2015 gint sf_body_length)
2017 gint start = offset;
2018 gint16 hdr_length;
2020 static const hf_items outbound_text_header_fields1[] = {
2021 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2022 { &hf_tn3270_outbound_text_header_operation_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2023 { NULL, NULL, 0, NULL, 0 }
2026 static const hf_items outbound_text_header_fields2[] = {
2027 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2028 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2029 { &hf_tn3270_lvl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2030 { &hf_tn3270_cro, NULL, 2, NULL, ENC_BIG_ENDIAN },
2031 { &hf_tn3270_cc, NULL, 2, NULL, ENC_BIG_ENDIAN },
2032 { NULL, NULL, 0, NULL, 0 }
2035 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2036 outbound_text_header_fields1);
2037 offset += dissect_wcc(tn3270_tree, tvb, offset);
2038 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2039 outbound_text_header_fields2);
2041 hdr_length = tvb_get_ntohs(tvb, offset);
2043 proto_tree_add_item(tn3270_tree, hf_tn3270_outbound_text_header_lhdr,
2044 tvb, offset, 2, ENC_BIG_ENDIAN);
2045 offset += 2;
2047 proto_tree_add_item(tn3270_tree, hf_tn3270_outbound_text_header_hdr,
2048 tvb, offset, hdr_length, ENC_BIG_ENDIAN);
2049 offset += hdr_length;
2051 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2053 return (offset - start);
2056 /* 5.16 Outbound 3270DS */
2057 static gint
2058 dissect_outbound_3270ds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2059 tn3270_conv_info_t *tn3270_info, gint sf_body_length )
2061 gint start = offset;
2062 gint cmd;
2064 proto_tree_add_item(tn3270_tree,
2065 hf_tn3270_partition_id,
2066 tvb, offset,
2068 ENC_BIG_ENDIAN);
2069 offset += 1;
2071 cmd = tvb_get_guint8(tvb, offset);
2072 proto_tree_add_item(tn3270_tree,
2073 hf_tn3270_partition_command,
2074 tvb, offset,
2076 ENC_BIG_ENDIAN);
2077 offset += 1;
2079 switch (cmd) {
2080 case CC_SNA_BSC:
2081 /* FIXME: the spec is ambiguous at best about what to expect here,
2082 need a live sample to validate. */
2083 offset += dissect_ccc(tn3270_tree, tvb, offset);
2084 proto_tree_add_item(tn3270_tree,
2085 hf_tn3270_bsc,
2086 tvb, offset,
2088 ENC_BIG_ENDIAN);
2089 offset += 2;
2090 break;
2091 /* XXX: are "local" commands valid for Outbound 3270DS ? */
2092 case CC_LCL_W:
2093 case CC_LCL_EW:
2094 case CC_LCL_EWA:
2095 case CC_LCL_EAU:
2096 case CC_RMT_W:
2097 case CC_RMT_EW:
2098 case CC_RMT_EWA:
2099 case CC_RMT_EAU:
2100 /* WCC */
2101 if ((offset - start) < sf_body_length)
2102 offset += dissect_wcc(tn3270_tree, tvb, offset);
2103 if ((offset - start) < sf_body_length)
2104 offset += dissect_orders_and_data(tn3270_tree, tvb, offset, tn3270_info);
2105 break;
2106 default:
2107 break;
2110 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2112 return (offset - start);
2115 /* 5.17 Present Absolute Format */
2116 static gint
2117 dissect_present_absolute_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2118 gint sf_body_length)
2120 gint start = offset;
2122 proto_tree_add_item(tn3270_tree,
2123 hf_tn3270_partition_id,
2124 tvb, offset,
2126 ENC_BIG_ENDIAN);
2127 offset += 1;
2129 proto_tree_add_item(tn3270_tree,
2130 hf_tn3270_fpc,
2131 tvb, offset,
2133 ENC_BIG_ENDIAN);
2134 offset += 1;
2136 offset += dissect_wcc(tn3270_tree, tvb, offset);
2138 proto_tree_add_item(tn3270_tree,
2139 hf_tn3270_format_name,
2140 tvb, offset,
2141 sf_body_length - (offset - start),
2142 ENC_EBCDIC|ENC_NA);
2143 offset += (sf_body_length - (offset - start));
2145 return (offset - start);
2148 /* 5.18 Present Relative Format */
2149 static gint
2150 dissect_present_relative_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2151 gint sf_body_length)
2153 gint start = offset;
2155 proto_tree_add_item(tn3270_tree,
2156 hf_tn3270_partition_id,
2157 tvb, offset,
2159 ENC_BIG_ENDIAN);
2160 offset += 1;
2162 proto_tree_add_item(tn3270_tree,
2163 hf_tn3270_fov,
2164 tvb, offset,
2166 ENC_BIG_ENDIAN);
2167 offset += 2;
2169 proto_tree_add_item(tn3270_tree,
2170 hf_tn3270_fpc,
2171 tvb, offset,
2173 ENC_BIG_ENDIAN);
2174 offset += 1;
2176 offset += dissect_wcc(tn3270_tree, tvb, offset);
2178 proto_tree_add_item(tn3270_tree,
2179 hf_tn3270_format_name,
2180 tvb, offset,
2181 sf_body_length - (offset - start),
2182 ENC_EBCDIC|ENC_NA);
2183 offset += (sf_body_length - (offset - start));
2185 return (offset - start);
2188 /* 5.19 Read Partition */
2189 static gint
2190 dissect_read_partition(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2191 gint sf_body_length)
2193 gint start = offset;
2194 gint type;
2195 proto_item *pi;
2196 proto_tree *query_list_tree;
2197 gint qcode_list_len, i;
2199 proto_tree_add_item(tn3270_tree,
2200 hf_tn3270_partition_id,
2201 tvb, offset,
2203 ENC_BIG_ENDIAN);
2204 offset += 1;
2206 type = tvb_get_guint8(tvb, offset);
2207 if (type == 0xFF) { /* Partition ID of 0xFF is escaped with another 0xFF */
2208 /* XXX: removing tn3270 IAX escapes should be handled in the telnet dissector ! */
2209 offset += 1;
2210 type = tvb_get_guint8(tvb, offset);
2213 proto_tree_add_item(tn3270_tree,
2214 hf_tn3270_read_partition_operation_type,
2215 tvb, offset,
2217 ENC_BIG_ENDIAN);
2218 offset += 1;
2220 if (type == READ_PARTITION_OPTYPE_QUERY_LIST) { /* 'Query List' */
2221 proto_tree_add_item(tn3270_tree,
2222 hf_tn3270_read_partition_reqtyp,
2223 tvb, offset,
2225 ENC_BIG_ENDIAN);
2226 offset += 1;
2228 if (sf_body_length > (offset - start)) {
2229 qcode_list_len = sf_body_length - (offset - start);
2230 pi = proto_tree_add_text(tn3270_tree, tvb, offset, qcode_list_len,
2231 "Query List");
2232 query_list_tree = proto_item_add_subtree(pi, ett_tn3270_query_list);
2233 for (i = 0; i < qcode_list_len; i++) {
2234 proto_tree_add_item(query_list_tree,
2235 hf_tn3270_sf_query_reply,
2236 tvb, offset, 1, ENC_BIG_ENDIAN);
2237 offset += 1;
2242 return (offset - start);
2245 /*5.20 Request Recovery Data - Search for REQUEST_RECOVERY_DATA*/
2246 /*5.21 Reset Partition - Search for RESET_PARTITION */
2248 /*5.22 Restart */
2249 static gint
2250 dissect_restart(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2251 gint sf_body_length)
2253 gint start = offset;
2255 proto_tree_add_item(tn3270_tree,
2256 hf_tn3270_resbyte,
2257 tvb, offset,
2259 ENC_BIG_ENDIAN);
2260 offset += 1;
2262 proto_tree_add_item(tn3270_tree,
2263 hf_tn3270_start_page,
2264 tvb, offset,
2266 ENC_BIG_ENDIAN);
2267 offset += 2;
2269 proto_tree_add_item(tn3270_tree,
2270 hf_tn3270_start_line,
2271 tvb, offset,
2273 ENC_BIG_ENDIAN);
2274 offset += 2;
2277 proto_tree_add_item(tn3270_tree,
2278 hf_tn3270_scs_data,
2279 tvb, offset,
2280 sf_body_length - (offset - start),
2281 ENC_NA);
2282 offset += (sf_body_length - (offset - start));
2284 return (offset - start);
2287 /* 5.23 SCS Data - Search for SCS_DATA */
2288 /* 5.24 Color Table - Search for COLOR_TABLE */
2289 /* 5.25 Format Group - Search for FORMAT_GROUP */
2290 /* 5.26 Set Checkpoint Interval - Search for CHECKPOINT_INTERVAL */
2292 /* 5.27 Set MSR Control */
2293 static gint
2294 dissect_set_msr_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2295 gint sf_body_length)
2297 gint start = offset;
2299 static const gint *byte[] = {
2300 &hf_tn3270_msr_user,
2301 &hf_tn3270_msr_locked,
2302 &hf_tn3270_msr_auto,
2303 &hf_tn3270_msr_ind1,
2304 &hf_tn3270_msr_ind2,
2305 NULL
2308 static const hf_items outbound_text_header_fields[] = {
2309 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2310 { &hf_tn3270_msr_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2311 { &hf_tn3270_msr_state_mask, &ett_tn3270_msr_state_mask, 1, byte, 0 },
2312 { &hf_tn3270_msr_state_value, NULL, 1, NULL, ENC_BIG_ENDIAN },
2313 { &hf_tn3270_msr_ind_mask, NULL, 1, NULL, ENC_BIG_ENDIAN },
2314 { &hf_tn3270_msr_ind_value, NULL, 1, NULL, ENC_BIG_ENDIAN },
2315 { NULL, NULL, 0, NULL, 0 }
2319 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2320 outbound_text_header_fields);
2322 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2324 return (offset - start);
2327 /* 5.28 Set Partition Characteristics */
2328 static gint
2329 dissect_set_partition_characteristics_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2332 gint start = offset;
2333 guint16 sdp;
2335 static const hf_items sdp1[] = {
2336 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2337 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2338 { &hf_tn3270_spc_sdp_ot, NULL, 1, NULL, ENC_BIG_ENDIAN },
2339 { &hf_tn3270_spc_sdp_ob, NULL, 1, NULL, ENC_BIG_ENDIAN },
2340 { &hf_tn3270_spc_sdp_ol, NULL, 1, NULL, ENC_BIG_ENDIAN },
2341 { &hf_tn3270_spc_sdp_or, NULL, 1, NULL, ENC_BIG_ENDIAN },
2342 { NULL, NULL, 0, NULL, 0 }
2345 static const hf_items sdp2[] = {
2346 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2347 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2348 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2349 { NULL, NULL, 0, NULL, 0 }
2352 static const hf_items sdp3[] = {
2353 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2354 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2355 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2356 { &hf_tn3270_spc_sdp_eucflags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2357 { NULL, NULL, 0, NULL, 0 }
2361 sdp = tvb_get_ntohs(tvb, offset);
2363 switch (sdp) {
2364 case 0x0601: /*View Outport*/
2365 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2366 sdp1);
2367 break;
2368 case 0x0304: /*Enable User Call Up*/
2369 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2370 sdp2);
2371 break;
2372 case 0x0405: /*Select Base Character Set*/
2373 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2374 sdp3);
2375 break;
2376 default:
2377 return 0;
2380 return (offset - start);
2384 static gint
2385 dissect_set_partition_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2386 gint sf_body_length)
2389 gint start = offset;
2390 gint i;
2392 static const hf_items fields[] = {
2393 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2394 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
2395 { NULL, NULL, 0, NULL, 0 }
2399 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2400 fields);
2402 for (i = 0; i < 3; i++) {
2403 offset += dissect_set_partition_characteristics_sd_parms(tn3270_tree, tvb, offset);
2404 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2405 break;
2408 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2410 return (offset - start);
2413 /* 5.29 Set Printer Characteristics */
2414 static gint
2415 dissect_set_printer_characteristics_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2418 gint start = offset;
2419 guint16 sdp;
2421 static const hf_items sdp1[] = {
2422 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2423 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2424 { &hf_tn3270_spc_sdp_srepc, NULL, 1, NULL, ENC_BIG_ENDIAN },
2425 { NULL, NULL, 0, NULL, 0 }
2428 sdp = tvb_get_ntohs(tvb, offset);
2430 switch (sdp) {
2431 case 0x0301: /*Early Print Complete*/
2432 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2433 sdp1);
2434 break;
2435 default:
2436 return 0;
2439 return (offset - start);
2443 static gint
2444 dissect_set_printer_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2445 gint sf_body_length)
2448 gint start = offset;
2449 gint i;
2451 static const hf_items fields[] = {
2452 { &hf_tn3270_printer_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2453 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2454 { NULL, NULL, 0, NULL, 0 }
2457 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2458 fields);
2460 for (i = 0; i < 3; i++) {
2461 offset += dissect_set_printer_characteristics_sd_parms(tn3270_tree, tvb, offset);
2462 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2463 break;
2466 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2468 return (offset - start);
2472 /* 5.30 Set Reply Mode */
2473 static gint
2474 dissect_set_reply_mode(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2475 gint sf_body_length)
2477 gint start = offset;
2478 gint type;
2479 gint i;
2481 static const hf_items fields[] = {
2482 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2483 { &hf_tn3270_mode, NULL, 1, NULL, ENC_BIG_ENDIAN },
2484 { NULL, NULL, 0, NULL, 0 }
2487 type = tvb_get_guint8(tvb, offset+1);
2489 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2490 fields);
2492 if (type == 0x02) { /* 'Query List' */
2493 for (i = 0; i < (sf_body_length-(offset-start)); i++) {
2494 proto_tree_add_item(tn3270_tree,
2495 hf_tn3270_reply_mode_attr_list,
2496 tvb, offset, 1, ENC_BIG_ENDIAN);
2497 offset += 1;
2501 return (offset - start);
2504 /* 5.31 Set Window Origin - Search for SET_WINDOW_ORIGIN */
2505 /* 6.6 Type 1 Text Inbound
2506 5.32 Type 1 Text Outbound */
2507 static gint
2508 dissect_type_1_text(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2509 gint sf_body_length)
2511 gint start = offset;
2513 static const hf_items fields[] = {
2514 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2515 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
2516 { NULL, NULL, 0, NULL, 0 }
2519 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2520 fields);
2521 proto_tree_add_item(tn3270_tree,
2522 hf_tn3270_field_data,
2523 tvb, offset,
2524 sf_body_length - (offset - start),
2525 ENC_EBCDIC|ENC_NA);
2526 offset += (sf_body_length - (offset - start));
2528 return (offset - start);
2531 /* 5.34 Data Chain */
2532 static guint
2533 dissect_data_chain(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2534 gint sf_body_length)
2536 gint start = offset;
2538 static const gint *byte[] = {
2539 &hf_tn3270_data_chain_group,
2540 &hf_tn3270_data_chain_inbound_control,
2541 NULL
2544 static const hf_items data_chain_fields[] = {
2545 { &hf_tn3270_data_chain_fields, &ett_tn3270_data_chain_fields, 1, byte, 0 },
2546 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2547 { NULL, NULL, 0, NULL, 0 }
2550 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2551 data_chain_fields);
2553 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2555 return (offset - start);
2558 /* 5.35 Destination/Origin - Search for DESTINATION_OR_ORIGIN*/
2560 /* 5.36 Object Control */
2561 static gint
2562 dissect_object_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2563 gint sf_body_length)
2565 gint start = offset;
2567 static const hf_items fields[] = {
2568 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2569 { &hf_tn3270_object_control_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2570 { &hf_tn3270_object_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
2571 { NULL, NULL, 0, NULL, 0 }
2574 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2575 fields);
2577 proto_tree_add_item(tn3270_tree,
2578 hf_tn3270_type_1_text_outbound_data,
2579 tvb, offset,
2580 sf_body_length - (offset - start),
2581 ENC_NA);
2582 offset += (sf_body_length - (offset - start));
2584 return (offset - start);
2587 /* 5.37 Object Data - Search for OBJECT_DATA*/
2588 /* 5.38 Object Picture - Search for OBJECT_PICTURE */
2589 /* 5.39 OEM Data - Search for OEM_DATA */
2591 /* 5.40 Save/Restore Format */
2592 static gint
2593 dissect_save_or_restore_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2594 gint sf_body_length)
2596 gint start = offset;
2598 hf_items fields[] = {
2599 { &hf_tn3270_save_or_restore_format_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2600 { &hf_tn3270_srf_fpcb, NULL, sf_body_length-1, NULL, ENC_NA },
2601 { NULL, NULL, 0, NULL, 0 }
2604 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2605 fields);
2607 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2609 return (offset - start);
2612 /* 5.41 Select Intelligent Printer Data Stream (IPDS) Mode - Search for SELECT_IPDS_MODE*/
2614 /* -----------------------------------------*/
2615 /* 6.0 CHAPTER 6. INBOUND STRUCTURED FIELDS */
2616 /* -----------------------------------------*/
2618 /* 6.2 Exception/Status */
2619 static gint
2620 dissect_exception_or_status_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2623 gint start = offset;
2624 guint16 sdp;
2626 static const hf_items sdp1[] = {
2627 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2628 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2629 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2630 { &hf_tn3270_sdp_excode, NULL, 2, NULL, ENC_BIG_ENDIAN },
2631 { NULL, NULL, 0, NULL, 0 }
2634 static const hf_items sdp2[] = {
2635 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2636 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2637 { &hf_tn3270_sdp_statcode, NULL, 2, NULL, ENC_BIG_ENDIAN },
2638 { NULL, NULL, 0, NULL, 0 }
2641 static const hf_items sdp3[] = {
2642 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2643 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2644 { &hf_tn3270_format_group, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2645 { &hf_tn3270_format_name, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2646 { NULL, NULL, 0, NULL, 0 }
2649 static const hf_items sdp4[] = {
2650 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2651 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2652 { &hf_tn3270_sdp_ngl, NULL, 2, NULL, ENC_BIG_ENDIAN },
2653 { &hf_tn3270_sdp_nml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2654 { &hf_tn3270_sdp_nlml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2655 { &hf_tn3270_sdp_stor, NULL, 4, NULL, ENC_BIG_ENDIAN },
2656 { NULL, NULL, 0, NULL, 0 }
2659 static const hf_items sdp5[] = {
2660 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2661 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2662 { &hf_tn3270_format_group, NULL, 16, NULL, ENC_EBCDIC|ENC_NA },
2663 { &hf_tn3270_sdp_nml, NULL, 2, NULL, ENC_BIG_ENDIAN },
2664 { NULL, NULL, 0, NULL, 0 }
2667 sdp = tvb_get_ntohs(tvb, offset);
2669 switch (sdp) {
2670 case 0x0601: /*Auxiliary Device Exception*/
2671 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2672 sdp1);
2673 break;
2674 case 0x0402: /*Auxiliary Device status*/
2675 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2676 sdp2);
2677 break;
2678 case 0x2203: /*Failing Format status*/
2679 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2680 sdp3);
2681 break;
2682 case 0x0C04: /*Format status*/
2683 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2684 sdp4);
2685 break;
2686 case 0x1405: /*Group status*/
2687 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2688 sdp5);
2689 break;
2690 default:
2691 return 0;
2694 return (offset - start);
2698 static gint
2699 dissect_exception_or_status(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2700 gint sf_body_length)
2702 gint start = offset, i;
2704 static const hf_items fields[] = {
2705 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2706 { &hf_tn3270_exception_or_status_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2707 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2708 { NULL, NULL, 0, NULL, 0 }
2711 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2712 fields);
2714 for (i = 0; i < 5; i++) {
2715 offset += dissect_exception_or_status_sd_parms(tn3270_tree, tvb, offset);
2716 if (tvb_reported_length_remaining(tvb, offset) <= 0)
2717 break;
2720 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2722 return (offset - start);
2725 /* 6.3 Inbound Text Header */
2726 static gint
2727 dissect_inbound_text_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2728 gint sf_body_length)
2730 gint start = offset;
2732 static const hf_items outbound_text_header_fields[] = {
2733 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2734 { &hf_tn3270_aid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2735 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2736 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2737 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2738 { &hf_tn3270_lvl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2739 { &hf_tn3270_cro, NULL, 2, NULL, ENC_BIG_ENDIAN },
2740 { &hf_tn3270_cc, NULL, 2, NULL, ENC_BIG_ENDIAN },
2741 { &hf_tn3270_rw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2742 { &hf_tn3270_cw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2743 { &hf_tn3270_hw, NULL, 2, NULL, ENC_BIG_ENDIAN },
2744 { &hf_tn3270_ww, NULL, 2, NULL, ENC_BIG_ENDIAN },
2745 { NULL, NULL, 0, NULL, 0 }
2749 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2750 outbound_text_header_fields);
2752 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2754 return (offset - start);
2757 /* 6.4 Inbound 3270DS */
2758 static gint
2759 dissect_inbound_3270ds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2760 tn3270_conv_info_t *tn3270_info, gint sf_body_length)
2762 gint start = offset;
2764 static const hf_items fields1[] = {
2765 { &hf_tn3270_partition_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2766 { &hf_tn3270_aid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2767 { NULL, NULL, 0, NULL, 0 }
2770 hf_items fields2[] = {
2771 { &hf_tn3270_field_data, NULL, sf_body_length - 4, NULL, ENC_EBCDIC|ENC_NA },
2772 { NULL, NULL, 0, NULL, 0 }
2775 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset, fields1);
2776 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info);
2777 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset, fields2);
2779 return (offset - start);
2784 /* 6.5 Recovery Data */
2785 static gint
2786 dissect_recovery_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2787 gint sf_body_length)
2789 gint start = offset;
2792 static const hf_items fields[] = {
2793 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
2794 { &hf_tn3270_recovery_data_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
2795 { &hf_tn3270_sld, NULL, 1, NULL, ENC_BIG_ENDIAN },
2796 { &hf_tn3270_charset, NULL, 1, NULL, ENC_BIG_ENDIAN },
2797 { &hf_tn3270_vertical, NULL, 2, NULL, ENC_BIG_ENDIAN },
2798 { &hf_tn3270_v_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2799 { &hf_tn3270_v_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2800 { &hf_tn3270_v_length, NULL, 2, NULL, ENC_BIG_ENDIAN },
2801 { &hf_tn3270_spd, NULL, 2, NULL, ENC_BIG_ENDIAN },
2802 { &hf_tn3270_horizon, NULL, 2, NULL, ENC_BIG_ENDIAN },
2803 { &hf_tn3270_h_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2804 { &hf_tn3270_h_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2805 { &hf_tn3270_h_length, NULL, 2, NULL, ENC_BIG_ENDIAN },
2806 { &hf_tn3270_color, NULL, 1, NULL, ENC_BIG_ENDIAN },
2807 { &hf_tn3270_hilite, NULL, 1, NULL, ENC_BIG_ENDIAN },
2808 { &hf_tn3270_pages, NULL, 2, NULL, ENC_BIG_ENDIAN },
2809 { &hf_tn3270_lines, NULL, 2, NULL, ENC_BIG_ENDIAN },
2810 { &hf_tn3270_checkpoint, NULL, 2, NULL, ENC_BIG_ENDIAN },
2811 { &hf_tn3270_c_offset, NULL, 2, NULL, ENC_BIG_ENDIAN },
2812 { &hf_tn3270_c_sequence, NULL, 2, NULL, ENC_BIG_ENDIAN },
2813 { &hf_tn3270_c_seqoff, NULL, 2, NULL, ENC_BIG_ENDIAN },
2814 { &hf_tn3270_c_scsoff, NULL, 2, NULL, ENC_BIG_ENDIAN },
2815 { &hf_tn3270_prime, NULL, 1, NULL, ENC_BIG_ENDIAN },
2816 { NULL, NULL, 0, NULL, 0 }
2820 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2821 fields);
2823 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2825 return (offset - start);
2828 /* 6.6 Query Reply (Type 1 Text Inbound) - See above*/
2829 /* 6.7 and 6.8 Query Reply - Introductory Matter */
2831 /* 6.9 Query Reply (Alphanumeric Partitions) */
2832 static gint
2833 dissect_query_reply_alphanumeric_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
2836 gint start = offset;
2837 guint16 sdp;
2839 static const hf_items sdp1[] = {
2840 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
2841 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
2842 { &hf_tn3270_ap_cm, NULL, 1, NULL, ENC_BIG_ENDIAN },
2843 { &hf_tn3270_ap_ro, NULL, 1, NULL, ENC_BIG_ENDIAN },
2844 { &hf_tn3270_ap_co, NULL, 1, NULL, ENC_BIG_ENDIAN },
2845 { &hf_tn3270_ap_fo, NULL, 2, NULL, ENC_BIG_ENDIAN },
2846 { NULL, NULL, 0, NULL, 0 }
2850 sdp = tvb_get_ntohs(tvb, offset);
2852 switch (sdp) {
2853 case 0x0702: /*Buffer Allocation*/
2854 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2855 sdp1);
2856 break;
2857 default:
2858 return 0;
2861 return (offset - start);
2865 static gint
2866 dissect_query_reply_alphanumeric(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2867 gint sf_body_length)
2869 gint start = offset;
2871 static const gint *byte[] = {
2872 &hf_tn3270_ap_vertical_scrolling,
2873 &hf_tn3270_ap_horizontal_scrolling,
2874 &hf_tn3270_ap_apres1,
2875 &hf_tn3270_ap_apa,
2876 &hf_tn3270_ap_pp,
2877 &hf_tn3270_ap_lc,
2878 &hf_tn3270_ap_mp,
2879 &hf_tn3270_ap_apres2,
2880 NULL
2883 static const hf_items fields[] = {
2884 { &hf_tn3270_ap_na, NULL, 1, NULL, ENC_BIG_ENDIAN },
2885 { &hf_tn3270_ap_m, NULL, 2, NULL, ENC_BIG_ENDIAN },
2886 { &hf_tn3270_query_reply_alphanumeric_flags, &ett_tn3270_query_reply_alphanumeric_flags, 1, byte, 0 },
2887 { NULL, NULL, 0, NULL, 0 }
2890 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2891 fields);
2893 offset += dissect_query_reply_alphanumeric_sd_parms(tn3270_tree, tvb, offset);
2895 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
2897 return (offset - start);
2900 /* 6.10 Query Reply (Auxiliary Device) - Search for QUERY_REPLY_AUXILIARY_DEVICE */
2901 /* 6.11 Query Reply (BEGIN/End of File ) - Search for QUERY_REPLY_BEGIN_OR_END_OF_FILE */
2903 /* 6.12 Query Reply (Character Sets) */
2904 static gint
2905 dissect_query_reply_character_sets(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
2906 gint sf_body_length)
2908 gint start = offset;
2909 gint flagbyte1, flagbyte2;
2911 static const gint *byte1[] = {
2912 &hf_tn3270_cs_ge,
2913 &hf_tn3270_cs_mi,
2914 &hf_tn3270_cs_lps,
2915 &hf_tn3270_cs_lpse,
2916 &hf_tn3270_cs_ms,
2917 &hf_tn3270_cs_ch2,
2918 &hf_tn3270_cs_gf,
2919 &hf_tn3270_cs_res,
2920 NULL
2923 static const gint *byte2[] = {
2924 &hf_tn3270_cs_res2,
2925 &hf_tn3270_cs_pscs,
2926 &hf_tn3270_cs_res3,
2927 &hf_tn3270_cs_cf,
2928 NULL
2931 static const gint *byte3[] = {
2932 &hf_tn3270_cs_form_type1,
2933 &hf_tn3270_cs_form_type2,
2934 &hf_tn3270_cs_form_type3,
2935 &hf_tn3270_cs_form_type4,
2936 &hf_tn3270_cs_form_type5,
2937 &hf_tn3270_cs_form_type6,
2938 &hf_tn3270_cs_form_type8,
2939 NULL
2942 static const gint *byte4[] = {
2943 &hf_tn3270_cs_ds_load,
2944 &hf_tn3270_cs_ds_triple,
2945 &hf_tn3270_cs_ds_char,
2946 &hf_tn3270_cs_ds_cb,
2947 NULL
2951 static const hf_items fields[] = {
2952 { &hf_tn3270_character_sets_flags1, &ett_tn3270_character_sets_flags1, 1, byte1, 0 },
2953 { &hf_tn3270_character_sets_flags2, &ett_tn3270_character_sets_flags2, 1, byte2, 0 },
2954 { &hf_tn3270_sdw, NULL, 1, NULL, ENC_BIG_ENDIAN },
2955 { &hf_tn3270_sdh, NULL, 1, NULL, ENC_BIG_ENDIAN },
2956 { &hf_tn3270_form, &ett_tn3270_character_sets_form, 1, byte3, 0 },
2957 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2958 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2959 { &hf_tn3270_formres, NULL, 1, NULL, ENC_BIG_ENDIAN },
2960 { &hf_tn3270_cs_dl, NULL, 1, NULL, ENC_BIG_ENDIAN },
2961 { NULL, NULL, 0, NULL, 0 }
2964 static const hf_items descriptors[] = {
2965 { &hf_tn3270_cs_descriptor_set, NULL, 1, NULL, ENC_BIG_ENDIAN },
2966 { &hf_tn3270_cs_descriptor_flags, &ett_tn3270_cs_descriptor_flags, 1, byte4, 0 },
2967 { &hf_tn3270_lcid, NULL, 1, NULL, ENC_BIG_ENDIAN },
2968 { NULL, NULL, 0, NULL, 0 }
2971 static const hf_items sw_sh[] = {
2972 { &hf_tn3270_sw, NULL, 1, NULL, ENC_BIG_ENDIAN },
2973 { &hf_tn3270_sh, NULL, 1, NULL, ENC_BIG_ENDIAN },
2974 { NULL, NULL, 0, NULL, 0 }
2977 static const hf_items subsn[] = {
2978 { &hf_tn3270_ssubsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
2979 { &hf_tn3270_esubsn, NULL, 1, NULL, ENC_BIG_ENDIAN },
2980 { NULL, NULL, 0, NULL, 0 }
2983 static const hf_items gf[] = {
2984 { &hf_tn3270_ccsgid, NULL, 4, NULL, ENC_BIG_ENDIAN },
2985 { NULL, NULL, 0, NULL, 0 }
2988 static const hf_items cf[] = {
2989 { &hf_tn3270_ccsid, NULL, 2, NULL, ENC_BIG_ENDIAN },
2990 { NULL, NULL, 0, NULL, 0 }
2993 flagbyte1 = tvb_get_guint8(tvb, offset);
2994 flagbyte2 = tvb_get_guint8(tvb, offset+1);
2996 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
2997 fields);
2999 while ((offset - start) < sf_body_length) {
3001 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3002 descriptors);
3004 if (flagbyte1 & QR_CS_MS) {
3005 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3006 sw_sh);
3009 if (flagbyte1 & QR_CS_CH2) {
3010 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3011 subsn);
3014 if (flagbyte1 & QR_CS_GF) {
3015 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3016 gf);
3019 if (flagbyte2 & QR_CS_CF) {
3020 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3021 cf);
3024 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3026 return (offset - start);
3029 /* 6.13 Query Reply (Color) */
3030 static gint
3031 dissect_query_reply_color_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3034 gint start = offset;
3035 guint16 sdp;
3037 static const hf_items sdp1[] = {
3038 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3039 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3040 { &hf_tn3270_db_cavdef, NULL, 1, NULL, ENC_BIG_ENDIAN },
3041 { &hf_tn3270_db_cidef, NULL, 1, NULL, ENC_BIG_ENDIAN },
3042 { NULL, NULL, 0, NULL, 0 }
3046 sdp = tvb_get_ntohs(tvb, offset);
3048 switch (sdp) {
3049 case 0x0402: /*Default Background Color*/
3050 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3051 sdp1);
3052 break;
3053 default:
3054 return 0;
3057 return (offset - start);
3061 static gint
3062 dissect_query_reply_color(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3063 gint sf_body_length)
3065 gint start = offset;
3066 gint i;
3067 gint np;
3069 static const gint *byte[] = {
3070 &hf_tn3270_c_prtblk,
3071 NULL
3074 static const hf_items fields[] = {
3075 { &hf_tn3270_color_flags, &ett_tn3270_color_flags, 1, byte, 0 },
3076 { &hf_tn3270_c_np, NULL, 1, NULL, ENC_BIG_ENDIAN },
3077 { NULL, NULL, 0, NULL, 0 }
3081 np = tvb_get_guint8(tvb, offset +1);
3082 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3083 fields);
3085 for (i=0; i < np; i++) {
3086 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3087 offset += 1;
3089 proto_tree_add_item(tn3270_tree,
3090 hf_tn3270_c_cav,
3091 tvb, offset,
3093 ENC_BIG_ENDIAN);
3094 offset += 1;
3095 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3096 offset += 1;
3098 proto_tree_add_item(tn3270_tree,
3099 hf_tn3270_c_ci,
3100 tvb, offset,
3102 ENC_BIG_ENDIAN);
3103 offset += 1;
3105 offset += dissect_query_reply_color_sd_parms(tn3270_tree, tvb, offset);
3107 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3109 return (offset - start);
3113 /* 6.36 - Query Reply (OEM Auxiliary Device) Self-Defining Parameters */
3114 static gint
3115 dissect_daid_sd_parm(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3118 gint start = offset;
3120 static const hf_items sdp1[] = {
3121 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3122 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3123 { &hf_tn3270_sdp_daid, NULL, 2, NULL, ENC_BIG_ENDIAN },
3124 { NULL, NULL, 0, NULL, 0 }
3127 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3128 sdp1);
3129 return (offset - start);
3133 static gint
3134 dissect_pclk_sd_parm(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3137 gint start = offset;
3139 static const hf_items sdp1[] = {
3140 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3141 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3142 { &hf_tn3270_oem_sdp_pclk_vers, NULL, 2, NULL, ENC_BIG_ENDIAN },
3143 { NULL, NULL, 0, NULL, 0 }
3146 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3147 sdp1);
3148 return (offset - start);
3152 static gint
3153 dissect_query_reply_oem_auxiliary_device_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3156 gint start = offset;
3157 gint sdp_len;
3158 gint sdp;
3160 static const hf_items sdp1[] = {
3161 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3162 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3163 { &hf_tn3270_sdp_daid, NULL, 2, NULL, ENC_BIG_ENDIAN },
3164 { NULL, NULL, 0, NULL, 0 }
3167 static const hf_items sdp2[] = {
3168 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3169 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3170 { &hf_tn3270_oem_sdp_ll_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3171 { &hf_tn3270_oem_sdp_ll_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3173 { NULL, NULL, 0, NULL, 0 }
3176 static const hf_items sdp3[] = {
3177 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3178 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3179 { &hf_tn3270_oem_sdp_pclk_vers, NULL, 2, NULL, ENC_BIG_ENDIAN },
3180 { NULL, NULL, 0, NULL, 0 }
3184 sdp_len = tvb_get_guint8(tvb, offset);
3185 if ((sdp_len != 0x04) && (sdp_len != 0x06)) {
3186 return 0;
3189 sdp = tvb_get_guint8(tvb, offset+1);
3191 switch (sdp) {
3192 case 0x01:
3193 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3194 sdp1);
3195 break;
3196 case 0x02:
3197 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3198 sdp2);
3199 break;
3200 case 0x03:
3201 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3202 sdp3);
3203 break;
3204 default:
3205 return 0;
3208 return (offset - start);
3212 /* 6.14 - Query Reply (Cooperative Processing Requestor) */
3213 static gint
3214 dissect_query_reply_cooperative(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3215 gint sf_body_length)
3217 gint start = offset;
3219 static const hf_items fields[] = {
3220 { &hf_tn3270_res_twobytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3221 { &hf_tn3270_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3222 { &hf_tn3270_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3223 { &hf_tn3270_featl, NULL, 1, NULL, ENC_BIG_ENDIAN },
3224 { &hf_tn3270_feats, NULL, 2, NULL, ENC_BIG_ENDIAN },
3225 { NULL, NULL, 0, NULL, 0 }
3229 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3230 fields);
3232 #if 0
3233 /*FIXME: Need to see this in action to dissect in detail */
3234 proto_tree_add_item(tn3270_tree,
3235 hf_tn3270_field_data,
3236 tvb, offset,
3237 sf_body_length - (offset-start),
3238 ENC_EBCDIC|ENC_NA);
3239 offset += (sf_body_length - (offset - start));
3241 /* Uses same Self-Defining Parm as OEM Auxiliary Device */
3242 offset += dissect_query_reply_oem_auxiliary_device_sd_parms(tn3270_tree, tvb, offset);
3243 #endif
3245 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3247 return (offset - start);
3250 /* 6.15 - Query Reply (Data Chaining) */
3251 static gint
3252 dissect_query_reply_data_chaining(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3253 gint sf_body_length)
3255 gint start = offset;
3257 static const hf_items fields[] = {
3258 { &hf_tn3270_dc_dir, NULL, 1, NULL, ENC_BIG_ENDIAN },
3259 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3260 { NULL, NULL, 0, NULL, 0 }
3263 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3264 fields);
3266 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3268 return (offset - start);
3271 /* 6.16 - Query Reply (Data Streams) */
3273 static gint
3274 dissect_query_reply_data_streams(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3275 gint sf_body_length)
3277 gint start = offset;
3278 gint i;
3280 proto_tree_add_item(tn3270_tree, hf_tn3270_ds_default_sfid, tvb, offset, 1,
3281 ENC_BIG_ENDIAN);
3282 offset += 1;
3284 for (i=0; i < (sf_body_length-(offset-start)); i++) {
3285 proto_tree_add_item(tn3270_tree,
3286 hf_tn3270_ds_sfid,
3287 tvb, offset,
3289 ENC_BIG_ENDIAN);
3290 offset += 1;
3292 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3294 return (offset - start);
3297 /* 6.17 - Query Reply (DBCS Asia) */
3299 static gint
3300 dissect_query_reply_dbcs_asia_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3303 gint start = offset;
3304 gint sdp_len;
3305 gint sdp;
3307 static const hf_items sdp1[] = {
3308 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3309 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3310 { &hf_tn3270_asia_sdp_sosi_soset, NULL, 1, NULL, ENC_BIG_ENDIAN },
3311 { NULL, NULL, 0, NULL, 0 }
3314 static const hf_items sdp2[] = {
3315 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3316 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3317 { &hf_tn3270_asia_sdp_ic_func, NULL, 1, NULL, ENC_BIG_ENDIAN },
3318 { NULL, NULL, 0, NULL, 0 }
3321 sdp_len = tvb_get_guint8(tvb, offset);
3322 if (sdp_len != 0x03) {
3323 return 0;
3326 sdp = tvb_get_guint8(tvb, offset+1);
3328 switch (sdp) {
3329 case 0x01: /*SO/SI*/
3330 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3331 sdp1);
3332 break;
3333 case 0x02: /*Input Control*/
3334 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3335 sdp2);
3336 break;
3337 default:
3338 return 0;
3341 return (offset - start);
3345 static gint
3346 dissect_query_reply_dbcs_asia(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3347 gint sf_body_length)
3350 gint start = offset;
3351 gint i;
3353 static const hf_items fields[] = {
3354 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3355 { NULL, NULL, 0, NULL, 0 }
3359 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3360 fields);
3362 for (i = 0; i < 3; i++) {
3363 offset += dissect_query_reply_dbcs_asia_sd_parms(tn3270_tree, tvb, offset);
3364 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3365 break;
3368 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3370 return (offset - start);
3373 /* 6.18 - Query Reply (Device Characteristics) */
3374 static gint
3375 dissect_query_reply_device_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb,
3376 gint offset, gint sf_body_length)
3378 gint start = offset;
3380 #if 0 /* XXX: I don't think this is correct (i.e., this field is not part of this message) .... */
3381 proto_tree_add_item(tn3270_tree,
3382 hf_tn3270_sf_outbound_id,
3383 tvb, offset,
3385 ENC_BIG_ENDIAN);
3386 offset += 1;
3387 #endif
3389 /* TODO: dissect descriptors */
3390 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3392 return (offset - start);
3395 /* 6.19 - Query Reply (Distributed Data Management) */
3396 static gint
3397 dissect_query_reply_distributed_data_management(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3398 gint sf_body_length)
3400 gint start = offset, i;
3401 gint sdp;
3402 gboolean done = FALSE;
3404 static const hf_items fields[] = {
3405 { &hf_tn3270_ddm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3406 { &hf_tn3270_ddm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3407 { &hf_tn3270_ddm_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3408 { &hf_tn3270_ddm_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3409 { &hf_tn3270_ddm_nss, NULL, 1, NULL, ENC_BIG_ENDIAN },
3410 { &hf_tn3270_ddm_ddmss, NULL, 1, NULL, ENC_BIG_ENDIAN },
3411 { NULL, NULL, 0, NULL, 0 }
3414 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3415 fields);
3417 for (i = 0; i < 3; i++) {
3418 sdp = tvb_get_guint8(tvb, offset+1);
3419 switch (sdp) {
3420 case 0x02: /*DDM*/
3421 /*TODO: DDM */
3422 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, tvb_get_guint8(tvb,offset));
3423 break;
3424 case 0x01: /*DAID*/
3425 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3426 break;
3427 case 0x03: /*PCLK*/
3428 offset += dissect_pclk_sd_parm(tn3270_tree, tvb, offset);
3429 break;
3430 default:
3431 done = TRUE;
3432 break;
3434 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3435 break;
3438 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3440 return (offset - start);
3443 /* 6.20 - Query Reply (Document Interchange Architecture) */
3444 static gint
3445 dissect_query_reply_document_interchange_architecture(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3446 gint sf_body_length)
3448 gint start = offset, sdp, ln, i;
3450 static const hf_items fields[] = {
3451 { &hf_tn3270_dia_flags, NULL, 2, NULL, ENC_BIG_ENDIAN },
3452 { &hf_tn3270_dia_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3453 { &hf_tn3270_dia_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3454 { NULL, NULL, 0, NULL, 0 }
3457 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3458 fields);
3460 ln = tvb_get_guint8(tvb, offset);
3461 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_nfs, tvb, offset, 1, ENC_BIG_ENDIAN);
3463 for (i=0; i < ln; i++) {
3464 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_diafs, tvb, offset, 1,
3465 ENC_BIG_ENDIAN);
3466 offset += 1;
3467 proto_tree_add_item(tn3270_tree, hf_tn3270_dia_diafn, tvb, offset, 2,
3468 ENC_BIG_ENDIAN);
3469 offset += 1;
3472 sdp = tvb_get_guint8(tvb, offset+1);
3473 if (sdp == 0x01) { /*DAID*/
3474 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3477 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3479 return (offset - start);
3482 /* 6.21 - Query Reply (Extended Drawing Routine) */
3483 static gint
3484 dissect_query_reply_extended_drawing_routine(proto_tree *tn3270_tree, tvbuff_t *tvb,
3485 gint offset, gint sf_body_length)
3487 gint start = offset;
3489 proto_tree_add_item(tn3270_tree, hf_tn3270_field_data ,tvb, offset,
3490 sf_body_length, ENC_EBCDIC|ENC_NA);
3492 offset += sf_body_length;
3494 return (offset - start);
3497 /* 6.22 - Query Reply (Field Outlining) */
3498 static gint
3499 dissect_query_reply_field_outlining(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3500 gint sf_body_length)
3502 gint start = offset;
3504 static const hf_items fields[] = {
3505 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3506 { &hf_tn3270_fo_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3507 { &hf_tn3270_fo_vpos, NULL, 1, NULL, ENC_BIG_ENDIAN },
3508 { &hf_tn3270_fo_hpos, NULL, 1, NULL, ENC_BIG_ENDIAN },
3509 { &hf_tn3270_fo_hpos0, NULL, 1, NULL, ENC_BIG_ENDIAN },
3510 { &hf_tn3270_fo_hpos1, NULL, 1, NULL, ENC_BIG_ENDIAN },
3511 { NULL, NULL, 0, NULL, 0 }
3514 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3515 fields);
3517 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3519 return (offset - start);
3522 /* 6.23 - Query Reply (Field Validation) - Search for FIELD_VALIDATION*/
3523 /* 6.24 - Query Reply (Format Presentation) - Search for FORMAT_PRESENTATION*/
3525 /* 6.25 - Query Reply (Format Storage Auxiliary Device)*/
3526 static gint
3527 dissect_query_reply_format_storage_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3528 gint sf_body_length)
3530 gint start = offset, sdp;
3532 static const hf_items fields[] = {
3533 { &hf_tn3270_fsad_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3534 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3535 { &hf_tn3270_fsad_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3536 { &hf_tn3270_fsad_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3537 { NULL, NULL, 0, NULL, 0 }
3540 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3541 fields);
3543 sdp = tvb_get_guint8(tvb, offset+1);
3544 if (sdp == 0x01) { /*DAID*/
3545 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3546 proto_tree_add_item(tn3270_tree, hf_tn3270_fsad_size ,tvb, offset,
3547 2, ENC_BIG_ENDIAN);
3548 offset += 2;
3551 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3553 return (offset - start);
3556 /* 6.26 - Query Reply (Graphic Color) - Search for GRAPHIC_COLOR*/
3557 /* 6.27 - Query Reply (Graphic Symbol Sets) - Search for GRAPHIC_SYMBOL_SETS*/
3559 /* 6.28 - Query Reply (Highlighting) */
3560 static gint
3561 dissect_query_reply_highlighting(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3562 gint sf_body_length)
3564 gint start = offset;
3565 gint i;
3566 gint np;
3568 static const hf_items fields[] = {
3569 { &hf_tn3270_h_np, NULL, 1, NULL, ENC_BIG_ENDIAN },
3570 { NULL, NULL, 0, NULL, 0 }
3574 np = tvb_get_guint8(tvb, offset);
3575 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3576 fields);
3578 for (i=0; i < np; i++) {
3579 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3580 offset += 1;
3582 proto_tree_add_item(tn3270_tree,
3583 hf_tn3270_h_vi,
3584 tvb, offset,
3586 ENC_BIG_ENDIAN);
3587 offset += 1;
3588 if (tvb_get_guint8(tvb, offset) == 0xFF) {
3589 offset += 1;
3591 proto_tree_add_item(tn3270_tree,
3592 hf_tn3270_h_ai,
3593 tvb, offset,
3595 ENC_BIG_ENDIAN);
3596 offset += 1;
3599 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3601 return (offset - start);
3604 /* 6.29 - Query Reply (IBM Auxiliary Device) */
3605 static gint
3606 dissect_query_reply_ibm_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3607 gint sf_body_length)
3609 gint start = offset, i, sdp;
3610 gboolean done = FALSE;
3612 static const hf_items fields[] = {
3613 { &hf_tn3270_ibm_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3614 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3615 { &hf_tn3270_ibm_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3616 { &hf_tn3270_ibm_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3617 { &hf_tn3270_ibm_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3618 { NULL, NULL, 0, NULL, 0 }
3621 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3622 fields);
3624 for (i = 0; i < 3; i++) {
3625 sdp = tvb_get_guint8(tvb, offset+1);
3626 switch (sdp) {
3627 case 0x02: /*Printer Name*/
3628 /*TODO: Printer Name */
3629 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, tvb_get_guint8(tvb,offset));
3630 break;
3631 case 0x01: /*DAID*/
3632 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3633 break;
3634 case 0x03: /*PCLK*/
3635 offset += dissect_pclk_sd_parm(tn3270_tree, tvb, offset);
3636 break;
3637 default:
3638 done = TRUE;
3639 break;
3641 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3642 break;
3645 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3647 return (offset - start);
3650 /* 6.30 - Query Reply (Image) */
3652 /* 6.31 - Query Reply (Implicit Partitions) */
3653 static gint
3654 dissect_query_reply_implicit_partitions_sd_parms(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
3657 gint start = offset;
3658 gint sdp_len;
3659 gint sdp;
3661 static const hf_items sdp1[] = {
3662 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3663 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3664 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3665 { &hf_tn3270_ipdd_wd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3666 { &hf_tn3270_ipdd_hd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3667 { &hf_tn3270_ipdd_wa, NULL, 2, NULL, ENC_BIG_ENDIAN },
3668 { &hf_tn3270_ipdd_ha, NULL, 2, NULL, ENC_BIG_ENDIAN },
3669 { NULL, NULL, 0, NULL, 0 }
3672 static const hf_items sdp2[] = {
3673 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3674 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3675 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3676 { &hf_tn3270_ippd_dpbs, NULL, 4, NULL, ENC_BIG_ENDIAN },
3677 { &hf_tn3270_ippd_apbs, NULL, 4, NULL, ENC_BIG_ENDIAN },
3678 { NULL, NULL, 0, NULL, 0 }
3681 static const hf_items sdp3[] = {
3682 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3683 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3684 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3685 { &hf_tn3270_ipccd_wcd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3686 { &hf_tn3270_ipccd_hcd, NULL, 2, NULL, ENC_BIG_ENDIAN },
3687 { &hf_tn3270_ipccd_wca, NULL, 2, NULL, ENC_BIG_ENDIAN },
3688 { &hf_tn3270_ipccd_hca, NULL, 2, NULL, ENC_BIG_ENDIAN },
3689 { NULL, NULL, 0, NULL, 0 }
3692 sdp_len = tvb_get_guint8(tvb, offset);
3693 if (sdp_len != 0x0B) {
3694 return 0;
3697 sdp = tvb_get_guint8(tvb, offset+1);
3699 switch (sdp) {
3700 case QR_IP_SDP_DISPLAY:
3701 /* XXX: Save default and alternate screen size info as reported ? */
3702 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3703 sdp1);
3704 break;
3705 case QR_IP_SDP_PRINTER:
3706 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3707 sdp2);
3708 break;
3709 case QR_IP_SDP_CHARACTER:
3710 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3711 sdp3);
3712 break;
3713 default:
3714 return 0;
3717 return (offset - start);
3721 static gint
3722 dissect_query_reply_implicit_partitions(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3723 gint sf_body_length)
3725 gint start = offset;
3726 gint i;
3728 static const hf_items fields[] = {
3729 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3730 { &hf_tn3270_ip_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3731 { NULL, NULL, 0, NULL, 0 }
3734 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3735 fields);
3737 for (i = 0; i < 3; i++) {
3738 gint len;
3739 len = dissect_query_reply_implicit_partitions_sd_parms(tn3270_tree, tvb, offset);
3740 if ((len == 0) || (tvb_reported_length_remaining(tvb, offset) <= 0))
3741 break;
3742 offset += len;
3745 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3747 return (offset - start);
3750 /* 6.32 - Query Reply (IOCA Auxiliary Device) */
3751 static gint
3752 dissect_query_reply_ioca_aux_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3753 gint sf_body_length)
3755 gint start = offset;
3757 static const hf_items fields[] = {
3758 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3759 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3760 { &hf_tn3270_ioca_limin, NULL, 2, NULL, ENC_BIG_ENDIAN },
3761 { &hf_tn3270_ioca_limout, NULL, 2, NULL, ENC_BIG_ENDIAN },
3762 { &hf_tn3270_ioca_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3763 { NULL, NULL, 0, NULL, 0 }
3766 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3767 fields);
3769 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3771 return (offset - start);
3774 /* 6.33 - Query Reply (Line Type) - Search for LINE_TYPE*/
3776 /* 6.34 - Query Reply (MSR Control) */
3777 static gint
3778 dissect_query_reply_msr_control(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3779 gint sf_body_length)
3781 gint start = offset;
3783 static const hf_items fields[] = {
3784 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3785 { &hf_tn3270_msr_nd, NULL, 1, NULL, ENC_BIG_ENDIAN },
3786 { &hf_tn3270_msr_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
3787 { NULL, NULL, 0, NULL, 0 }
3790 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3791 fields);
3792 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3794 return (offset - start);
3797 /* 6.35 - Query Reply (Null) - Search for QUERY_REPLY_NULL */
3799 /* 6.36 - Query Reply (OEM Auxiliary Device) */
3800 static gint
3801 dissect_query_reply_oem_auxiliary_device(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3802 gint sf_body_length)
3804 gint start = offset;
3805 gint i;
3807 static const hf_items fields[] = {
3808 { &hf_tn3270_resbyte, NULL, 1, NULL, ENC_BIG_ENDIAN },
3809 { &hf_tn3270_oem_dsref, NULL, 1, NULL, ENC_BIG_ENDIAN },
3810 { &hf_tn3270_oem_dtype, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
3811 { &hf_tn3270_oem_uname, NULL, 8, NULL, ENC_EBCDIC|ENC_NA },
3812 { NULL, NULL, 0, NULL, 0 }
3815 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3816 fields);
3818 for (i = 0; i < 3; i++) {
3819 offset += dissect_query_reply_oem_auxiliary_device_sd_parms(tn3270_tree, tvb, offset);
3820 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3821 break;
3824 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3826 return (offset - start);
3829 /* 6.37 - Query Reply (Paper Feed Techniques) */
3830 static gint
3831 dissect_query_reply_paper_feed_techniques(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3832 gint sf_body_length)
3834 gint start = offset;
3836 static const hf_items fields[] = {
3837 { &hf_tn3270_pft_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
3838 { &hf_tn3270_pft_tmo, NULL, 2, NULL, ENC_BIG_ENDIAN },
3839 { &hf_tn3270_pft_bmo, NULL, 2, NULL, ENC_BIG_ENDIAN },
3840 { NULL, NULL, 0, NULL, 0 }
3843 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3844 fields);
3845 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3847 return (offset - start);
3850 /* 6.38 - Query Reply (Partition Characteristics) */
3851 static gint
3852 dissect_query_reply_partition_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3853 gint sf_body_length)
3855 gint start = offset, i, sdp;
3856 gboolean done = FALSE;
3858 static const hf_items fields[] = {
3859 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
3860 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
3861 { NULL, NULL, 0, NULL, 0 }
3864 for (i = 0; i < 2; i++) {
3865 sdp = tvb_get_guint8(tvb, offset+1);
3866 switch (sdp) {
3867 case 0x01: /*Viewport Outline*/
3868 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3869 fields);
3870 proto_tree_add_item(tn3270_tree, hf_tn3270_pc_vo_thickness,
3871 tvb, offset, 1, ENC_BIG_ENDIAN);
3872 offset += 1;
3873 break;
3874 case 0x03: /*Enable User Call-Up*/
3875 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3876 fields);
3877 break;
3878 default:
3879 done = TRUE;
3880 break;
3882 if ((tvb_reported_length_remaining(tvb, offset) <= 0) || done)
3883 break;
3886 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3888 return (offset - start);
3891 /* 6.39 - Query Reply (Port) - Search for QUERY_REPLY_PORT */
3892 /* 6.40 - Query Reply (Procedure) - Search for QUERY_REPLY_PROCEDURE */
3894 /* 6.41 - Query Reply ((Product Defined Data Stream) */
3895 static gint
3896 dissect_query_reply_product_defined_data_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3897 gint sf_body_length)
3899 gint start = offset, sdp;
3901 static const hf_items fields[] = {
3902 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
3903 { &hf_tn3270_pdds_refid, NULL, 1, NULL, ENC_BIG_ENDIAN },
3904 { &hf_tn3270_pdds_ssid, NULL, 1, NULL, ENC_BIG_ENDIAN },
3905 { NULL, NULL, 0, NULL, 0 }
3908 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3909 fields);
3911 sdp = tvb_get_guint8(tvb, offset+1);
3912 if (sdp == 0x01) { /*DAID*/
3913 offset += dissect_daid_sd_parm(tn3270_tree, tvb, offset);
3916 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3918 return (offset - start);
3921 /* 6.42 - Query Reply (Modes) */
3922 static gint
3923 dissect_query_reply_modes(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3924 gint sf_body_length)
3926 gint start = offset;
3927 gint i;
3929 for (i=0; i < sf_body_length; i++) {
3930 proto_tree_add_item(tn3270_tree,
3931 hf_tn3270_mode,
3932 tvb, offset,
3934 ENC_BIG_ENDIAN);
3935 offset += 1;
3938 return (offset - start);
3941 /* 6.43 - Query Reply (RPQ Names) */
3942 static gint
3943 dissect_query_reply_rpq_names(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3944 gint sf_body_length)
3946 gint start = offset;
3947 gint rpql;
3949 static const hf_items fields[] = {
3950 { &hf_tn3270_rpq_device, NULL, 4, NULL, ENC_EBCDIC|ENC_NA },
3951 { &hf_tn3270_rpq_mid, NULL, 4, NULL, ENC_BIG_ENDIAN },
3952 { NULL, NULL, 0, NULL, 0 }
3955 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3956 fields);
3958 rpql = tvb_get_guint8(tvb, offset);
3960 proto_tree_add_item(tn3270_tree,
3961 hf_tn3270_rpq_rpql,
3962 tvb, offset,
3964 ENC_BIG_ENDIAN);
3965 offset += 1;
3967 proto_tree_add_item(tn3270_tree,
3968 hf_tn3270_rpq_name,
3969 tvb, offset,
3970 (rpql - 1),
3971 ENC_EBCDIC|ENC_NA);
3972 offset += (rpql-1);
3974 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3976 return (offset - start);
3979 /* 6.44 - Query Reply (Save/Restore Format) */
3980 static gint
3981 dissect_query_reply_save_or_restore_format(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
3982 gint sf_body_length)
3984 gint start = offset;
3986 static const hf_items fields[] = {
3987 { &hf_tn3270_srf_fpcbl, NULL, 1, NULL, ENC_NA },
3988 { NULL, NULL, 0, NULL, 0 }
3991 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
3992 fields);
3994 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
3996 return (offset - start);
3999 /* 6.45 - Query Reply (Segment) - Search for QUERY_REPLY_SEGMENT */
4001 /* 6.46 - Query Reply ((Settable Printer Characteristics) */
4002 static gint
4003 dissect_query_reply_settable_printer_characteristics(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4004 gint sf_body_length)
4006 gint start = offset, sdp;
4008 static const hf_items fields[] = {
4009 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
4010 { NULL, NULL, 0, NULL, 0 }
4013 static const hf_items fields2[] = {
4014 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
4015 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
4016 { NULL, NULL, 0, NULL, 0 }
4019 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4020 fields);
4022 sdp = tvb_get_guint8(tvb, offset+1);
4023 if (sdp == 0x01) { /*Early Print Complete*/
4024 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4025 fields2);
4026 proto_tree_add_item(tn3270_tree, hf_tn3270_spc_epc_flags, tvb, offset,
4027 1, ENC_BIG_ENDIAN);
4028 offset += 1;
4031 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4033 return (offset - start);
4036 /* 6.47 - Query Reply (Storage Pools) */
4037 static gint
4038 dissect_query_reply_storage_pools(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4039 gint sf_body_length)
4041 gint start = offset, sdp, i;
4043 static const hf_items fields2[] = {
4044 { &hf_tn3270_sdp_ln, NULL, 1, NULL, ENC_BIG_ENDIAN },
4045 { &hf_tn3270_sdp_id, NULL, 1, NULL, ENC_BIG_ENDIAN },
4046 { &hf_tn3270_sp_spid, NULL, 1, NULL, ENC_BIG_ENDIAN },
4047 { &hf_tn3270_sp_size, NULL, 4, NULL, ENC_BIG_ENDIAN },
4048 { &hf_tn3270_sp_space, NULL, 4, NULL, ENC_BIG_ENDIAN },
4049 { NULL, NULL, 0, NULL, 0 }
4052 sdp = tvb_get_guint8(tvb, offset+1);
4053 if (sdp == 0x01) { /* Storage Pool Characteristics */
4054 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4055 fields2);
4056 for (i=0; i < (sf_body_length-(offset-start)); i+=2) {
4057 proto_tree_add_item(tn3270_tree, hf_tn3270_sp_objlist,
4058 tvb, offset, 2, ENC_BIG_ENDIAN);
4059 offset += 2;
4063 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4065 return (offset - start);
4068 /* 6.48 - Query Reply (Summary) */
4069 static gint
4070 dissect_query_reply_summary(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4071 gint sf_body_length)
4073 gint i;
4074 gint datalen = 0;
4075 gint length_remaining = tvb_reported_length_remaining(tvb, offset);
4077 for (i=0; i < sf_body_length; i++) {
4078 if (datalen >= length_remaining) {
4079 return (datalen);
4081 proto_tree_add_item(tn3270_tree,
4082 hf_tn3270_sf_query_reply,
4083 tvb, offset + datalen,
4085 ENC_BIG_ENDIAN);
4086 datalen += 1;
4088 datalen += dissect_unknown_data(tn3270_tree, tvb, offset+datalen, offset, sf_body_length);
4090 return (datalen);
4093 /* 6.49 - Query Reply (Text Partitions) */
4094 static gint
4095 dissect_query_reply_text_partitions(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4096 gint sf_body_length)
4098 gint start = offset, len, i;
4100 static const hf_items fields[] = {
4101 { &hf_tn3270_tp_nt, NULL, 1, NULL, ENC_BIG_ENDIAN },
4102 { &hf_tn3270_tp_m, NULL, 2, NULL, ENC_BIG_ENDIAN },
4103 { &hf_tn3270_tp_flags, NULL, 1, NULL, ENC_BIG_ENDIAN },
4104 { NULL, NULL, 0, NULL, 0 }
4107 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4108 fields);
4110 len = tvb_get_guint8(tvb, offset);
4111 proto_tree_add_item(tn3270_tree, hf_tn3270_tp_ntt, tvb, offset, 1, ENC_BIG_ENDIAN);
4112 offset += 1;
4114 for (i=0; i < len; i++) {
4115 proto_tree_add_item(tn3270_tree, hf_tn3270_tp_tlist,
4116 tvb, offset, 1, ENC_BIG_ENDIAN);
4117 offset += 1;
4120 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4122 return (offset - start);
4125 /* 6.50 - Query Reply (Transparency) */
4126 static gint
4127 dissect_query_reply_transparency(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4128 gint sf_body_length)
4130 gint start = offset, i, len;
4132 len = tvb_get_guint8(tvb, offset);
4133 proto_tree_add_item(tn3270_tree, hf_tn3270_t_np, tvb, offset, 1, ENC_BIG_ENDIAN);
4134 offset += 1;
4136 for (i=0; i < len; i+=2) {
4137 proto_tree_add_item(tn3270_tree, hf_tn3270_t_vi,
4138 tvb, offset, 1, ENC_BIG_ENDIAN);
4139 offset += 1;
4140 proto_tree_add_item(tn3270_tree, hf_tn3270_t_ai,
4141 tvb, offset, 1, ENC_BIG_ENDIAN);
4142 offset += 1;
4145 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4147 return (offset - start);
4150 /* 6.51 - Query Reply Usable Area */
4151 static gint
4152 dissect_query_reply_usable_area(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4153 gint sf_body_length)
4155 gint start = offset;
4156 gint vcp;
4158 static const gint *byte1[] = {
4159 &hf_tn3270_ua_reserved1,
4160 &hf_tn3270_ua_page_printer,
4161 &hf_tn3270_ua_reserved2,
4162 &hf_tn3270_ua_hard_copy,
4163 &hf_tn3270_ua_addressing,
4164 NULL
4167 static const gint *byte2[] = {
4168 &hf_tn3270_ua_variable_cells,
4169 &hf_tn3270_ua_characters,
4170 &hf_tn3270_ua_cell_units,
4171 NULL
4174 static const hf_items fields[] = {
4175 { &hf_tn3270_usable_area_flags1, &ett_tn3270_usable_area_flags1, 1, byte1, 0 },
4176 { &hf_tn3270_usable_area_flags2, &ett_tn3270_usable_area_flags1, 1, byte2, 0 },
4177 { &hf_tn3270_ua_width_cells_pels, NULL, 2, NULL, ENC_BIG_ENDIAN },
4178 { &hf_tn3270_ua_height_cells_pels, NULL, 2, NULL, ENC_BIG_ENDIAN },
4179 { &hf_tn3270_ua_uom_cells_pels, NULL, 1, NULL, ENC_BIG_ENDIAN },
4180 { &hf_tn3270_ua_xr, NULL, 4, NULL, ENC_BIG_ENDIAN },
4181 { &hf_tn3270_ua_yr, NULL, 4, NULL, ENC_BIG_ENDIAN },
4182 { &hf_tn3270_ua_aw, NULL, 1, NULL, ENC_BIG_ENDIAN },
4183 { &hf_tn3270_ua_ah, NULL, 1, NULL, ENC_BIG_ENDIAN },
4184 { &hf_tn3270_ua_buffsz, NULL, 2, NULL, ENC_BIG_ENDIAN },
4185 { NULL, NULL, 0, NULL, 0 }
4188 static const hf_items fields2[] = {
4189 { &hf_tn3270_ua_xmin, NULL, 1, NULL, ENC_BIG_ENDIAN },
4190 { &hf_tn3270_ua_ymin, NULL, 1, NULL, ENC_BIG_ENDIAN },
4191 { &hf_tn3270_ua_xmax, NULL, 1, NULL, ENC_BIG_ENDIAN },
4192 { &hf_tn3270_ua_ymax, NULL, 1, NULL, ENC_BIG_ENDIAN },
4193 { NULL, NULL, 0, NULL, 0 }
4196 vcp = tvb_get_guint8(tvb, offset+1);
4198 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4199 fields);
4201 if ((vcp & QR_UA_VARIABLE_CELLS) != 0) {
4202 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4203 fields2);
4206 /*TODO: self defining parms */
4207 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4209 return (offset - start);
4212 /* 6.52 - Query Reply 3270 IPDS */
4213 static gint
4214 dissect_query_reply_3270_ipds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4215 gint sf_body_length)
4217 gint start = offset;
4219 static const hf_items fields[] = {
4220 { &hf_tn3270_resbytes, NULL, 2, NULL, ENC_BIG_ENDIAN },
4221 { &hf_tn3270_3270_tranlim, NULL, 2, NULL, ENC_BIG_ENDIAN },
4222 { NULL, NULL, 0, NULL, 0 }
4225 offset += tn3270_add_hf_items(tn3270_tree, tvb, offset,
4226 fields);
4227 offset += dissect_unknown_data(tn3270_tree, tvb, offset, start, sf_body_length);
4229 return (offset - start);
4232 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4233 /* call only with valid sf_id */
4234 static gint
4235 process_inbound_structured_field(proto_tree *sf_tree, tvbuff_t *tvb, gint offset,
4236 tn3270_conv_info_t *tn3270_info, guint sf_id, gint sf_body_length)
4238 gint start = offset; /* start of structured field param(s) */
4240 switch (sf_id) {
4241 case SF_IB_EXCEPTION_OR_STATUS:
4242 offset += dissect_exception_or_status(sf_tree, tvb, offset, sf_body_length);
4243 break;
4244 case SF_IB_INBOUND_TEXT_HEADER:
4245 offset += dissect_inbound_text_header(sf_tree, tvb, offset, sf_body_length);
4246 break;
4247 case SF_IB_INBOUND_3270DS:
4248 offset += dissect_inbound_3270ds(sf_tree, tvb, offset, tn3270_info, sf_body_length);
4249 break;
4250 case SF_IB_RECOVERY_DATA:
4251 offset += dissect_recovery_data(sf_tree, tvb, offset, sf_body_length);
4252 break;
4253 case SF_IB_TYPE_1_TEXT_INBOUND:
4254 offset += dissect_type_1_text(sf_tree, tvb, offset, sf_body_length);
4255 break;
4256 case SF_IB_QUERY_REPLY_ALPHANUMERIC_PARTITIONS:
4257 offset += dissect_query_reply_alphanumeric(sf_tree, tvb, offset, sf_body_length);
4258 break;
4259 case SF_IB_QUERY_REPLY_AUXILIARY_DEVICE:
4260 case SF_IB_QUERY_REPLY_BEGIN_OR_END_OF_FILE:
4261 offset += dissect_query_reply_resbytes(sf_tree, tvb, offset, sf_body_length);
4262 break;
4263 case SF_IB_QUERY_REPLY_CHARACTER_SETS:
4264 offset += dissect_query_reply_character_sets(sf_tree, tvb, offset, sf_body_length);
4265 break;
4266 case SF_IB_QUERY_REPLY_COLOR:
4267 offset += dissect_query_reply_color(sf_tree, tvb, offset, sf_body_length);
4268 break;
4269 case SF_IB_QUERY_REPLY_COOPERATIVE_PROCESSING_REQUESTOR:
4270 offset += dissect_query_reply_cooperative(sf_tree, tvb, offset, sf_body_length);
4271 break;
4272 case SF_IB_QUERY_REPLY_DATA_CHAINING:
4273 offset += dissect_query_reply_data_chaining(sf_tree, tvb, offset, sf_body_length);
4274 break;
4275 case SF_IB_QUERY_REPLY_DATA_STREAMS:
4276 offset += dissect_query_reply_data_streams(sf_tree, tvb, offset, sf_body_length);
4277 break;
4278 case SF_IB_QUERY_REPLY_DBCS_ASIA:
4279 offset += dissect_query_reply_dbcs_asia(sf_tree, tvb, offset, sf_body_length);
4280 break;
4281 case SF_IB_QUERY_REPLY_DEVICE_CHARACTERISTICS:
4282 /*TODO: implement this beast */
4283 offset += dissect_query_reply_device_characteristics(sf_tree, tvb, offset, sf_body_length);
4284 break;
4285 case SF_IB_QUERY_REPLY_SUMMARY:
4286 offset += dissect_query_reply_summary(sf_tree, tvb, offset, sf_body_length);
4287 break;
4288 case SF_IB_QUERY_REPLY_USABLE_AREA:
4289 offset += dissect_query_reply_usable_area(sf_tree, tvb, offset, sf_body_length);
4290 break;
4291 case SF_IB_QUERY_REPLY_HIGHLIGHTING:
4292 offset += dissect_query_reply_highlighting(sf_tree, tvb, offset, sf_body_length);
4293 break;
4294 case SF_IB_QUERY_REPLY_REPLY_MODES:
4295 offset += dissect_query_reply_modes(sf_tree, tvb, offset, sf_body_length);
4296 break;
4297 case SF_IB_QUERY_REPLY_DISTRIBUTED_DATA_MANAGEMENT:
4298 offset += dissect_query_reply_distributed_data_management(sf_tree, tvb, offset, sf_body_length);
4299 break;
4300 case SF_IB_QUERY_REPLY_RPQ_NAMES:
4301 offset += dissect_query_reply_rpq_names(sf_tree, tvb, offset, sf_body_length);
4302 break;
4303 case SF_IB_QUERY_REPLY_IMPLICIT_PARTITION:
4304 offset += dissect_query_reply_implicit_partitions(sf_tree, tvb, offset, sf_body_length);
4305 break;
4306 case SF_IB_QUERY_REPLY_OEM_AUXILIARY_DEVICE:
4307 offset += dissect_query_reply_oem_auxiliary_device(sf_tree, tvb, offset, sf_body_length);
4308 break;
4309 case SF_IB_QUERY_REPLY_DOCUMENT_INTERCHANGE_ARCHITECTURE:
4310 offset += dissect_query_reply_document_interchange_architecture(sf_tree, tvb, offset, sf_body_length);
4311 break;
4312 case SF_IB_QUERY_REPLY_EXTENDED_DRAWING_ROUTINE:
4313 offset += dissect_query_reply_extended_drawing_routine(sf_tree, tvb, offset, sf_body_length);
4314 break;
4315 case SF_IB_QUERY_REPLY_FIELD_OUTLINING:
4316 offset += dissect_query_reply_field_outlining(sf_tree, tvb, offset, sf_body_length);
4317 break;
4318 case SF_IB_QUERY_REPLY_FIELD_VALIDATION:
4319 offset += dissect_3270_field_validation(sf_tree, tvb, offset);
4320 break;
4321 case SF_IB_QUERY_REPLY_FORMAT_STORAGE_AUXILIARY_DEVICE:
4322 offset += dissect_query_reply_format_storage_aux_device(sf_tree, tvb, offset, sf_body_length);
4323 break;
4324 case SF_IB_QUERY_REPLY_GRAPHIC_COLOR:
4325 case SF_IB_QUERY_REPLY_GRAPHIC_SYMBOL_SETS:
4326 case SF_IB_QUERY_REPLY_IMAGE:
4327 case SF_IB_QUERY_REPLY_LINE_TYPE:
4328 case SF_IB_QUERY_REPLY_PROCEDURE:
4329 case SF_IB_QUERY_REPLY_SEGMENT:
4330 /* Not an error - just has a data field like 'extended drawing'*/
4331 offset += dissect_query_reply_extended_drawing_routine(sf_tree, tvb, offset, sf_body_length);
4332 break;
4333 case SF_IB_QUERY_REPLY_IBM_AUXILIARY_DEVICE:
4334 offset += dissect_query_reply_ibm_aux_device(sf_tree, tvb, offset, sf_body_length);
4335 break;
4336 case SF_IB_QUERY_REPLY_IOCA_AUXILIARY_DEVICE:
4337 offset += dissect_query_reply_ioca_aux_device(sf_tree, tvb, offset, sf_body_length);
4338 break;
4339 case SF_IB_QUERY_REPLY_MSR_CONTROL:
4340 offset += dissect_query_reply_msr_control(sf_tree, tvb, offset, sf_body_length);
4341 break;
4342 case SF_IB_QUERY_REPLY_FORMAT_PRESENTATION:
4343 case SF_IB_QUERY_REPLY_NULL:
4344 case SF_IB_QUERY_REPLY_PORT:
4345 /* This field is always empty */
4346 break;
4347 case SF_IB_QUERY_REPLY_PAPER_FEED_TECHNIQUES:
4348 offset += dissect_query_reply_paper_feed_techniques(sf_tree, tvb, offset, sf_body_length);
4349 break;
4350 case SF_IB_QUERY_REPLY_PARTITION_CHARACTERISTICS:
4351 offset += dissect_query_reply_partition_characteristics(sf_tree, tvb, offset, sf_body_length);
4352 break;
4353 case SF_IB_QUERY_REPLY_PRODUCT_DEFINED_DATA_STREAM:
4354 offset += dissect_query_reply_product_defined_data_stream(sf_tree, tvb, offset, sf_body_length);
4355 break;
4356 case SF_IB_QUERY_REPLY_SAVE_OR_RESTORE_FORMAT:
4357 offset += dissect_query_reply_save_or_restore_format(sf_tree, tvb, offset, sf_body_length);
4358 break;
4359 case SF_IB_QUERY_REPLY_SETTABLE_PRINTER_CHARACTERISTICS:
4360 offset += dissect_query_reply_settable_printer_characteristics(sf_tree, tvb, offset, sf_body_length);
4361 break;
4362 case SF_IB_QUERY_REPLY_STORAGE_POOLS:
4363 offset += dissect_query_reply_storage_pools(sf_tree, tvb, offset, sf_body_length);
4364 break;
4365 case SF_IB_QUERY_REPLY_TEXT_PARTITIONS:
4366 offset += dissect_query_reply_text_partitions(sf_tree, tvb, offset, sf_body_length);
4367 break;
4368 case SF_IB_QUERY_REPLY_TRANSPARENCY:
4369 offset += dissect_query_reply_transparency(sf_tree, tvb, offset, sf_body_length);
4370 break;
4371 case SF_IB_QUERY_REPLY_3270_IPDS:
4372 offset += dissect_query_reply_3270_ipds(sf_tree, tvb, offset, sf_body_length);
4373 break;
4374 default:
4375 DISSECTOR_ASSERT_NOT_REACHED();
4376 break;
4379 return (offset - start);
4383 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4384 /* call only with valid sf_id */
4385 static gint
4386 process_outbound_structured_field(proto_tree *sf_tree, tvbuff_t *tvb, gint offset,
4387 tn3270_conv_info_t *tn3270_info, guint sf_id, gint sf_body_length)
4389 gint start = offset; /* start of structured field param(s) */
4391 switch (sf_id) {
4392 case SF_OB_READ_PARTITION:
4393 offset += dissect_read_partition(sf_tree, tvb, offset, sf_body_length);
4394 break;
4395 case SF_OB_ACTIVATE_PARTITION:
4396 case SF_OB_DESTROY_PARTITION:
4397 case SF_OB_RESET_PARTITION:
4398 proto_tree_add_item(sf_tree,
4399 hf_tn3270_partition_id,
4400 tvb, offset,
4402 ENC_BIG_ENDIAN);
4403 offset += 1;
4404 break;
4405 case SF_OB_CREATE_PARTITION:
4406 offset += dissect_create_partition(sf_tree, tvb, offset, sf_body_length);
4407 break;
4408 case SF_OB_ERASE_OR_RESET:
4409 /* Bit 0: 0= Use default screen size; 1= use alternate screen size */
4410 /* XXX: Not really valid: See comment under dissect_outbound_stream(). */
4411 if ((tvb_get_guint8(tvb, offset) & 0x80) != 0) {
4412 tn3270_info->rows = tn3270_info->altrows;
4413 tn3270_info->cols = tn3270_info->altcols;
4415 else {
4416 tn3270_info->rows = 24;
4417 tn3270_info->cols = 80;
4419 proto_tree_add_bits_item(sf_tree,
4420 hf_tn3270_erase_flags,
4421 tvb, offset<<3,
4423 ENC_BIG_ENDIAN);
4424 offset += 1;
4425 break;
4426 case SF_OB_LOAD_PROGRAMMED_SYMBOLS:
4427 offset += dissect_load_programmed_symbols(sf_tree, tvb, offset, sf_body_length);
4428 break;
4429 case SF_OB_OUTBOUND_3270DS:
4430 offset += dissect_outbound_3270ds(sf_tree, tvb, offset, tn3270_info, sf_body_length);
4431 break;
4432 case SF_OB_PRESENT_ABSOLUTE_FORMAT:
4433 offset += dissect_present_absolute_format(sf_tree, tvb, offset, sf_body_length);
4434 break;
4435 case SF_OB_PRESENT_RELATIVE_FORMAT:
4436 offset += dissect_present_relative_format(sf_tree, tvb, offset, sf_body_length);
4437 break;
4438 case SF_OB_SCS_DATA:
4439 proto_tree_add_item(sf_tree,
4440 hf_tn3270_partition_id,
4441 tvb, offset,
4443 ENC_BIG_ENDIAN);
4444 offset += 1;
4445 proto_tree_add_item(sf_tree,
4446 hf_tn3270_scs_data,
4447 tvb, offset,
4448 (sf_body_length - (offset - start)),
4449 ENC_NA);
4450 offset += (sf_body_length - (offset - start));
4451 break;
4452 case SF_OB_SET_REPLY_MODE:
4453 offset += dissect_set_reply_mode(sf_tree, tvb, offset, sf_body_length);
4454 break;
4455 case SF_OB_SELECT_FORMAT_GROUP:
4456 proto_tree_add_item(sf_tree,
4457 hf_tn3270_partition_id,
4458 tvb, offset,
4460 ENC_BIG_ENDIAN);
4461 offset += 1;
4462 proto_tree_add_item(sf_tree,
4463 hf_tn3270_format_group,
4464 tvb, offset,
4465 (sf_body_length - (offset - start)),
4466 ENC_EBCDIC|ENC_NA);
4467 offset += (sf_body_length - (offset - start));
4468 break;
4469 case SF_OB_SET_WINDOW_ORIGIN:
4470 proto_tree_add_item(sf_tree,
4471 hf_tn3270_partition_id,
4472 tvb, offset,
4474 ENC_BIG_ENDIAN);
4475 offset += 1;
4476 proto_tree_add_item(sf_tree,
4477 hf_tn3270_partition_rw,
4478 tvb, offset,
4480 ENC_BIG_ENDIAN);
4481 offset += 2;
4482 proto_tree_add_item(sf_tree,
4483 hf_tn3270_partition_cw,
4484 tvb, offset,
4486 ENC_BIG_ENDIAN);
4487 offset += 2;
4488 break;
4489 case SF_OB_BEGIN_OR_END_OF_FILE:
4490 proto_tree_add_item(sf_tree,
4491 hf_tn3270_partition_id,
4492 tvb, offset,
4494 ENC_BIG_ENDIAN);
4495 offset += 1;
4496 /*TODO: use bits_text */
4497 proto_tree_add_bits_item(sf_tree,
4498 hf_tn3270_begin_end_flags1,
4499 tvb, offset<<3,
4501 ENC_BIG_ENDIAN);
4502 offset += 1;
4503 proto_tree_add_item(sf_tree,
4504 hf_tn3270_begin_end_flags2,
4505 tvb, offset,
4507 ENC_BIG_ENDIAN);
4508 offset += 1;
4509 break;
4510 case SF_OB_LOAD_COLOR_TABLE:
4511 /* Refer to related graphics docs !*/
4512 proto_tree_add_item(sf_tree,
4513 hf_tn3270_load_color_command,
4514 tvb, offset,
4515 sf_body_length,
4516 ENC_NA);
4517 offset += sf_body_length;
4518 break;
4519 case SF_OB_LOAD_FORMAT_STORAGE:
4520 offset += dissect_load_format_storage(sf_tree, tvb, offset, sf_body_length);
4521 break;
4522 case SF_OB_LOAD_LINE_TYPE:
4523 /* Refer to related graphics docs !*/
4524 proto_tree_add_item(sf_tree,
4525 hf_tn3270_load_line_type_command,
4526 tvb, offset,
4527 sf_body_length,
4528 ENC_NA);
4529 offset += sf_body_length;
4530 break;
4531 case SF_OB_MODIFY_PARTITION:
4532 offset += dissect_modify_partition(sf_tree, tvb, offset, sf_body_length);
4533 break;
4534 case SF_OB_OUTBOUND_TEXT_HEADER:
4535 offset += dissect_outbound_text_header(sf_tree, tvb, offset, sf_body_length);
4536 break;
4537 case SF_OB_REQUEST_RECOVERY_DATA:
4538 proto_tree_add_item(sf_tree,
4539 hf_tn3270_resbyte,
4540 tvb, offset,
4542 ENC_BIG_ENDIAN);
4543 offset += 1;
4544 break;
4545 case SF_OB_RESTART:
4546 offset += dissect_restart(sf_tree, tvb, offset, sf_body_length);
4547 break;
4548 case SF_OB_SELECT_COLOR_TABLE:
4549 proto_tree_add_item(sf_tree,
4550 hf_tn3270_color_command,
4551 tvb, offset,
4553 ENC_BIG_ENDIAN);
4554 offset += 2;
4555 break;
4556 case SF_OB_SET_CHECKPOINT_INTERVAL:
4557 proto_tree_add_item(sf_tree,
4558 hf_tn3270_resbyte,
4559 tvb, offset,
4561 ENC_BIG_ENDIAN);
4562 offset += 1;
4563 proto_tree_add_item(sf_tree,
4564 hf_tn3270_interval,
4565 tvb, offset,
4567 ENC_BIG_ENDIAN);
4568 offset += 2;
4569 break;
4570 case SF_OB_SET_MSR_CONTROL:
4571 offset += dissect_set_msr_control(sf_tree, tvb, offset, sf_body_length);
4572 break;
4573 case SF_OB_SET_PARTITION_CHARACTERISTICS:
4574 offset += dissect_set_partition_characteristics(sf_tree, tvb, offset, sf_body_length);
4575 break;
4576 case SF_OB_SET_PRINTER_CHARACTERISTICS:
4577 offset += dissect_set_printer_characteristics(sf_tree, tvb, offset, sf_body_length);
4578 break;
4579 case SF_OB_TYPE_1_TEXT_OUTBOUND:
4580 offset += dissect_type_1_text(sf_tree, tvb, offset, sf_body_length);
4581 break;
4582 default:
4583 DISSECTOR_ASSERT_NOT_REACHED();
4584 break;
4587 return (offset - start);
4590 /* sf_body_length is the total length of the structured field including the sf_len and sf_id fields */
4591 /* call only with valid sf_id */
4592 static gint
4593 process_outbound_inbound_structured_field(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4594 tn3270_conv_info_t *tn3270_info _U_, guint sf_id, gint sf_body_length)
4596 gint start = offset;
4598 switch (sf_id) {
4599 case SF_OB_IB_DATA_CHAIN:
4600 offset += dissect_data_chain(tn3270_tree, tvb, offset, sf_body_length);
4601 break;
4602 case SF_OB_IB_DESTINATION_OR_ORIGIN:
4603 proto_tree_add_item(tn3270_tree,
4604 hf_tn3270_destination_or_origin_flags_input_control,
4605 tvb, offset,
4607 ENC_BIG_ENDIAN);
4608 offset += 1;
4609 proto_tree_add_item(tn3270_tree,
4610 hf_tn3270_resbyte,
4611 tvb, offset,
4613 ENC_BIG_ENDIAN);
4614 offset += 1;
4615 proto_tree_add_item(tn3270_tree,
4616 hf_tn3270_destination_or_origin_doid,
4617 tvb, offset,
4619 ENC_BIG_ENDIAN);
4620 offset += 2;
4621 break;
4622 case SF_OB_IB_OBJECT_DATA:
4623 case SF_OB_IB_OBJECT_CONTROL:
4624 case SF_OB_IB_OBJECT_PICTURE:
4625 case SF_OB_IB_OEM_DATA: /* FIXME: Not really but same layout */
4626 offset += dissect_object_control(tn3270_tree, tvb, offset, sf_body_length);
4627 break;
4628 case SF_OB_IB_SAVE_OR_RESTORE_FORMAT:
4629 offset += dissect_save_or_restore_format(tn3270_tree, tvb, offset, sf_body_length);
4630 break;
4631 case SF_OB_IB_SELECT_IPDS_MODE:
4632 proto_tree_add_item(tn3270_tree,
4633 hf_tn3270_resbytes,
4634 tvb, offset,
4636 ENC_BIG_ENDIAN);
4637 offset += 2;
4638 break;
4639 default:
4640 DISSECTOR_ASSERT_NOT_REACHED();
4641 break;
4644 return (offset - start);
4647 static proto_tree *
4648 display_sf_hdr(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4649 gint sf_length, guint sf_id, guint sf_id_len, const gchar *sf_id_str)
4651 proto_item *pi;
4652 proto_tree *sf_tree;
4654 pi = proto_tree_add_text(tn3270_tree, tvb, offset, sf_length,
4655 "Structured Field: %s", sf_id_str);
4656 sf_tree = proto_item_add_subtree(pi, ett_sf);
4658 proto_tree_add_item(sf_tree,
4659 hf_tn3270_sf_length,
4660 tvb, offset,
4662 ENC_BIG_ENDIAN);
4664 proto_tree_add_uint_format_value(sf_tree,
4665 (sf_id_len == 1) ? hf_tn3270_sf_single_byte_id : hf_tn3270_sf_double_byte_id,
4666 tvb, offset+2, sf_id_len,
4667 sf_id, "%s (0x%0*x)", sf_id_str, sf_id_len*2, sf_id);
4669 return sf_tree;
4672 static gint
4673 dissect_structured_fields(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
4674 tn3270_conv_info_t *tn3270_info, gboolean direction_inbound)
4676 proto_tree *sf_tree;
4677 gint start;
4678 gint sf_length;
4679 guint sf_id;
4680 guint sf_id_len;
4681 const gchar *sf_id_str;
4683 start = offset;
4685 while (tvb_reported_length_remaining(tvb, offset) >= 2) {
4687 /* Handle NULL bytes until we find a length value */
4688 /* XXX: An earlier version of the code for structured field */
4689 /* processing did this check only for inbound structured */
4690 /* fields. Should the same be done in this code which */
4691 /* combines handling for both inbound and outbound */
4692 /* structured fields ? */
4693 if ((sf_length = tvb_get_ntohs(tvb, offset)) == 0) {
4694 proto_tree_add_item(tn3270_tree,
4695 hf_tn3270_null,
4696 tvb, offset,
4698 ENC_BIG_ENDIAN);
4699 offset += 1;
4700 continue;
4703 sf_id = tvb_get_guint8(tvb, offset+2);
4704 sf_id_len = 1;
4705 if ((sf_id == 0x0F) ||
4706 (sf_id == 0x10) ||
4707 (sf_id == 0x81)) {
4708 sf_id = (sf_id << 8) + tvb_get_guint8(tvb, offset+3);
4709 sf_id_len = 2;
4712 sf_id_str = try_val_to_str(sf_id, direction_inbound ?
4713 vals_inbound_structured_fields : vals_outbound_structured_fields);
4714 if (sf_id_str != NULL) {
4715 sf_tree = display_sf_hdr(tn3270_tree, tvb, offset,
4716 sf_length, sf_id, sf_id_len, sf_id_str);
4717 offset += (sf_id_len + 2);
4718 if (direction_inbound) {
4719 offset += process_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4721 else {
4722 offset += process_outbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4724 continue;
4727 /* Not found above: See if an "outbound-inbound" field */
4728 sf_id_str = try_val_to_str(sf_id, vals_outbound_inbound_structured_fields);
4729 if (sf_id_str != NULL) {
4730 sf_tree = display_sf_hdr(tn3270_tree, tvb, offset,
4731 sf_length, sf_id, sf_id_len, sf_id_str);
4732 offset += (sf_id_len + 2);
4733 offset += process_outbound_inbound_structured_field(sf_tree, tvb, offset, tn3270_info, sf_id, sf_length-2-sf_id_len);
4734 continue;
4737 /* Not found */
4738 sf_id_str = wmem_strdup_printf(wmem_packet_scope(), "Unknown [%0*x]", sf_id_len*2, sf_id);
4739 display_sf_hdr(tn3270_tree, tvb, offset, sf_length,
4740 sf_length, sf_id_len, sf_id_str);
4741 offset += sf_length;
4742 continue;
4743 } /* while */
4745 return (offset - start);
4749 /* Start: Handle WCC, Orders and Data */
4751 static gint
4752 dissect_stop_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4754 gint start = offset;
4755 gint is_oc_ge;
4757 proto_tree_add_item(tn3270_tree,
4758 hf_tn3270_stop_address,
4759 tvb, offset,
4761 ENC_BIG_ENDIAN);
4762 offset += 1;
4763 is_oc_ge = tvb_get_guint8(tvb, offset);
4764 if (is_oc_ge != OC_GE) {
4765 proto_tree_add_item(tn3270_tree,
4766 hf_tn3270_character_code,
4767 tvb, offset,
4769 ENC_BIG_ENDIAN);
4770 offset += 1;
4773 return (offset - start);
4777 * From section "4.3.3 Set Buffer Address (SBA)" of the IBM document
4778 * cited above.
4782 * Address format.
4784 * XXX - what about 16-bit addressing?
4786 #define SBA_ADDRESS_FORMAT_MASK 0xC000
4787 #define SBA_ADDRESS_MASK_SHIFT 14
4788 #define SBA_ADDRESS_FORMAT(address) (((address) & SBA_ADDRESS_FORMAT_MASK) >> SBA_ADDRESS_MASK_SHIFT)
4790 #define SBA_ADDRESS_VALUE_MASK 0x3FFF
4791 #define SBA_ADDRESS_VALUE(address) ((address) & SBA_ADDRESS_VALUE_MASK)
4793 #define SBA_14_BIT_BINARY 0x0
4794 #define SBA_12_BIT_CODED_1 0x1
4795 #define SBA_RESERVED 0x2
4796 #define SBA_12_BIT_CODED_2 0x3
4798 static gint
4799 dissect_buffer_address(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, gint hf, tn3270_conv_info_t *tn3270_info)
4801 gint start = offset;
4802 guint16 buffer_addr;
4803 guint16 address_format, address_value;
4804 guint8 b1, b2;
4805 guint8 rowsx = tn3270_info->rows;
4806 guint8 colsx = tn3270_info->cols;
4808 buffer_addr = tvb_get_ntohs(tvb, offset);
4809 address_format = SBA_ADDRESS_FORMAT(buffer_addr);
4810 address_value = SBA_ADDRESS_VALUE(buffer_addr);
4813 * XXX - put the address format and address value into the protocol
4814 * tree as bitfields under these items?
4816 switch (address_format) {
4818 case SBA_14_BIT_BINARY:
4819 proto_tree_add_uint_format_value(tn3270_tree,
4821 tvb, offset, 2,
4822 buffer_addr,
4823 "14-bit address, %u = row %u, column %u [assuming a %ux%u display] (0x%04x)",
4824 address_value,
4825 (address_value / colsx) + 1,
4826 (address_value % colsx) + 1,
4827 rowsx, colsx,
4828 buffer_addr);
4829 break;
4831 case SBA_12_BIT_CODED_1:
4832 case SBA_12_BIT_CODED_2:
4834 * This is a wacky encoding. At least as I read the IBM document
4835 * in question, the lower 6 bits of the first byte of the SBA
4836 * address, and the lower 6 bits of the second byte of the SBA
4837 * address, are combined into a 12-bit binary address. The upper
4838 * 2 bits of the first byte are the address format; the upper 2
4839 * bits of the second byte are ignored.
4841 b1 = (address_value >> 8) & 0x3F;
4842 b2 = (address_value >> 0) & 0x3F;
4843 address_value = (b1 << 6) | b2;
4844 proto_tree_add_uint_format_value(tn3270_tree,
4846 tvb, offset, 2,
4847 buffer_addr,
4848 "12-bit address, %u = row %u, column %u [assuming a %ux%u display] (0x%04x)",
4849 address_value,
4850 (address_value / colsx) + 1,
4851 (address_value % colsx) + 1,
4852 rowsx, colsx,
4853 buffer_addr);
4854 break;
4856 case SBA_RESERVED:
4857 proto_tree_add_uint_format_value(tn3270_tree,
4859 tvb, offset, 2,
4860 buffer_addr,
4861 "Reserved (0x%04x)",
4862 buffer_addr);
4863 break;
4865 offset += 2;
4867 return (offset - start);
4870 static gint
4871 dissect_field_attribute_pair(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4873 gint start = offset;
4874 gint attribute_type;
4876 attribute_type = tvb_get_guint8(tvb, offset);
4877 proto_tree_add_item(tn3270_tree,
4878 hf_tn3270_attribute_type,
4879 tvb, offset,
4881 ENC_BIG_ENDIAN);
4882 offset += 1;
4883 switch (attribute_type) {
4884 case AT_ALL_CHARACTER_ATTRIBUTES:
4885 proto_tree_add_item(tn3270_tree,
4886 hf_tn3270_all_character_attributes,
4887 tvb, offset,
4889 ENC_BIG_ENDIAN);
4890 offset += 1;
4891 break;
4892 case AT_T3270_FIELD_ATTRIBUTE:
4893 offset += dissect_3270_field_attribute(tn3270_tree, tvb, offset);
4894 break;
4895 case AT_EXTENDED_HIGHLIGHTING:
4896 proto_tree_add_item(tn3270_tree,
4897 hf_tn3270_extended_highlighting,
4898 tvb, offset,
4900 ENC_BIG_ENDIAN);
4901 offset += 1;
4902 break;
4903 case AT_FOREGROUND_COLOR:
4904 case AT_BACKGROUND_COLOR:
4905 proto_tree_add_item(tn3270_tree,
4906 hf_tn3270_color,
4907 tvb, offset,
4909 ENC_BIG_ENDIAN);
4910 offset += 1;
4911 break;
4912 case AT_CHARACTER_SET:
4913 proto_tree_add_item(tn3270_tree,
4914 hf_tn3270_character_set,
4915 tvb, offset,
4917 ENC_BIG_ENDIAN);
4918 offset += 1;
4919 break;
4920 case AT_FIELD_OUTLINING:
4921 proto_tree_add_item(tn3270_tree,
4922 hf_tn3270_field_outlining,
4923 tvb, offset,
4925 ENC_BIG_ENDIAN);
4926 offset += 1;
4927 break;
4928 case AT_TRANSPARENCY:
4929 proto_tree_add_item(tn3270_tree,
4930 hf_tn3270_transparency,
4931 tvb, offset,
4933 ENC_BIG_ENDIAN);
4934 offset += 1;
4935 break;
4936 case AT_FIELD_VALIDATION:
4937 offset += dissect_3270_field_validation(tn3270_tree, tvb, offset);
4938 break;
4941 return (offset - start);
4944 static gint
4945 dissect_field_attribute_pairs(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
4947 gint start = offset;
4948 gint no_of_pairs;
4949 gint i;
4951 no_of_pairs = tvb_get_guint8(tvb, offset);
4952 proto_tree_add_item(tn3270_tree,
4953 hf_tn3270_number_of_attributes,
4954 tvb, offset,
4956 ENC_BIG_ENDIAN);
4957 offset += 1;
4959 for (i=0; i < no_of_pairs; i++) {
4960 offset += dissect_field_attribute_pair(tn3270_tree, tvb, offset);
4963 return (offset - start);
4966 static gint
4967 dissect_orders_and_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
4969 gint start = offset;
4970 gint order_code;
4972 /* Order Code */
4974 /* XXX: '0' is treated as data; See comment under add_data_until_next_order_code() */
4975 while (tvb_reported_length_remaining(tvb, offset) > 0) {
4976 order_code = tvb_get_guint8(tvb, offset);
4977 if ((order_code > 0) && (order_code <= OC_MAX)) { /* XXX: also 0xFF ?? */
4978 proto_tree_add_item(tn3270_tree,
4979 hf_tn3270_order_code,
4980 tvb, offset,
4982 ENC_BIG_ENDIAN);
4983 offset += 1;
4985 switch (order_code) {
4986 case OC_SF:
4987 offset += dissect_3270_field_attribute(tn3270_tree, tvb, offset);
4988 break;
4989 case OC_MF:
4990 case OC_SFE:
4991 offset += dissect_field_attribute_pairs(tn3270_tree, tvb, offset);
4992 break;
4993 case OC_SA:
4994 offset += dissect_field_attribute_pair(tn3270_tree, tvb, offset);
4995 break;
4996 case OC_EUA:
4997 case OC_RA:
4998 offset += dissect_stop_address(tn3270_tree, tvb, offset);
4999 break;
5000 case OC_GE:
5001 proto_tree_add_item(tn3270_tree,
5002 hf_tn3270_character_code,
5003 tvb, offset,
5005 ENC_BIG_ENDIAN);
5006 offset += 1;
5007 break;
5008 case OC_SBA:
5009 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_buffer_address, tn3270_info);
5010 break;
5011 case OC_PT: /* XXX: This case was previously commented out; I don't know why */
5012 case OC_IC:
5013 break;
5014 default:
5015 proto_tree_add_text(tn3270_tree, tvb, offset, 1, "Bogus value: %u", order_code);
5016 break;
5017 } /* switch */
5019 else {
5020 offset += add_data_until_next_order_code(tn3270_tree, tvb, offset);
5022 } /* while */
5024 return (offset - start);
5027 /* End: Handle WCC, Orders and Data */
5030 static gint
5031 dissect_tn3270e_header(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
5033 proto_item *pi;
5034 proto_tree *tn3270e_hdr_tree;
5035 gint start = offset;
5036 gint data_type;
5038 static const hf_items fields[] = {
5039 { &hf_tn3270_tn3270e_data_type, NULL, 1, NULL, ENC_BIG_ENDIAN },
5040 { &hf_tn3270_tn3270e_request_flag, NULL, 1, NULL, ENC_BIG_ENDIAN },
5041 { NULL, NULL, 0, NULL, 0 }
5044 data_type = tvb_get_guint8(tvb, offset);
5046 pi = proto_tree_add_text(tn3270_tree, tvb, offset, -1,
5047 "TN3270E Header (Data Type: %s)",
5048 val_to_str_const(data_type, vals_tn3270_header_data_types, "Unknown"));
5049 tn3270e_hdr_tree = proto_item_add_subtree(pi, ett_tn3270e_hdr);
5051 offset += tn3270_add_hf_items(tn3270e_hdr_tree, tvb, offset,
5052 fields);
5053 switch(data_type) {
5054 case TN3270E_3270_DATA:
5055 case TN3270E_SCS_DATA:
5056 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_3270_SCS, tvb, offset, 1, ENC_BIG_ENDIAN);
5057 break;
5058 case TN3270E_RESPONSE:
5059 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_response, tvb, offset, 1, ENC_BIG_ENDIAN);
5060 break;
5061 case TN3270E_BIND_IMAGE:
5062 case TN3270E_NVT_DATA:
5063 case TN3270E_REQUEST:
5064 case TN3270E_SSCP_LU_DATA:
5065 case TN3270E_UNBIND:
5066 default:
5067 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_response_flag_unused, tvb, offset, 1, ENC_BIG_ENDIAN);
5068 break;
5070 offset += 1;
5072 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN);
5073 offset += 2;
5075 switch (data_type) {
5076 case TN3270E_BIND_IMAGE:
5077 case TN3270E_NVT_DATA:
5078 case TN3270E_REQUEST:
5079 case TN3270E_RESPONSE:
5080 case TN3270E_SCS_DATA:
5081 case TN3270E_SSCP_LU_DATA:
5082 case TN3270E_UNBIND:
5083 proto_tree_add_item(tn3270e_hdr_tree, hf_tn3270_tn3270e_header_data, tvb, offset, -1, ENC_EBCDIC|ENC_NA);
5084 offset += tvb_reported_length_remaining(tvb, offset);
5085 break;
5086 default:
5087 break;
5090 proto_item_set_len(pi, offset - start);
5092 return (offset - start);
5095 /* Detect and Handle Direction of Stream */
5096 static gint
5097 dissect_outbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
5099 gint command_code;
5100 gint start = offset;
5102 /* Command Code*/
5103 command_code = tvb_get_guint8(tvb, offset);
5105 /* XXX: Storing rows/cols each time they change is not valid */
5106 /* since packets can (will be) randomly selected for dissection */
5107 /* after the initial dissection pass. In actuality screen size */
5108 /* "state" needs to be associated in some manner with each */
5109 /* frame of a conversation. */
5110 switch (command_code) {
5111 case CC_LCL_EW:
5112 case CC_RMT_EW:
5113 tn3270_info->rows = 24;
5114 tn3270_info->cols = 80;
5115 break;
5116 case CC_LCL_EWA:
5117 case CC_RMT_EWA:
5118 tn3270_info->rows = tn3270_info->altrows;
5119 tn3270_info->cols = tn3270_info->altcols;
5120 break;
5121 default:
5122 break;
5125 switch (command_code) {
5126 case CC_LCL_W:
5127 case CC_LCL_EW:
5128 case CC_LCL_EWA:
5129 case CC_LCL_EAU:
5130 case CC_RMT_W:
5131 case CC_RMT_EW:
5132 case CC_RMT_EWA:
5133 case CC_RMT_EAU:
5134 proto_tree_add_item(tn3270_tree,
5135 hf_tn3270_command_code,
5136 tvb, offset,
5138 ENC_BIG_ENDIAN);
5139 offset += 1;
5140 /* WCC */
5141 offset += dissect_wcc(tn3270_tree, tvb, offset);
5142 offset += dissect_orders_and_data(tn3270_tree, tvb, offset, tn3270_info);
5143 break;
5144 case CC_LCL_WSF:
5145 case CC_RMT_WSF:
5146 proto_tree_add_item(tn3270_tree,
5147 hf_tn3270_command_code,
5148 tvb, offset,
5150 ENC_BIG_ENDIAN);
5151 offset += 1;
5152 offset += dissect_structured_fields(tn3270_tree, tvb, offset, tn3270_info, FALSE);
5153 break;
5154 case CC_LCL_RB:
5155 case CC_LCL_RM:
5156 case CC_LCL_RMA:
5157 case CC_RMT_RB:
5158 case CC_RMT_RM:
5159 case CC_RMT_RMA:
5160 proto_tree_add_item(tn3270_tree,
5161 hf_tn3270_command_code,
5162 tvb, offset,
5164 ENC_BIG_ENDIAN);
5165 offset += 1;
5166 break;
5167 default:
5168 /* XXX: Add expert item ? */
5169 proto_tree_add_text(tn3270_tree, tvb, offset, 1, "Bogus value: %u", command_code);
5170 offset += 1;
5171 break;
5174 return (offset - start);
5178 /* INBOUND DATA STREAM (DISPLAY -> MAINFRAME PROGRAM) */
5179 /* Dissect tvb as inbound */
5180 static gint
5181 dissect_inbound_stream(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset, tn3270_conv_info_t *tn3270_info)
5183 gint start = offset;
5184 gint aid;
5186 /* Command Code*/
5187 aid = tvb_get_guint8(tvb, offset);
5188 proto_tree_add_item(tn3270_tree,
5189 hf_tn3270_aid,
5190 tvb, offset,
5192 ENC_BIG_ENDIAN);
5193 offset += 1;
5194 switch (aid) {
5195 case AID_STRUCTURED_FIELD:
5196 offset += dissect_structured_fields(tn3270_tree, tvb, offset, tn3270_info, TRUE);
5197 break;
5198 case AID_PA1_KEY:
5199 case AID_PA2_KEY_CNCL:
5200 case AID_PA3_KEY:
5201 case AID_CLEAR_KEY:
5202 /* Certain AID bytes need not be followed by anything */
5203 /* XXX: Is this the correct/complete set of AID bytes for this case ? */
5204 if (tvb_reported_length_remaining(tvb, offset) <= 0)
5205 break;
5206 /* fall into next */
5207 case AID_READ_PARTITION_AID:
5208 case AID_NO_AID_GENERATED:
5209 case AID_NO_AID_GENERATED_PRINTER_ONLY:
5210 case AID_TRIGGER_ACTION:
5211 case AID_TEST_REQ_AND_SYS_REQ:
5212 case AID_PF1_KEY:
5213 case AID_PF2_KEY:
5214 case AID_PF3_KEY:
5215 case AID_PF4_KEY:
5216 case AID_PF5_KEY:
5217 case AID_PF6_KEY:
5218 case AID_PF7_KEY:
5219 case AID_PF8_KEY:
5220 case AID_PF9_KEY:
5221 case AID_PF10_KEY:
5222 case AID_PF11_KEY:
5223 case AID_PF12_KEY:
5224 case AID_PF13_KEY:
5225 case AID_PF14_KEY:
5226 case AID_PF15_KEY:
5227 case AID_PF16_KEY:
5228 case AID_PF17_KEY:
5229 case AID_PF18_KEY:
5230 case AID_PF19_KEY:
5231 case AID_PF20_KEY:
5232 case AID_PF21_KEY:
5233 case AID_PF22_KEY:
5234 case AID_PF23_KEY:
5235 case AID_PF24_KEY:
5236 case AID_CLEAR_PARTITION_KEY:
5237 case AID_ENTER_KEY:
5238 case AID_SELECTOR_PEN_ATTENTION:
5239 case AID_OPERATOR_ID_READER:
5240 case AID_MAG_READER_NUMBER:
5241 offset += dissect_buffer_address(tn3270_tree, tvb, offset, hf_tn3270_cursor_address, tn3270_info);
5242 offset += dissect_orders_and_data(tn3270_tree, tvb, offset, tn3270_info);
5243 break;
5244 default:
5245 proto_tree_add_text(tn3270_tree, tvb, offset, 1, "Bogus value: %u", aid);
5246 offset += 1;
5247 break;
5250 return (offset - start);
5254 static void
5255 dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
5257 proto_tree *tn3270_tree;
5258 proto_item *pi;
5259 gint offset = 0;
5260 conversation_t *conversation;
5261 tn3270_conv_info_t *tn3270_info = NULL;
5263 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TN3270");
5265 pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC;
5267 /* Do we have a conversation for this connection? */
5268 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5269 pinfo->ptype, pinfo->srcport,
5270 pinfo->destport, 0);
5271 if (conversation != NULL) {
5272 /* Do we already have a type and mechanism? */
5273 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5276 if (tn3270_info == NULL)
5277 return;
5279 pi = proto_tree_add_item(tree, proto_tn3270, tvb, offset, -1, ENC_NA);
5280 tn3270_tree = proto_item_add_subtree(pi, ett_tn3270);
5281 col_clear(pinfo->cinfo, COL_INFO);
5283 if (tn3270_info->extended) {
5284 offset += dissect_tn3270e_header(tn3270_tree, tvb, offset);
5287 if (tvb_reported_length_remaining(tvb, offset) <= 0)
5288 return;
5290 if (pinfo->srcport == tn3270_info->outbound_port) {
5291 col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data from Mainframe");
5293 else {
5294 col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data to Mainframe");
5297 if(tree) {
5298 while (tvb_reported_length_remaining(tvb, offset) > 0) {
5299 if (pinfo->srcport == tn3270_info->outbound_port) {
5300 offset += dissect_outbound_stream(tn3270_tree, tvb, offset, tn3270_info);
5302 else {
5303 offset += dissect_inbound_stream(tn3270_tree, tvb, offset, tn3270_info);
5310 void
5311 add_tn3270_conversation(packet_info *pinfo, int tn3270e, gint model)
5313 conversation_t *conversation;
5314 tn3270_conv_info_t *tn3270_info;
5316 conversation = find_or_create_conversation(pinfo);
5319 * Do we already have a type and mechanism?
5321 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5322 if (tn3270_info == NULL) {
5323 /* No. Attach that information to the conversation, and add
5324 * it to the list of information structures.
5326 tn3270_info = wmem_new(wmem_file_scope(), tn3270_conv_info_t);
5328 COPY_ADDRESS(&(tn3270_info->outbound_addr), &(pinfo->dst));
5329 tn3270_info->outbound_port = pinfo->destport;
5331 COPY_ADDRESS(&(tn3270_info->inbound_addr), &(pinfo->src));
5332 tn3270_info->inbound_port = pinfo->srcport;
5334 conversation_add_proto_data(conversation, proto_tn3270, tn3270_info);
5337 /* The maximum rows/cols is tied to the 3270 model number */
5338 switch (model) {
5339 default:
5340 case 2:
5341 tn3270_info->altrows = 24;
5342 tn3270_info->altcols = 80;
5343 break;
5344 case 3:
5345 tn3270_info->altrows = 32;
5346 tn3270_info->altcols = 80;
5347 break;
5348 case 4:
5349 tn3270_info->altrows = 43;
5350 tn3270_info->altcols = 80;
5351 break;
5352 case 5:
5353 tn3270_info->altrows = 27;
5354 tn3270_info->altcols = 132;
5355 break;
5357 tn3270_info->rows = 24;
5358 tn3270_info->cols = 80;
5360 tn3270_info->extended = tn3270e;
5365 find_tn3270_conversation(packet_info *pinfo)
5367 conversation_t *conversation = NULL;
5368 tn3270_conv_info_t *tn3270_info = NULL;
5371 * Do we have a conversation for this connection?
5373 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
5374 pinfo->ptype, pinfo->srcport,
5375 pinfo->destport, 0);
5376 if (conversation != NULL) {
5377 tn3270_info = (tn3270_conv_info_t *)conversation_get_proto_data(conversation, proto_tn3270);
5378 if (tn3270_info != NULL) {
5380 * Do we already have a type and mechanism?
5382 return 1;
5385 return 0;
5388 void
5389 proto_register_tn3270(void)
5391 static hf_register_info hf[] = {
5392 { &hf_tn3270_command_code,
5393 { "Command Code",
5394 "tn3270.command_code",
5395 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5396 NULL, HFILL }
5398 { &hf_tn3270_sf_length,
5399 { "Structured Field Length",
5400 "tn3270.sf_length",
5401 FT_UINT16, BASE_DEC, NULL, 0x0,
5402 NULL, HFILL }
5405 /* 3.4 Write Control Characters */
5406 { &hf_tn3270_wcc_nop,
5407 { "WCC NOP",
5408 "tn3270.wcc.nop",
5409 FT_BOOLEAN, 8, NULL, WCC_NOP,
5410 NULL, HFILL }
5412 { &hf_tn3270_wcc_reset,
5413 { "WCC Reset",
5414 "tn3270.wcc.reset",
5415 FT_BOOLEAN, 8, NULL, WCC_RESET,
5416 NULL, HFILL }
5418 { &hf_tn3270_wcc_printer1,
5419 { "WCC Printer1",
5420 "tn3270.wcc.printer1",
5421 FT_BOOLEAN, 8, NULL, WCC_PRINTER1,
5422 NULL, HFILL }
5424 { &hf_tn3270_wcc_printer2,
5425 { "WCC Printer2",
5426 "tn3270.wcc.printer2",
5427 FT_BOOLEAN, 8, NULL, WCC_PRINTER2,
5428 NULL, HFILL }
5430 { &hf_tn3270_wcc_start_printer,
5431 { "WCC Start Printer",
5432 "tn3270.wcc.start_printer",
5433 FT_BOOLEAN, 8, NULL, WCC_START_PRINTER,
5434 NULL, HFILL }
5436 { &hf_tn3270_wcc_sound_alarm,
5437 { "WCC Sound Alarm",
5438 "tn3270.wcc.sound_alarm",
5439 FT_BOOLEAN, 8, NULL, WCC_SOUND_ALARM,
5440 NULL, HFILL }
5442 { &hf_tn3270_wcc_keyboard_restore,
5443 { "WCC Keyboard Restore",
5444 "tn3270.wcc.keyboard_restore",
5445 FT_BOOLEAN, 8, NULL, WCC_KEYBOARD_RESTORE,
5446 NULL, HFILL }
5448 { &hf_tn3270_wcc_reset_mdt,
5449 { "WCC Reset MDT",
5450 "tn3270.wcc.reset_mdt",
5451 FT_BOOLEAN, 8, NULL, WCC_RESET_MDT,
5452 NULL, HFILL }
5455 /* 8.7 Copy Control Codes (CCC) */
5456 { &hf_tn3270_ccc,
5457 { "Copy Control Code",
5458 "tn3270.ccc",
5459 FT_UINT8, BASE_HEX, NULL, 0,
5460 NULL, HFILL }
5462 { &hf_tn3270_ccc_coding,
5463 { "Coding",
5464 "tn3270.ccc_coding",
5465 FT_UINT8, BASE_HEX, NULL, CCC_GRAPHIC_CONVERT_MASK,
5466 NULL, HFILL }
5468 { &hf_tn3270_ccc_printout,
5469 { "Printout Format",
5470 "tn3270.ccc_printout",
5471 FT_UINT8, BASE_HEX, VALS(ccc_vals_printout_format), CCC_PRINT_BITS_MASK,
5472 NULL, HFILL }
5474 { &hf_tn3270_ccc_start_print,
5475 { "The start-print bit",
5476 "tn3270.ccc_start_print",
5477 FT_BOOLEAN, 8, NULL, CCC_START_PRINT,
5478 NULL, HFILL }
5480 { &hf_tn3270_ccc_sound_alarm,
5481 { "The sound-alarm bit",
5482 "tn3270.ccc_sound_alarm",
5483 FT_BOOLEAN, 8, NULL, CCC_SOUND_ALARM,
5484 NULL, HFILL }
5486 { &hf_tn3270_ccc_copytype,
5487 { "Type of Data to be Copied",
5488 "tn3270.ccc_copytype",
5489 FT_UINT8, BASE_HEX, VALS(ccc_vals_copytype), CCC_ATTRIBUTE_BITS_MASK,
5490 NULL, HFILL }
5493 /* 4.4.1 Field Attributes */
5494 { &hf_tn3270_field_attribute,
5495 { "3270 Field Attribute",
5496 "tn3270.field_attribute",
5497 FT_UINT8, BASE_HEX, NULL, 0,
5498 NULL, HFILL }
5500 { &hf_tn3270_fa_graphic_convert,
5501 { "Graphic Convert",
5502 "tn3270.fa.graphic_convert",
5503 FT_UINT8, BASE_HEX, NULL, FA_GRAPHIC_CONVERT_MASK,
5504 NULL, HFILL }
5506 { &hf_tn3270_fa_protected,
5507 { "Protected",
5508 "tn3270.fa.protected",
5509 FT_BOOLEAN, 8, NULL, FA_PROTECTED,
5510 NULL, HFILL }
5512 { &hf_tn3270_fa_numeric,
5513 { "Numeric",
5514 "tn3270.fa.numeric",
5515 FT_BOOLEAN, 8, NULL, FA_NUMERIC,
5516 NULL, HFILL }
5518 { &hf_tn3270_fa_display,
5519 { "Display",
5520 "tn3270.fa.display",
5521 FT_UINT8, BASE_HEX, VALS(vals_fa_display), FA_DISPLAY_BITS_MASK,
5522 NULL, HFILL }
5524 { &hf_tn3270_fa_reserved,
5525 { "Reserved",
5526 "tn3270.fa.reserved",
5527 FT_BOOLEAN, 8, NULL, FA_RESERVED,
5528 NULL, HFILL }
5530 { &hf_tn3270_fa_modified,
5531 { "Modified",
5532 "tn3270.fa.modified",
5533 FT_BOOLEAN, 8, NULL, FA_MODIFIED,
5534 NULL, HFILL }
5537 /* Order Code */
5538 { &hf_tn3270_order_code,
5539 { "Order Code",
5540 "tn3270.order_code",
5541 FT_UINT8, BASE_HEX, VALS(vals_order_codes), 0x0,
5542 NULL, HFILL }
5544 { &hf_tn3270_character_code,
5545 { "Character Code",
5546 "tn3270.character_code",
5547 FT_UINT8, BASE_HEX, NULL, 0x0,
5548 NULL, HFILL }
5550 { &hf_tn3270_stop_address,
5551 { "Stop Address",
5552 "tn3270.stop_address",
5553 FT_UINT16, BASE_DEC, NULL, 0x0,
5554 NULL, HFILL }
5556 { &hf_tn3270_attribute_type,
5557 { "Attribute Type",
5558 "tn3270.attribute_type",
5559 FT_UINT8, BASE_HEX, VALS(vals_attribute_types), 0x0,
5560 NULL, HFILL }
5562 { &hf_tn3270_extended_highlighting,
5563 { "Extended Highlighting",
5564 "tn3270.extended_highlighting",
5565 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
5566 NULL, HFILL }
5568 { &hf_tn3270_color,
5569 { "Color",
5570 "tn3270.color",
5571 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
5572 NULL, HFILL }
5574 { &hf_tn3270_character_set,
5575 { "Character Set",
5576 "tn3270.character_set",
5577 FT_UINT8, BASE_RANGE_STRING|BASE_HEX, RVALS(rvals_at_character_set), 0x0,
5578 NULL, HFILL }
5580 { &hf_tn3270_field_outlining,
5581 { "Field Outlining",
5582 "tn3270.field_outlining",
5583 FT_UINT8, BASE_HEX, VALS(vals_at_field_outlining), 0x0,
5584 NULL, HFILL }
5586 { &hf_tn3270_transparency,
5587 { "Transparency",
5588 "tn3270.transparency",
5589 FT_UINT8, BASE_HEX, VALS(vals_at_transparency), 0x0,
5590 NULL, HFILL }
5593 { &hf_tn3270_field_validation_mandatory_fill,
5594 { "3270 Field validation_mandatory_fill",
5595 "tn3270.field_validation_mandatory_fill",
5596 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_mandatory_fill), AT_FV_MANDATORY_FILL,
5597 NULL, HFILL }
5599 { &hf_tn3270_field_validation_mandatory_entry,
5600 { "3270 Field validation_mandatory_entry",
5601 "tn3270.field_validation_mandatory_entry",
5602 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_mandatory_entry), AT_FV_MANDATORY_ENTRY,
5603 NULL, HFILL }
5605 { &hf_tn3270_field_validation_trigger,
5606 { "3270 Field validation_trigger",
5607 "tn3270.field_validation_trigger",
5608 FT_BOOLEAN, 8, TFS(&tn3270_field_validation_trigger), AT_FV_TRIGGER,
5609 NULL, HFILL }
5612 { &hf_tn3270_all_character_attributes,
5613 { "all_character_attributes",
5614 "tn3270.all_character_attributes",
5615 FT_UINT8, BASE_HEX, NULL, 0x0,
5616 NULL, HFILL }
5618 { &hf_tn3270_aid,
5619 { "Attention Identification",
5620 "tn3270.aid",
5621 FT_UINT8, BASE_HEX, VALS(vals_attention_identification_bytes), 0x0,
5622 NULL, HFILL }
5625 { &hf_tn3270_buffer_address,
5626 { "Buffer Address",
5627 "tn3270.buffer_address",
5628 FT_UINT16, BASE_HEX, NULL, 0x0,
5629 NULL, HFILL }
5632 /* Self Defining Parameters */
5633 { &hf_tn3270_sdp_ln,
5634 { "Length of this Self-Defining Parameter",
5635 "tn3270.sdp_ln",
5636 FT_UINT8, BASE_DEC, NULL, 0x0,
5637 NULL, HFILL }
5639 { &hf_tn3270_sdp_id,
5640 { "Self-Defining Parameter ID",
5641 "tn3270.sdp_id",
5642 FT_UINT8, BASE_HEX, NULL, 0x0,
5643 NULL, HFILL }
5645 /* Self Defining Parameters */
5647 /* 5.6 - Begin/End of File */
5648 { &hf_tn3270_begin_end_flags1,
5649 { "Begin End Flags1",
5650 "tn3270.begin_end_flags1",
5651 FT_UINT8, BASE_HEX, NULL, 0x0,
5652 NULL, HFILL }
5654 { &hf_tn3270_begin_end_flags2,
5655 { "Begin End Flags2",
5656 "tn3270.begin_end_flags2",
5657 FT_UINT8, BASE_HEX, NULL, 0x0,
5658 NULL, HFILL }
5660 /* END - 5.6 - Begin/End of File */
5662 /* 5.7 - Create Partition */
5663 { &hf_tn3270_partition_id,
5664 { "Partition ID",
5665 "tn3270.partition_id",
5666 FT_UINT8, BASE_HEX, NULL, 0x0,
5667 NULL, HFILL }
5669 { &hf_tn3270_partition_uom,
5670 { "The unit of measure and address mode",
5671 "tn3270.partition_uom",
5672 FT_UINT8, BASE_HEX, NULL, 0x0,
5673 NULL, HFILL }
5675 { &hf_tn3270_partition_flags,
5676 { "Flags",
5677 "tn3270.partition_flags",
5678 FT_UINT8, BASE_HEX, NULL, 0x0,
5679 NULL, HFILL }
5681 { &hf_tn3270_partition_height,
5682 { "The height of the presentation space",
5683 "tn3270.partition_height",
5684 FT_UINT16, BASE_DEC, NULL, 0x0,
5685 NULL, HFILL }
5687 { &hf_tn3270_partition_width,
5688 { "The width of the presentation space",
5689 "tn3270.partition_width",
5690 FT_UINT16, BASE_DEC, NULL, 0x0,
5691 NULL, HFILL }
5693 { &hf_tn3270_partition_rv,
5694 { "The y, or row, origin of the viewport relative to the top edge of the usable area",
5695 "tn3270.partition_rv",
5696 FT_UINT16, BASE_DEC, NULL, 0x0,
5697 NULL, HFILL }
5699 { &hf_tn3270_partition_cv,
5700 { "The x, or column, origin of the viewport relative to the left side of the usable area",
5701 "tn3270.partition_cv",
5702 FT_UINT16, BASE_DEC, NULL, 0x0,
5703 NULL, HFILL }
5705 { &hf_tn3270_partition_hv,
5706 { "The height of the viewport",
5707 "tn3270.partition_hv",
5708 FT_UINT16, BASE_DEC, NULL, 0x0,
5709 NULL, HFILL }
5711 { &hf_tn3270_partition_wv,
5712 { "The width of the viewport",
5713 "tn3270.partition_wv",
5714 FT_UINT16, BASE_DEC, NULL, 0x0,
5715 NULL, HFILL }
5717 { &hf_tn3270_partition_rw,
5718 { "The y, or row, origin of the window relative to the top edge of the presentation space",
5719 "tn3270.partition_rw",
5720 FT_UINT16, BASE_DEC, NULL, 0x0,
5721 NULL, HFILL }
5723 { &hf_tn3270_partition_cw,
5724 { "The x, or column, origin of the window relative to the left edge of the presentation space",
5725 "tn3270.partition_cw",
5726 FT_UINT16, BASE_DEC, NULL, 0x0,
5727 NULL, HFILL }
5729 { &hf_tn3270_partition_rs,
5730 { "The number of units to be scrolled in a vertical multiple scroll",
5731 "tn3270.partition_rs",
5732 FT_UINT16, BASE_DEC, NULL, 0x0,
5733 NULL, HFILL }
5735 { &hf_tn3270_partition_res,
5736 { "Reserved",
5737 "tn3270.partition_res",
5738 FT_UINT16, BASE_DEC, NULL, 0x0,
5739 NULL, HFILL }
5741 { &hf_tn3270_partition_pw,
5742 { "The number of points in the horizontal direction in a character cell in this presentation space",
5743 "tn3270.partition_pw",
5744 FT_UINT8, BASE_HEX, NULL, 0x0,
5745 NULL, HFILL }
5747 { &hf_tn3270_partition_ph,
5748 { "The number of points in the vertical direction in a character cell in this presentation space",
5749 "tn3270.partition_ph",
5750 FT_UINT16, BASE_DEC, NULL, 0x0,
5751 NULL, HFILL }
5754 { &hf_tn3270_partition_command,
5755 { "Partition Command",
5756 "tn3270.partition_command",
5757 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5758 NULL, HFILL }
5760 /* End - 5.7 - Create Partition */
5762 /* 5.9 - Erase/Reset */
5763 { &hf_tn3270_erase_flags,
5764 { "Erase Flags",
5765 "tn3270.erase_flags",
5766 FT_UINT8, BASE_HEX, NULL, 0x0,
5767 NULL, HFILL }
5769 /* End - 5.9 - Erase/Reset */
5771 /* 5.10 - Load Color Table */
5772 { &hf_tn3270_load_color_command,
5773 { "Command",
5774 "tn3270.load_color_command",
5775 FT_BYTES, BASE_NONE, NULL, 0x0,
5776 NULL, HFILL }
5778 /* End - 5.10 - Load Color Table */
5780 /* 5.11 - Load Format Storage */
5781 { &hf_tn3270_load_format_storage_flags1,
5782 { "Flags",
5783 "tn3270.load_format_storage_flags1",
5784 FT_UINT8, BASE_HEX, NULL, 0x0,
5785 NULL, HFILL }
5787 { &hf_tn3270_load_format_storage_flags2,
5788 { "Flags (Reserved)",
5789 "tn3270.load_format_storage_flags2",
5790 FT_UINT8, BASE_HEX, NULL, 0x0,
5791 NULL, HFILL }
5793 { &hf_tn3270_load_format_storage_operand,
5794 { "Operand:",
5795 "tn3270.load_format_storage_operand",
5796 FT_UINT8, BASE_HEX, VALS(vals_load_storage_format_operand), 0x0,
5797 NULL, HFILL }
5799 { &hf_tn3270_load_format_storage_localname,
5800 { "Local name for user selectable formats",
5801 "tn3270.load_format_storage_localname",
5802 FT_STRING, BASE_NONE, NULL, 0x0,
5803 NULL, HFILL }
5805 { &hf_tn3270_format_group,
5806 { "Format Group name",
5807 "tn3270.format_group_name",
5808 FT_STRING, BASE_NONE, NULL, 0x0,
5809 NULL, HFILL }
5811 { &hf_tn3270_format_name,
5812 { "Format name",
5813 "tn3270.format_name",
5814 FT_STRING, BASE_NONE, NULL, 0x0,
5815 NULL, HFILL }
5817 { &hf_tn3270_load_format_storage_format_data,
5818 { "Format data",
5819 "tn3270.load_format_storage_format_data",
5820 FT_STRING, BASE_NONE, NULL, 0x0,
5821 NULL, HFILL }},
5822 /* END - 5.11 - Load Format Storage */
5824 /* 5.12 - Load Line Type */
5825 { &hf_tn3270_load_line_type_command,
5826 { "Line Type Command",
5827 "tn3270.load_line_type_command",
5828 FT_BYTES, BASE_NONE, NULL, 0x0,
5829 NULL, HFILL }
5832 /* 5.13 - Load Programmed Symbols */
5833 { &hf_tn3270_ps_flags,
5834 { "Flags",
5835 "tn3270.ps_flags",
5836 FT_UINT8, BASE_HEX, NULL, 0x0,
5837 NULL, HFILL }
5839 { &hf_tn3270_ps_lcid,
5840 { "Local character set ID",
5841 "tn3270.ps_lcid",
5842 FT_UINT8, BASE_HEX, NULL, 0x0,
5843 NULL, HFILL }
5845 { &hf_tn3270_ps_char,
5846 { "Beginning code point X'41' through X'FE'",
5847 "tn3270.ps_char",
5848 FT_UINT8, BASE_HEX, NULL, 0x0,
5849 NULL, HFILL }
5851 { &hf_tn3270_ps_rws,
5852 { "Loadable Character Set RWS Number",
5853 "tn3270.ps_rws",
5854 FT_UINT8, BASE_HEX, NULL, 0x0,
5855 NULL, HFILL }
5857 { &hf_tn3270_extended_ps_length,
5858 { "Length of parameters for extended form, including the length parameter",
5859 "tn3270.extended_ps_length",
5860 FT_UINT8, BASE_HEX, NULL, 0x0,
5861 NULL, HFILL }
5863 { &hf_tn3270_extended_ps_flags,
5864 { "Flags",
5865 "tn3270.extended_ps_flags",
5866 FT_UINT8, BASE_HEX, NULL, 0x0,
5867 NULL, HFILL }
5869 { &hf_tn3270_extended_ps_lw,
5870 { "Number of X-units in character cell (width of character matrixes)",
5871 "tn3270.extended_ps_lw",
5872 FT_UINT8, BASE_HEX, NULL, 0x0,
5873 NULL, HFILL }
5875 { &hf_tn3270_extended_ps_lh,
5876 { "Number of Y-units in character cell (depth ofcharacter matrixes)",
5877 "tn3270.extended_ps_lh",
5878 FT_UINT8, BASE_HEX, NULL, 0x0,
5879 NULL, HFILL }
5881 { &hf_tn3270_extended_ps_subsn,
5882 { "Subsection ID",
5883 "tn3270.extended_ps_subsn",
5884 FT_UINT8, BASE_HEX, NULL, 0x0,
5885 NULL, HFILL }
5887 { &hf_tn3270_extended_ps_color,
5888 { "Color planes",
5889 "tn3270.extended_ps_color",
5890 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
5891 NULL, HFILL }
5893 { &hf_tn3270_extended_ps_stsubs,
5894 { "Starting Subsection Identifier",
5895 "tn3270.extended_ps_stsubs",
5896 FT_UINT8, BASE_HEX, NULL, 0x0,
5897 NULL, HFILL }
5899 { &hf_tn3270_extended_ps_echar,
5900 { "Ending code point",
5901 "tn3270.extended_ps_echar",
5902 FT_UINT8, BASE_HEX, NULL, 0x0,
5903 NULL, HFILL }
5905 { &hf_tn3270_extended_ps_nw,
5906 { "Number of width pairs",
5907 "tn3270.extended_ps_nw",
5908 FT_UINT8, BASE_HEX, NULL, 0x0,
5909 NULL, HFILL }
5911 { &hf_tn3270_extended_ps_nh,
5912 { "Number of height pairs",
5913 "tn3270.extended_ps_nh",
5914 FT_UINT8, BASE_HEX, NULL, 0x0,
5915 NULL, HFILL }
5917 { &hf_tn3270_extended_ps_res,
5918 { "Reserved",
5919 "tn3270.extended_ps_res",
5920 FT_UINT8, BASE_HEX, NULL, 0x0,
5921 NULL, HFILL }
5923 /* END - 5.13 - Load Programmed Symbols */
5925 /* 5.15 - Outbound Text Header */
5926 /* Note: some of these entries multiply used */
5927 { &hf_tn3270_outbound_text_header_operation_type,
5928 { "Outbound Text Operation Type",
5929 "tn3270.outbound_text_operation_type",
5930 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5931 NULL, HFILL }
5933 { &hf_tn3270_lvl,
5934 { "Cursor level",
5935 "tn3270.lvl",
5936 FT_UINT8, BASE_HEX, NULL, 0x0,
5937 NULL, HFILL }
5939 { &hf_tn3270_cro,
5940 { "Cursor row offset",
5941 "tn3270.cro",
5942 FT_UINT16, BASE_DEC, NULL, 0x0,
5943 NULL, HFILL }
5945 { &hf_tn3270_cc,
5946 { "Cursor column offset",
5947 "tn3270.cc",
5948 FT_UINT16, BASE_DEC, NULL, 0x0,
5949 NULL, HFILL }
5951 { &hf_tn3270_outbound_text_header_lhdr,
5952 { "Header length includes itself",
5953 "tn3270.outbound_text_header_lhdr",
5954 FT_UINT16, BASE_DEC, NULL, 0x0,
5955 NULL, HFILL }
5957 { &hf_tn3270_outbound_text_header_hdr,
5958 { "Initial format controls",
5959 "tn3270.outbound_text_header_hdr",
5960 FT_BYTES, BASE_NONE, NULL, 0x0,
5961 NULL, HFILL }
5963 /* END - 5.15 - Outbound Text Header */
5965 /* 5.16 - Outbound 3270DS */
5966 { &hf_tn3270_bsc,
5967 { "SNA BSC",
5968 "tn3270.bsc",
5969 FT_UINT8, BASE_HEX, NULL, 0x0,
5970 NULL, HFILL }
5972 /* END - 5.16 - Outbound 3270DS */
5974 /* 5.17 - Present Absolute Format */
5975 { &hf_tn3270_fpc,
5976 { "Format Presentation Command",
5977 "tn3270.fpc",
5978 FT_UINT8, BASE_HEX, VALS(vals_command_codes), 0x0,
5979 NULL, HFILL }
5981 /* END - 5.17 - Present Absolute Format */
5983 /* 5.18 - Present Relative Format */
5984 { &hf_tn3270_fov,
5985 { "Format Offset Value",
5986 "tn3270.fov",
5987 FT_UINT16, BASE_DEC, NULL, 0x0,
5988 NULL, HFILL }
5990 /* End - 5.18 - Present Relative Format */
5992 /* 5.19 - Read Partition */
5993 { &hf_tn3270_read_partition_operation_type,
5994 { "Read Partition Operation Type",
5995 "tn3270.read_partition_reqtyp",
5996 FT_UINT8, BASE_HEX, VALS(vals_read_partition_operation_type), 0x0,
5997 NULL, HFILL }
5999 { &hf_tn3270_read_partition_reqtyp,
6000 { "Read Partition Request Type",
6001 "tn3270.read_partition_reqtyp",
6002 FT_UINT8, BASE_HEX, VALS(vals_read_partition_reqtype), READ_PARTITION_REQTYPE_MASK,
6003 NULL, HFILL }
6005 /* End - 5.19 - Read Partition */
6007 /* 5.22 - Restart */
6008 { &hf_tn3270_start_page,
6009 { "Number of pages to skip on restart",
6010 "tn3270.start_page",
6011 FT_UINT16, BASE_DEC, NULL, 0x0,
6012 NULL, HFILL }
6014 { &hf_tn3270_start_line,
6015 { "Number of lines to skip on page for restart",
6016 "tn3270.start_line",
6017 FT_UINT16, BASE_DEC, NULL, 0x0,
6018 NULL, HFILL }
6020 { &hf_tn3270_scs_data,
6021 { "SCS data (noncompressed and noncompacted) to set up for restart",
6022 "tn3270.scs_data",
6023 FT_BYTES, BASE_NONE, NULL, 0x0,
6024 NULL, HFILL }
6026 /* End - 5.22 - Restart */
6028 /* 5.24 - Select Color Table */
6029 { &hf_tn3270_color_command,
6030 { "Color Command",
6031 "tn3270.color_command",
6032 FT_UINT16, BASE_HEX, NULL, 0x0,
6033 NULL, HFILL }
6035 /* 5.24 - Select Color Table */
6037 /* 5.26 - Set Checkpoint Interval */
6038 { &hf_tn3270_interval,
6039 { "Checkpoint interval",
6040 "tn3270.interval",
6041 FT_UINT8, BASE_HEX, NULL, 0x0,
6042 "Specifies the number of pages in the interval between terminal checkpoints", HFILL }
6044 /* End - 5.26 - Set Checkpoint Interval */
6046 /* 5.27 - Set MSR Interval */
6047 { &hf_tn3270_msr_type,
6048 { "MSR type",
6049 "tn3270.msr_type",
6050 FT_UINT8, BASE_HEX, NULL, 0x0,
6051 NULL, HFILL }
6053 { &hf_tn3270_msr_state_mask,
6054 { "State Mask",
6055 "tn3270.msr_state_mask",
6056 FT_UINT8, BASE_HEX, NULL, 0x0,
6057 NULL, HFILL }
6059 { &hf_tn3270_msr_user,
6060 { "User Mode",
6061 "tn3270.msr.user",
6062 FT_BOOLEAN, 8, NULL, 0x80,
6063 NULL, HFILL }
6065 { &hf_tn3270_msr_locked,
6066 { "Locked",
6067 "tn3270.msr.locked",
6068 FT_BOOLEAN, 8, NULL, 0x40,
6069 NULL, HFILL }
6071 { &hf_tn3270_msr_auto,
6072 { "Auto Enter",
6073 "tn3270.msr.auto",
6074 FT_BOOLEAN, 8, NULL, 0x20,
6075 NULL, HFILL }
6077 { &hf_tn3270_msr_ind1,
6078 { "Audible Ind 1 Suppress",
6079 "tn3270.msr.ind1",
6080 FT_BOOLEAN, 8, NULL, 0x10,
6081 NULL, HFILL }
6083 { &hf_tn3270_msr_ind2,
6084 { "Audible Ind 2 Suppress",
6085 "tn3270.msr.ind2",
6086 FT_BOOLEAN, 8, NULL, 0x08,
6087 NULL, HFILL }
6089 { &hf_tn3270_msr_state_value,
6090 { "State Value", "tn3270.msr_state_value",
6091 FT_UINT8, BASE_HEX, NULL, 0x0,
6092 NULL, HFILL }
6094 { &hf_tn3270_msr_ind_mask,
6095 { "Indicator Mask",
6096 "tn3270.msr_ind_mask",
6097 FT_UINT8, BASE_HEX, NULL, 0x0,
6098 NULL, HFILL }
6100 { &hf_tn3270_msr_ind_value,
6101 { "Indicator Value",
6102 "tn3270.msr_ind_value",
6103 FT_UINT8, BASE_HEX, NULL, 0x0,
6104 NULL, HFILL }
6106 /* END - 5.27 - Set MSR Interval */
6108 /* 5.28 - Set Partition Characteristics */
6109 { &hf_tn3270_spc_sdp_ot,
6110 { "Top edge outline thickness",
6111 "tn3270.spc_sdp_ot",
6112 FT_UINT8, BASE_DEC, NULL, 0x0,
6113 NULL, HFILL }
6115 { &hf_tn3270_spc_sdp_ob,
6116 { "Bottom edge outline thickness",
6117 "tn3270.spc_sdp_ob",
6118 FT_UINT8, BASE_DEC, NULL, 0x0,
6119 NULL, HFILL }
6121 { &hf_tn3270_spc_sdp_ol,
6122 { "Left edge outline thickness",
6123 "tn3270.spc_sdp_ol",
6124 FT_UINT8, BASE_DEC, NULL, 0x0,
6125 NULL, HFILL }
6127 { &hf_tn3270_spc_sdp_or,
6128 { "Right edge outline thickness",
6129 "tn3270.spc_sdp_or",
6130 FT_UINT8, BASE_DEC, NULL, 0x0,
6131 NULL, HFILL }
6133 { &hf_tn3270_spc_sdp_eucflags,
6134 { "Flags",
6135 "tn3270.spc_sdp_eucflags",
6136 FT_UINT8, BASE_HEX, NULL, 0x0,
6137 NULL, HFILL }
6139 /* END - 5.28 - Set Partition Characteristics */
6141 /* 5.29 - Set Printer Characteristics */
6142 { &hf_tn3270_printer_flags,
6143 { "Flags",
6144 "tn3270.printer_flags",
6145 FT_UINT8, BASE_HEX, NULL, 0x0,
6146 NULL, HFILL }
6148 { &hf_tn3270_spc_sdp_srepc,
6149 { "Set/Reset Early Print Complete",
6150 "tn3270.spc_sdp_srepc",
6151 FT_UINT8, BASE_HEX, NULL, 0x0,
6152 NULL, HFILL }
6154 /* END - 5.29 - Set Printer Characteristics */
6156 /* 5.30 - Set Reply Mode */
6157 /* hf_tn3270_mode also used for 6.42: Query Reply (modes) */
6158 { &hf_tn3270_mode,
6159 { "Mode",
6160 "tn3270.mode",
6161 FT_UINT8, BASE_HEX, VALS(vals_reply_modes), 0x0,
6162 NULL, HFILL }
6164 { &hf_tn3270_reply_mode_attr_list,
6165 { "Type codes for the attribute types",
6166 "tn3270.reply_mode_attr_list",
6167 FT_UINT8, BASE_HEX, VALS(vals_attribute_types), 0x0,
6168 NULL, HFILL }
6170 /* END - 5.30 - Set Reply Mode */
6172 /* 5.34 - Data Chain */
6173 { &hf_tn3270_data_chain_fields,
6174 { "Data Chain Fields",
6175 "tn3270.data_chain_fields",
6176 FT_UINT8, BASE_HEX, NULL, 0x0,
6177 NULL, HFILL }
6179 { &hf_tn3270_data_chain_group,
6180 { "Data Chain Group",
6181 "tn3270.data_chain_group",
6182 FT_UINT8, BASE_HEX, VALS(vals_data_chain_group), DATA_CHAIN_GROUP_MASK,
6183 NULL, HFILL }
6185 { &hf_tn3270_data_chain_inbound_control,
6186 { "Data Chain Inbound Control",
6187 "tn3270.data_chain_inbound_control",
6188 FT_UINT8, BASE_HEX, VALS(vals_data_chain_inbound_control), DATA_CHAIN_INBOUND_CONTROL_MASK,
6189 NULL, HFILL }
6191 /* END - 5.34 - Data Chain */
6193 /* 5.35 - Destination/Origin */
6194 { &hf_tn3270_destination_or_origin_flags_input_control,
6195 { "Input Control",
6196 "tn3270.destination_or_origin_flags_input_control",
6197 FT_UINT8, BASE_HEX, VALS(vals_destination_or_origin_flags_input_control), DESTINATION_OR_ORIGIN_FLAGS_INPUT_CONTROL_MASK,
6198 NULL, HFILL }
6200 { &hf_tn3270_destination_or_origin_doid,
6201 { "DOID",
6202 "tn3270.destination_or_origin_doid",
6203 FT_UINT16, BASE_HEX, NULL, 0x0,
6204 NULL, HFILL }
6206 /* END - 5.35 - Destination/Origin */
6209 /* 5.36 - Object Control */
6210 { &hf_tn3270_object_control_flags,
6211 { "Flags",
6212 "tn3270.object_control_flags",
6213 FT_UINT8, BASE_HEX, NULL, 0x0,
6214 NULL, HFILL }
6216 { &hf_tn3270_object_type,
6217 { "Object Type",
6218 "tn3270.object_type",
6219 FT_UINT8, BASE_HEX, VALS(vals_oc_type), 0x0,
6220 NULL, HFILL }
6222 /* END - 5.36 - Object Control */
6224 /* 5.40 - Save/Restore Format */
6225 { &hf_tn3270_save_or_restore_format_flags,
6226 { "Flags",
6227 "tn3270.save_or_restore_format_flags",
6228 FT_UINT8, BASE_HEX, NULL, 0x0,
6229 NULL, HFILL }
6231 { &hf_tn3270_srf_fpcb,
6232 { "Contents of the FPCB that is to be saved or restored",
6233 "tn3270.srf_fpcb",
6234 FT_BYTES, BASE_NONE, NULL, 0x0,
6235 NULL, HFILL }
6238 /* 5.40 - Save/Restore Format */
6239 { &hf_tn3270_type_1_text_outbound_data,
6240 { "Type 1 text outbound data",
6241 "tn3270.type_1_text_outbound_data",
6242 FT_BYTES, BASE_NONE, NULL, 0x0,
6243 NULL, HFILL }
6246 /* 6.2 - Exception/Status */
6247 { &hf_tn3270_exception_or_status_flags,
6248 { "Flags",
6249 "tn3270.exception_or_status_flags",
6250 FT_UINT8, BASE_HEX, NULL, 0x0,
6251 NULL, HFILL }
6253 { &hf_tn3270_sdp_excode,
6254 { "Exception Code",
6255 "tn3270.sdp_excode",
6256 FT_UINT16, BASE_DEC, VALS(vals_sdp_excode), 0x0,
6257 NULL, HFILL }
6259 { &hf_tn3270_sdp_statcode,
6260 { "Status Code",
6261 "tn3270.sdp_statcode",
6262 FT_UINT16, BASE_DEC, VALS(vals_sdp_statcode), 0x0,
6263 NULL, HFILL }
6265 { &hf_tn3270_sdp_ngl,
6266 { "Number of groups currently assigned",
6267 "tn3270.sdp_ngl",
6268 FT_UINT16, BASE_DEC, NULL, 0x0,
6269 NULL, HFILL }
6271 { &hf_tn3270_sdp_nml,
6272 { "Number of formats currently loaded",
6273 "tn3270.sdp_nml",
6274 FT_UINT16, BASE_DEC, NULL, 0x0,
6275 NULL, HFILL }
6277 { &hf_tn3270_sdp_nlml,
6278 { "Number of local names used",
6279 "tn3270.sdp_nlml",
6280 FT_UINT16, BASE_DEC, NULL, 0x0,
6281 NULL, HFILL }
6283 { &hf_tn3270_sdp_stor,
6284 { "Amount of format storage space available (KB)",
6285 "tn3270.sdp_stor",
6286 FT_UINT32, BASE_DEC, NULL, 0x0,
6287 NULL, HFILL }
6289 /* 6.2 - Exception/Status */
6291 /* 6.3 - Inbound Text Header */
6292 { &hf_tn3270_hw,
6293 { "Window height",
6294 "tn3270.hw",
6295 FT_UINT16, BASE_DEC, NULL, 0x0,
6296 NULL, HFILL }
6298 { &hf_tn3270_rw,
6299 { "Row offset of window origin",
6300 "tn3270.rw",
6301 FT_UINT16, BASE_DEC, NULL, 0x0,
6302 NULL, HFILL }
6304 { &hf_tn3270_ww,
6305 { "Window width",
6306 "tn3270.ww",
6307 FT_UINT16, BASE_DEC, NULL, 0x0,
6308 NULL, HFILL }
6310 { &hf_tn3270_cw,
6311 { "Column Offset of Window Origin",
6312 "tn3270.cw",
6313 FT_UINT16, BASE_DEC, NULL, 0x0,
6314 NULL, HFILL }
6316 /* END - 6.3 - Inbound Text Header */
6318 /* 6.4 Inbound 3270DS */
6319 { &hf_tn3270_cursor_address,
6320 { "Cursor Address",
6321 "tn3270.cursor_address",
6322 FT_UINT16, BASE_HEX, NULL, 0x0,
6323 NULL, HFILL }
6325 /* END - 6.4 Inbound 3270DS */
6327 /* 6.5 - Recovery Data */
6328 { &hf_tn3270_recovery_data_flags,
6329 { "Flags",
6330 "tn3270.recovery_data_flags",
6331 FT_UINT8, BASE_HEX, NULL, 0x0,
6332 NULL, HFILL }
6334 { &hf_tn3270_sld,
6335 { "SLD -- Set line density parameter in effect at the checkpoint",
6336 "tn3270.sld",
6337 FT_UINT8, BASE_HEX, NULL, 0x0,
6338 NULL, HFILL }
6340 { &hf_tn3270_charset,
6341 { "Character set parameter of Set Attribute control in effect at the checkpoint",
6342 "tn3270.charset",
6343 FT_UINT8, BASE_HEX, NULL, 0x0,
6344 NULL, HFILL }
6346 { &hf_tn3270_vertical,
6347 { "Byte offset from Checkpoint Interval structured field to the Set Vertical Format control in effect for the checkpoint",
6348 "tn3270.vertical",
6349 FT_UINT32, BASE_DEC, NULL, 0x0,
6350 NULL, HFILL }
6352 { &hf_tn3270_v_offset,
6353 { "Byte offset within the string control byte string or the SVF character",
6354 "tn3270.v_offset",
6355 FT_UINT16, BASE_DEC, NULL, 0x0,
6356 NULL, HFILL }
6358 { &hf_tn3270_v_sequence,
6359 { "RU sequence number",
6360 "tn3270.v_sequence",
6361 FT_UINT16, BASE_DEC, NULL, 0x0,
6362 NULL, HFILL }
6364 { &hf_tn3270_v_length,
6365 { "Length of the SVF character string required for restart",
6366 "tn3270.v_length",
6367 FT_UINT16, BASE_DEC, NULL, 0x0,
6368 NULL, HFILL }
6370 { &hf_tn3270_spd,
6371 { "Set Primary Density parameter in effect at the checkpoint",
6372 "tn3270.spd",
6373 FT_UINT16, BASE_HEX, NULL, 0x0,
6374 NULL, HFILL }
6376 { &hf_tn3270_horizon,
6377 { "Byte offset from Checkpoint Interval structured field to the Set Horizontal Format control in effect for the checkpoint",
6378 "tn3270.horizon",
6379 FT_UINT32, BASE_DEC, NULL, 0x0,
6380 NULL, HFILL }
6382 { &hf_tn3270_h_offset,
6383 { "Byte offset from Checkpoint Interval structured field to the Set Horizontal Format control in effect for the checkpoint",
6384 "tn3270.h_offset",
6385 FT_UINT32, BASE_DEC, NULL, 0x0,
6386 NULL, HFILL }
6388 { &hf_tn3270_h_sequence,
6389 { "RU sequence number",
6390 "tn3270.h_sequence",
6391 FT_UINT16, BASE_DEC, NULL, 0x0,
6392 NULL, HFILL }
6394 { &hf_tn3270_h_length,
6395 { "Length of the SHF character string required for restart",
6396 "tn3270.h_length",
6397 FT_UINT16, BASE_DEC, NULL, 0x0,
6398 NULL, HFILL }
6400 { &hf_tn3270_hilite,
6401 { "Highlighting",
6402 "tn3270.hilite",
6403 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
6404 NULL, HFILL }
6406 { &hf_tn3270_pages,
6407 { "Number of pages printed since the checkpoint",
6408 "tn3270.pages",
6409 FT_UINT16, BASE_DEC, NULL, 0x0,
6410 NULL, HFILL }
6412 { &hf_tn3270_lines,
6413 { "Number of lines printed since the checkpoint",
6414 "tn3270.lines",
6415 FT_UINT16, BASE_DEC, NULL, 0x0,
6416 NULL, HFILL }
6418 { &hf_tn3270_checkpoint,
6419 { "Byte offset from Set Checkpoint Interval structured field to the first"
6420 " character afterhe code point or character that caused an eject to the"
6421 " checkpointed page",
6422 "tn3270.checkpoint",
6423 FT_UINT32, BASE_DEC, NULL, 0x0,
6424 NULL, HFILL }
6426 { &hf_tn3270_c_offset,
6427 { "Byte offset within the String Control Byte string or structured field of"
6428 " the checkpointed character",
6429 "tn3270.c_offset",
6430 FT_UINT16, BASE_DEC, NULL, 0x0,
6431 NULL, HFILL }
6433 { &hf_tn3270_c_sequence,
6434 { "RU sequence number of the RU containing the checkpoint character",
6435 "tn3270.c_sequence",
6436 FT_UINT16, BASE_DEC, NULL, 0x0,
6437 NULL, HFILL }
6439 { &hf_tn3270_c_seqoff,
6440 { "Byte offset within the RU of the checkpointed character",
6441 "tn3270.c_seqoff",
6442 FT_UINT16, BASE_DEC, NULL, 0x0,
6443 NULL, HFILL }
6445 { &hf_tn3270_c_scsoff,
6446 { "Byte offset within the parameterized SCS control code (for example, TRN) of the checkpointed character.",
6447 "tn3270.c_scsoff",
6448 FT_UINT16, BASE_DEC, NULL, 0x0,
6449 NULL, HFILL }
6451 { &hf_tn3270_prime,
6452 { "Prime compression character",
6453 "tn3270.prime",
6454 FT_UINT8, BASE_HEX, NULL, 0x0,
6455 NULL, HFILL }
6457 /* END - 6.5 - Recovery Data */
6459 /* 6.9 - Query Reply (Alphanumeric Partitions) */
6460 { &hf_tn3270_ap_na,
6461 { "Max number of alphanumeric partitions",
6462 "tn3270.ap_na",
6463 FT_UINT8, BASE_DEC, NULL, 0x0,
6464 NULL, HFILL }
6466 { &hf_tn3270_ap_m,
6467 { "Total available partition storage",
6468 "tn3270.ap_m",
6469 FT_UINT16, BASE_DEC, NULL, 0x0,
6470 NULL, HFILL }
6472 { &hf_tn3270_query_reply_alphanumeric_flags,
6473 { "Flags",
6474 "tn3270.ap_flags",
6475 FT_UINT8, BASE_HEX, NULL, 0x0,
6476 NULL, HFILL }
6478 { &hf_tn3270_ap_vertical_scrolling,
6479 { "Vertical Scrolling Supported",
6480 "tn3270.ap_vertical_scrolling",
6481 FT_BOOLEAN, 8, NULL, QR_AP_VERTWIN,
6482 NULL, HFILL }
6484 { &hf_tn3270_ap_horizontal_scrolling,
6485 { "Horizontal Scrolling Supported",
6486 "tn3270.ap_horizontal_scrolling",
6487 FT_BOOLEAN, 8, NULL, QR_AP_HORWIN,
6488 NULL, HFILL }
6490 { &hf_tn3270_ap_apres1,
6491 { "Reserved",
6492 "tn3270.ap_apres1",
6493 FT_BOOLEAN, 8, NULL, QR_AP_APRES1,
6494 NULL, HFILL }
6496 { &hf_tn3270_ap_apa,
6497 { "All Points addressability supported",
6498 "tn3270.ap_apa",
6499 FT_BOOLEAN, 8, NULL, QR_AP_APA_FLG,
6500 NULL, HFILL }
6502 { &hf_tn3270_ap_pp,
6503 { "Partition protection supported",
6504 "tn3270.ap_pp",
6505 FT_BOOLEAN, 8, NULL, QR_AP_PROT,
6506 NULL, HFILL }
6508 { &hf_tn3270_ap_lc,
6509 { "Presentation space local copy supported",
6510 "tn3270.ap_lc",
6511 FT_BOOLEAN, 8, NULL, QR_AP_LCOPY,
6512 NULL, HFILL }
6514 { &hf_tn3270_ap_mp,
6515 { "Modify Partition supported",
6516 "tn3270.ap_mp",
6517 FT_BOOLEAN, 8, NULL, QR_AP_MODPART,
6518 NULL, HFILL }
6520 { &hf_tn3270_ap_apres2,
6521 { "Reserved",
6522 "tn3270.ap_apres2",
6523 FT_BOOLEAN, 8, NULL, QR_AP_APRES2,
6524 NULL, HFILL }
6527 { &hf_tn3270_ap_cm,
6528 { "Character multiplier",
6529 "tn3270.ap_cm",
6530 FT_UINT8, BASE_DEC, NULL, 0x0,
6531 NULL, HFILL }
6533 { &hf_tn3270_ap_ro,
6534 { "Row overhead",
6535 "tn3270.ap_ro",
6536 FT_UINT8, BASE_DEC, NULL, 0x0,
6537 NULL, HFILL }
6539 { &hf_tn3270_ap_co,
6540 { "Column overhead",
6541 "tn3270.ap_co",
6542 FT_UINT8, BASE_DEC, NULL, 0x0,
6543 NULL, HFILL }
6545 { &hf_tn3270_ap_fo,
6546 { "Fixed overhead",
6547 "tn3270.ap_fo",
6548 FT_UINT16, BASE_DEC, NULL, 0x0,
6549 NULL, HFILL }
6551 /* END - 6.9 - Query Reply (Alphanumeric Partitions) */
6553 /* 6.12 - Query Reply (Character Sets) */
6554 { &hf_tn3270_character_sets_flags1,
6555 { "Flags (1)",
6556 "tn3270.character_sets_flags1",
6557 FT_UINT8, BASE_HEX, NULL, 0x0,
6558 NULL, HFILL }
6560 { &hf_tn3270_cs_ge,
6561 { "Graphic Escape supported",
6562 "tn3270.cs_ge",
6563 FT_BOOLEAN, 8, NULL, QR_CS_ALT,
6564 NULL, HFILL }
6566 { &hf_tn3270_cs_mi,
6567 { "Multiple LCIDs are supported",
6568 "tn3270.cs_mi",
6569 FT_BOOLEAN, 8, NULL, QR_CS_MULTID,
6570 NULL, HFILL }
6572 { &hf_tn3270_cs_lps,
6573 { "Load PSSF is supported",
6574 "tn3270.cs_lps",
6575 FT_BOOLEAN, 8, NULL, QR_CS_LOADABLE,
6576 NULL, HFILL }
6578 { &hf_tn3270_cs_lpse,
6579 { "Load PS EXTENDED is supported",
6580 "tn3270.cs_lpse",
6581 FT_BOOLEAN, 8, NULL, QR_CS_EXT,
6582 NULL, HFILL }
6584 { &hf_tn3270_cs_ms,
6585 { "More than one size of character slot is supported",
6586 "tn3270.cs_ms",
6587 FT_BOOLEAN, 8, NULL, QR_CS_MS,
6588 NULL, HFILL }
6590 { &hf_tn3270_cs_ch2,
6591 { "Two-byte coded character sets are supported",
6592 "tn3270.cs_ch2",
6593 FT_BOOLEAN, 8, NULL, QR_CS_CH2,
6594 NULL, HFILL }
6596 { &hf_tn3270_cs_gf,
6597 { "CGCSGID is present",
6598 "tn3270.cs_gf",
6599 FT_BOOLEAN, 8, NULL, QR_CS_GF,
6600 NULL, HFILL }
6602 { &hf_tn3270_cs_res,
6603 { "Reserved",
6604 "tn3270.cs_res",
6605 FT_BOOLEAN, 8, NULL, QR_CS_CSRES,
6606 NULL, HFILL }
6609 { &hf_tn3270_character_sets_flags2,
6610 { "Flags (2)",
6611 "tn3270.character_sets_flags2",
6612 FT_UINT8, BASE_HEX, NULL, 0x0,
6613 NULL, HFILL }
6615 { &hf_tn3270_cs_res2,
6616 { "Reserved",
6617 "tn3270.cs_res2",
6618 FT_BOOLEAN, 8, NULL, QR_CS_CSRES2,
6619 NULL, HFILL }
6621 { &hf_tn3270_cs_pscs,
6622 { "Load PS slot size match not required",
6623 "tn3270.cs_pscs",
6624 FT_BOOLEAN, 8, NULL, QR_CS_PSCS,
6625 NULL, HFILL }
6627 { &hf_tn3270_cs_res3,
6628 { "Reserved",
6629 "tn3270.cs_res3",
6630 FT_BOOLEAN, 8, NULL, QR_CS_CSRES3,
6631 NULL, HFILL }
6633 { &hf_tn3270_cs_cf,
6634 { "CCSID present",
6635 "tn3270.cs_cf",
6636 FT_BOOLEAN, 8, NULL, QR_CS_CF,
6637 NULL, HFILL }
6640 { &hf_tn3270_sdw,
6641 { "Default character slot width",
6642 "tn3270.cs_sdw",
6643 FT_UINT8, BASE_HEX, NULL, 0x0,
6644 NULL, HFILL }
6646 { &hf_tn3270_sdh,
6647 { "Default character slot height",
6648 "tn3270.cs_sdh",
6649 FT_UINT8, BASE_HEX, NULL, 0x0,
6650 NULL, HFILL }
6652 { &hf_tn3270_form,
6653 { "Form Types",
6654 "tn3270.form",
6655 FT_UINT8, BASE_HEX, NULL, 0x0,
6656 NULL, HFILL }
6658 { &hf_tn3270_formres,
6659 { "Form Types (Reserved)",
6660 "tn3270.formres",
6661 FT_UINT8, BASE_HEX, NULL, 0x0,
6662 NULL, HFILL }
6664 { &hf_tn3270_cs_form_type1,
6665 { "18-byte form; the first 2 bytes contain a 16-bit vertical slice,"
6666 " the following 16 bytes contain 8-bit horizontal slices. For a 9"
6667 " x 12 character matrix the last 4 bytes contain binary zero.",
6668 "tn3270.cs_form_type1",
6669 FT_BOOLEAN, 8, NULL, 0x80,
6670 NULL, HFILL }
6672 { &hf_tn3270_cs_form_type2,
6673 { "18-byte form; the first 2 bytes contain a 16-bit vertical slice,"
6674 " the following 16 bytes contain 8-bit horizontal slices. For a 9"
6675 " x 12 character matrix the last 4 bytes contain binary zero. (COMPRESSED)",
6676 "tn3270.cs_form_type2",
6677 FT_BOOLEAN, 8, NULL, 0x40,
6678 NULL, HFILL }
6680 { &hf_tn3270_cs_form_type3,
6681 { "Row loading (from top to bottom)",
6682 "tn3270.cs_form_type3",
6683 FT_BOOLEAN, 8, NULL, 0x20,
6684 NULL, HFILL }
6686 { &hf_tn3270_cs_form_type4,
6687 { "Row loading (from top to bottom) (Compressed)",
6688 "tn3270.cs_form_type4",
6689 FT_BOOLEAN, 8, NULL, 0x10,
6690 NULL, HFILL }
6692 { &hf_tn3270_cs_form_type5,
6693 { "Column loading (from left to right)",
6694 "tn3270.cs_form_type5",
6695 FT_BOOLEAN, 8, NULL, 0x08,
6696 NULL, HFILL }
6698 { &hf_tn3270_cs_form_type6,
6699 { "Column loading (from left to right) (Compressed)",
6700 "tn3270.cs_form_type6",
6701 FT_BOOLEAN, 8, NULL, 0x04,
6702 NULL, HFILL }
6704 { &hf_tn3270_cs_form_type8,
6705 { "Vector",
6706 "tn3270.cs_form_type8",
6707 FT_BOOLEAN, 8, NULL, 0x02,
6708 NULL, HFILL }
6710 { &hf_tn3270_cs_dl,
6711 { "Length of each descriptor",
6712 "tn3270.cs_dl",
6713 FT_UINT8, BASE_DEC, NULL, 0x0,
6714 NULL, HFILL }
6717 { &hf_tn3270_cs_descriptor_set,
6718 { "Device Specific Character Set ID (PS store No.)",
6719 "tn3270.cs_descriptor_set",
6720 FT_UINT8, BASE_DEC, NULL, 0x0,
6721 NULL, HFILL }
6723 { &hf_tn3270_cs_descriptor_flags,
6724 { "Flags",
6725 "tn3270.cs_descriptor_flags",
6726 FT_UINT8, BASE_HEX, NULL, 0x0,
6727 NULL, HFILL }
6729 { &hf_tn3270_cs_ds_load,
6730 { "Loadable character set",
6731 "tn3270.cs_ds_load",
6732 FT_BOOLEAN, 8, NULL, 0x80,
6733 NULL, HFILL }
6735 { &hf_tn3270_cs_ds_triple,
6736 { "Triple-plane character set",
6737 "tn3270.cs_ds_triple",
6738 FT_BOOLEAN, 8, NULL, 0x40,
6739 NULL, HFILL }
6741 { &hf_tn3270_cs_ds_char,
6742 { "Double-Byte coded character set",
6743 "tn3270.cs_ds_char",
6744 FT_BOOLEAN, 8, NULL, 0x20,
6745 NULL, HFILL }
6747 { &hf_tn3270_cs_ds_cb,
6748 { "No LCID compare",
6749 "tn3270.cs_ds_cb",
6750 FT_BOOLEAN, 8, NULL, 0x10,
6751 NULL, HFILL }
6754 { &hf_tn3270_lcid,
6755 { "Local character set ID (alias)",
6756 "tn3270.lcid",
6757 FT_UINT8, BASE_HEX, NULL, 0x0,
6758 NULL, HFILL }
6760 { &hf_tn3270_sw,
6761 { "Width of the character slots in this characterset.",
6762 "tn3270.sw",
6763 FT_UINT8, BASE_HEX, NULL, 0x0,
6764 NULL, HFILL }
6766 { &hf_tn3270_sh,
6767 { "Height of the character slots in this character set.",
6768 "tn3270.sh",
6769 FT_UINT8, BASE_HEX, NULL, 0x0,
6770 NULL, HFILL }
6772 { &hf_tn3270_ssubsn,
6773 { "Starting subsection.",
6774 "tn3270.ssubsn",
6775 FT_UINT8, BASE_HEX, NULL, 0x0,
6776 NULL, HFILL }
6778 { &hf_tn3270_esubsn,
6779 { "Ending subsection.",
6780 "tn3270.esubsn",
6781 FT_UINT8, BASE_HEX, NULL, 0x0,
6782 NULL, HFILL }
6784 { &hf_tn3270_ccsgid,
6785 { "Coded Graphic Character Set Identifier.",
6786 "tn3270.ccsgid",
6787 FT_UINT64, BASE_HEX, NULL, 0x0,
6788 NULL, HFILL }
6790 { &hf_tn3270_ccsid,
6791 { "Coded Character Set Identifier.",
6792 "tn3270.ccsid",
6793 FT_UINT64, BASE_HEX, NULL, 0x0,
6794 NULL, HFILL }
6796 /* END - 6.12 - Query Reply (Character Sets) */
6798 /* 6.13 - Query Reply (Color) */
6799 { &hf_tn3270_color_flags,
6800 { "Flags",
6801 "tn3270.color_flags",
6802 FT_UINT8, BASE_HEX, NULL, 0x0,
6803 NULL, HFILL }
6805 { &hf_tn3270_c_prtblk,
6806 { "Printer only - black ribbon is loaded",
6807 "tn3270.cc_prtblk",
6808 FT_BOOLEAN, 8, NULL, 0x40,
6809 NULL, HFILL }
6811 { &hf_tn3270_c_np,
6812 { "Length of color attribute list",
6813 "tn3270.np",
6814 FT_UINT8, BASE_DEC, NULL, 0x0,
6815 NULL, HFILL }
6817 { &hf_tn3270_c_cav,
6818 { "Color attribute value accepted by the device",
6819 "tn3270.c_cav",
6820 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6821 NULL, HFILL }
6823 { &hf_tn3270_c_ci,
6824 { "Color identifier",
6825 "tn3270.c_ci",
6826 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6827 NULL, HFILL }
6829 { &hf_tn3270_db_cavdef,
6830 { "Default color attribute value",
6831 "tn3270.db_cavdef",
6832 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6833 NULL, HFILL }
6835 { &hf_tn3270_db_cidef,
6836 { "Default background color identifier",
6837 "tn3270.db_cidef",
6838 FT_UINT8, BASE_HEX, VALS(vals_at_color_identifications), 0x0,
6839 NULL, HFILL }
6841 /* END - 6.13 - Query Reply (Color) */
6843 /* 6.14 - Query Reply (Cooperative Processing Requestor) */
6844 { &hf_tn3270_limin,
6845 { "Maximum CPR bytes/transmission allowed inbound",
6846 "tn3270.limin",
6847 FT_UINT16, BASE_DEC, NULL, 0x0,
6848 NULL, HFILL }
6850 { &hf_tn3270_limout,
6851 { "Maximum CPR bytes/transmission allowed outbound",
6852 "tn3270.limout",
6853 FT_UINT16, BASE_DEC, NULL, 0x0,
6854 NULL, HFILL }
6856 { &hf_tn3270_featl,
6857 { "Length (in bytes) of feature information that follows",
6858 "tn3270.featl",
6859 FT_UINT8, BASE_DEC, NULL, 0x0,
6860 NULL, HFILL }
6862 { &hf_tn3270_feats,
6863 { "CPR length and feature flags",
6864 "tn3270.feats",
6865 FT_UINT16, BASE_DEC, NULL, 0x0,
6866 NULL, HFILL }
6868 /* END - 6.14 - Query Reply (Cooperative Processing Requestor) */
6870 /* 6.15 - Query Reply (Data Chaining) */
6871 { &hf_tn3270_dc_dir,
6872 { "Indicates which direction can use the Data Chain structured field.",
6873 "tn3270.dc_dir",
6874 FT_UINT8, BASE_HEX, VALS(vals_data_chaining_dir), 0xC0,
6875 NULL, HFILL }
6877 /* END - 6.15 - Query Reply (Data Chaining) */
6879 /* 6.16 - Query Reply (Data Streams) */
6880 { &hf_tn3270_ds_default_sfid,
6881 { "Default Data Stream",
6882 "tn3270.ds_default_sfid",
6883 FT_UINT8, BASE_HEX, VALS(vals_data_streams), 0x0,
6884 NULL, HFILL }
6886 { &hf_tn3270_ds_sfid,
6887 { "Supported Data Stream",
6888 "tn3270.ds_sfid",
6889 FT_UINT8, BASE_HEX, VALS(vals_data_streams), 0x0,
6890 NULL, HFILL }
6892 /* END - 6.16 - Query Reply (Data Streams) */
6894 /* 6.17 - Query Reply (DBCS Asia) */
6895 { &hf_tn3270_asia_sdp_sosi_soset,
6896 { "Set ID of the Shift Out (SO) character set",
6897 "tn3270.asia_sdp_sosi_soset",
6898 FT_UINT8, BASE_HEX, NULL, 0x0,
6899 NULL, HFILL }
6901 { &hf_tn3270_asia_sdp_ic_func,
6902 { "SO/SI Creation supported",
6903 "tn3270.asia_sdp_ic_func",
6904 FT_BOOLEAN, 8, NULL, 0x01,
6905 NULL, HFILL }
6907 /* END - 6.17 - Query Reply (DBCS Asia) */
6909 /* 6.19 - Query Reply (Distributed Data Management) */
6910 { &hf_tn3270_ddm_flags,
6911 { "Flags (Reserved)",
6912 "tn3270.ddm_flags",
6913 FT_UINT8, BASE_HEX, NULL, 0x0,
6914 NULL, HFILL }
6916 { &hf_tn3270_ddm_limin,
6917 { "Maximum DDM bytes/transmission allowed inbound",
6918 "tn3270.ddm_limin",
6919 FT_UINT16, BASE_DEC, NULL, 0x0,
6920 NULL, HFILL }
6922 { &hf_tn3270_ddm_limout,
6923 { "Maximum DDM bytes/transmission allowed outbound",
6924 "tn3270.ddm_limout",
6925 FT_UINT16, BASE_DEC, NULL, 0x0,
6926 NULL, HFILL }
6928 { &hf_tn3270_ddm_nss,
6929 { "Number of subsets supported",
6930 "tn3270.ddm_nss",
6931 FT_UINT8, BASE_HEX, NULL, 0x0,
6932 NULL, HFILL }
6934 { &hf_tn3270_ddm_ddmss,
6935 { "DDM subset identifier",
6936 "tn3270.ddm_ddmss",
6937 FT_UINT8, BASE_HEX, VALS(vals_qr_ddm), 0x0,
6938 NULL, HFILL }
6940 /* END - 6.19 - Query Reply (Distributed Data Management) */
6942 /* 6.20 - Query Reply (Document Interchange Architecture) */
6943 { &hf_tn3270_dia_flags,
6944 { "Flags (Reserved)",
6945 "tn3270.dia_flags",
6946 FT_UINT16, BASE_HEX, NULL, 0x0,
6947 NULL, HFILL }
6949 { &hf_tn3270_dia_limin,
6950 { "Maximum DIA bytes/transmission allowed inbound",
6951 "tn3270.dia_limin",
6952 FT_UINT16, BASE_DEC, NULL, 0x0,
6953 NULL, HFILL }
6955 { &hf_tn3270_dia_limout,
6956 { "Maximum DIA bytes/transmission allowed outbound",
6957 "tn3270.dia_limout",
6958 FT_UINT16, BASE_DEC, NULL, 0x0,
6959 NULL, HFILL }
6961 { &hf_tn3270_dia_nfs,
6962 { "Number of subsets supported",
6963 "tn3270.dia_nfs",
6964 FT_UINT8, BASE_HEX, NULL, 0x0,
6965 NULL, HFILL }
6967 { &hf_tn3270_dia_diafs,
6968 { "DIA function set identifier",
6969 "tn3270.dia_diafs",
6970 FT_UINT8, BASE_HEX, VALS(vals_qr_dia), 0x0,
6971 NULL, HFILL }
6973 { &hf_tn3270_dia_diafn,
6974 { "DIA function set number",
6975 "tn3270.dia_diafn",
6976 FT_UINT16, BASE_DEC, NULL, 0x0,
6977 NULL, HFILL }
6979 /* END - 6.20 - Query Reply (Document Interchange Architecture) */
6981 /* 6.22 - Query Reply (Field Outlining) */
6982 { &hf_tn3270_fo_flags,
6983 { "Flags",
6984 "tn3270.fo_flags",
6985 FT_UINT8, BASE_HEX, NULL, 0x0,
6986 NULL, HFILL }
6988 { &hf_tn3270_fo_vpos,
6989 { "Location of vertical line",
6990 "tn3270.fo_vpos",
6991 FT_UINT8, BASE_DEC, NULL, 0x0,
6992 NULL, HFILL }
6994 { &hf_tn3270_fo_hpos,
6995 { "Location of overline/underline",
6996 "tn3270.fo_hpos",
6997 FT_UINT8, BASE_DEC, NULL, 0x0,
6998 NULL, HFILL }
7000 { &hf_tn3270_fo_hpos0,
7001 { "Location of overline in case of separation",
7002 "tn3270.fo_hpos0",
7003 FT_UINT8, BASE_DEC, NULL, 0x0,
7004 NULL, HFILL }
7006 { &hf_tn3270_fo_hpos1,
7007 { "Location of underline in case of separation",
7008 "tn3270.fo_hpos1",
7009 FT_UINT8, BASE_DEC, NULL, 0x0,
7010 NULL, HFILL }
7012 /* END - 6.22 - Query Reply (Field Outlining) */
7014 /* 6.25 - Query Reply (Format Storage Auxiliary Device) */
7015 { &hf_tn3270_fsad_flags,
7016 { "Flags",
7017 "tn3270.fsad_flags",
7018 FT_UINT8, BASE_HEX, NULL, 0x0,
7019 NULL, HFILL }
7021 { &hf_tn3270_fsad_limin,
7022 { "Reserved for LIMIN parameter. Must be set to zeros.",
7023 "tn3270.fsad_limin",
7024 FT_UINT16, BASE_DEC, NULL, 0x0,
7025 NULL, HFILL }
7027 { &hf_tn3270_fsad_limout,
7028 { "Maximum bytes of format storage data per transmission allowed outbound.",
7029 "tn3270.fsad_limout",
7030 FT_UINT16, BASE_DEC, NULL, 0x0,
7031 NULL, HFILL }
7033 { &hf_tn3270_fsad_size,
7034 { "Size of the format storage space",
7035 "tn3270.fsad_size",
7036 FT_UINT16, BASE_DEC, NULL, 0x0,
7037 NULL, HFILL }
7039 /* END - 6.25 - Query Reply (Format Storage Auxiliary Device) */
7041 /* 6.28 - Query Reply (Highlighting) */
7042 { &hf_tn3270_h_np,
7043 { "Number of attribute-value/action pairs",
7044 "tn3270.h_np",
7045 FT_UINT8, BASE_DEC, NULL, 0x0,
7046 NULL, HFILL }
7048 { &hf_tn3270_h_vi,
7049 { "Data stream attribute value accepted",
7050 "tn3270.h_vi",
7051 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
7052 NULL, HFILL }
7054 { &hf_tn3270_h_ai,
7055 { "Data stream action",
7056 "tn3270.h_ai",
7057 FT_UINT8, BASE_HEX, VALS(vals_at_extended_highlighting), 0x0,
7058 NULL, HFILL }
7060 /* END - Query Reply (Highlighting) */
7062 /* 6.29 - Query Reply (IBM Auxiliary Device) */
7063 { &hf_tn3270_ibm_flags,
7064 { "Flags",
7065 "tn3270.ibm_flags",
7066 FT_UINT8, BASE_HEX, NULL, 0x0,
7067 NULL, HFILL }
7069 { &hf_tn3270_ibm_limin,
7070 { "Inbound message size limit",
7071 "tn3270.ibm_limin",
7072 FT_UINT16, BASE_DEC, NULL, 0x0,
7073 NULL, HFILL }
7075 { &hf_tn3270_ibm_limout,
7076 { "Outbound message size limit",
7077 "tn3270.ibm_limout",
7078 FT_UINT16, BASE_DEC, NULL, 0x0,
7079 NULL, HFILL }
7081 { &hf_tn3270_ibm_type,
7082 { "Type of IBM Auxiliary Device",
7083 "tn3270.ibm_type",
7084 FT_UINT16, BASE_DEC, NULL, 0x0,
7085 NULL, HFILL }
7087 /* END - 6.29 - Query Reply (IBM Auxiliary Device) */
7089 /* 6.31 - Query Reply (Implicit Partitions) */
7090 { &hf_tn3270_ip_flags,
7091 { "Flags (Reserved)",
7092 "tn3270.ip_flags",
7093 FT_UINT8, BASE_HEX, NULL, 0x0,
7094 NULL, HFILL }
7096 { &hf_tn3270_ipdd_wd,
7097 { "Width of the Implicit Partition default screen size (in character cells)",
7098 "tn3270.ipdd_wd",
7099 FT_UINT16, BASE_DEC, NULL, 0x0,
7100 NULL, HFILL }
7102 { &hf_tn3270_ipdd_hd,
7103 { "Height of the Implicit Partition default screen size",
7104 "tn3270.ipdd_hd",
7105 FT_UINT16, BASE_DEC, NULL, 0x0,
7106 NULL, HFILL }
7108 { &hf_tn3270_ipdd_wa,
7109 { "Width of the Implicit Partition alternate screen size",
7110 "tn3270.ipdd_wa",
7111 FT_UINT16, BASE_DEC, NULL, 0x0,
7112 NULL, HFILL }
7114 { &hf_tn3270_ipdd_ha,
7115 { "Height of the Implicit Partition alternate screen size",
7116 "tn3270.ipdd_ha",
7117 FT_UINT16, BASE_DEC, NULL, 0x0,
7118 NULL, HFILL }
7120 { &hf_tn3270_ippd_dpbs,
7121 { "Default printer buffer size (in character cells)",
7122 "tn3270.ippd_dpbs",
7123 FT_UINT64, BASE_DEC, NULL, 0x0,
7124 NULL, HFILL }
7126 { &hf_tn3270_ippd_apbs,
7127 { "Default printer buffer size (in character cells)",
7128 "tn3270.ippd_apbs",
7129 FT_UINT64, BASE_DEC, NULL, 0x0,
7130 NULL, HFILL }
7132 { &hf_tn3270_ipccd_wcd,
7133 { "Width of the character cell for the Implicit Partition default screen size",
7134 "tn3270.ipccd_wcd",
7135 FT_UINT16, BASE_DEC, NULL, 0x0,
7136 NULL, HFILL }
7138 { &hf_tn3270_ipccd_hcd,
7139 { "Height of the character cell for the Implicit Partition default screen size",
7140 "tn3270.ipccd_hcd",
7141 FT_UINT16, BASE_DEC, NULL, 0x0,
7142 NULL, HFILL }
7144 { &hf_tn3270_ipccd_wca,
7145 { "Width of the character cell for the Implicit Partition alternate screen size",
7146 "tn3270.ipccd_wca",
7147 FT_UINT16, BASE_DEC, NULL, 0x0,
7148 NULL, HFILL }
7150 { &hf_tn3270_ipccd_hca,
7151 { "Height of the character cell for the Implicit Partition alternate screen size",
7152 "tn3270.ipccd_hca",
7153 FT_UINT16, BASE_DEC, NULL, 0x0,
7154 NULL, HFILL }
7156 /* END - Query Reply (Implicit Partitions) */
7158 /* 6.32 - Query Reply (IOCA Auxiliary Device) */
7159 { &hf_tn3270_ioca_limin,
7160 { "Max IOCA bytes/inbound transmission",
7161 "tn3270.ioca_limin",
7162 FT_UINT16, BASE_DEC, NULL, 0x0,
7163 NULL, HFILL }
7165 { &hf_tn3270_ioca_limout,
7166 { "Max IOCA bytes/outbound transmission",
7167 "tn3270.ioca_limout",
7168 FT_UINT16, BASE_DEC, NULL, 0x0,
7169 NULL, HFILL }
7171 { &hf_tn3270_ioca_type,
7172 { "Type of IOCA Auxiliary Device",
7173 "tn3270.ioca_type",
7174 FT_UINT16, BASE_DEC, NULL, 0x0,
7175 NULL, HFILL }
7177 /* END - 6.32 - Query Reply (IOCA Auxiliary Device) */
7179 /* 6.34 - Query Reply (MSR Control) */
7180 { &hf_tn3270_msr_nd,
7181 { "Number of MSR device types",
7182 "tn3270.msr_nd",
7183 FT_UINT8, BASE_DEC, NULL, 0x0,
7184 NULL, HFILL }
7186 /* END - 6.34 - Query Reply (MSR Control) */
7188 /* 6.36 - Query Reply (OEM Auxiliary Device) */
7189 { &hf_tn3270_oem_dsref,
7190 { "Data stream reference identifier",
7191 "tn3270.oem_dsref",
7192 FT_UINT8, BASE_HEX, NULL, 0x0,
7193 NULL, HFILL }
7195 { &hf_tn3270_oem_dtype,
7196 { "Device type",
7197 "tn3270.oem_dtype",
7198 FT_STRING, BASE_NONE, NULL, 0x0,
7199 NULL, HFILL }
7201 { &hf_tn3270_oem_uname,
7202 { "User assigned name",
7203 "tn3270.oem_uname",
7204 FT_STRING, BASE_NONE, NULL, 0x0,
7205 NULL, HFILL }
7207 { &hf_tn3270_sdp_daid,
7208 { "Destination/Origin ID",
7209 "tn3270.oem_sdp_daid_doid",
7210 FT_UINT16, BASE_DEC, NULL, 0x0,
7211 NULL, HFILL }
7213 { &hf_tn3270_oem_sdp_ll_limin,
7214 { "Maximum OEM dsf bytes/transmission allowed inbound",
7215 "tn3270.oem_sdp_ll_limin",
7216 FT_UINT16, BASE_DEC, NULL, 0x0,
7217 NULL, HFILL }
7219 { &hf_tn3270_oem_sdp_ll_limout,
7220 { "Maximum OEM dsf bytes/transmission allowed outbound",
7221 "tn3270.oem_sdp_ll_limout",
7222 FT_UINT16, BASE_DEC, NULL, 0x0,
7223 NULL, HFILL }
7225 { &hf_tn3270_oem_sdp_pclk_vers,
7226 { "Protocol version",
7227 "tn3270.oem_sdp_pclk_vers",
7228 FT_UINT16, BASE_DEC, NULL, 0x0,
7229 NULL, HFILL }
7231 /* END - 6.36 - Query Reply (OEM Auxiliary Device) */
7233 /* 6.37 - Query Reply (Paper Feed Techniques) */
7234 { &hf_tn3270_pft_flags,
7235 { "Flags",
7236 "tn3270.pft_flags",
7237 FT_UINT8, BASE_HEX, NULL, 0x0,
7238 NULL, HFILL }
7240 { &hf_tn3270_pft_tmo,
7241 { "Top margin offset in 1/1440ths of an inch",
7242 "tn3270.pft_tmo",
7243 FT_UINT16, BASE_DEC, NULL, 0x0,
7244 NULL, HFILL }
7246 { &hf_tn3270_pft_bmo,
7247 { "Bottom margin offset in 1/1440ths of an inch",
7248 "tn3270.pft_bmo",
7249 FT_UINT16, BASE_DEC, NULL, 0x0,
7250 NULL, HFILL }
7252 /* END - 6.37 - Query Reply (Paper Feed Techniques) */
7254 /* 6.38 - Query Reply (Partition Characteristics) */
7255 { &hf_tn3270_pc_vo_thickness,
7256 { "Thickness",
7257 "tn3270.pc_vo_thickness",
7258 FT_UINT8, BASE_DEC, NULL, 0x0,
7259 NULL, HFILL }
7261 /* END- 6.38 - Query Reply (Partition Characteristics) */
7263 /* 6.41 - Query Reply (Product Defined Data Stream) */
7264 { &hf_tn3270_pdds_refid,
7265 { "Reference identifier",
7266 "tn3270.pdds_refid",
7267 FT_UINT8, BASE_HEX, VALS(vals_qr_pdds_refid), 0x0,
7268 NULL, HFILL }
7270 { &hf_tn3270_pdds_ssid,
7271 { "Subset identifier",
7272 "tn3270.pdds_ssid",
7273 FT_UINT8, BASE_HEX, VALS(vals_qr_pdds_ssid), 0x0,
7274 NULL, HFILL }
7276 /* END - 6.41 - Query Reply (Product Defined Data Stream) */
7278 /* 6.43 - Query Reply (RPQ Names) */
7279 { &hf_tn3270_rpq_device,
7280 { "Device type identifier",
7281 "tn3270.rpq_device",
7282 FT_STRING, BASE_NONE, NULL, 0x0,
7283 NULL, HFILL }
7285 { &hf_tn3270_rpq_mid,
7286 { "Model type identifier",
7287 "tn3270.rpq_mid",
7288 FT_UINT64, BASE_DEC, NULL, 0x0,
7289 NULL, HFILL }
7291 { &hf_tn3270_rpq_rpql,
7292 { "Length of RPQ name (including this byte)",
7293 "tn3270.rpq_rpql",
7294 FT_UINT8, BASE_DEC, NULL, 0x0,
7295 NULL, HFILL }
7297 { &hf_tn3270_rpq_name,
7298 { "RPQ name",
7299 "tn3270.rpq_name",
7300 FT_STRING, BASE_NONE, NULL, 0x0,
7301 NULL, HFILL }
7303 /* END - Query Reply (Names) */
7305 /* 6.44 - Query Reply (Save or Restore Format) */
7306 { &hf_tn3270_srf_fpcbl,
7307 { "Format parameter control block length",
7308 "tn3270.srf_fpcbl",
7309 FT_UINT16, BASE_DEC, NULL, 0x0,
7310 NULL, HFILL }
7312 /* END - 6.44 - Query Reply (Save or Restore Format) */
7314 /* 6.45 - Query Reply (Settable Printer Characteristics) */
7315 { &hf_tn3270_spc_epc_flags,
7316 { "Flags",
7317 "tn3270.spc_epc_flags",
7318 FT_UINT8, BASE_HEX, NULL, 0x0,
7319 NULL, HFILL }
7321 /* END - 6.45 - Query Reply (Settable Printer Characteristics) */
7323 /* 6.47 - Query Reply (Storage Pools) */
7324 { &hf_tn3270_sp_spid,
7325 { "Storage pool identity",
7326 "tn3270.sp_spid",
7327 FT_UINT8, BASE_HEX, NULL, 0x0,
7328 NULL, HFILL }
7330 { &hf_tn3270_sp_size,
7331 { "Size of this storage pool when empty",
7332 "tn3270.sp_size",
7333 FT_UINT32, BASE_DEC, NULL, 0x0,
7334 NULL, HFILL }
7336 { &hf_tn3270_sp_space,
7337 { "Space available in this storage pool",
7338 "tn3270.sp_space",
7339 FT_UINT32, BASE_DEC, NULL, 0x0,
7340 NULL, HFILL }
7342 { &hf_tn3270_sp_objlist,
7343 { "Identifiers of objects housed in this storage pool",
7344 "tn3270.sp_objlist",
7345 FT_UINT16, BASE_HEX, VALS(vals_sp_objlist), 0x0,
7346 NULL, HFILL }
7348 /* END - 6.47 - Query Reply (Storage Pools) */
7350 /* 6.49 - Query Reply (Text Partitions) */
7351 { &hf_tn3270_tp_nt,
7352 { "Maximum number of text partitions",
7353 "tn3270.tp_nt",
7354 FT_UINT8, BASE_DEC, NULL, 0x0,
7355 NULL, HFILL }
7357 { &hf_tn3270_tp_m,
7358 { "Maximum partition size",
7359 "tn3270.tp_m",
7360 FT_UINT16, BASE_DEC, NULL, 0x0,
7361 NULL, HFILL }
7363 { &hf_tn3270_tp_flags,
7364 { "Flags",
7365 "tn3270.tp_flags",
7366 FT_UINT8, BASE_HEX, NULL, 0x0,
7367 NULL, HFILL }
7369 { &hf_tn3270_tp_ntt,
7370 { "Number of text types supported",
7371 "tn3270.tp_ntt",
7372 FT_UINT8, BASE_DEC, NULL, 0x0,
7373 NULL, HFILL }
7375 { &hf_tn3270_tp_tlist,
7376 { "List of types supported",
7377 "tn3270.tp_tlist",
7378 FT_UINT8, BASE_HEX, NULL, 0x0,
7379 NULL, HFILL }
7381 /* END - 6.49 - Query Reply (Text Partitions) */
7383 /* 6.50 - Query Reply (Transparency) */
7384 { &hf_tn3270_t_np,
7385 { "Number of pairs",
7386 "tn3270.t_np",
7387 FT_UINT8, BASE_DEC, NULL, 0x0,
7388 NULL, HFILL }
7390 { &hf_tn3270_t_vi,
7391 { "Data stream attribute value accepted",
7392 "tn3270.t_vi",
7393 FT_UINT8, BASE_HEX, NULL, 0x0,
7394 NULL, HFILL }
7396 { &hf_tn3270_t_ai,
7397 { "Associated action value",
7398 "tn3270.t_ai",
7399 FT_UINT8, BASE_HEX, NULL, 0x0,
7400 NULL, HFILL }
7402 /* END - 6.50 - Query Reply (Transparency) */
7404 /* 6.51 Query Reply Usable Area */
7405 { &hf_tn3270_usable_area_flags1,
7406 {"Usable Area Flags",
7407 "tn3270.query_reply_usable_area_flags1",
7408 FT_UINT8, BASE_HEX, NULL, 0,
7409 NULL, HFILL}
7411 { &hf_tn3270_ua_reserved1,
7412 { "Reserved",
7413 "tn3270.reserved",
7414 FT_BOOLEAN, 8, NULL, QR_UA_RESERVED1,
7415 NULL, HFILL }
7417 { &hf_tn3270_ua_page_printer,
7418 { "Page Printer",
7419 "tn3270.ua_page_printer",
7420 FT_BOOLEAN, 8, NULL, QR_UA_PAGE_PRINTER,
7421 NULL, HFILL }
7423 { &hf_tn3270_ua_reserved2,
7424 { "Reserved",
7425 "tn3270.reserved",
7426 FT_BOOLEAN, 8, NULL, QR_UA_RESERVED2,
7427 NULL, HFILL }
7429 { &hf_tn3270_ua_hard_copy,
7430 { "Hard Copy",
7431 "tn3270.ua_hard_copy",
7432 FT_BOOLEAN, 8, NULL, QR_UA_HARD_COPY,
7433 NULL, HFILL }
7435 { &hf_tn3270_ua_addressing,
7436 { "Usable Area Addressing",
7437 "tn3270.ua_addressing",
7438 FT_UINT8, BASE_HEX, VALS(vals_usable_area_addr_mode), QR_UA_ADDR_MODE_MASK,
7439 NULL, HFILL}
7441 { &hf_tn3270_usable_area_flags2,
7442 { "Usable Area Flags",
7443 "tn3270.query_reply_usable_area_flags2",
7444 FT_UINT8, BASE_HEX, NULL, 0x0,
7445 NULL, HFILL}
7447 { &hf_tn3270_ua_variable_cells,
7448 { "Variable Cells",
7449 "tn3270.ua_variable_cells",
7450 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_variable_cells), QR_UA_VARIABLE_CELLS,
7451 NULL, HFILL }
7453 { &hf_tn3270_ua_characters,
7454 { "Characters",
7455 "tn3270.ua_characters",
7456 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_characters), QR_UA_CHARACTERS,
7457 NULL, HFILL }
7459 { &hf_tn3270_ua_cell_units,
7460 { "Cell Units",
7461 "tn3270.ua_cell_units",
7462 FT_BOOLEAN, 8, TFS(&tn3270_tfs_ua_cell_units), QR_UA_CELL_UNITS,
7463 NULL, HFILL }
7465 { &hf_tn3270_ua_width_cells_pels,
7466 { "Width of usable area in cells/pels",
7467 "tn3270.ua_width_cells_pels",
7468 FT_UINT16, BASE_DEC, NULL, 0x0,
7469 NULL, HFILL }
7471 { &hf_tn3270_ua_height_cells_pels,
7472 { "Height of usable area in cells/pels",
7473 "tn3270.ua_height_cells_pels",
7474 FT_UINT16, BASE_DEC, NULL, 0x0,
7475 NULL, HFILL }
7477 { &hf_tn3270_ua_uom_cells_pels,
7478 { "Units of measure for cells/pels",
7479 "tn3270.ua_uom_cells_pels",
7480 FT_UINT8, BASE_HEX, VALS(vals_usable_area_uom), 0x0,
7481 NULL, HFILL }
7483 { &hf_tn3270_ua_xr,
7484 { "Distance between points in X direction as a fraction, measured in UNITS, with 2-byte"
7485 " numerator and 2-byte denominator",
7486 "tn3270.ua_xr",
7487 FT_UINT32, BASE_HEX, NULL, 0x0,
7488 NULL, HFILL }
7490 { &hf_tn3270_ua_yr,
7491 { "Distance between points in Y direction as a fraction, measured in UNITS, with 2-byte"
7492 " numerator and 2-byte denominator",
7493 "tn3270.ua_xr",
7494 FT_UINT32, BASE_HEX, NULL, 0x0,
7495 NULL, HFILL }
7497 { &hf_tn3270_ua_aw,
7498 { "Number of X units in default cell",
7499 "tn3270.ua_aw",
7500 FT_UINT8, BASE_DEC, NULL, 0x0,
7501 NULL, HFILL }
7503 { &hf_tn3270_ua_ah,
7504 { "Number of Y units in default cell",
7505 "tn3270.ua_ah",
7506 FT_UINT8, BASE_DEC, NULL, 0x0,
7507 NULL, HFILL }
7509 { &hf_tn3270_ua_buffsz,
7510 { "Character buffer size (bytes)",
7511 "tn3270.ua_buffsz",
7512 FT_UINT16, BASE_DEC, NULL, 0x0,
7513 NULL, HFILL }
7515 { &hf_tn3270_ua_xmin,
7516 { "Minimum number of X units in variable cell",
7517 "tn3270.ua_xmin",
7518 FT_UINT8, BASE_DEC, NULL, 0x0,
7519 NULL, HFILL }
7521 { &hf_tn3270_ua_ymin,
7522 { "Minimum number of Y units in variable cell",
7523 "tn3270.ua_ymin",
7524 FT_UINT8, BASE_DEC, NULL, 0x0,
7525 NULL, HFILL }
7527 { &hf_tn3270_ua_xmax,
7528 { "Maximum number of X units in variable cell",
7529 "tn3270.ua_xmax",
7530 FT_UINT8, BASE_DEC, NULL, 0x0,
7531 NULL, HFILL }
7533 { &hf_tn3270_ua_ymax,
7534 { "Maximum number of Y units in variable cell",
7535 "tn3270.ua_ymax",
7536 FT_UINT8, BASE_DEC, NULL, 0x0,
7537 NULL, HFILL }
7539 /* End - 6.51 Query Reply Usable Area */
7541 /* 6.52 - Query Reply (3270 IPDS) */
7542 { &hf_tn3270_3270_tranlim,
7543 { "Maximum transmission size allowed outbound",
7544 "tn3270.3270_tranlim",
7545 FT_UINT16, BASE_DEC, NULL, 0x0,
7546 NULL, HFILL }
7548 /* END - 6.52 - Query Reply (3270 IPDS) */
7550 /* Miscellaneous */
7551 { &hf_tn3270_field_data,
7552 { "Field Data",
7553 "tn3270.field_data",
7554 FT_STRING, BASE_NONE, NULL, 0x0,
7555 "tn3270.field_data", HFILL }
7557 { &hf_tn3270_number_of_attributes,
7558 { "Number of Attributes",
7559 "tn3270.number_of_attributes",
7560 FT_UINT8, BASE_HEX, NULL, 0x0,
7561 NULL, HFILL }
7563 { &hf_tn3270_resbyte,
7564 { "Flags (Reserved)",
7565 "tn3270.resbyte",
7566 FT_UINT8, BASE_HEX, NULL, 0x0,
7567 NULL, HFILL }
7569 { &hf_tn3270_resbytes,
7570 { "Flags (Reserved)",
7571 "tn3270.resbytes",
7572 FT_UINT8, BASE_HEX, NULL, 0x0,
7573 NULL, HFILL }
7575 { &hf_tn3270_res_twobytes,
7576 { "Flags (Reserved)",
7577 "tn3270.res_twobytes",
7578 FT_UINT16, BASE_HEX, NULL, 0x0,
7579 NULL, HFILL }
7581 { &hf_tn3270_sf_single_byte_id,
7582 { "Structured Field",
7583 "tn3270.sf_id",
7584 FT_UINT8, BASE_HEX, NULL, 0x0,
7585 NULL, HFILL }
7587 { &hf_tn3270_sf_double_byte_id,
7588 { "Structured Field",
7589 "tn3270.sf_id",
7590 FT_UINT16, BASE_HEX, NULL, 0x0,
7591 NULL, HFILL }
7593 { &hf_tn3270_sf_query_reply,
7594 { "Query Reply",
7595 "tn3270.sf_query_reply",
7596 FT_UINT8, BASE_HEX, VALS(vals_sf_query_replies), 0x0,
7597 NULL, HFILL }
7599 { &hf_tn3270_null,
7600 { "Trailing Null (Possible Mainframe/Emulator Bug)",
7601 "tn3270.null",
7602 FT_UINT8, BASE_HEX, NULL, 0x0,
7603 NULL, HFILL }
7605 { &hf_tn3270_unknown_data,
7606 { "Unknown Data (Possible Mainframe/Emulator Bug)",
7607 "tn3270.unknown_data",
7608 FT_BYTES, BASE_NONE, NULL, 0x0,
7609 NULL, HFILL }
7612 /* TN3270E - Header Fields */
7613 { &hf_tn3270_tn3270e_data_type,
7614 { "TN3270E Data Type",
7615 "tn3270.tn3270e_data_type",
7616 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_data_types), 0x0,
7617 NULL, HFILL }
7619 { &hf_tn3270_tn3270e_request_flag,
7620 { "TN3270E Request Flag",
7621 "tn3270.tn3270e_request_flag",
7622 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_request_flags), 0x0,
7623 NULL, HFILL }
7625 { &hf_tn3270_tn3270e_response_flag_3270_SCS,
7626 { "TN3270E Response Flag",
7627 "tn3270.tn3270e_response_flag",
7628 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_response_flags_3270_SCS), 0x0,
7629 NULL, HFILL }
7631 { &hf_tn3270_tn3270e_response_flag_response,
7632 { "TN3270E Response Flag",
7633 "tn3270.tn3270e_response_flag",
7634 FT_UINT8, BASE_HEX, VALS(vals_tn3270_header_response_flags_response), 0x0,
7635 NULL, HFILL }
7637 { &hf_tn3270_tn3270e_response_flag_unused,
7638 { "TN3270E Response Flag",
7639 "tn3270.tn3270e_response_flag",
7640 FT_UINT8, BASE_HEX, NULL, 0x0,
7641 NULL, HFILL }
7643 { &hf_tn3270_tn3270e_seq_number,
7644 { "TN3270E Seq Number",
7645 "tn3270.tn3270e_seq_number",
7646 FT_UINT16, BASE_DEC, NULL, 0x0,
7647 NULL, HFILL }
7649 { &hf_tn3270_tn3270e_header_data,
7650 { "TN3270E Header Data",
7651 "tn3270.tn3270e_header_data",
7652 FT_STRING, BASE_NONE, NULL, 0x0,
7653 NULL, HFILL }
7657 static gint *ett[] = {
7658 &ett_tn3270,
7659 &ett_tn3270e_hdr,
7660 &ett_sf,
7661 &ett_tn3270_field_attribute,
7662 &ett_tn3270_field_validation,
7663 &ett_tn3270_usable_area_flags1,
7664 &ett_tn3270_usable_area_flags2,
7665 &ett_tn3270_query_reply_alphanumeric_flags,
7666 &ett_tn3270_character_sets_flags1,
7667 &ett_tn3270_character_sets_flags2,
7668 &ett_tn3270_character_sets_form,
7669 &ett_tn3270_cs_descriptor_flags,
7670 &ett_tn3270_color_flags,
7671 &ett_tn3270_wcc,
7672 &ett_tn3270_ccc,
7673 &ett_tn3270_msr_state_mask,
7674 &ett_tn3270_data_chain_fields,
7675 &ett_tn3270_query_list
7678 proto_tn3270 = proto_register_protocol("TN3270 Protocol", "TN3270", "tn3270");
7679 register_dissector("tn3270", dissect_tn3270, proto_tn3270);
7680 proto_register_field_array(proto_tn3270, hf, array_length(hf));
7681 proto_register_subtree_array(ett, array_length(ett));
7686 * Editor modelines
7688 * Local Variables:
7689 * c-basic-offset: 2
7690 * tab-width: 8
7691 * indent-tabs-mode: nil
7692 * End:
7694 * ex: set shiftwidth=2 tabstop=8 expandtab:
7695 * :indentSize=2:tabSize=8:noTabs=true: