aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-04-20 11:36:16 +0000
committerGuy Harris <guy@alum.mit.edu>2003-04-20 11:36:16 +0000
commitd359286841fb9221400bcc64bf8bbcc88e3127fd (patch)
tree7ed0620519b78e1ad0b8f6a83d488e1dd856bb3f
parent4af58d8967aecdaea73d618ea7d6310183e6ffd2 (diff)
Add a pointer to an hf_ value for a "reassembled_in" field (which can be
null) to the "fragment_items" structure, and don't pass that value into "process_reassembled_data()", just have it use the value in the "fragment_items" structure passed to it. Make "process_reassembled_data()" capable of handling reassembly done by "fragment_add_seq_check()", and use it in the ATP and 802.11 dissectors; give them "reassembled_in" fields. Make "process_reassembled_data()" handle only the case of a completed reassembly (fd_head != NULL) so that we can use it in those dissectors without gunking the code up too much. svn path=/trunk/; revision=7513
-rw-r--r--packet-atalk.c18
-rw-r--r--packet-clnp.c14
-rw-r--r--packet-dcerpc.c3
-rw-r--r--packet-eap.c3
-rw-r--r--packet-ieee80211.c16
-rw-r--r--packet-ip.c15
-rw-r--r--packet-ipv6.c14
-rw-r--r--packet-ndps.c3
-rw-r--r--packet-netbios.c3
-rw-r--r--packet-rpc.c3
-rw-r--r--packet-smb-pipe.c3
-rw-r--r--packet-smb.c3
-rw-r--r--packet-tcp.c3
-rw-r--r--packet-tds.c3
-rw-r--r--packet-wtp.c3
-rw-r--r--packet-x25.c3
-rw-r--r--reassemble.c89
-rw-r--r--reassemble.h15
18 files changed, 139 insertions, 75 deletions
diff --git a/packet-atalk.c b/packet-atalk.c
index 5a56dc24aa..67bbc07b13 100644
--- a/packet-atalk.c
+++ b/packet-atalk.c
@@ -2,7 +2,7 @@
* Routines for AppleTalk packet disassembly: LLAP, DDP, NBP, ATP, ASP,
* RTMP.
*
- * $Id: packet-atalk.c,v 1.87 2003/03/05 07:17:49 guy Exp $
+ * $Id: packet-atalk.c,v 1.88 2003/04/20 11:36:11 guy Exp $
*
* Simon Wilkinson <sxw@dcs.ed.ac.uk>
*
@@ -127,6 +127,7 @@ static int hf_atp_segment_overlap_conflict = -1;
static int hf_atp_segment_multiple_tails = -1;
static int hf_atp_segment_too_long_segment = -1;
static int hf_atp_segment_error = -1;
+static int hf_atp_reassembled_in = -1;
/* ------------------------- */
static int proto_zip = -1;
@@ -346,6 +347,7 @@ static const fragment_items atp_frag_items = {
&hf_atp_segment_multiple_tails,
&hf_atp_segment_too_long_segment,
&hf_atp_segment_error,
+ &hf_atp_reassembled_in,
"segments"
};
@@ -857,14 +859,8 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
more_fragment);
if (fd_head != NULL) {
if (fd_head->next != NULL) {
- new_tvb = tvb_new_real_data(fd_head->data, fd_head->len, fd_head->len);
- tvb_set_child_real_data_tvbuff(tvb, new_tvb);
- add_new_data_source(pinfo, new_tvb, "Reassembled ATP");
- /* Show all fragments. */
- if (tree) {
- show_fragment_seq_tree(fd_head, &atp_frag_items,
- atp_tree, pinfo, new_tvb);
- }
+ new_tvb = process_reassembled_data(tvb, pinfo, "Reassembled ATP",
+ fd_head, &atp_frag_items, NULL, atp_tree);
}
else
new_tvb = tvb_new_subset(tvb, ATP_HDRSIZE -1, -1, -1);
@@ -1965,6 +1961,10 @@ proto_register_atalk(void)
{ &hf_atp_segments,
{ "ATP Fragments", "atp.fragments", FT_NONE, BASE_NONE,
NULL, 0x0, "ATP Fragments", HFILL }},
+
+ { &hf_atp_reassembled_in,
+ { "Reassembled ATP in frame", "atp.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
+ "This ATP packet is reassembled in this frame", HFILL }}
};
static hf_register_info hf_asp[] = {
diff --git a/packet-clnp.c b/packet-clnp.c
index 35f9b1375d..1e1912c27a 100644
--- a/packet-clnp.c
+++ b/packet-clnp.c
@@ -1,7 +1,7 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
- * $Id: packet-clnp.c,v 1.72 2003/04/20 08:06:00 guy Exp $
+ * $Id: packet-clnp.c,v 1.73 2003/04/20 11:36:13 guy Exp $
* Laurent Deniel <laurent.deniel@free.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@@ -92,6 +92,7 @@ static const fragment_items clnp_frag_items = {
&hf_clnp_segment_multiple_tails,
&hf_clnp_segment_too_long_segment,
&hf_clnp_segment_error,
+ &hf_clnp_reassembled_in,
"segments"
};
@@ -1885,9 +1886,14 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
clnp_reassembled_table, segment_offset,
segment_length - cnf_hdr_len,
cnf_type & CNF_MORE_SEGS);
- next_tvb = process_reassembled_data(tvb, pinfo, "Reassembled CLNP",
- fd_head, &clnp_frag_items, hf_clnp_reassembled_in, &update_col_info,
- clnp_tree);
+
+ if (fd_head != NULL) {
+ next_tvb = process_reassembled_data(tvb, pinfo, "Reassembled CLNP",
+ fd_head, &clnp_frag_items, &update_col_info, clnp_tree);
+ } else {
+ /* We don't have the complete reassembled payload. */
+ next_tvb = NULL;
+ }
} else {
/* If this is the first segment, dissect its contents, otherwise
just show it as a segment.
diff --git a/packet-dcerpc.c b/packet-dcerpc.c
index b7c88a8f86..2967896753 100644
--- a/packet-dcerpc.c
+++ b/packet-dcerpc.c
@@ -2,7 +2,7 @@
* Routines for DCERPC packet disassembly
* Copyright 2001, Todd Sabin <tas@webspan.net>
*
- * $Id: packet-dcerpc.c,v 1.116 2003/04/15 08:04:54 guy Exp $
+ * $Id: packet-dcerpc.c,v 1.117 2003/04/20 11:36:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -425,6 +425,7 @@ static const fragment_items dcerpc_frag_items = {
&hf_dcerpc_fragment_multiple_tails,
&hf_dcerpc_fragment_too_long_fragment,
&hf_dcerpc_fragment_error,
+ NULL,
"fragments"
};
diff --git a/packet-eap.c b/packet-eap.c
index 5c52637863..2a1bc999df 100644
--- a/packet-eap.c
+++ b/packet-eap.c
@@ -2,7 +2,7 @@
* Routines for EAP Extensible Authentication Protocol dissection
* RFC 2284
*
- * $Id: packet-eap.c,v 1.33 2003/04/01 19:17:53 guy Exp $
+ * $Id: packet-eap.c,v 1.34 2003/04/20 11:36:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -213,6 +213,7 @@ static const fragment_items eaptls_frag_items = {
&hf_eaptls_fragment_multiple_tails,
&hf_eaptls_fragment_too_long_fragment,
&hf_eaptls_fragment_error,
+ NULL,
"fragments"
};
diff --git a/packet-ieee80211.c b/packet-ieee80211.c
index a0ea0b0757..4984dbe58b 100644
--- a/packet-ieee80211.c
+++ b/packet-ieee80211.c
@@ -3,7 +3,7 @@
* Copyright 2000, Axis Communications AB
* Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
*
- * $Id: packet-ieee80211.c,v 1.84 2003/04/01 19:05:55 guy Exp $
+ * $Id: packet-ieee80211.c,v 1.85 2003/04/20 11:36:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -328,6 +328,7 @@ static int hf_fragment_overlap_conflict = -1;
static int hf_fragment_multiple_tails = -1;
static int hf_fragment_too_long_fragment = -1;
static int hf_fragment_error = -1;
+static int hf_reassembled_in = -1;
static int proto_wlan_mgt = -1;
@@ -399,6 +400,7 @@ static const fragment_items frag_items = {
&hf_fragment_multiple_tails,
&hf_fragment_too_long_fragment,
&hf_fragment_error,
+ &hf_reassembled_in,
"fragments"
};
@@ -1776,12 +1778,8 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
* a non-fragmented frame.
*/
if (fd_head->next != NULL) {
- next_tvb = tvb_new_real_data(fd_head->data, fd_head->len, fd_head->len);
- tvb_set_child_real_data_tvbuff(tvb, next_tvb);
- add_new_data_source(pinfo, next_tvb, "Reassembled 802.11");
-
- /* Show all fragments. */
- show_fragment_seq_tree(fd_head, &frag_items, hdr_tree, pinfo, next_tvb);
+ next_tvb = process_reassembled_data(tvb, pinfo, "Reassembled 802.11",
+ fd_head, &frag_items, NULL, hdr_tree);
} else {
/*
* Not fragmented, really.
@@ -2234,6 +2232,10 @@ proto_register_ieee80211 (void)
{"802.11 Fragments", "wlan.fragments", FT_NONE, BASE_NONE, NULL, 0x0,
"802.11 Fragments", HFILL }},
+ {&hf_reassembled_in,
+ {"Reassembled 802.11 in frame", "wlan.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
+ "This 802.11 packet is reassembled in this frame", HFILL }},
+
{&hf_wep_iv,
{"Initialization Vector", "wlan.wep.iv", FT_UINT24, BASE_HEX, NULL, 0,
"Initialization Vector", HFILL }},
diff --git a/packet-ip.c b/packet-ip.c
index 84d298ae09..46f59b944a 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.189 2003/04/20 08:06:00 guy Exp $
+ * $Id: packet-ip.c,v 1.190 2003/04/20 11:36:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -120,6 +120,7 @@ static const fragment_items ip_frag_items = {
&hf_ip_fragment_multiple_tails,
&hf_ip_fragment_too_long_fragment,
&hf_ip_fragment_error,
+ &hf_ip_reassembled_in,
"fragments"
};
@@ -1033,9 +1034,14 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
(iph->ip_off & IP_OFFSET)*8,
pinfo->iplen - pinfo->iphdrlen,
iph->ip_off & IP_MF);
- next_tvb = process_reassembled_data(tvb, pinfo, "Reassembled IPv4",
- ipfd_head, &ip_frag_items, hf_ip_reassembled_in, &update_col_info,
- ip_tree);
+
+ if (ipfd_head != NULL) {
+ next_tvb = process_reassembled_data(tvb, pinfo, "Reassembled IPv4",
+ ipfd_head, &ip_frag_items, &update_col_info, ip_tree);
+ } else {
+ /* We don't have the complete reassembled payload. */
+ next_tvb = NULL;
+ }
} else {
/* If this is the first fragment, dissect its contents, otherwise
just show it as a fragment.
@@ -1693,7 +1699,6 @@ proto_register_ip(void)
{ &hf_ip_reassembled_in,
{ "Reassembled IP in frame", "ip.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
"This IP packet is reassembled in this frame", HFILL }}
-
};
static gint *ett[] = {
&ett_ip,
diff --git a/packet-ipv6.c b/packet-ipv6.c
index 95aceb9187..6ef5d2ebf0 100644
--- a/packet-ipv6.c
+++ b/packet-ipv6.c
@@ -1,7 +1,7 @@
/* packet-ipv6.c
* Routines for IPv6 packet disassembly
*
- * $Id: packet-ipv6.c,v 1.96 2003/04/20 08:06:01 guy Exp $
+ * $Id: packet-ipv6.c,v 1.97 2003/04/20 11:36:14 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -91,6 +91,7 @@ static const fragment_items ipv6_frag_items = {
&hf_ipv6_fragment_multiple_tails,
&hf_ipv6_fragment_too_long_fragment,
&hf_ipv6_fragment_error,
+ &hf_ipv6_reassembled_in,
"fragments"
};
@@ -645,9 +646,14 @@ again:
offlg & IP6F_OFF_MASK,
plen,
offlg & IP6F_MORE_FRAG);
- next_tvb = process_reassembled_data(tvb, pinfo, "Reassembled IPv6",
- ipfd_head, &ipv6_frag_items, hf_ipv6_reassembled_in, &update_col_info,
- ipv6_tree);
+
+ if (ipfd_head != NULL) {
+ next_tvb = process_reassembled_data(tvb, pinfo, "Reassembled IPv6",
+ ipfd_head, &ipv6_frag_items, &update_col_info, ipv6_tree);
+ } else {
+ /* We don't have the complete reassembled payload. */
+ next_tvb = NULL;
+ }
} else {
/* If this is the first fragment, dissect its contents, otherwise
just show it as a fragment.
diff --git a/packet-ndps.c b/packet-ndps.c
index 66b5ad03dc..a9501e2bcb 100644
--- a/packet-ndps.c
+++ b/packet-ndps.c
@@ -3,7 +3,7 @@
* Greg Morris <gmorris@novell.com>
* Copyright (c) Novell, Inc. 2002-2003
*
- * $Id: packet-ndps.c,v 1.19 2003/04/09 22:33:19 guy Exp $
+ * $Id: packet-ndps.c,v 1.20 2003/04/20 11:36:14 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -3013,6 +3013,7 @@ static const fragment_items ndps_frag_items = {
&hf_ndps_segment_multiple_tails,
&hf_ndps_segment_too_long_segment,
&hf_ndps_segment_error,
+ NULL,
"segments"
};
diff --git a/packet-netbios.c b/packet-netbios.c
index 66dc5bde85..27e4acc66e 100644
--- a/packet-netbios.c
+++ b/packet-netbios.c
@@ -5,7 +5,7 @@
*
* derived from the packet-nbns.c
*
- * $Id: packet-netbios.c,v 1.56 2003/03/04 06:47:10 guy Exp $
+ * $Id: packet-netbios.c,v 1.57 2003/04/20 11:36:14 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -131,6 +131,7 @@ static const fragment_items netbios_frag_items = {
&hf_netb_fragment_multiple_tails,
&hf_netb_fragment_too_long_fragment,
&hf_netb_fragment_error,
+ NULL,
"fragments"
};
diff --git a/packet-rpc.c b/packet-rpc.c
index d05cae3dcc..818d48db8f 100644
--- a/packet-rpc.c
+++ b/packet-rpc.c
@@ -2,7 +2,7 @@
* Routines for rpc dissection
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
*
- * $Id: packet-rpc.c,v 1.118 2003/04/20 00:27:29 guy Exp $
+ * $Id: packet-rpc.c,v 1.119 2003/04/20 11:36:14 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -229,6 +229,7 @@ static const fragment_items rpc_frag_items = {
&hf_rpc_fragment_multiple_tails,
&hf_rpc_fragment_too_long_fragment,
&hf_rpc_fragment_error,
+ NULL,
"fragments"
};
diff --git a/packet-smb-pipe.c b/packet-smb-pipe.c
index fec3aff5a9..7bdcb6ea67 100644
--- a/packet-smb-pipe.c
+++ b/packet-smb-pipe.c
@@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets
* significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and
* Guy Harris 2001
*
- * $Id: packet-smb-pipe.c,v 1.93 2003/04/15 09:23:42 guy Exp $
+ * $Id: packet-smb-pipe.c,v 1.94 2003/04/20 11:36:15 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -87,6 +87,7 @@ static const fragment_items smb_pipe_frag_items = {
&hf_pipe_fragment_multiple_tails,
&hf_pipe_fragment_too_long_fragment,
&hf_pipe_fragment_error,
+ NULL,
"fragments"
};
diff --git a/packet-smb.c b/packet-smb.c
index 3c2c7ae392..a77be70d77 100644
--- a/packet-smb.c
+++ b/packet-smb.c
@@ -3,7 +3,7 @@
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
* 2001 Rewrite by Ronnie Sahlberg and Guy Harris
*
- * $Id: packet-smb.c,v 1.331 2003/04/18 18:07:50 sharpe Exp $
+ * $Id: packet-smb.c,v 1.332 2003/04/20 11:36:15 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -691,6 +691,7 @@ static const fragment_items smb_frag_items = {
&hf_smb_segment_multiple_tails,
&hf_smb_segment_too_long_fragment,
&hf_smb_segment_error,
+ NULL,
"segments"
};
diff --git a/packet-tcp.c b/packet-tcp.c
index f19796a608..fdf445d9e8 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.189 2003/03/27 19:55:59 guy Exp $
+ * $Id: packet-tcp.c,v 1.190 2003/04/20 11:36:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -144,6 +144,7 @@ static const fragment_items tcp_segment_items = {
&hf_tcp_segment_multiple_tails,
&hf_tcp_segment_too_long_fragment,
&hf_tcp_segment_error,
+ NULL,
"Segments"
};
diff --git a/packet-tds.c b/packet-tds.c
index 12a0c16e18..9acfdb7163 100644
--- a/packet-tds.c
+++ b/packet-tds.c
@@ -3,7 +3,7 @@
* Copyright 2000-2002, Brian Bruns <camber@ais.org>
* Copyright 2002, Steve Langasek <vorlon@netexpress.net>
*
- * $Id: packet-tds.c,v 1.11 2003/03/04 06:47:10 guy Exp $
+ * $Id: packet-tds.c,v 1.12 2003/04/20 11:36:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -289,6 +289,7 @@ static const fragment_items tds_frag_items = {
&hf_tds_fragment_multiple_tails,
&hf_tds_fragment_too_long_fragment,
&hf_tds_fragment_error,
+ NULL,
"fragments"
};
diff --git a/packet-wtp.c b/packet-wtp.c
index 92de3b7355..a4c713c3fa 100644
--- a/packet-wtp.c
+++ b/packet-wtp.c
@@ -2,7 +2,7 @@
*
* Routines to dissect WTP component of WAP traffic.
*
- * $Id: packet-wtp.c,v 1.44 2003/04/09 18:15:53 guy Exp $
+ * $Id: packet-wtp.c,v 1.45 2003/04/20 11:36:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -213,6 +213,7 @@ static const fragment_items wtp_frag_items = {
&hf_wtp_fragment_multiple_tails,
&hf_wtp_fragment_too_long_fragment,
&hf_wtp_fragment_error,
+ NULL,
"fragments"
};
diff --git a/packet-x25.c b/packet-x25.c
index 25e15f3ebb..a10dba162d 100644
--- a/packet-x25.c
+++ b/packet-x25.c
@@ -2,7 +2,7 @@
* Routines for X.25 packet disassembly
* Olivier Abad <oabad@noos.fr>
*
- * $Id: packet-x25.c,v 1.83 2003/03/05 05:20:38 guy Exp $
+ * $Id: packet-x25.c,v 1.84 2003/04/20 11:36:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -203,6 +203,7 @@ static const fragment_items x25_frag_items = {
&hf_x25_segment_multiple_tails,
&hf_x25_segment_too_long_segment,
&hf_x25_segment_error,
+ NULL,
"segments"
};
diff --git a/reassemble.c b/reassemble.c
index a039ccb897..b15de7e4e3 100644
--- a/reassemble.c
+++ b/reassemble.c
@@ -1,7 +1,7 @@
/* reassemble.c
* Routines for {fragment,segment} reassembly
*
- * $Id: reassemble.c,v 1.36 2003/04/20 08:40:45 guy Exp $
+ * $Id: reassemble.c,v 1.37 2003/04/20 11:36:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -434,7 +434,8 @@ fragment_unhash(GHashTable *fragment_table, fragment_key *key)
/*
* This function adds fragment_data structure to a reassembled-packet
* hash table, using the frame numbers of each of the frames from
- * which it was reassembled as keys.
+ * which it was reassembled as keys, and sets the "reassembled_in"
+ * frame number.
*/
void
fragment_reassembled(fragment_data *fd_head, packet_info *pinfo,
@@ -442,10 +443,23 @@ fragment_reassembled(fragment_data *fd_head, packet_info *pinfo,
{
fragment_data *fd;
- for (fd = fd_head->next; fd != NULL; fd = fd->next){
- g_hash_table_insert(reassembled_table, (gpointer)fd->frame,
+ if (fd_head->next == NULL) {
+ /*
+ * This was not fragmented, so there's no fragment
+ * table; just hash it using the current frame number.
+ */
+ g_hash_table_insert(reassembled_table, (gpointer)pinfo->fd->num,
fd_head);
+ } else {
+ /*
+ * Hash it with the frame numbers for all the frames.
+ */
+ for (fd = fd_head->next; fd != NULL; fd = fd->next){
+ g_hash_table_insert(reassembled_table,
+ (gpointer)fd->frame, fd_head);
+ }
}
+ fd_head->reassembled_in = pinfo->fd->num;
}
/*
@@ -1353,43 +1367,60 @@ fragment_add_seq_next(tvbuff_t *tvb, int offset, packet_info *pinfo,
*/
tvbuff_t *
process_reassembled_data(tvbuff_t *tvb, packet_info *pinfo, char *name,
- fragment_data *fd_head, const fragment_items *frag_items,
- int hf_reassembled_in, gboolean *update_col_infop, proto_tree *tree)
+ fragment_data *fd_head, const fragment_items *fit,
+ gboolean *update_col_infop, proto_tree *tree)
{
tvbuff_t *next_tvb;
+ gboolean update_col_info;
- if (fd_head != NULL) {
- if (pinfo->fd->num == fd_head->reassembled_in) {
- /*
- * OK, we have the complete reassembled payload.
- * Allocate a new tvbuff, referring to the reassembled
- * payload.
- */
+ if (pinfo->fd->num == fd_head->reassembled_in) {
+ /*
+ * OK, we have the complete reassembled payload.
+ * Allocate a new tvbuff, referring to the reassembled
+ * payload.
+ */
+ if (fd_head->flags & FD_BLOCKSEQUENCE) {
next_tvb = tvb_new_real_data(fd_head->data,
- fd_head->datalen, fd_head->datalen);
+ fd_head->len, fd_head->len);
+ } else {
+ next_tvb = tvb_new_real_data(fd_head->data,
+ fd_head->datalen, fd_head->datalen);
+ }
- /*
- * Add the tvbuff to the list of tvbuffs to which
- * the tvbuff we were handed refers, so it'll get
- * cleaned up when that tvbuff is cleaned up.
- */
- tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+ /*
+ * Add the tvbuff to the list of tvbuffs to which
+ * the tvbuff we were handed refers, so it'll get
+ * cleaned up when that tvbuff is cleaned up.
+ */
+ tvb_set_child_real_data_tvbuff(tvb, next_tvb);
- /* Add the defragmented data to the data source list. */
- add_new_data_source(pinfo, next_tvb, name);
+ /* Add the defragmented data to the data source list. */
+ add_new_data_source(pinfo, next_tvb, name);
- /* show all fragments */
- *update_col_infop = !show_fragment_tree(fd_head,
- frag_items, tree, pinfo, next_tvb);
+ /* show all fragments */
+ if (fd_head->flags & FD_BLOCKSEQUENCE) {
+ update_col_info = !show_fragment_seq_tree(fd_head,
+ fit, tree, pinfo, next_tvb);
} else {
- /* We don't have the complete reassembled payload. */
- next_tvb = NULL;
- proto_tree_add_uint(tree, hf_reassembled_in, tvb, 0, 0,
- fd_head->reassembled_in);
+ update_col_info = !show_fragment_tree(fd_head,
+ fit, tree, pinfo, next_tvb);
}
+ if (update_col_infop != NULL)
+ *update_col_infop = update_col_info;
} else {
/* We don't have the complete reassembled payload. */
next_tvb = NULL;
+
+ /*
+ * If there's a field to use for the number of
+ * the frame in which the packet was reassembled,
+ * add it to the protocol tree.
+ */
+ if (fit->hf_reassembled_in != NULL) {
+ proto_tree_add_uint(tree,
+ *(fit->hf_reassembled_in), tvb,
+ 0, 0, fd_head->reassembled_in);
+ }
}
return next_tvb;
}
diff --git a/reassemble.h b/reassemble.h
index 269c4087d0..1e3781ceb5 100644
--- a/reassemble.h
+++ b/reassemble.h
@@ -1,7 +1,7 @@
/* reassemble.h
* Declarations of outines for {fragment,segment} reassembly
*
- * $Id: reassemble.h,v 1.17 2003/04/20 08:06:01 guy Exp $
+ * $Id: reassemble.h,v 1.18 2003/04/20 11:36:16 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -194,14 +194,16 @@ fragment_delete(packet_info *pinfo, guint32 id, GHashTable *fragment_table);
/*
* This function adds fragment_data structure to a reassembled-packet
- * hash table, using the frame data structure as the key.
+ * hash table, using the frame numbers of each of the frames from
+ * which it was reassembled as keys, and sets the "reassembled_in"
+ * frame number.
*/
extern void
fragment_reassembled(fragment_data *fd_head, packet_info *pinfo,
GHashTable *reassembled_table);
-/* hf_fragment and hf_fragment_error should be FT_FRAMENUM,
- the others should be FT_BOOLEAN
+/* hf_fragment, hf_fragment_error, and hf_reassembled_in should be
+ FT_FRAMENUM, the others should be FT_BOOLEAN
*/
typedef struct _fragment_items {
gint *ett_fragment;
@@ -214,14 +216,15 @@ typedef struct _fragment_items {
int *hf_fragment_multiple_tails;
int *hf_fragment_too_long_fragment;
int *hf_fragment_error;
+ int *hf_reassembled_in;
char *tag;
} fragment_items;
extern tvbuff_t *
process_reassembled_data(tvbuff_t *tvb, packet_info *pinfo, char *name,
- fragment_data *fd_head, const fragment_items *frag_items,
- int hf_reassembled_in, gboolean *update_col_infop, proto_tree *tree);
+ fragment_data *fd_head, const fragment_items *fit,
+ gboolean *update_col_infop, proto_tree *tree);
extern gboolean
show_fragment_tree(fragment_data *ipfd_head, const fragment_items *fit,