forked from osmocom/wireshark
From Robert Hogan via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4257 :
Correctly decode and display the buffer address in SBA orders. Note: This includes a macro with a new license which is added to COPYING. svn path=/trunk/; revision=32785
This commit is contained in:
parent
2fcc6996c9
commit
acc410ae87
59
COPYING
59
COPYING
|
@ -28,7 +28,7 @@ Parts of Wireshark can be built and distributed as libraries. These
|
|||
parts are still covered by the GPL, and NOT by the Lesser General Public
|
||||
License or any other license.
|
||||
|
||||
If you integrate all or part of Wireshark into your own application, then
|
||||
If you integrate all or part of Wireshark into your own application, then
|
||||
that application must be released under a license compatible with the GPL.
|
||||
|
||||
The full text of the GNU GPL and the other applicable licenses follows.
|
||||
|
@ -383,7 +383,7 @@ Parts of this software are licensed as follows
|
|||
|
||||
Copyright (c) 1988, 1992, 1993
|
||||
The Regents of the University of California. All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -395,7 +395,7 @@ Parts of this software are licensed as follows
|
|||
3. Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@ -410,7 +410,7 @@ Parts of this software are licensed as follows
|
|||
|
||||
|
||||
Copyright (c) 2003 Markus Friedl. All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -419,7 +419,7 @@ Parts of this software are licensed as follows
|
|||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
|
@ -434,25 +434,25 @@ Parts of this software are licensed as follows
|
|||
|
||||
Copyright (c) 2003 Endace Technology Ltd, Hamilton, New Zealand.
|
||||
All rights reserved.
|
||||
|
||||
|
||||
This software and documentation has been developed by Endace Technology Ltd.
|
||||
along with the DAG PCI network capture cards. For further information please
|
||||
visit http://www.endace.com/.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
3. The name of Endace Technology Ltd may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ENDACE TECHNOLOGY LTD ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
|
@ -467,7 +467,7 @@ Parts of this software are licensed as follows
|
|||
|
||||
Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -479,7 +479,7 @@ Parts of this software are licensed as follows
|
|||
3. Neither the name of the project nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@ -494,7 +494,7 @@ Parts of this software are licensed as follows
|
|||
|
||||
|
||||
Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
@ -503,7 +503,7 @@ Parts of this software are licensed as follows
|
|||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
|
@ -515,3 +515,32 @@ Parts of this software are licensed as follows
|
|||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Copyright (c) 1993-2009, Paul Mattes.
|
||||
Copyright (c) 1990, Jeff Sparkes.
|
||||
Copyright (c) 1989, Georgia Tech Research Corporation (GTRC), Atlanta, GA
|
||||
30332.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the names of Paul Mattes, Jeff Sparkes, GTRC nor the names of
|
||||
their contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY PAUL MATTES, JEFF SPARKES AND GTRC "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL PAUL MATTES, JEFF SPARKES OR GTRC BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
|
@ -138,21 +138,30 @@ typedef struct tn_opt {
|
|||
} tn_opt;
|
||||
|
||||
static void
|
||||
check_for_tn3270(packet_info *pinfo _U_, const char *optname, const char *terminaltype)
|
||||
check_tn3270_model(packet_info *pinfo _U_, const char *terminaltype)
|
||||
{
|
||||
|
||||
if (strcmp(optname,"Terminal Type") != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int model;
|
||||
char str_model[2];
|
||||
if ((strcmp(terminaltype,"IBM-3278-2-E") == 0) || (strcmp(terminaltype,"IBM-3278-2") == 0) ||
|
||||
(strcmp(terminaltype,"IBM-3278-3") == 0) || (strcmp(terminaltype,"IBM-3278-4") == 0) ||
|
||||
(strcmp(terminaltype,"IBM-3278-5") == 0) || (strcmp(terminaltype,"IBM-3277-2") == 0) ||
|
||||
(strcmp(terminaltype,"IBM-3279-3") == 0) || (strcmp(terminaltype,"IBM-3279-4") == 0) ||
|
||||
(strcmp(terminaltype,"IBM-3279-2-E") == 0) || (strcmp(terminaltype,"IBM-3279-2") == 0) ||
|
||||
(strcmp(terminaltype,"IBM-3279-4-E") == 0))
|
||||
add_tn3270_conversation(pinfo, 0);
|
||||
(strcmp(terminaltype,"IBM-3279-4-E") == 0)) {
|
||||
str_model[0] = terminaltype[9];
|
||||
str_model[1] = '\0';
|
||||
model = atoi(str_model);
|
||||
add_tn3270_conversation(pinfo, 0, model);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_for_tn3270(packet_info *pinfo _U_, const char *optname, const char *terminaltype)
|
||||
{
|
||||
if (strcmp(optname,"Terminal Type") != 0) {
|
||||
return;
|
||||
}
|
||||
check_tn3270_model(pinfo, terminaltype);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -210,7 +219,7 @@ dissect_tn3270_regime_subopt(packet_info *pinfo _U_, const char *optname _U_, tv
|
|||
case TN3270_REGIME_IS:
|
||||
if (cmd == TN3270_REGIME_ARE) {
|
||||
proto_tree_add_text(tree, tvb, offset, 1, "ARE");
|
||||
add_tn3270_conversation(pinfo, 0);
|
||||
add_tn3270_conversation(pinfo, 0, 0);
|
||||
} else {
|
||||
proto_tree_add_text(tree, tvb, offset, 1, "IS");
|
||||
}
|
||||
|
@ -294,6 +303,7 @@ dissect_tn3270e_subopt(packet_info *pinfo _U_, const char *optname _U_, tvbuff_t
|
|||
if (datalen > 0) {
|
||||
proto_tree_add_text(tree, tvb, offset + 1, datalen, "%s",
|
||||
tvb_format_text(tvb, offset + 1, datalen));
|
||||
check_tn3270_model(pinfo, tvb_format_text(tvb, offset + 1, datalen));
|
||||
offset += datalen;
|
||||
len -= datalen;
|
||||
}
|
||||
|
@ -339,7 +349,7 @@ dissect_tn3270e_subopt(packet_info *pinfo _U_, const char *optname _U_, tvbuff_t
|
|||
proto_tree_add_text(tree, tvb, offset, 1, "REJECT");
|
||||
break;
|
||||
case TN3270_REQUEST:
|
||||
add_tn3270_conversation(pinfo, 1);
|
||||
add_tn3270_conversation(pinfo, 1, 0);
|
||||
proto_tree_add_text(tree, tvb, offset, 1, "REQUEST");
|
||||
device_type = tvb_get_guint8(tvb, offset-1);
|
||||
if (device_type == TN3270_DEVICE_TYPE) {
|
||||
|
|
|
@ -30,6 +30,43 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* The DECODE_BADDR macro comes from ctlr.c in X3270 and has the following licence:
|
||||
*
|
||||
* Copyright (c) 1993-2009, Paul Mattes.
|
||||
* Copyright (c) 1990, Jeff Sparkes.
|
||||
* Copyright (c) 1989, Georgia Tech Research Corporation (GTRC), Atlanta, GA
|
||||
* 30332.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the names of Paul Mattes, Jeff Sparkes, GTRC nor the names of
|
||||
* their contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY PAUL MATTES, JEFF SPARKES AND GTRC "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL PAUL MATTES, JEFF SPARKES OR GTRC BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define DECODE_BADDR(c1, c2) \
|
||||
((((c1) & 0xC0) == 0x00) ? \
|
||||
(((c1) & 0x3F) << 8) | (c2) : \
|
||||
(((c1) & 0x3F) << 6) | ((c2) & 0x3F))
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
|
@ -60,8 +97,7 @@ static int hf_tn3270_attribute_type=-1;
|
|||
static int hf_tn3270_begin_end_flags1=-1;
|
||||
static int hf_tn3270_begin_end_flags2=-1;
|
||||
static int hf_tn3270_bsc=-1;
|
||||
static int hf_tn3270_buffer_x=-1;
|
||||
static int hf_tn3270_buffer_y=-1;
|
||||
static int hf_tn3270_buffer_address=-1;
|
||||
static int hf_tn3270_c_cav=-1;
|
||||
static int hf_tn3270_cc=-1;
|
||||
static int hf_tn3270_character_code=-1;
|
||||
|
@ -417,6 +453,8 @@ static gint ett_tn3270_msr_state_mask=-1;
|
|||
|
||||
tn3270_conv_info_t *tn3270_info_items;
|
||||
|
||||
guint8 ROWS, COLS, MAXROWS, MAXCOLS;
|
||||
|
||||
gint dissect_orders_and_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset);
|
||||
|
||||
typedef struct hf_items {
|
||||
|
@ -842,7 +880,7 @@ static gint
|
|||
dissect_outbound_3270ds(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
|
||||
gint sf_length)
|
||||
{
|
||||
int start=offset;
|
||||
int start=offset;
|
||||
int cmd;
|
||||
|
||||
proto_tree_add_item(tn3270_tree,
|
||||
|
@ -1050,7 +1088,7 @@ dissect_restart(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset,
|
|||
(sf_length - 9),
|
||||
FALSE);
|
||||
offset+=(sf_length - 9);
|
||||
|
||||
|
||||
return (offset - start);
|
||||
}
|
||||
|
||||
|
@ -3450,18 +3488,22 @@ static gint
|
|||
dissect_sba(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
|
||||
{
|
||||
int start = offset;
|
||||
proto_tree_add_item(tn3270_tree,
|
||||
hf_tn3270_buffer_x,
|
||||
guint8 x, y;
|
||||
int buffer_addr=0;
|
||||
proto_item *ti;
|
||||
|
||||
x = tvb_get_guint8(tvb, offset);
|
||||
y = tvb_get_guint8(tvb, offset+1);
|
||||
buffer_addr = DECODE_BADDR(x,y);
|
||||
|
||||
ti = proto_tree_add_item(tn3270_tree,
|
||||
hf_tn3270_buffer_address,
|
||||
tvb, offset,
|
||||
1,
|
||||
2,
|
||||
FALSE);
|
||||
offset++;
|
||||
proto_tree_add_item(tn3270_tree,
|
||||
hf_tn3270_buffer_y,
|
||||
tvb, offset,
|
||||
1,
|
||||
FALSE);
|
||||
offset++;
|
||||
proto_item_append_text(ti, " (Row %u, Column %u for %ux%u Display)",
|
||||
(buffer_addr / COLS) + 1, (buffer_addr % COLS) + 1, ROWS, COLS);
|
||||
offset+=2;
|
||||
|
||||
return (offset - start);
|
||||
}
|
||||
|
@ -3605,10 +3647,15 @@ dissect_orders_and_data(proto_tree *tn3270_tree, tvbuff_t *tvb, gint offset)
|
|||
break;
|
||||
/* case PT:*/
|
||||
case IC:
|
||||
case EW:
|
||||
case EWA:
|
||||
break;
|
||||
/* return (offset - start);*/
|
||||
case EW:
|
||||
ROWS=24;
|
||||
COLS=80;
|
||||
break;
|
||||
case EWA:
|
||||
ROWS=MAXROWS;
|
||||
COLS=MAXCOLS;
|
||||
break;
|
||||
default:
|
||||
proto_tree_add_text(tn3270_tree, tvb, offset, 1, "Bogus value: %u", order_code);
|
||||
offset ++;
|
||||
|
@ -3838,7 +3885,7 @@ dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
|
||||
void
|
||||
add_tn3270_conversation(packet_info *pinfo, int tn3270e)
|
||||
add_tn3270_conversation(packet_info *pinfo, int tn3270e, int model)
|
||||
{
|
||||
conversation_t *conversation;
|
||||
tn3270_conv_info_t *tn3270_info = NULL;
|
||||
|
@ -3874,6 +3921,24 @@ add_tn3270_conversation(packet_info *pinfo, int tn3270e)
|
|||
tn3270_info_items = tn3270_info;
|
||||
}
|
||||
|
||||
/* The maximum rows/cols is tied to the 3270 model number */
|
||||
switch (model) {
|
||||
case 4:
|
||||
MAXROWS = 32;
|
||||
MAXCOLS = 80;
|
||||
break;
|
||||
case 5:
|
||||
MAXROWS = 27;
|
||||
MAXCOLS = 132;
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
MAXROWS = 24;
|
||||
MAXCOLS = 80;
|
||||
}
|
||||
ROWS = 24;
|
||||
COLS = 80;
|
||||
|
||||
tn3270_info->extended = tn3270e;
|
||||
|
||||
}
|
||||
|
@ -4048,13 +4113,9 @@ proto_register_tn3270(void)
|
|||
FT_UINT8, BASE_HEX, VALS(vals_attention_identification_bytes), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_tn3270_buffer_x,
|
||||
{ "Buffer X", "tn3270.buffer_x",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_tn3270_buffer_y,
|
||||
{ "Buffer Y", "tn3270.buffer_y",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
{ &hf_tn3270_buffer_address,
|
||||
{ "Buffer Address", "tn3270.buffer_address",
|
||||
FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
/* Self Defining Parameters */
|
||||
|
@ -4193,7 +4254,7 @@ proto_register_tn3270(void)
|
|||
/* END - 5.11 - Load Format Storage */
|
||||
|
||||
/* 5.12 - Load Line Type */
|
||||
{ &hf_tn3270_load_line_type_command,
|
||||
{ &hf_tn3270_load_line_type_command,
|
||||
{ "Line Type Command", "tn3270.load_line_type_command",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
|
|
@ -1143,7 +1143,7 @@ typedef struct tn3270_conv_info_t {
|
|||
gint extended;
|
||||
} tn3270_conv_info_t;
|
||||
|
||||
void add_tn3270_conversation(packet_info *pinfo, int tn3270e);
|
||||
void add_tn3270_conversation(packet_info *pinfo, int tn3270e, int model);
|
||||
int find_tn3270_conversation(packet_info *pinfo);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue