aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2017-12-03 13:49:36 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2017-12-09 13:58:19 +0000
commitd96ef7ed05a9f3219742699988faae3889334c85 (patch)
tree8c5117e6c7e78276c91a9bfe12d797c986a768fd
parentf8203771ec1580013e8de21e6286a33c330f08e3 (diff)
Allow switching direction in LTE RLC graph
Change-Id: I1681089aebe7f00b2b84ece00c53a3bf8769d50b Reviewed-on: https://code.wireshark.org/review/24682 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
-rw-r--r--ui/qt/lte_rlc_graph_dialog.cpp44
-rw-r--r--ui/qt/lte_rlc_graph_dialog.h9
-rw-r--r--ui/qt/lte_rlc_graph_dialog.ui21
-rw-r--r--ui/qt/lte_rlc_statistics_dialog.cpp2
-rw-r--r--ui/tap-rlc-graph.c15
-rw-r--r--ui/tap-rlc-graph.h8
6 files changed, 74 insertions, 25 deletions
diff --git a/ui/qt/lte_rlc_graph_dialog.cpp b/ui/qt/lte_rlc_graph_dialog.cpp
index 922a9bc..ed86aab 100644
--- a/ui/qt/lte_rlc_graph_dialog.cpp
+++ b/ui/qt/lte_rlc_graph_dialog.cpp
@@ -102,6 +102,8 @@ LteRlcGraphDialog::LteRlcGraphDialog(QWidget &parent, CaptureFile &cf, bool chan
ctx_menu_->addAction(ui->actionDragZoom);
// ctx_menu_->addAction(ui->actionToggleTimeOrigin);
ctx_menu_->addAction(ui->actionCrosshairs);
+ ctx_menu_->addSeparator();
+ ctx_menu_->addAction(ui->actionSwitchDirection);
// Zero out this struct.
memset(&graph_, 0, sizeof(graph_));
@@ -121,7 +123,8 @@ LteRlcGraphDialog::~LteRlcGraphDialog()
// Set the channel information that this graph should show.
void LteRlcGraphDialog::setChannelInfo(guint16 ueid, guint8 rlcMode,
- guint16 channelType, guint16 channelId, guint8 direction)
+ guint16 channelType, guint16 channelId, guint8 direction,
+ bool maybe_empty)
{
graph_.ueid = ueid;
graph_.rlcMode = rlcMode;
@@ -130,16 +133,16 @@ void LteRlcGraphDialog::setChannelInfo(guint16 ueid, guint8 rlcMode,
graph_.channelSet = TRUE;
graph_.direction = direction;
- completeGraph();
+ completeGraph(maybe_empty);
}
// Once channel details are known, complete the graph with details that depend upon the channel.
-void LteRlcGraphDialog::completeGraph()
+void LteRlcGraphDialog::completeGraph(bool may_be_empty)
{
QCustomPlot *rp = ui->rlcPlot;
// If no channel chosen already, try to use currently selected frame.
- findChannel();
+ findChannel(may_be_empty);
// Set window title here.
if (graph_.channelSet) {
@@ -194,7 +197,7 @@ bool LteRlcGraphDialog::compareHeaders(rlc_segment *seg)
}
// Look for channel to plot based upon currently selected frame.
-void LteRlcGraphDialog::findChannel()
+void LteRlcGraphDialog::findChannel(bool may_fail)
{
// Temporarily disconnect mouse move signals.
QCustomPlot *rp = ui->rlcPlot;
@@ -205,7 +208,9 @@ void LteRlcGraphDialog::findChannel()
// Rescan for channel data.
rlc_graph_segment_list_free(&graph_);
if (!rlc_graph_segment_list_get(cap_file_.capFile(), &graph_, graph_.channelSet,
- &err_string)) {
+ &err_string) &&
+ !may_fail) {
+
// Pop up an error box to report error.
simple_error_message_box("%s", err_string);
g_free(err_string);
@@ -392,6 +397,11 @@ void LteRlcGraphDialog::keyPressEvent(QKeyEvent *event)
case Qt::Key_Z:
on_actionDragZoom_triggered();
break;
+
+ case Qt::Key_D:
+ on_actionSwitchDirection_triggered();
+ break;
+
}
WiresharkDialog::keyPressEvent(event);
@@ -495,6 +505,7 @@ void LteRlcGraphDialog::panAxes(int x_pixels, int y_pixels)
}
}
+// Given a selected rect in pixels, work out what this should be in graph units.
// Don't accidentally zoom into a 1x1 rect if you happen to click on the graph
// in zoom mode.
const int min_zoom_pixels_ = 20;
@@ -614,6 +625,7 @@ void LteRlcGraphDialog::mouseMoved(QMouseEvent *event)
} else {
if (event && rubber_band_ && rubber_band_->isVisible()) {
+ // Work out zoom based upon selected region (in pixels).
rubber_band_->setGeometry(QRect(rb_origin_, event->pos()).normalized());
QRectF zoom_ranges = getZoomRanges(QRect(rb_origin_, event->pos()));
if (zoom_ranges.width() > 0.0 && zoom_ranges.height() > 0.0) {
@@ -640,6 +652,7 @@ void LteRlcGraphDialog::mouseReleased(QMouseEvent *event)
if (rubber_band_) {
rubber_band_->hide();
if (!mouse_drags_) {
+ resetAxes();
QRectF zoom_ranges = getZoomRanges(QRect(rb_origin_, event->pos()));
if (zoom_ranges.width() > 0.0 && zoom_ranges.height() > 0.0) {
rp->xAxis->setRangeLower(zoom_ranges.x());
@@ -779,6 +792,20 @@ void LteRlcGraphDialog::on_actionMoveDown1_triggered()
panAxes(0, -1);
}
+void LteRlcGraphDialog::on_actionSwitchDirection_triggered()
+{
+ // Channel settings exactly the same, except change direction.
+ // N.B. do not fail and close if there are no packets in opposite direction.
+ setChannelInfo(graph_.ueid,
+ graph_.rlcMode,
+ graph_.channelType,
+ graph_.channelId,
+ !graph_.direction,
+ true /* maybe_empty */);
+}
+
+
+
// Switch between zoom/drag.
void LteRlcGraphDialog::on_actionDragZoom_triggered()
{
@@ -808,6 +835,11 @@ void LteRlcGraphDialog::on_resetButton_clicked()
resetAxes();
}
+void LteRlcGraphDialog::on_otherDirectionButton_clicked()
+{
+ on_actionSwitchDirection_triggered();
+}
+
// No need to register tap listeners here. This is done
// in calls to the common functions in ui/tap-rlc-graph.c
diff --git a/ui/qt/lte_rlc_graph_dialog.h b/ui/qt/lte_rlc_graph_dialog.h
index 51a004a..2929312 100644
--- a/ui/qt/lte_rlc_graph_dialog.h
+++ b/ui/qt/lte_rlc_graph_dialog.h
@@ -46,7 +46,8 @@ public:
~LteRlcGraphDialog();
void setChannelInfo(guint16 ueid, guint8 rlcMode,
- guint16 channelType, guint16 channelId, guint8 direction);
+ guint16 channelType, guint16 channelId, guint8 direction,
+ bool maybe_empty=false);
signals:
void goToPacket(int packet_num);
@@ -76,11 +77,11 @@ private:
QCPItemTracer *tracer_;
guint32 packet_num_;
- void completeGraph();
+ void completeGraph(bool may_be_empty=false);
bool compareHeaders(rlc_segment *seg);
- void findChannel();
+ void findChannel(bool may_fail=false);
void fillGraph();
void zoomAxes(bool in);
@@ -101,6 +102,7 @@ private slots:
void on_dragRadioButton_toggled(bool checked);
void on_zoomRadioButton_toggled(bool checked);
void on_resetButton_clicked();
+ void on_otherDirectionButton_clicked();
void on_actionReset_triggered();
void on_actionZoomIn_triggered();
@@ -118,6 +120,7 @@ private slots:
void on_actionMoveDown100_triggered();
void on_actionGoToPacket_triggered();
void on_actionCrosshairs_triggered();
+ void on_actionSwitchDirection_triggered();
};
#endif // LTE_RLC_GRAPH_DIALOG_H
diff --git a/ui/qt/lte_rlc_graph_dialog.ui b/ui/qt/lte_rlc_graph_dialog.ui
index eba63ae..1d6927f 100644
--- a/ui/qt/lte_rlc_graph_dialog.ui
+++ b/ui/qt/lte_rlc_graph_dialog.ui
@@ -113,6 +113,16 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QPushButton" name="otherDirectionButton">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Switch the direction of the connection (view the opposite flow).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Switch Direction</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
@@ -346,6 +356,17 @@
<string>Shift+X</string>
</property>
</action>
+ <action name="actionSwitchDirection">
+ <property name="text">
+ <string>Switch Direction</string>
+ </property>
+ <property name="toolTip">
+ <string>Switch direction (swap between UL and DL)</string>
+ </property>
+ <property name="shortcut">
+ <string>D</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
diff --git a/ui/qt/lte_rlc_statistics_dialog.cpp b/ui/qt/lte_rlc_statistics_dialog.cpp
index f289eaf..f66a51e 100644
--- a/ui/qt/lte_rlc_statistics_dialog.cpp
+++ b/ui/qt/lte_rlc_statistics_dialog.cpp
@@ -32,7 +32,6 @@
#include <QTreeWidgetItem>
#include <QPushButton>
-#include "lte_rlc_graph_dialog.h"
#include <ui/qt/utils/qt_ui_utils.h>
#include "wireshark_application.h"
@@ -936,6 +935,7 @@ void LteRlcStatisticsDialog::launchDLGraphButtonClicked()
}
}
+
// Store filter from signal.
void LteRlcStatisticsDialog::filterUpdated(QString filter)
{
diff --git a/ui/tap-rlc-graph.c b/ui/tap-rlc-graph.c
index 817b4c0..0184191 100644
--- a/ui/tap-rlc-graph.c
+++ b/ui/tap-rlc-graph.c
@@ -1,8 +1,7 @@
-/* tap-rlc-stream.c
- * LTE RLC stream statistics
+/* tap-rlc-graph.c
+ * LTE RLC channel graph info
*
* Originally from tcp_graph.c by Pavel Mores <pvl@uh.cz>
- * Win32 port: rwh@unifiedtech.com
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
@@ -172,8 +171,6 @@ rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf,
hdrs->num = fdata->num;
hdrs->rel_secs = (guint32) rel_ts.secs;
hdrs->rel_usecs = rel_ts.nsecs/1000;
- hdrs->abs_secs = (guint32) fdata->abs_ts.secs;
- hdrs->abs_usecs = fdata->abs_ts.nsecs/1000;
hdrs->ueid = th.rlchdrs[0]->ueid;
hdrs->channelType = th.rlchdrs[0]->channelType;
@@ -203,8 +200,6 @@ int rlc_lte_tap_for_graph_data(void *pct, packet_info *pinfo, epan_dissect_t *ed
segment->num = pinfo->num;
segment->rel_secs = (guint32) pinfo->rel_ts.secs;
segment->rel_usecs = pinfo->rel_ts.nsecs/1000;
- segment->abs_secs = (guint32) pinfo->abs_ts.secs;
- segment->abs_usecs = pinfo->abs_ts.nsecs/1000;
segment->ueid = rlchdr->ueid;
segment->channelType = rlchdr->channelType;
@@ -254,7 +249,7 @@ gboolean rlc_graph_segment_list_get(capture_file *cf, struct rlc_graph *g, gbool
struct rlc_segment current;
GString *error_string;
- g_log(NULL, G_LOG_LEVEL_DEBUG, "graph_segment_list_get()");
+ g_log(NULL, G_LOG_LEVEL_DEBUG, "rlc_graph_segment_list_get()");
if (!cf || !g) {
/* Really shouldn't happen */
@@ -276,8 +271,8 @@ gboolean rlc_graph_segment_list_get(capture_file *cf, struct rlc_graph *g, gbool
}
- /* rescan all the packets and pick up all interesting RLC headers.
- * we only filter for rlc-lte here for speed and do the actual compare
+ /* Rescan all the packets and pick up all interesting RLC headers.
+ * We only filter for rlc-lte here for speed and do the actual compare
* in the tap listener
*/
diff --git a/ui/tap-rlc-graph.h b/ui/tap-rlc-graph.h
index 679b897..fdd8660 100644
--- a/ui/tap-rlc-graph.h
+++ b/ui/tap-rlc-graph.h
@@ -35,11 +35,9 @@ extern "C" {
struct rlc_segment {
struct rlc_segment *next;
- guint32 num; /* framenum */
- guint32 rel_secs;
- guint32 rel_usecs;
- guint32 abs_secs;
- guint32 abs_usecs;
+ guint32 num; /* framenum */
+ guint32 rel_secs;
+ guint32 rel_usecs;
gboolean isControlPDU;
guint16 SN;