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 void setYAxisFactor(double y_axis_factor);
48 int hfIndex() const { return hf_index_; }
49 const std::vector<plot_item_t>& getItems() const { return items_; }
50
51 void removeTapListener();
52
53 static bool itemCompare(const plot_item_t& a, const plot_item_t& b);
54 static bool itemRelCapCompare(const plot_item_t& a, const plot_item_t& b);
55 static void setAxisColor(QCPAxis* axis, const QPen& pen);
56 uint32_t packetFromTime(double ts) const;
57
58 void makeCsv(QTextStream& stream) const;
59 QCPRange recentDrawnDataRange(int count) const;
60
61public slots:
62 void captureEvent(const CaptureEvent& e);
63
64signals:
65 void requestReplot();
66 void requestRecalc();
67 void requestRetap();
68
69private:
70 // Callbacks for register_tap_listener
71 static void tap_reset(void* plot_ptr);
72 static tap_packet_status tap_packet(void* plot_ptr, packet_info* pinfo, epan_dissect_t* edt, const void* data, tap_flags_t flags);
73 static void tap_draw(void* plot_ptr);
74 // Actual non-static functions called by the callbacks above
75 void tapReset();
76 tap_packet_status tapPacket(packet_info* pinfo, epan_dissect_t* edt, const void* data _U_, tap_flags_t flags _U_);
77 void tapDraw();
78
79 nstime_t first_packet_;
80 double plot_start_time_;
81 bool abs_time_;
82 bool tap_registered_;
83 bool retap_needed_; // Used to delay calling requestRetap() when the plot is not visible
84 int hf_index_;
85 QString full_filter_;
86 QString config_err_;
87
88 std::vector<plot_item_t> items_;
89};
90
91#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