2012-01-04 22:13:01 +00:00
|
|
|
/* packet_list.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2012-01-04 22:13:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PACKET_LIST_H
|
|
|
|
#define PACKET_LIST_H
|
|
|
|
|
2013-07-08 16:54:18 +00:00
|
|
|
#include "byte_view_tab.h"
|
2017-07-25 14:47:16 +00:00
|
|
|
#include <ui/qt/models/packet_list_model.h>
|
2012-01-14 00:16:16 +00:00
|
|
|
#include "proto_tree.h"
|
2015-06-17 00:24:19 +00:00
|
|
|
#include "protocol_preferences_menu.h"
|
2017-07-25 14:47:16 +00:00
|
|
|
#include <ui/qt/models/related_packet_delegate.h>
|
2017-10-30 12:58:28 +00:00
|
|
|
#include <ui/qt/utils/field_information.h>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2012-12-07 01:46:20 +00:00
|
|
|
#include <QMenu>
|
2015-02-20 14:30:23 +00:00
|
|
|
#include <QTime>
|
|
|
|
#include <QTreeView>
|
2015-02-18 12:30:06 +00:00
|
|
|
#include <QPainter>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2019-06-13 17:31:29 +00:00
|
|
|
class PacketListHeader;
|
2015-06-11 22:53:51 +00:00
|
|
|
class OverlayScrollBar;
|
|
|
|
|
2015-01-01 19:41:03 +00:00
|
|
|
class QAction;
|
2015-02-20 14:30:23 +00:00
|
|
|
class QTimerEvent;
|
2015-01-01 19:41:03 +00:00
|
|
|
|
2019-11-19 21:42:53 +00:00
|
|
|
//
|
|
|
|
// XXX - Wireshark supports up to 2^32-1 packets in a capture, but
|
|
|
|
// row numbers in a QAbstractItemModel are ints, not unsigned ints,
|
|
|
|
// so we can only have 2^31-1 rows on ILP32, LP64, and LLP64 platforms.
|
|
|
|
// Does that mean we're permanently stuck at a maximum of 2^31-1 packets
|
|
|
|
// per capture?
|
|
|
|
//
|
2012-01-04 22:13:01 +00:00
|
|
|
class PacketList : public QTreeView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit PacketList(QWidget *parent = 0);
|
2019-11-12 15:39:19 +00:00
|
|
|
|
|
|
|
enum SummaryCopyType {
|
|
|
|
CopyAsText,
|
|
|
|
CopyAsCSV,
|
|
|
|
CopyAsYAML
|
|
|
|
};
|
|
|
|
Q_ENUM(SummaryCopyType)
|
|
|
|
|
2015-07-29 19:09:28 +00:00
|
|
|
QMenu *conversationMenu() { return &conv_menu_; }
|
|
|
|
QMenu *colorizeMenu() { return &colorize_menu_; }
|
2012-08-23 02:59:31 +00:00
|
|
|
void setProtoTree(ProtoTree *proto_tree);
|
2017-10-30 12:58:28 +00:00
|
|
|
|
2016-12-12 19:34:03 +00:00
|
|
|
/** Disable and clear the packet list.
|
|
|
|
*
|
|
|
|
* Disable packet list widget updates, clear the detail and byte views,
|
|
|
|
* and disconnect the model.
|
|
|
|
*/
|
2013-11-15 20:24:56 +00:00
|
|
|
void freeze();
|
2016-12-12 19:34:03 +00:00
|
|
|
/** Enable and restore the packet list.
|
|
|
|
*
|
|
|
|
* Enable packet list widget updates and reconnect the model.
|
|
|
|
*
|
|
|
|
* @param restore_selection If true, redissect the previously selected
|
|
|
|
* packet. This includes filling in the detail and byte views.
|
|
|
|
*/
|
|
|
|
void thaw(bool restore_selection = false);
|
2012-01-04 22:13:01 +00:00
|
|
|
void clear();
|
|
|
|
void writeRecent(FILE *rf);
|
2019-06-14 20:08:37 +00:00
|
|
|
bool contextMenuActive();
|
2019-06-28 10:37:47 +00:00
|
|
|
QString getFilterFromRowAndColumn(QModelIndex idx);
|
2015-06-11 22:53:51 +00:00
|
|
|
void resetColorized();
|
2021-04-29 11:23:21 +00:00
|
|
|
QString getPacketComment(guint c_number);
|
|
|
|
void addPacketComment(QString new_comment);
|
|
|
|
void setPacketComment(guint c_number, QString new_comment);
|
2012-12-23 04:37:58 +00:00
|
|
|
QString allPacketComments();
|
2021-08-11 12:57:45 +00:00
|
|
|
void deleteCommentsFromPackets();
|
2017-11-23 19:22:45 +00:00
|
|
|
void deleteAllPacketComments();
|
2015-11-27 16:01:05 +00:00
|
|
|
void setVerticalAutoScroll(bool enabled = true);
|
2015-02-20 14:30:23 +00:00
|
|
|
void setCaptureInProgress(bool in_progress = false) { capture_in_progress_ = in_progress; tail_at_end_ = in_progress; }
|
2015-09-16 17:46:45 +00:00
|
|
|
void captureFileReadFinished();
|
2015-12-12 22:28:26 +00:00
|
|
|
void resetColumns();
|
2017-03-01 16:03:17 +00:00
|
|
|
bool haveNextHistory(bool update_cur = false);
|
|
|
|
bool havePreviousHistory(bool update_cur = false);
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2019-07-03 21:01:34 +00:00
|
|
|
frame_data * getFDataForRow(int row) const;
|
|
|
|
|
2019-11-12 15:39:19 +00:00
|
|
|
bool multiSelectActive();
|
|
|
|
QList<int> selectedRows(bool useFrameNum = false);
|
|
|
|
|
|
|
|
QString createSummaryText(QModelIndex idx, SummaryCopyType type);
|
2019-11-20 10:28:34 +00:00
|
|
|
QString createHeaderSummaryText(SummaryCopyType type);
|
2019-11-12 15:39:19 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
protected:
|
2019-11-12 15:39:19 +00:00
|
|
|
|
2019-09-03 20:18:06 +00:00
|
|
|
void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected) override;
|
|
|
|
virtual void contextMenuEvent(QContextMenuEvent *event) override;
|
|
|
|
void timerEvent(QTimerEvent *event) override;
|
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
virtual void mousePressEvent (QMouseEvent *event) override;
|
|
|
|
virtual void mouseReleaseEvent (QMouseEvent *event) override;
|
|
|
|
virtual void mouseMoveEvent (QMouseEvent *event) override;
|
|
|
|
virtual void resizeEvent(QResizeEvent *event) override;
|
2019-11-12 15:39:19 +00:00
|
|
|
virtual void keyPressEvent(QKeyEvent *event) override;
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2015-02-20 14:30:23 +00:00
|
|
|
protected slots:
|
2019-09-03 20:18:06 +00:00
|
|
|
void rowsInserted(const QModelIndex &parent, int start, int end) override;
|
|
|
|
virtual void drawRow(QPainter *painter, const QStyleOptionViewItem &option,
|
|
|
|
const QModelIndex &index) const override;
|
2013-09-09 19:30:30 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
private:
|
2012-08-19 23:52:08 +00:00
|
|
|
PacketListModel *packet_list_model_;
|
2019-06-13 17:31:29 +00:00
|
|
|
PacketListHeader * packet_list_header_;
|
2012-08-19 23:52:08 +00:00
|
|
|
ProtoTree *proto_tree_;
|
2012-10-30 19:21:24 +00:00
|
|
|
capture_file *cap_file_;
|
2014-08-08 10:59:42 +00:00
|
|
|
QMenu conv_menu_;
|
2015-07-29 19:09:28 +00:00
|
|
|
QMenu colorize_menu_;
|
2020-07-02 08:20:14 +00:00
|
|
|
QMenu proto_prefs_menus_;
|
2012-12-07 20:08:00 +00:00
|
|
|
int ctx_column_;
|
2015-02-19 01:18:27 +00:00
|
|
|
QByteArray column_state_;
|
2015-06-11 22:53:51 +00:00
|
|
|
OverlayScrollBar *overlay_sb_;
|
|
|
|
int overlay_timer_id_;
|
|
|
|
bool create_near_overlay_;
|
|
|
|
bool create_far_overlay_;
|
|
|
|
QVector<QRgb> overlay_colors_;
|
2015-01-01 19:41:03 +00:00
|
|
|
|
2019-06-16 21:39:37 +00:00
|
|
|
QModelIndex mouse_pressed_at_;
|
|
|
|
|
2013-07-08 16:54:18 +00:00
|
|
|
RelatedPacketDelegate related_packet_delegate_;
|
2015-01-01 19:41:03 +00:00
|
|
|
QAction *show_hide_separator_;
|
|
|
|
QList<QAction *>show_hide_actions_;
|
2015-02-20 14:30:23 +00:00
|
|
|
bool capture_in_progress_;
|
|
|
|
int tail_timer_id_;
|
|
|
|
bool tail_at_end_;
|
|
|
|
bool rows_inserted_;
|
2015-11-23 13:06:59 +00:00
|
|
|
bool columns_changed_;
|
2015-11-24 19:42:50 +00:00
|
|
|
bool set_column_visibility_;
|
2020-10-27 22:10:00 +00:00
|
|
|
QModelIndexList frozen_rows_;
|
2017-03-01 16:03:17 +00:00
|
|
|
QVector<int> selection_history_;
|
|
|
|
int cur_history_;
|
|
|
|
bool in_history_;
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2012-12-17 23:03:21 +00:00
|
|
|
void setFrameReftime(gboolean set, frame_data *fdata);
|
2014-06-16 23:54:57 +00:00
|
|
|
void setColumnVisibility();
|
2019-09-03 20:18:06 +00:00
|
|
|
int sizeHintForColumn(int column) const override;
|
2015-11-26 18:15:44 +00:00
|
|
|
void setRecentColumnWidth(int column);
|
2015-10-15 21:14:10 +00:00
|
|
|
void drawCurrentPacket();
|
2015-12-12 22:28:26 +00:00
|
|
|
void applyRecentColumnWidths();
|
2017-06-19 20:26:45 +00:00
|
|
|
void scrollViewChanged(bool at_end);
|
2018-05-22 08:06:27 +00:00
|
|
|
void colorsChanged();
|
2019-11-20 10:28:34 +00:00
|
|
|
QString joinSummaryRow(QStringList col_parts, int row, SummaryCopyType type);
|
2015-05-13 22:46:51 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
signals:
|
2013-01-18 00:50:14 +00:00
|
|
|
void packetDissectionChanged();
|
2017-12-29 16:23:07 +00:00
|
|
|
void showColumnPreferences(QString pane_name);
|
2015-01-01 19:41:03 +00:00
|
|
|
void editColumn(int column);
|
2015-02-20 14:30:23 +00:00
|
|
|
void packetListScrolled(bool at_end);
|
2015-06-17 00:24:19 +00:00
|
|
|
void showProtocolPreferences(const QString module_name);
|
2015-06-17 15:41:41 +00:00
|
|
|
void editProtocolPreference(struct preference *pref, struct pref_module *module);
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2019-11-12 15:39:19 +00:00
|
|
|
void framesSelected(QList<int>);
|
2017-10-30 12:58:28 +00:00
|
|
|
void fieldSelected(FieldInformation *);
|
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
public slots:
|
2012-10-30 19:21:24 +00:00
|
|
|
void setCaptureFile(capture_file *cf);
|
2014-09-23 20:35:10 +00:00
|
|
|
void setMonospaceFont(const QFont &mono_font);
|
2012-08-14 04:12:56 +00:00
|
|
|
void goNextPacket();
|
|
|
|
void goPreviousPacket();
|
2018-02-02 14:59:04 +00:00
|
|
|
void goFirstPacket(bool user_selected = true);
|
2012-08-14 04:12:56 +00:00
|
|
|
void goLastPacket();
|
2019-05-29 14:06:38 +00:00
|
|
|
void goToPacket(int packet, int hf_id = -1);
|
2017-03-01 16:03:17 +00:00
|
|
|
void goNextHistoryPacket();
|
|
|
|
void goPreviousHistoryPacket();
|
2012-12-17 23:03:21 +00:00
|
|
|
void markFrame();
|
|
|
|
void markAllDisplayedFrames(bool set);
|
|
|
|
void ignoreFrame();
|
|
|
|
void ignoreAllDisplayedFrames(bool set);
|
|
|
|
void setTimeReference();
|
|
|
|
void unsetAllTimeReferences();
|
2015-10-15 21:14:10 +00:00
|
|
|
void applyTimeShift();
|
2015-11-12 19:50:01 +00:00
|
|
|
void recolorPackets();
|
2014-10-21 20:36:10 +00:00
|
|
|
void redrawVisiblePackets();
|
2017-06-19 20:46:49 +00:00
|
|
|
void redrawVisiblePacketsDontSelectCurrent();
|
2015-07-09 23:47:11 +00:00
|
|
|
void columnsChanged();
|
2015-08-17 19:39:41 +00:00
|
|
|
void fieldsChanged(capture_file *cf);
|
2015-10-27 22:04:44 +00:00
|
|
|
void preferencesChanged();
|
2013-07-08 16:54:18 +00:00
|
|
|
|
|
|
|
private slots:
|
2015-01-01 19:41:03 +00:00
|
|
|
void columnVisibilityTriggered();
|
2015-05-13 22:46:51 +00:00
|
|
|
void sectionResized(int col, int, int new_width);
|
2015-07-09 23:47:11 +00:00
|
|
|
void sectionMoved(int, int, int);
|
2015-09-23 00:18:33 +00:00
|
|
|
void updateRowHeights(const QModelIndex &ih_index);
|
2015-07-29 23:24:39 +00:00
|
|
|
void copySummary();
|
2015-02-20 14:30:23 +00:00
|
|
|
void vScrollBarActionTriggered(int);
|
2015-06-11 22:53:51 +00:00
|
|
|
void drawFarOverlay();
|
|
|
|
void drawNearOverlay();
|
2019-06-13 17:31:29 +00:00
|
|
|
void updatePackets(bool redraw);
|
2019-09-02 13:12:01 +00:00
|
|
|
void ctxDecodeAsDialog();
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PACKET_LIST_H
|