2012-01-04 22:13:01 +00:00
|
|
|
/* packet_list_model.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
#ifndef PACKET_LIST_MODEL_H
|
|
|
|
#define PACKET_LIST_MODEL_H
|
|
|
|
|
2015-01-03 20:52:54 +00:00
|
|
|
#include <config.h>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
#include "packet_list_record.h"
|
|
|
|
|
|
|
|
#include "cfile.h"
|
|
|
|
|
2015-09-20 20:17:07 +00:00
|
|
|
class QElapsedTimer;
|
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
class PacketListModel : public QAbstractItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2012-10-30 19:21:24 +00:00
|
|
|
explicit PacketListModel(QObject *parent = 0, capture_file *cf = NULL);
|
2015-09-20 20:17:07 +00:00
|
|
|
~PacketListModel();
|
2012-10-30 19:21:24 +00:00
|
|
|
void setCaptureFile(capture_file *cf);
|
2012-01-04 22:13:01 +00:00
|
|
|
QModelIndex index(int row, int column,
|
2015-02-26 21:02:06 +00:00
|
|
|
const QModelIndex & = QModelIndex()) const;
|
|
|
|
QModelIndex parent(const QModelIndex &) const;
|
2013-09-07 00:33:41 +00:00
|
|
|
int packetNumberToRow(int packet_num) const;
|
2012-08-23 17:29:05 +00:00
|
|
|
guint recreateVisibleRows();
|
2012-01-04 22:13:01 +00:00
|
|
|
void clear();
|
|
|
|
|
2012-08-23 17:29:05 +00:00
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
2015-02-26 21:02:06 +00:00
|
|
|
int columnCount(const QModelIndex & = QModelIndex()) const;
|
2015-07-16 19:07:49 +00:00
|
|
|
QVariant data(const QModelIndex &d_index, int role) const;
|
2019-11-14 22:04:59 +00:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
2012-08-23 17:29:05 +00:00
|
|
|
|
|
|
|
gint appendPacket(frame_data *fdata);
|
2019-11-19 12:11:36 +00:00
|
|
|
frame_data *getRowFdata(QModelIndex idx);
|
2012-08-23 17:29:05 +00:00
|
|
|
frame_data *getRowFdata(int row);
|
2015-06-11 22:53:51 +00:00
|
|
|
void ensureRowColorized(int row);
|
2012-01-04 22:13:01 +00:00
|
|
|
int visibleIndexOf(frame_data *fdata) const;
|
2018-03-08 23:17:58 +00:00
|
|
|
/**
|
|
|
|
* @brief Invalidate any cached column strings.
|
|
|
|
*/
|
|
|
|
void invalidateAllColumnStrings();
|
|
|
|
/**
|
|
|
|
* @brief Rebuild columns from settings.
|
|
|
|
*/
|
2013-07-23 08:56:20 +00:00
|
|
|
void resetColumns();
|
2014-09-22 23:33:05 +00:00
|
|
|
void resetColorized();
|
2019-11-12 15:39:19 +00:00
|
|
|
void toggleFrameMark(const QModelIndexList &indeces);
|
2015-07-16 19:07:49 +00:00
|
|
|
void setDisplayedFrameMark(gboolean set);
|
2019-11-12 15:39:19 +00:00
|
|
|
void toggleFrameIgnore(const QModelIndexList &indeces);
|
2015-07-16 19:07:49 +00:00
|
|
|
void setDisplayedFrameIgnore(gboolean set);
|
|
|
|
void toggleFrameRefTime(const QModelIndex &rt_index);
|
|
|
|
void unsetAllFrameRefTime();
|
2015-09-23 00:18:33 +00:00
|
|
|
|
2019-07-03 15:18:18 +00:00
|
|
|
void setMaximumRowHeight(int height);
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
signals:
|
2014-10-05 19:23:33 +00:00
|
|
|
void goToPacket(int);
|
2015-09-23 00:18:33 +00:00
|
|
|
void maxLineCountChanged(const QModelIndex &ih_index) const;
|
|
|
|
void itemHeightChanged(const QModelIndex &ih_index);
|
2015-08-27 00:14:39 +00:00
|
|
|
|
2017-04-06 21:45:33 +00:00
|
|
|
void bgColorizationProgress(int first, int last);
|
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
public slots:
|
2014-10-05 19:23:33 +00:00
|
|
|
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
2015-09-16 17:46:45 +00:00
|
|
|
void flushVisibleRows();
|
2015-09-20 20:17:07 +00:00
|
|
|
void dissectIdle(bool reset = false);
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
private:
|
2012-10-30 19:21:24 +00:00
|
|
|
capture_file *cap_file_;
|
2012-08-23 17:29:05 +00:00
|
|
|
QList<QString> col_names_;
|
|
|
|
QVector<PacketListRecord *> physical_rows_;
|
2015-09-16 17:46:45 +00:00
|
|
|
QVector<PacketListRecord *> visible_rows_;
|
|
|
|
QVector<PacketListRecord *> new_visible_rows_;
|
2016-07-14 17:39:52 +00:00
|
|
|
QVector<int> number_to_row_;
|
2012-08-23 17:29:05 +00:00
|
|
|
|
2015-09-23 00:18:33 +00:00
|
|
|
int max_row_height_; // px
|
|
|
|
int max_line_count_;
|
2014-10-05 19:23:33 +00:00
|
|
|
|
|
|
|
static int sort_column_;
|
2017-06-21 19:51:35 +00:00
|
|
|
static int sort_column_is_numeric_;
|
2014-10-05 19:23:33 +00:00
|
|
|
static int text_sort_column_;
|
|
|
|
static Qt::SortOrder sort_order_;
|
|
|
|
static capture_file *sort_cap_file_;
|
|
|
|
static bool recordLessThan(PacketListRecord *r1, PacketListRecord *r2);
|
2017-06-30 21:06:39 +00:00
|
|
|
static double parseNumericColumn(const QString &val, bool *ok);
|
2015-02-26 21:02:06 +00:00
|
|
|
|
2015-09-20 20:17:07 +00:00
|
|
|
QElapsedTimer *idle_dissection_timer_;
|
|
|
|
int idle_dissection_row_;
|
|
|
|
|
2019-01-09 17:09:11 +00:00
|
|
|
struct _GStringChunk *string_cache_pool_;
|
|
|
|
|
2017-06-21 19:51:35 +00:00
|
|
|
bool isNumericColumn(int column);
|
2015-09-20 20:17:07 +00:00
|
|
|
|
2015-02-26 21:02:06 +00:00
|
|
|
private slots:
|
2015-07-16 19:07:49 +00:00
|
|
|
void emitItemHeightChanged(const QModelIndex &ih_index);
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PACKET_LIST_MODEL_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:
|
|
|
|
*/
|