aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-03-08 15:17:58 -0800
committerRoland Knall <rknall@gmail.com>2018-03-15 12:19:23 +0000
commitbbe5fc102821cc3fa9e661078311f681501025ef (patch)
treeb61de63e63e01e4b55d59dd7ba4d46db6b484bb4 /epan
parent03af5553eb1aaf38b2053e8b83a2be60097306d8 (diff)
Epan+Qt: Invalidate cached column strings.
Add col_data_changed, which checks to see if we have updated column info. Add col_append_frame_number, which adds a frame number and sets col_data_changed. Call col_append_frame_number instead of col_append_fstr from some dissectors. Add PacketListRecord::invalidateAllRecords, which invalidates any cached record data. Add PacketListModel::invalidateAllColumnStrings which calls invalidateAllRecords and signals that our data has changed. Call invalidateAllColumnStrings when we have new name resolution or column information. Bug: 11414 Bug: 11468 Change-Id: I2671594a722f4f9436fe1df84d43489a148e0cee Reviewed-on: https://code.wireshark.org/review/26373 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/column-utils.c16
-rw-r--r--epan/column-utils.h17
-rw-r--r--epan/dissectors/packet-bthci_acl.c6
-rw-r--r--epan/dissectors/packet-btl2cap.c2
-rw-r--r--epan/dissectors/packet-icmp.c4
-rw-r--r--epan/dissectors/packet-icmpv6.c4
-rw-r--r--epan/dissectors/packet-ip.c2
-rw-r--r--epan/dissectors/packet-iso15765.c2
-rw-r--r--epan/dissectors/packet-ltp.c2
-rw-r--r--epan/dissectors/packet-reload.c2
10 files changed, 45 insertions, 12 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 42a9d8541f..9976804819 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -41,6 +41,9 @@
/* Used for locale decimal point */
static char *col_decimal_point;
+/* Used to indicate updated column information, e.g. a new request/response. */
+static gboolean col_data_changed_;
+
/* Allocate all the data structures for constructing column data, given
the number of columns. */
void
@@ -456,6 +459,15 @@ col_append_ports(column_info *cinfo, const gint col, port_type typ, guint16 src,
col_append_lstr(cinfo, col, buf_src, " " UTF8_RIGHTWARDS_ARROW " ", buf_dst, COL_ADD_LSTR_TERMINATOR);
}
+void
+col_append_frame_number(packet_info *pinfo, const gint col, const gchar *fmt_str, guint frame_num)
+{
+ col_append_fstr(pinfo->cinfo, col, fmt_str, frame_num);
+ if (!pinfo->fd->flags.visited) {
+ col_data_changed_ = TRUE;
+ }
+}
+
static void
col_do_append_fstr(column_info *cinfo, const int el, const char *separator, const char *format, va_list ap)
{
@@ -2282,6 +2294,10 @@ col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col
}
}
+gboolean col_data_changed(void) {
+ return col_data_changed_;
+ col_data_changed_ = FALSE;
+}
/*
* Editor modelines
*
diff --git a/epan/column-utils.h b/epan/column-utils.h
index 28755aaf0d..3463e00801 100644
--- a/epan/column-utils.h
+++ b/epan/column-utils.h
@@ -132,6 +132,12 @@ WS_DLL_PUBLIC void col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs
*/
WS_DLL_PUBLIC void col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
+/** Check to see if our column data has changed, e.g. we have new request/response info.
+ *
+ * Internal, don't use this in dissectors!
+ */
+WS_DLL_PUBLIC gboolean col_data_changed(void);
+
/* Utility routines used by packet*.c */
/** Are the columns writable?
@@ -271,6 +277,17 @@ WS_DLL_PUBLIC void col_append_str_uint(column_info *cinfo, const gint col, const
*/
WS_DLL_PUBLIC void col_append_ports(column_info *cinfo, const gint col, port_type typ, guint16 src, guint16 dst);
+/** Append a frame number and signal that we have updated
+ * column information.
+ *
+ * @param pinfo the current packet info
+ * @param col the column to use, e.g. COL_INFO
+ * @param fmt_str Format string, e.g. "reassembled in %u".
+ * @param src the source port value to append
+ * @param dst the destination port value to append
+ */
+WS_DLL_PUBLIC void col_append_frame_number(packet_info *pinfo, const gint col, const gchar *fmt_str, guint frame_num);
+
/* Append the given strings (terminated by COL_ADD_LSTR_TERMINATOR) to a column element,
*
* Same result as col_append_str() called for every string element.
diff --git a/epan/dissectors/packet-bthci_acl.c b/epan/dissectors/packet-bthci_acl.c
index 86db90e3f7..8b66e7d691 100644
--- a/epan/dissectors/packet-bthci_acl.c
+++ b/epan/dissectors/packet-bthci_acl.c
@@ -446,7 +446,7 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_reassembled_in, tvb, 0, 0, mfp->last_frame);
PROTO_ITEM_SET_GENERATED(item);
- col_append_fstr(pinfo->cinfo, COL_INFO, " [Reassembled in #%u]", mfp->last_frame);
+ col_append_frame_number(pinfo, COL_INFO, " [Reassembled in #%u]", mfp->last_frame);
}
}
if (pb_flag == 0x01) { /* continuation fragment */
@@ -466,11 +466,11 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_continuation_to, tvb, 0, 0, mfp->first_frame);
PROTO_ITEM_SET_GENERATED(item);
- col_append_fstr(pinfo->cinfo, COL_INFO, " [Continuation to #%u]", mfp->first_frame);
+ col_append_frame_number(pinfo, COL_INFO, " [Continuation to #%u]", mfp->first_frame);
if (mfp->last_frame && mfp->last_frame != pinfo->num) {
item = proto_tree_add_uint(bthci_acl_tree, hf_bthci_acl_reassembled_in, tvb, 0, 0, mfp->last_frame);
PROTO_ITEM_SET_GENERATED(item);
- col_append_fstr(pinfo->cinfo, COL_INFO, " [Reassembled in #%u]", mfp->last_frame);
+ col_append_frame_number(pinfo, COL_INFO, " [Reassembled in #%u]", mfp->last_frame);
}
}
if (mfp != NULL && mfp->last_frame == pinfo->num) {
diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c
index 088244f0f7..d34a7e7124 100644
--- a/epan/dissectors/packet-btl2cap.c
+++ b/epan/dissectors/packet-btl2cap.c
@@ -2221,7 +2221,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_item *item;
item = proto_tree_add_uint(btl2cap_tree, hf_btl2cap_reassembled_in, tvb, 0, 0, mfp->last_frame);
PROTO_ITEM_SET_GENERATED(item);
- col_append_fstr(pinfo->cinfo, COL_INFO, "[Reassembled in #%u] ", mfp->last_frame);
+ col_append_frame_number(pinfo, COL_INFO, "[Reassembled in #%u] ", mfp->last_frame);
}
} else {
if (length <= 4) {
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c
index 0bdb52d699..b8371a4b54 100644
--- a/epan/dissectors/packet-icmp.c
+++ b/epan/dissectors/packet-icmp.c
@@ -1056,7 +1056,7 @@ static icmp_transaction_t *transaction_start(packet_info * pinfo,
icmp_trans->resp_frame);
PROTO_ITEM_SET_GENERATED(it);
- col_append_fstr(pinfo->cinfo, COL_INFO, " (reply in %d)",
+ col_append_frame_number(pinfo, COL_INFO, " (reply in %u)",
icmp_trans->resp_frame);
}
@@ -1159,7 +1159,7 @@ static icmp_transaction_t *transaction_end(packet_info * pinfo,
"%.3f ms", resp_time);
PROTO_ITEM_SET_GENERATED(it);
- col_append_fstr(pinfo->cinfo, COL_INFO, " (request in %d)",
+ col_append_frame_number(pinfo, COL_INFO, " (request in %d)",
icmp_trans->rqst_frame);
return icmp_trans;
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c
index 56633a6ee3..133df68e20 100644
--- a/epan/dissectors/packet-icmpv6.c
+++ b/epan/dissectors/packet-icmpv6.c
@@ -1467,7 +1467,7 @@ static icmp_transaction_t *transaction_start(packet_info *pinfo, proto_tree *tre
icmpv6_trans->resp_frame);
PROTO_ITEM_SET_GENERATED(it);
}
- col_append_fstr(pinfo->cinfo, COL_INFO, " (reply in %d)", icmpv6_trans->resp_frame);
+ col_append_frame_number(pinfo, COL_INFO, " (reply in %d)", icmpv6_trans->resp_frame);
}
return icmpv6_trans;
@@ -1560,7 +1560,7 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree,
PROTO_ITEM_SET_GENERATED(it);
}
- col_append_fstr(pinfo->cinfo, COL_INFO, " (request in %d)",
+ col_append_frame_number(pinfo, COL_INFO, " (request in %d)",
icmpv6_trans->rqst_frame);
return icmpv6_trans;
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 479ac64488..d2a54b7c14 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -2266,7 +2266,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
ipprotostr(iph->ip_proto), iph->ip_proto,
(iph->ip_off & IP_OFFSET) * 8, iph->ip_id);
if ( ipfd_head && ipfd_head->reassembled_in != pinfo->num ) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " [Reassembled in #%u]",
+ col_append_frame_number(pinfo, COL_INFO, " [Reassembled in #%u]",
ipfd_head->reassembled_in);
}
diff --git a/epan/dissectors/packet-iso15765.c b/epan/dissectors/packet-iso15765.c
index 13c3681c43..9ebbbf1cf9 100644
--- a/epan/dissectors/packet-iso15765.c
+++ b/epan/dissectors/packet-iso15765.c
@@ -325,7 +325,7 @@ dissect_iso15765(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
&iso15765_frag_items, NULL, iso15765_tree);
if (frag_msg && frag_msg->reassembled_in != pinfo->num) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " [Reassembled in #%u]",
+ col_append_frame_number(pinfo, COL_INFO, " [Reassembled in #%u]",
frag_msg->reassembled_in);
}
diff --git a/epan/dissectors/packet-ltp.c b/epan/dissectors/packet-ltp.c
index 79a1a144e9..c7da441276 100644
--- a/epan/dissectors/packet-ltp.c
+++ b/epan/dissectors/packet-ltp.c
@@ -412,7 +412,7 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
{
if(frag_msg && more_frags)
{
- col_append_fstr(pinfo->cinfo, COL_INFO, "[Reassembled in %d] ",frag_msg->reassembled_in);
+ col_append_frame_number(pinfo, COL_INFO, "[Reassembled in %d] ",frag_msg->reassembled_in);
}
else
{
diff --git a/epan/dissectors/packet-reload.c b/epan/dissectors/packet-reload.c
index 3f36c9ecdf..30641a23c3 100644
--- a/epan/dissectors/packet-reload.c
+++ b/epan/dissectors/packet-reload.c
@@ -4115,7 +4115,7 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
col_add_fstr(pinfo->cinfo, COL_INFO, "Fragmented RELOAD protocol (trans id=%x%x off=%u",
transaction_id[0],transaction_id[1], fragment);
if (reload_fd_head && reload_fd_head->reassembled_in != pinfo->num) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " [Reassembled in #%u]",
+ col_append_frame_number(pinfo, COL_INFO, " [Reassembled in #%u]",
reload_fd_head->reassembled_in);
}
save_fragmented = pinfo->fragmented;