Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
plot.h
Go to the documentation of this file.
1
13#ifndef PLOT_H
14#define PLOT_H
15
16#include <config.h>
17
18#include "graph.h"
19
20#include <vector>
21
22typedef struct _plot_item_t {
23 double frame_ts; /* Absolute timestamp of the packet */
24 double rel_cap_ts; /* Time relative from capture start */
25 uint32_t frame_num; /* Packet number */
26 unsigned idx; /* Istance of the field in the packet */
27 double value; /* Value of the field (always converted to double) */
29
30class QCPRange;
31
32class Plot : public Graph {
33 Q_OBJECT
34
35public:
36 explicit Plot(QCustomPlot* parent, QCPAxis* keyAxis = nullptr, QCPAxis* valueAxis = nullptr);
37 ~Plot();
38 void setFilterField(const QString& filter, const QString& field);
39 void setPlotStyle(PlotStyles style);
40 void setVisible(bool visible);
41 QString configError() const { return config_err_; }
42 /* Returns the timestamp of the first packet, so that relative times can be calculated. */
43 double startTime() const;
44 void setPlotStartTime(double start_time);
45 bool absoluteTime() const { return abs_time_; }
46 void setAbsoluteTime(bool abs_time);
47 int hfIndex() const { return hf_index_; }
48 const std::vector<plot_item_t>& getItems() const { return items_; }
49
50 void removeTapListener();
51
52 static bool itemCompare(const plot_item_t& a, const plot_item_t& b);
53 static bool itemRelCapCompare(const plot_item_t& a, const plot_item_t& b);
54 uint32_t packetFromTime(double ts) const;
55
56 void makeCsv(QTextStream& stream) const;
57 QCPRange recentDrawnDataRange(int count) const;
58
59public slots:
60 void captureEvent(const CaptureEvent& e);
61
62signals:
63 void requestReplot();
64 void requestRecalc();
65 void requestRetap();
66
67private:
68 // Callbacks for register_tap_listener
69 static void tap_reset(void* plot_ptr);
70 static tap_packet_status tap_packet(void* plot_ptr, packet_info* pinfo, epan_dissect_t* edt, const void* data, tap_flags_t flags);
71 static void tap_draw(void* plot_ptr);
72 // Actual non-static functions called by the callbacks above
73 void tapReset();
74 tap_packet_status tapPacket(packet_info* pinfo, epan_dissect_t* edt, const void* data _U_, tap_flags_t flags _U_);
75 void tapDraw();
76
77 nstime_t first_packet_;
78 double plot_start_time_;
79 bool abs_time_;
80 bool tap_registered_;
81 bool retap_needed_; // Used to delay calling requestRetap() when the plot is not visible
82 int hf_index_;
83 QString full_filter_;
84 QString config_err_;
85
86 std::vector<plot_item_t> items_;
87};
88
89#endif // PLOT_H
Definition capture_event.h:21
Definition graph.h:22
Definition plot.h:32
Definition packet_info.h:43
Definition plot.h:22
Definition epan_dissect.h:28
Definition nstime.h:26
Definition stream.c:41
tap_packet_status
Definition tap.h:25