aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorSake Blok <sake@euronet.nl>2011-07-15 23:40:16 +0000
committerSake Blok <sake@euronet.nl>2011-07-15 23:40:16 +0000
commitd00167886f226b71b7176b1ac0c438cd242a39bb (patch)
treef54d7a7a84dda1cff08bf5746fb822d25bd8b637 /epan/dissectors
parent9659cc77e8f60e02f9c16e8339493b5059911e59 (diff)
Stop using the conversation index for tcp stream values as the gaps in the numbering is causing to many questions. Also, numbering could be different for the same file when viewed on different Wireshark versions, which could lead to confusion too.
(see also: http://ask.wireshark.org/questions/5056/how-does-wireshark-calculate-the-tcp-stream-index) svn path=/trunk/; revision=38056
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-tcp.c19
-rw-r--r--epan/dissectors/packet-tcp.h6
2 files changed, 17 insertions, 8 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index d39a7f6cb3..88ebee4e8d 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -324,6 +324,7 @@ static const fragment_items tcp_segment_items = {
static dissector_table_t subdissector_table;
static heur_dissector_list_t heur_subdissector_list;
static dissector_handle_t data_handle;
+static guint32 tcp_stream_index;
/* TCP structs and definitions */
@@ -396,7 +397,7 @@ init_tcp_conversation_data(packet_info *pinfo)
tcpd->ts_prev.nsecs=pinfo->fd->abs_ts.nsecs;
tcpd->flow1.valid_bif = 1;
tcpd->flow2.valid_bif = 1;
-
+ tcpd->stream = tcp_stream_index++;
return tcpd;
}
@@ -1573,11 +1574,6 @@ print_tcp_fragment_tree(fragment_data *ipfd_head, proto_tree *tree, proto_tree *
/* Desegmentation of TCP streams */
/* table to hold defragmented TCP streams */
static GHashTable *tcp_fragment_table = NULL;
-static void
-tcp_fragment_init(void)
-{
- fragment_table_init(&tcp_fragment_table);
-}
/* functions to trace tcp segments */
/* Enable desegmenting of TCP streams */
@@ -3737,7 +3733,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tcpd->ta->flags|=TCP_A_REUSED_PORTS;
}
- item = proto_tree_add_uint(tcp_tree, hf_tcp_stream, tvb, offset, 0, conv->index);
+ item = proto_tree_add_uint(tcp_tree, hf_tcp_stream, tvb, offset, 0, tcpd->stream);
PROTO_ITEM_SET_GENERATED(item);
@@ -4334,6 +4330,13 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
+static void
+tcp_init(void)
+{
+ tcp_stream_index = 0;
+ fragment_table_init(&tcp_fragment_table);
+}
+
void
proto_register_tcp(void)
{
@@ -5043,7 +5046,7 @@ proto_register_tcp(void)
"Try to decode a packet using an heuristic sub-dissector before using a sub-dissector registered to a specific port",
&try_heuristic_first);
- register_init_routine(tcp_fragment_init);
+ register_init_routine(tcp_init);
}
void
diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h
index 3716c41bc3..54e76df295 100644
--- a/epan/dissectors/packet-tcp.h
+++ b/epan/dissectors/packet-tcp.h
@@ -227,6 +227,12 @@ struct tcp_analysis {
* to previous frame in this conversation
*/
nstime_t ts_prev;
+
+ /* Keep track of tcp stream numbers instead of using the conversation
+ * index (as how it was done before). This prevents gaps in the
+ * stream index numbering
+ */
+ guint32 stream;
};
/* Structure that keeps per packet data. First used to be able