Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
atap_data_model.h
Go to the documentation of this file.
1
10#ifndef ATAP_DATA_MODEL_H
11#define ATAP_DATA_MODEL_H
12
13#include "config.h"
14
15#include <epan/tap.h>
16#include <epan/conversation.h>
18
19#include <QAbstractListModel>
20
32class ATapDataModel : public QAbstractListModel
33{
34 Q_OBJECT
35public:
36
37 enum {
38 DISPLAY_FILTER = Qt::UserRole,
39 UNFORMATTED_DISPLAYDATA,
40#ifdef HAVE_MAXMINDDB
41 GEODATA_AVAILABLE,
42 GEODATA_LOOKUPTABLE,
43 GEODATA_ADDRESS,
44#endif
45 TIMELINE_DATA,
46 ENDPOINT_DATATYPE,
47 PROTO_ID,
48 CONVERSATION_ID,
49 ROW_IS_FILTERED,
50 DATA_ADDRESS_TYPE,
51 DATA_IPV4_INTEGER,
52 DATA_IPV6_LIST,
53 };
54
55 typedef enum {
56 DATAMODEL_ENDPOINT,
57 DATAMODEL_CONVERSATION,
58 DATAMODEL_UNKNOWN
59 } dataModelType;
60
61 conv_hash_t hash_;
62
76 explicit ATapDataModel(dataModelType type, int protoId, QString filter, QObject *parent = nullptr);
77 virtual ~ATapDataModel();
78
87 int rowCount(const QModelIndex &parent = QModelIndex()) const;
88
89 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0;
90 virtual QVariant headerData(int section, Qt::Orientation orientation = Qt::Horizontal, int role = Qt::DisplayRole) const = 0;
91 virtual QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const = 0;
92
98 QString tap() const;
99
105 int protoId() const;
106
114 void setFilter(QString filter);
115
121 QString filter() const;
122
129 bool resolveNames() const;
130
136 virtual void setResolveNames(bool resolve) = 0;
137
147 bool allowsNameResolution() const;
148
154 virtual void useAbsoluteTime(bool absolute) = 0;
155
163 virtual void useNanosecondTimestamps(bool nanoseconds) = 0;
164
171 bool portsAreHidden() const;
172
179 bool showTotalColumn() const;
180
190 bool enableTap();
191
195 void disableTap();
196
202 dataModelType modelType() const;
203
204 conv_hash_t * hash();
205
209 void updateFlags(unsigned flag);
210
211#ifdef HAVE_MAXMINDDB
218 bool hasGeoIPData();
219#endif
220
221signals:
222 void tapListenerChanged(bool enable);
223
224protected:
225
226 static void tapReset(void *tapdata);
227 static void tapDraw(void *tap_data);
228
229 virtual tap_packet_cb conversationPacketHandler();
230
231 void resetData();
232 void updateData(GArray * data);
233
234 dataModelType _type;
235 GArray * storage_;
236 QString _filter;
237
238 bool _absoluteTime;
239 // XXX - There are other possible time precisions besides
240 // microseconds and nanoseconds; e.g., Netmon 2.3 uses
241 // 100 ns, and pcapng can have one of many values.
242 bool _nanoseconds;
243 bool _resolveNames;
244 bool _disableTap;
245
246 double _minRelStartTime;
247 double _maxRelStopTime;
248
249 unsigned _tapFlags;
250
251 register_ct_t* registerTable() const;
252
253private:
254 int _protoId;
255
256};
257
259{
260 Q_OBJECT
261public:
262
263 typedef enum
264 {
265 ENDP_COLUMN_ADDR,
266 ENDP_COLUMN_PORT,
267 ENDP_COLUMN_PACKETS,
268 ENDP_COLUMN_BYTES,
269 ENDP_COLUMN_PACKETS_TOTAL,
270 ENDP_COLUMN_BYTES_TOTAL,
271 ENDP_COLUMN_PKT_AB,
272 ENDP_COLUMN_BYTES_AB,
273 ENDP_COLUMN_PKT_BA,
274 ENDP_COLUMN_BYTES_BA,
275 ENDP_NUM_COLUMNS,
276 ENDP_COLUMN_GEO_COUNTRY = ENDP_NUM_COLUMNS,
277 ENDP_COLUMN_GEO_CITY,
278 ENDP_COLUMN_GEO_LATITUDE,
279 ENDP_COLUMN_GEO_LONGITUDE,
280 ENDP_COLUMN_GEO_AS_NUM,
281 ENDP_COLUMN_GEO_AS_ORG,
282 ENDP_NUM_GEO_COLUMNS
283 } endpoint_column_type_e;
284
285 explicit EndpointDataModel(int protoId, QString filter, QObject *parent = nullptr);
286
287 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
288 QVariant headerData(int section, Qt::Orientation orientation = Qt::Horizontal, int role = Qt::DisplayRole) const override;
289 QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
290
291 void setResolveNames(bool resolve) override;
292 void useAbsoluteTime(bool absolute) override;
293 void useNanosecondTimestamps(bool nanoseconds) override;
294};
295
297{
298 Q_OBJECT
299public:
300
301 typedef enum {
302 CONV_COLUMN_SRC_ADDR,
303 CONV_COLUMN_SRC_PORT,
304 CONV_COLUMN_DST_ADDR,
305 CONV_COLUMN_DST_PORT,
306 CONV_COLUMN_PACKETS,
307 CONV_COLUMN_BYTES,
308 CONV_COLUMN_CONV_ID,
309 CONV_COLUMN_PACKETS_TOTAL,
310 CONV_COLUMN_BYTES_TOTAL,
311 CONV_COLUMN_PKT_AB,
312 CONV_COLUMN_BYTES_AB,
313 CONV_COLUMN_PKT_BA,
314 CONV_COLUMN_BYTES_BA,
315 CONV_COLUMN_START,
316 CONV_COLUMN_DURATION,
317 CONV_COLUMN_BPS_AB,
318 CONV_COLUMN_BPS_BA,
319 CONV_NUM_COLUMNS,
320 CONV_INDEX_COLUMN = CONV_NUM_COLUMNS
321 } conversation_column_type_e;
322
323 typedef enum {
324 CONV_TCP_EXT_COLUMN_A = CONV_INDEX_COLUMN,
325 CONV_TCP_EXT_NUM_COLUMNS,
326 CONV_TCP_EXT_INDEX_COLUMN = CONV_TCP_EXT_NUM_COLUMNS
327 } conversation_tcp_ext_column_type_e;
328
329 explicit ConversationDataModel(int protoId, QString filter, QObject *parent = nullptr);
330
331 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
332 QVariant headerData(int section, Qt::Orientation orientation = Qt::Horizontal, int role = Qt::DisplayRole) const override;
333 QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
334
335 void doDataUpdate();
336
337 conv_item_t * itemForRow(int row);
338
345 bool showConversationId(int row = 0) const;
346
347 void setResolveNames(bool resolve) override;
348 void useAbsoluteTime(bool absolute) override;
349 void useNanosecondTimestamps(bool nanoseconds) override;
350};
351
352#endif // ATAP_DATA_MODEL_H
DataModel for tap user data.
Definition atap_data_model.h:33
virtual void setResolveNames(bool resolve)=0
Enable or disable if names should be resolved.
bool showTotalColumn() const
A total column is filled.
Definition atap_data_model.cpp:302
bool resolveNames() const
Is the model set to resolve names in address and ports columns.
Definition atap_data_model.cpp:239
bool enableTap()
Enable tapping in this model.
Definition atap_data_model.cpp:106
QString tap() const
Returns the name for the tap being used.
Definition atap_data_model.cpp:79
bool allowsNameResolution() const
Does the model allow names to be resolved.
Definition atap_data_model.cpp:244
virtual void useAbsoluteTime(bool absolute)=0
Use absolute time for any column supporting it.
dataModelType modelType() const
Return the model type.
Definition atap_data_model.cpp:292
void setFilter(QString filter)
Set the filter string.
Definition atap_data_model.cpp:270
void disableTap()
Disable the tapping for this model.
Definition atap_data_model.cpp:133
void updateFlags(unsigned flag)
Update the flags.
Definition atap_data_model.cpp:142
int rowCount(const QModelIndex &parent=QModelIndex()) const
Number of rows under the given parent in this model, which is the total number of rows for the empty ...
Definition atap_data_model.cpp:156
bool portsAreHidden() const
Are ports hidden for this model.
Definition atap_data_model.cpp:297
int protoId() const
The protocol id for the tap.
Definition atap_data_model.cpp:74
virtual void useNanosecondTimestamps(bool nanoseconds)=0
Use nanosecond timestamps if requested.
QString filter() const
Return a filter set for the model.
Definition atap_data_model.cpp:287
Definition atap_data_model.h:297
void useAbsoluteTime(bool absolute) override
Use absolute time for any column supporting it.
Definition atap_data_model.cpp:905
bool showConversationId(int row=0) const
Show the conversation id if available.
Definition atap_data_model.cpp:879
void useNanosecondTimestamps(bool nanoseconds) override
Use nanosecond timestamps if requested.
Definition atap_data_model.cpp:917
void setResolveNames(bool resolve) override
Enable or disable if names should be resolved.
Definition atap_data_model.cpp:894
Definition atap_data_model.h:259
void useNanosecondTimestamps(bool nanoseconds) override
Use nanosecond timestamps if requested.
Definition atap_data_model.cpp:563
void setResolveNames(bool resolve) override
Enable or disable if names should be resolved.
Definition atap_data_model.cpp:543
void useAbsoluteTime(bool absolute) override
Use absolute time for any column supporting it.
Definition atap_data_model.cpp:554
Definition conversation_table.h:53
Definition conversation_table.h:121
Definition conversation_table.c:24