12#ifndef EXPORT_OBJECTS_MODEL_H
13#define EXPORT_OBJECTS_MODEL_H
20#include <QAbstractTableModel>
21#include <QSortFilterProxyModel>
51 return eo_entry_equal(entry, other.entry);
53#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
58 QByteArray
Data()
const {
return entry ? QByteArray::fromRawData(
reinterpret_cast<const char*
>(entry->
payload_data), entry->
payload_len) : QByteArray(); }
141 bool saveEntry(
const QModelIndex &index, QString filename);
148 void saveEntries(
const QModelIndexList &indices, QString path);
178 static void resetTap(
void *tapdata);
191 QVariant data(
const QModelIndex &index,
int role)
const;
200 QVariant
headerData(
int section, Qt::Orientation orientation,
201 int role = Qt::DisplayRole)
const;
208 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
215 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
219 QList<QVariant> objects_;
222 QSet<ExportObjectEntry> object_set_;
272 bool lessThan(
const QModelIndex &source_left,
const QModelIndex &source_right)
const;
280 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent)
const;
284 QString contentFilter_;
A wrapper class for an export object entry.
Definition export_objects_model.h:37
bool operator==(const ExportObjectEntry &other) const
Compares two ExportObjectEntry instances for equality.
Definition export_objects_model.h:50
QByteArrayView Data() const
Retrieves the payload data view for the entry.
Definition export_objects_model.h:64
ExportObjectEntry(export_object_entry_t *entry=nullptr)
Constructs a new ExportObjectEntry.
Definition export_objects_model.h:43
uint32_t PacketNum() const
Retrieves the packet number associated with the entry.
Definition export_objects_model.h:70
A table model managing a list of exportable objects extracted from network traffic.
Definition export_objects_model.h:89
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Retrieves the header data for a specific section and role.
Definition export_objects_model.cpp:112
void resetObjects()
Resets and clears all object entries from the model.
Definition export_objects_model.cpp:263
void addObjectEntry(export_object_entry_t *entry)
Adds a new export object entry to the model.
Definition export_objects_model.cpp:148
static void resetTap(void *tapdata)
Static callback used to reset the tap data.
Definition export_objects_model.cpp:281
tap_packet_cb getTapPacketFunc()
Retrieves the callback function used for processing tap packets.
Definition export_objects_model.cpp:299
virtual ~ExportObjectModel()
Destroys the ExportObjectModel.
Definition export_objects_model.cpp:59
void saveAllEntries(QString path)
Saves all entries in the model to a directory.
Definition export_objects_model.cpp:222
int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of rows under a given parent.
Definition export_objects_model.cpp:133
export_object_entry_t * objectEntry(int row)
Retrieves the export object entry at a specific row.
Definition export_objects_model.cpp:160
void saveEntries(const QModelIndexList &indices, QString path)
Saves multiple entries to a directory.
Definition export_objects_model.cpp:181
ExportObjectColumn
Enumerates the columns for the export object model.
Definition export_objects_model.h:108
@ colFilename
Definition export_objects_model.h:113
@ colHostname
Definition export_objects_model.h:110
@ colExportObjectMax
Definition export_objects_model.h:114
@ colPacket
Definition export_objects_model.h:109
@ colSize
Definition export_objects_model.h:112
@ colContent
Definition export_objects_model.h:111
const char * getTapListenerName()
Retrieves the name of the tap listener.
Definition export_objects_model.cpp:289
void removeTap()
Removes the associated tap listener.
Definition export_objects_model.cpp:304
void * getTapData()
Retrieves the tap data pointer.
Definition export_objects_model.cpp:294
bool saveEntry(const QModelIndex &index, QString filename)
Saves a specific entry to a file.
Definition export_objects_model.cpp:165
int columnCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of columns under a given parent.
Definition export_objects_model.cpp:143
A proxy model used for sorting and filtering export objects.
Definition export_objects_model.h:238
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
Determines whether a row from the source model matches the active filters and should be displayed.
Definition export_objects_model.cpp:377
void setUniqueFilter(bool unique)
Sets the filter to determine whether to show only unique items.
Definition export_objects_model.cpp:364
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
Compares two source indices to determine their sort order.
Definition export_objects_model.cpp:317
void setTextFilterString(QString textFilter)
Sets the text filter string used for general searching.
Definition export_objects_model.cpp:351
void setContentFilterString(QString contentFilter)
Sets the filter string used for matching content types.
Definition export_objects_model.cpp:338
size_t qHash(const ExportObjectEntry &entry, size_t seed=0)
Computes the hash for an ExportObjectEntry.
Definition export_objects_model.cpp:43
Represents a single object extracted from a packet capture for export.
Definition export_object.h:21
uint8_t * payload_data
Definition export_object.h:27
uint32_t pkt_num
Definition export_object.h:22
size_t payload_len
Definition export_object.h:26
Abstracts the GUI-specific operations needed to manage a list of exported objects during dissection.
Definition export_object.h:54
GUI context data for the export object list.
Definition export_objects_model.h:28
class ExportObjectModel * model
Pointer to the export object model.
Definition export_objects_model.h:30
Definition export_object.c:19