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
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
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>
|
2015-01-01 19:41:03 +00:00
|
|
|
#include "preferences_dialog.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
|
|
|
|
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
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
class PacketList : public QTreeView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-01-01 19:41:03 +00:00
|
|
|
enum ColumnActions {
|
|
|
|
caAlignLeft,
|
|
|
|
caAlignCenter,
|
|
|
|
caAlignRight,
|
|
|
|
caColumnPreferences,
|
|
|
|
caEditColumn,
|
|
|
|
caResolveNames,
|
|
|
|
caResizeToContents,
|
|
|
|
caDisplayedColumns,
|
|
|
|
caHideColumn,
|
|
|
|
caRemoveColumn
|
|
|
|
};
|
2012-01-04 22:13:01 +00:00
|
|
|
explicit PacketList(QWidget *parent = 0);
|
|
|
|
PacketListModel *packetListModel() const;
|
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);
|
2012-12-07 01:46:20 +00:00
|
|
|
bool contextMenuActive();
|
2015-09-04 10:22:30 +00:00
|
|
|
QString getFilterFromRowAndColumn();
|
2015-06-11 22:53:51 +00:00
|
|
|
void resetColorized();
|
2012-12-23 04:37:58 +00:00
|
|
|
QString packetComment();
|
|
|
|
void setPacketComment(QString new_comment);
|
|
|
|
QString allPacketComments();
|
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
|
|
|
|
|
|
|
protected:
|
2015-06-11 22:53:51 +00:00
|
|
|
void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
|
2012-12-07 01:46:20 +00:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
2015-02-20 14:30:23 +00:00
|
|
|
void timerEvent(QTimerEvent *event);
|
2015-06-11 22:53:51 +00:00
|
|
|
void paintEvent(QPaintEvent *event);
|
2016-02-10 00:38:43 +00:00
|
|
|
virtual void mousePressEvent (QMouseEvent *event);
|
|
|
|
virtual void resizeEvent(QResizeEvent *event);
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2015-02-20 14:30:23 +00:00
|
|
|
protected slots:
|
|
|
|
void rowsInserted(const QModelIndex &parent, int start, int end);
|
2016-01-23 12:18:30 +00:00
|
|
|
void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
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_;
|
|
|
|
ProtoTree *proto_tree_;
|
2012-10-30 19:21:24 +00:00
|
|
|
capture_file *cap_file_;
|
2012-12-07 01:46:20 +00:00
|
|
|
QMenu ctx_menu_;
|
2014-08-08 10:59:42 +00:00
|
|
|
QMenu conv_menu_;
|
2015-07-29 19:09:28 +00:00
|
|
|
QMenu colorize_menu_;
|
2015-06-17 00:24:19 +00:00
|
|
|
ProtocolPreferencesMenu proto_prefs_menu_;
|
2013-12-10 21:07:26 +00:00
|
|
|
QAction *decode_as_;
|
2015-07-29 23:24:39 +00:00
|
|
|
QList<QAction *> copy_actions_;
|
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
|
|
|
|
2013-07-08 16:54:18 +00:00
|
|
|
RelatedPacketDelegate related_packet_delegate_;
|
2015-01-01 19:41:03 +00:00
|
|
|
QMenu header_ctx_menu_;
|
|
|
|
QMap<ColumnActions, QAction*> header_actions_;
|
|
|
|
QList<ColumnActions> checkable_actions_;
|
|
|
|
int header_ctx_column_;
|
|
|
|
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_;
|
2016-12-12 19:34:03 +00:00
|
|
|
int frozen_row_;
|
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();
|
2015-03-27 23:49:39 +00:00
|
|
|
int sizeHintForColumn(int column) const;
|
2015-11-26 18:15:44 +00:00
|
|
|
void setRecentColumnWidth(int column);
|
2015-01-01 19:41:03 +00:00
|
|
|
void initHeaderContextMenu();
|
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);
|
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();
|
2015-06-17 00:24:19 +00:00
|
|
|
void showColumnPreferences(PreferencesDialog::PreferencesPane start_pane);
|
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
|
|
|
|
2017-11-12 10:29:13 +00:00
|
|
|
void frameSelected(int frameNum);
|
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();
|
|
|
|
void goFirstPacket();
|
|
|
|
void goLastPacket();
|
2012-08-19 23:52:08 +00:00
|
|
|
void goToPacket(int packet);
|
2015-03-11 22:22:20 +00:00
|
|
|
void goToPacket(int packet, int hf_id);
|
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 showHeaderMenu(QPoint pos);
|
|
|
|
void headerMenuTriggered();
|
|
|
|
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();
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PACKET_LIST_H
|
2012-09-04 08:18:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|