Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
export_objects_model.h
1 /* export_objects_model.h
2  * Data model for Export Objects.
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef EXPORT_OBJECTS_MODEL_H
12 #define EXPORT_OBJECTS_MODEL_H
13 
14 #include <config.h>
15 
16 #include <epan/tap.h>
17 #include <epan/export_object.h>
18 
19 #include <QAbstractTableModel>
20 #include <QSortFilterProxyModel>
21 #include <QList>
22 
23 typedef struct export_object_list_gui_t {
24  class ExportObjectModel *model;
26 
27 class ExportObjectModel : public QAbstractTableModel
28 {
29  Q_OBJECT
30 
31 public:
32  ExportObjectModel(register_eo_t* eo, QObject *parent);
33 
34  enum ExportObjectColumn {
35  colPacket = 0,
36  colHostname,
37  colContent,
38  colSize,
39  colFilename,
40  colExportObjectMax
41  };
42 
43  void addObjectEntry(export_object_entry_t *entry);
44  export_object_entry_t *objectEntry(int row);
45  void resetObjects();
46 
47  bool saveEntry(QModelIndex &index, QString filename);
48  bool saveAllEntries(QString path);
49 
50  const char* getTapListenerName();
51  void* getTapData();
52  tap_packet_cb getTapPacketFunc();
53  static void resetTap(void *tapdata);
54  void removeTap();
55 
56  QVariant data(const QModelIndex &index, int role) const;
57  QVariant headerData(int section, Qt::Orientation orientation,
58  int role = Qt::DisplayRole) const;
59  int rowCount(const QModelIndex &parent = QModelIndex()) const;
60  int columnCount(const QModelIndex &parent = QModelIndex()) const;
61 
62 private:
63  QList<QVariant> objects_;
64 
65  export_object_list_t export_object_list_;
66  export_object_list_gui_t eo_gui_data_;
67  register_eo_t* eo_;
68 };
69 
70 class ExportObjectProxyModel : public QSortFilterProxyModel
71 {
72  Q_OBJECT
73 public:
74 
75  explicit ExportObjectProxyModel(QObject * parent = Q_NULLPTR);
76 
77 protected:
78  bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
79 };
80 
81 #endif // EXPORT_OBJECTS_MODEL_H
Definition: export_object.c:19
Definition: export_objects_model.h:70
Definition: export_object.h:21
Definition: export_objects_model.h:23
Definition: export_object.h:43
Definition: export_objects_model.h:27