Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
manuf_table_model.h
Go to the documentation of this file.
1
10#ifndef MANUF_TABLE_MODEL_H
11#define MANUF_TABLE_MODEL_H
12
13#include <QSortFilterProxyModel>
14#include <QAbstractTableModel>
15#include <QList>
16
17#include <wireshark.h>
18#include <epan/manuf.h>
19
24{
25public:
30 ManufTableItem(struct ws_manuf *ptr);
31
36
38 QByteArray block_bytes_;
39
41 QString block_name_;
42
44 QString short_name_;
45
47 QString long_name_;
48};
49
53class ManufTableModel : public QAbstractTableModel
54{
55 Q_OBJECT
56
57public:
62 ManufTableModel(QObject *parent);
63
68
74 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const ;
75
81 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
82
89 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
90
98 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
99
104 void addRecord(struct ws_manuf *ptr);
105
109 void clear();
110
114 enum {
123 };
124
125private:
127 QList<ManufTableItem *> rows_;
128};
129
133class ManufSortFilterProxyModel : public QSortFilterProxyModel
134{
135 Q_OBJECT
136
137public:
151
152
156 ManufSortFilterProxyModel(QObject *parent);
157
164 virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
165
166public slots:
171 void setFilterAddress(const QByteArray& bytes);
172
177 void setFilterName(QRegularExpression& name);
178
182 void clearFilter();
183
184private:
186 ManufProxyFilterType filter_type_;
187
189 QByteArray filter_bytes_;
190
192 QRegularExpression filter_name_;
193
200 bool filterAddressAcceptsRow(int source_row, const QModelIndex& source_parent) const;
201
208 bool filterNameAcceptsRow(int source_row, const QModelIndex& source_parent) const;
209};
210
211#endif
A proxy model for sorting and filtering manufacturer data.
Definition manuf_table_model.h:134
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
Determines if a row is accepted by the current filter.
Definition manuf_table_model.cpp:233
ManufProxyFilterType
Enumeration of available filter types.
Definition manuf_table_model.h:142
@ FilterByAddress
Definition manuf_table_model.h:146
@ FilterEmpty
Definition manuf_table_model.h:144
@ FilterByName
Definition manuf_table_model.h:148
void setFilterAddress(const QByteArray &bytes)
Sets the filter to match a specific MAC address.
Definition manuf_table_model.cpp:172
void clearFilter()
Clears the active filter.
Definition manuf_table_model.cpp:157
void setFilterName(QRegularExpression &name)
Sets the filter to match a specific manufacturer name.
Definition manuf_table_model.cpp:186
A class representing a single manufacturer entry in the table.
Definition manuf_table_model.h:24
QString short_name_
Definition manuf_table_model.h:44
QByteArray block_bytes_
Definition manuf_table_model.h:38
QString block_name_
Definition manuf_table_model.h:41
QString long_name_
Definition manuf_table_model.h:47
~ManufTableItem()
Destroys the ManufTableItem.
Definition manuf_table_model.cpp:42
A table model for managing and displaying MAC address manufacturer data.
Definition manuf_table_model.h:54
~ManufTableModel()
Destroys the ManufTableModel.
Definition manuf_table_model.cpp:57
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Retrieves the number of columns in the model.
Definition manuf_table_model.cpp:67
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Retrieves the data stored under the given role for the item referred to by the index.
Definition manuf_table_model.cpp:72
void clear()
Clears all records from the model.
Definition manuf_table_model.cpp:121
void addRecord(struct ws_manuf *ptr)
Adds a new manufacturer record to the model.
Definition manuf_table_model.cpp:113
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Retrieves the header data for the given section, orientation, and role.
Definition manuf_table_model.cpp:131
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Retrieves the number of rows in the model.
Definition manuf_table_model.cpp:62
@ COL_MAC_PREFIX
Definition manuf_table_model.h:116
@ COL_VENDOR_NAME
Definition manuf_table_model.h:120
@ NUM_COLS
Definition manuf_table_model.h:122
@ COL_SHORT_NAME
Definition manuf_table_model.h:118
Represents a single manufacturer entry mapping an OUI or MA block to a vendor name.
Definition manuf.h:21