summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-03-06 16:10:37 -0800
committerAnders Broman <a.broman58@gmail.com>2015-03-12 16:47:17 +0000
commit8bae919a5d627d9644657bfd4389d5e857974ea3 (patch)
treeefeb36faef22f35b07a61cf93adc7b42b9721851
parentdd8a79974ceecf075d6f91d1860ba6d5008ccb80 (diff)
downloadwireshark-8bae919a5d627d9644657bfd4389d5e857974ea3.tar.gz
One check mark for ACKs, two check marks for dup ACKs.
Add FT_FRAMENUM_ACK and FT_FRAMENUM_DUP_ACK and set them for tcp.analysis.acks_frame and tcp.analysis.duplicate_ack_frame. Draw a single or double check mark in the packet list accordingly. These are probably specific to TCP, but as it happens there are a lot of TCP packets. Change-Id: I35416506419159a79ad8cc2e35f8a14485edfb7e Reviewed-on: https://code.wireshark.org/review/7568 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-tcp.c4
-rw-r--r--epan/ftypes/ftypes.h4
-rw-r--r--ui/qt/related_packet_delegate.cpp55
-rw-r--r--ui/qt/related_packet_delegate.h3
4 files changed, 53 insertions, 13 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 37e8148e25..a478010e83 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -5216,7 +5216,7 @@ proto_register_tcp(void)
"This is duplicate ACK number #", HFILL }},
{ &hf_tcp_analysis_duplicate_ack_frame,
- { "Duplicate to the ACK in frame", "tcp.analysis.duplicate_ack_frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
+ { "Duplicate to the ACK in frame", "tcp.analysis.duplicate_ack_frame", FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_DUP_ACK), 0x0,
"This is a duplicate to the ACK in frame #", HFILL }},
{ &hf_tcp_continuation_to,
@@ -5228,7 +5228,7 @@ proto_register_tcp(void)
NULL, HFILL}},
{ &hf_tcp_analysis_acks_frame,
- { "This is an ACK to the segment in frame", "tcp.analysis.acks_frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
+ { "This is an ACK to the segment in frame", "tcp.analysis.acks_frame", FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_ACK), 0x0,
"Which previous segment is this an ACK for", HFILL}},
{ &hf_tcp_analysis_bytes_in_flight,
diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h
index 226084449a..c215ca2ea4 100644
--- a/epan/ftypes/ftypes.h
+++ b/epan/ftypes/ftypes.h
@@ -100,7 +100,9 @@ typedef enum ftenum ftenum_t;
enum ft_framenum_type {
FT_FRAMENUM_NONE,
FT_FRAMENUM_REQUEST,
- FT_FRAMENUM_RESPONSE
+ FT_FRAMENUM_RESPONSE,
+ FT_FRAMENUM_ACK,
+ FT_FRAMENUM_DUP_ACK
};
typedef enum ft_framenum_type ft_framenum_type_t;
diff --git a/ui/qt/related_packet_delegate.cpp b/ui/qt/related_packet_delegate.cpp
index 83c93ee491..f9e154e2bd 100644
--- a/ui/qt/related_packet_delegate.cpp
+++ b/ui/qt/related_packet_delegate.cpp
@@ -28,9 +28,13 @@
#include <QPainter>
// To do:
-// - Add other frame types and symbols (ACKs, etc).
-// - Add tooltips. It looks like this needs to be done in
-// PacketListModel::data.
+// - Add other frame types and symbols. If `tshark -G fields | grep FT_FRAMENUM`
+// is any indication, we should add "reassembly" and "reassembly error"
+// fields.
+// - Don't add *too* many frame types and symbols. The goal is context, not
+// clutter.
+// - Add tooltips. It looks like this needs to be done in ::helpEvent
+// or PacketListModel::data.
// - Add "Go -> Next Related" and "Go -> Previous Related"?
// - Apply as filter?
@@ -49,6 +53,7 @@ void RelatedPacketDelegate::paint(QPainter *painter, const QStyleOptionViewItem
QStyledItemDelegate::initStyleOption(&optv4, index);
int em_w = optv4.fontMetrics.height();
int en_w = (em_w + 1) / 2;
+ int line_w = (optv4.fontMetrics.lineWidth());
optv4.features |= QStyleOptionViewItemV4::HasDecoration;
optv4.decorationSize.setHeight(1);
@@ -88,7 +93,7 @@ void RelatedPacketDelegate::paint(QPainter *painter, const QStyleOptionViewItem
fg = ColorUtils::alphaBlend(fg, optv4.palette.color(cg, QPalette::Base), 0.5);
QPen line_pen(fg);
- line_pen.setWidth(optv4.fontMetrics.lineWidth());
+ line_pen.setWidth(line_w);
line_pen.setJoinStyle(Qt::RoundJoin);
painter->setPen(line_pen);
@@ -111,8 +116,12 @@ void RelatedPacketDelegate::paint(QPainter *painter, const QStyleOptionViewItem
// for other packets in the start-end range.
if (setup_frame > 0 && last_frame > 0 && setup_frame != last_frame) {
if (fd->num == setup_frame) {
- painter->drawLine(0, height / 2, 0, height);
- painter->drawLine(1, height / 2, en_w - 1, height / 2);
+ QPoint start_line[] = {
+ QPoint(en_w - 1, height / 2),
+ QPoint(0, height / 2),
+ QPoint(0, height)
+ };
+ painter->drawPolyline(start_line, 3);
} else if (fd->num > setup_frame && fd->num < last_frame) {
painter->save();
if (conv_ != record->conversation()) {
@@ -123,8 +132,12 @@ void RelatedPacketDelegate::paint(QPainter *painter, const QStyleOptionViewItem
painter->drawLine(0, 0, 0, height);
painter->restore();
} else if (fd->num == last_frame) {
- painter->drawLine(0, 0, 0, height / 2);
- painter->drawLine(1, height / 2, en_w, height / 2);
+ QPoint end_line[] = {
+ QPoint(en_w - 1, height / 2),
+ QPoint(0, height / 2),
+ QPoint(0, 0)
+ };
+ painter->drawPolyline(end_line, 3);
}
}
@@ -151,6 +164,20 @@ void RelatedPacketDelegate::paint(QPainter *painter, const QStyleOptionViewItem
drawArrow(painter, tail, head, hh / 2);
break;
}
+ case FT_FRAMENUM_ACK:
+ {
+ QRect bbox (2 - en_w, height / 3, em_w - 2, height / 2);
+ drawCheckMark(painter, bbox);
+ break;
+ }
+ case FT_FRAMENUM_DUP_ACK:
+ {
+ QRect bbox (2 - en_w, (height / 3) - (line_w * 2), em_w - 2, height / 2);
+ drawCheckMark(painter, bbox);
+ bbox.moveTop(bbox.top() + (line_w * 3));
+ drawCheckMark(painter, bbox);
+ break;
+ }
case FT_FRAMENUM_NONE:
default:
painter->drawEllipse(QPointF(0.0, optv4.rect.height() / 2), 2, 2);
@@ -166,7 +193,7 @@ QSize RelatedPacketDelegate::sizeHint(const QStyleOptionViewItem &option,
QStyledItemDelegate::sizeHint(option, index).height());
}
-void RelatedPacketDelegate::drawArrow(QPainter *painter, QPoint tail, QPoint head, int head_size) const
+void RelatedPacketDelegate::drawArrow(QPainter *painter, const QPoint tail, const QPoint head, int head_size) const
{
int x_mul = head.x() > tail.x() ? -1 : 1;
QPoint head_points[] = {
@@ -179,6 +206,16 @@ void RelatedPacketDelegate::drawArrow(QPainter *painter, QPoint tail, QPoint hea
painter->drawPolygon(head_points, 3);
}
+void RelatedPacketDelegate::drawCheckMark(QPainter *painter, const QRect bbox) const
+{
+ QPoint cm_points[] = {
+ QPoint(bbox.x(), bbox.y() + (bbox.height() / 2)),
+ QPoint(bbox.x() + (bbox.width() / 4), bbox.y() + (bbox.height() * 3 / 4)),
+ bbox.topRight()
+ };
+ painter->drawPolyline(cm_points, 3);
+}
+
void RelatedPacketDelegate::clear()
{
related_frames_.clear();
diff --git a/ui/qt/related_packet_delegate.h b/ui/qt/related_packet_delegate.h
index c33bbf2c72..152448dfe6 100644
--- a/ui/qt/related_packet_delegate.h
+++ b/ui/qt/related_packet_delegate.h
@@ -55,7 +55,8 @@ private:
struct conversation *conv_;
guint32 current_frame_;
- void drawArrow(QPainter *painter, QPoint tail, QPoint head, int head_size) const;
+ void drawArrow(QPainter *painter, const QPoint tail, const QPoint head, int head_size) const;
+ void drawCheckMark(QPainter *painter, const QRect bbox) const;
signals: