Wireshark 4.5.0
The Wireshark network protocol analyzer
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
165 void limitToDisplayFilter(bool limit);
166
173 bool portsAreHidden() const;
174
181 bool showTotalColumn() const;
182
192 bool enableTap();
193
197 void disableTap();
198
204 dataModelType modelType() const;
205
206 conv_hash_t * hash();
207
211 void updateFlags(unsigned flag);
212
213#ifdef HAVE_MAXMINDDB
220 bool hasGeoIPData();
221#endif
222
223signals:
224 void tapListenerChanged(bool enable);
225
226protected:
227
228 static void tapReset(void *tapdata);
229 static void tapDraw(void *tap_data);
230
231 virtual tap_packet_cb conversationPacketHandler();
232
233 void resetData();
234 void updateData(GArray * data);
235
236 dataModelType _type;
237 GArray * storage_;
238 QString _filter;
239
240 bool _absoluteTime;
241 // XXX - There are other possible time precisions besides
242 // microseconds and nanoseconds; e.g., Netmon 2.3 uses
243 // 100 ns, and pcapng can have one of many values.
244 bool _nanoseconds;
245 bool _resolveNames;
246 bool _disableTap;
247
248 double _minRelStartTime;
249 double _maxRelStopTime;
250
251 unsigned _tapFlags;
252
253 register_ct_t* registerTable() const;
254
255private:
256 int _protoId;
257
258};
259
261{
262 Q_OBJECT
263public:
264
265 typedef enum
266 {
267 ENDP_COLUMN_ADDR,
268 ENDP_COLUMN_PORT,
269 ENDP_COLUMN_PACKETS,
270 ENDP_COLUMN_BYTES,
271 ENDP_COLUMN_PACKETS_TOTAL,
272 ENDP_COLUMN_BYTES_TOTAL,
273 ENDP_COLUMN_PKT_AB,
274 ENDP_COLUMN_BYTES_AB,
275 ENDP_COLUMN_PKT_BA,
276 ENDP_COLUMN_BYTES_BA,
277 ENDP_NUM_COLUMNS,
278 ENDP_COLUMN_GEO_COUNTRY = ENDP_NUM_COLUMNS,
279 ENDP_COLUMN_GEO_CITY,
280 ENDP_COLUMN_GEO_LATITUDE,
281 ENDP_COLUMN_GEO_LONGITUDE,
282 ENDP_COLUMN_GEO_AS_NUM,
283 ENDP_COLUMN_GEO_AS_ORG,
284 ENDP_NUM_GEO_COLUMNS
285 } endpoint_column_type_e;
286
287 explicit EndpointDataModel(int protoId, QString filter, QObject *parent = nullptr);
288
289 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
290 QVariant headerData(int section, Qt::Orientation orientation = Qt::Horizontal, int role = Qt::DisplayRole) const override;
291 QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
292
293 void setResolveNames(bool resolve) override;
294 void useAbsoluteTime(bool absolute) override;
295 void useNanosecondTimestamps(bool nanoseconds) override;
296};
297
299{
300 Q_OBJECT
301public:
302
303 typedef enum {
304 CONV_COLUMN_SRC_ADDR,
305 CONV_COLUMN_SRC_PORT,
306 CONV_COLUMN_DST_ADDR,
307 CONV_COLUMN_DST_PORT,
308 CONV_COLUMN_PACKETS,
309 CONV_COLUMN_BYTES,
310 CONV_COLUMN_CONV_ID,
311 CONV_COLUMN_PACKETS_TOTAL,
312 CONV_COLUMN_BYTES_TOTAL,
313 CONV_COLUMN_PKT_AB,
314 CONV_COLUMN_BYTES_AB,
315 CONV_COLUMN_PKT_BA,
316 CONV_COLUMN_BYTES_BA,
317 CONV_COLUMN_START,
318 CONV_COLUMN_DURATION,
319 CONV_COLUMN_BPS_AB,
320 CONV_COLUMN_BPS_BA,
321 CONV_NUM_COLUMNS,
322 CONV_INDEX_COLUMN = CONV_NUM_COLUMNS
323 } conversation_column_type_e;
324
325 typedef enum {
326 CONV_TCP_EXT_COLUMN_A = CONV_INDEX_COLUMN,
327 CONV_TCP_EXT_NUM_COLUMNS,
328 CONV_TCP_EXT_INDEX_COLUMN = CONV_TCP_EXT_NUM_COLUMNS
329 } conversation_tcp_ext_column_type_e;
330
331 explicit ConversationDataModel(int protoId, QString filter, QObject *parent = nullptr);
332
333 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
334 QVariant headerData(int section, Qt::Orientation orientation = Qt::Horizontal, int role = Qt::DisplayRole) const override;
335 QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
336
337 void doDataUpdate();
338
339 conv_item_t * itemForRow(int row);
340
347 bool showConversationId(int row = 0) const;
348
349 void setResolveNames(bool resolve) override;
350 void useAbsoluteTime(bool absolute) override;
351 void useNanosecondTimestamps(bool nanoseconds) override;
352};
353
354#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:314
bool resolveNames() const
Is the model set to resolve names in address and ports columns.
Definition atap_data_model.cpp:251
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:256
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:304
void setFilter(QString filter)
Set the filter string.
Definition atap_data_model.cpp:282
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:168
bool portsAreHidden() const
Are ports hidden for this model.
Definition atap_data_model.cpp:309
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:299
Definition atap_data_model.h:299
void useAbsoluteTime(bool absolute) override
Use absolute time for any column supporting it.
Definition atap_data_model.cpp:917
bool showConversationId(int row=0) const
Show the conversation id if available.
Definition atap_data_model.cpp:891
void useNanosecondTimestamps(bool nanoseconds) override
Use nanosecond timestamps if requested.
Definition atap_data_model.cpp:929
void setResolveNames(bool resolve) override
Enable or disable if names should be resolved.
Definition atap_data_model.cpp:906
Definition atap_data_model.h:261
void useNanosecondTimestamps(bool nanoseconds) override
Use nanosecond timestamps if requested.
Definition atap_data_model.cpp:575
void setResolveNames(bool resolve) override
Enable or disable if names should be resolved.
Definition atap_data_model.cpp:555
void useAbsoluteTime(bool absolute) override
Use absolute time for any column supporting it.
Definition atap_data_model.cpp:566
Definition conversation_table.h:53
Definition conversation_table.h:121
Definition conversation_table.c:24