Wireshark 4.5.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 Plot : public Graph {
31 Q_OBJECT
32
33public:
34 explicit Plot(QCustomPlot* parent, QCPAxis* keyAxis = nullptr, QCPAxis* valueAxis = nullptr);
35 ~Plot();
36 void setFilterField(const QString& filter, const QString& field);
37 void setPlotStyle(PlotStyles style);
38 void setVisible(bool visible);
39 QString configError() const { return config_err_; }
40 /* Returns the timestamp of the first packet, so that relative times can be calculated. */
41 double startTime() const;
42 void setPlotStartTime(double start_time);
43 bool absoluteTime() const { return abs_time_; }
44 void setAbsoluteTime(bool abs_time);
45 int hfIndex() const { return hf_index_; }
46 const std::vector<plot_item_t>& getItems() const { return items_; }
47
48 void removeTapListener();
49
50 static bool itemCompare(const plot_item_t& a, const plot_item_t& b);
51 static bool itemRelCapCompare(const plot_item_t& a, const plot_item_t& b);
52 uint32_t packetFromTime(double ts) const;
53
54 void makeCsv(QTextStream& stream) const;
55
56public slots:
57 void captureEvent(const CaptureEvent& e);
58
59signals:
60 void requestReplot();
61 void requestRecalc();
62 void requestRetap();
63
64private:
65 // Callbacks for register_tap_listener
66 static void tap_reset(void* plot_ptr);
67 static tap_packet_status tap_packet(void* plot_ptr, packet_info* pinfo, epan_dissect_t* edt, const void* data, tap_flags_t flags);
68 static void tap_draw(void* plot_ptr);
69 // Actual non-static functions called by the callbacks above
70 void tapReset();
71 tap_packet_status tapPacket(packet_info* pinfo, epan_dissect_t* edt, const void* data _U_, tap_flags_t flags _U_);
72 void tapDraw();
73
74 nstime_t first_packet_;
75 double plot_start_time_;
76 bool abs_time_;
77 bool tap_registered_;
78 bool retap_needed_; // Used to delay calling requestRetap() when the plot is not visible
79 int hf_index_;
80 QString full_filter_;
81 QString config_err_;
82
83 std::vector<plot_item_t> items_;
84};
85
86#endif // PLOT_H
Definition capture_event.h:21
Definition graph.h:22
Definition plot.h:30
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