| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
plot.h
Go to the documentation of this file.
1
12
13#ifndef PLOT_H
14#define PLOT_H
15
16#include <config.h>
17
18#include "graph.h"
19
20#include <vector>
21
25 typedef struct _plot_item_t {
26 double frame_ts;
27 double rel_cap_ts;
28 uint32_t frame_num;
29 unsigned idx;
30 double value;
31} plot_item_t;
32
33 class QCPRange;
34
38 class Plot : public Graph {
39 Q_OBJECT
40
41 public:
48 explicit Plot(QCustomPlot *parent, QCPAxis *keyAxis = nullptr, QCPAxis *valueAxis = nullptr);
49
53 ~Plot();
54
60 void setFilterField(const QString &filter, const QString &field);
61
66 void setPlotStyle(PlotStyles style);
67
73 void setVisible(bool visible);
74
79 QString configError() const { return config_err_; }
80
86 double startTime() const;
87
92 void setPlotStartTime(double start_time);
93
98 bool absoluteTime() const { return abs_time_; }
99
105 void setAbsoluteTime(bool abs_time);
106
111 void setYAxisFactor(double y_axis_factor);
112
118 int hfIndex() const { return hf_index_; }
119
125 const std::vector<plot_item_t> &getItems() const { return items_; }
126
130 void removeTapListener();
131
138 static bool itemCompare(const plot_item_t &a, const plot_item_t &b);
139
146 static bool itemRelCapCompare(const plot_item_t &a, const plot_item_t &b);
147
153 static void setAxisColor(QCPAxis *axis, const QPen &pen);
154
161 uint32_t packetFromTime(double ts) const;
162
167 void makeCsv(QTextStream &stream) const;
168
175 QCPRange recentDrawnDataRange(int count) const;
176
177 public slots:
182 void captureEvent(const CaptureEvent &e);
183
184
185signals:
187 void requestReplot();
188
190 void requestRecalc();
191
193 void requestRetap();
194
195 private:
196 // Static trampoline callbacks passed to register_tap_listener.
198 static void tap_reset(void *plot_ptr);
200 static tap_packet_status tap_packet(void *plot_ptr, packet_info *pinfo, epan_dissect_t *edt, const void *data, tap_flags_t flags);
202 static void tap_draw(void *plot_ptr);
203
205 void tapReset();
215 tap_packet_status tapPacket(packet_info *pinfo, epan_dissect_t *edt, const void *data _U_, tap_flags_t flags _U_);
217 void tapDraw();
218
219 nstime_t first_packet_;
220 double plot_start_time_;
221 bool abs_time_;
222 bool tap_registered_;
223 bool retap_needed_;
224 int hf_index_;
225 QString full_filter_;
226 QString config_err_;
227
228 std::vector<plot_item_t> items_;
229};
230
231#endif // PLOT_H
CaptureEvent
Represents an event occurring during a capture or file operation.
Definition capture_event.h:24
Graph::PlotStyles
PlotStyles
Defines the available visual styles for plotting data.
Definition graph.h:37
Graph::visible
bool visible() const
Checks if the graph is currently visible.
Definition graph.h:94
Graph::Graph
Graph(QCustomPlot *parent, QCPAxis *keyAxis=nullptr, QCPAxis *valueAxis=nullptr)
Constructs a new Graph.
Definition graph.cpp:15
Plot::requestReplot
void requestReplot()
Emitted to request a lightweight QCustomPlot replot without recalculation.
Plot::captureEvent
void captureEvent(const CaptureEvent &e)
React to a capture lifecycle event.
Definition plot.cpp:51
Plot::~Plot
~Plot()
Destroy the Plot.
Definition plot.cpp:47
Plot::Plot
Plot(QCustomPlot *parent, QCPAxis *keyAxis=nullptr, QCPAxis *valueAxis=nullptr)
Construct a Plot.
Definition plot.cpp:19
Plot::setYAxisFactor
void setYAxisFactor(double y_axis_factor)
Set a multiplier applied to all Y-axis values before plotting.
Definition plot.cpp:220
Plot::setAxisColor
static void setAxisColor(QCPAxis *axis, const QPen &pen)
Set the pen colour of all visual components of a QCPAxis.
Definition plot.cpp:269
Plot::itemRelCapCompare
static bool itemRelCapCompare(const plot_item_t &a, const plot_item_t &b)
Compare two plot items by relative capture timestamp.
Definition plot.cpp:240
Plot::makeCsv
void makeCsv(QTextStream &stream) const
Write all plot items as CSV rows to stream.
Definition plot.cpp:368
Plot::removeTapListener
void removeTapListener()
Remove this plot's tap listener, if one is registered.
Definition plot.cpp:60
Plot::requestRecalc
void requestRecalc()
Emitted to request a medium-weight value recalculation followed by replot.
Plot::startTime
double startTime() const
Return the capture timestamp of the first packet seen by this plot.
Definition plot.cpp:189
Plot::setVisible
void setVisible(bool visible)
Show or hide this plot on the graph.
Definition plot.cpp:173
Plot::setPlotStartTime
void setPlotStartTime(double start_time)
Set the shared plot start time used for relative-time calculations.
Definition plot.cpp:204
Plot::hfIndex
int hfIndex() const
Return the resolved header field index for the Y-axis field.
Definition plot.h:118
Plot::setPlotStyle
void setPlotStyle(PlotStyles style)
Set the visual plot style for this series.
Definition plot.cpp:148
Plot::configError
QString configError() const
Return any configuration error set by setFilterField().
Definition plot.h:79
Plot::absoluteTime
bool absoluteTime() const
Return whether this plot uses absolute (wall-clock) time on the X axis.
Definition plot.h:98
Plot::packetFromTime
uint32_t packetFromTime(double ts) const
Return the frame number of the packet closest to a given timestamp.
Definition plot.cpp:252
Plot::requestRetap
void requestRetap()
Emitted to request a full retap of the capture file.
Plot::itemCompare
static bool itemCompare(const plot_item_t &a, const plot_item_t &b)
Compare two plot items by absolute capture timestamp.
Definition plot.cpp:228
Plot::setFilterField
void setFilterField(const QString &filter, const QString &field)
Set the display filter and Y-axis field for this plot.
Definition plot.cpp:68
Plot::getItems
const std::vector< plot_item_t > & getItems() const
Return read-only access to the collected plot items.
Definition plot.h:125
Plot::setAbsoluteTime
void setAbsoluteTime(bool abs_time)
Set the X-axis time display mode.
Definition plot.cpp:212
Plot::recentDrawnDataRange
QCPRange recentDrawnDataRange(int count) const
Return the key (X-axis) range covering the most recent count items.
Definition plot.cpp:387
epan_dissect_t
struct epan_dissect epan_dissect_t
Opaque type representing a single packet dissection context.
Definition epan.h:62
graph.h
packet_info
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
plot_item_t
struct _plot_item_t plot_item_t
Represents a single data point sampled from a packet field for plotting.
_plot_item_t
Represents a single data point sampled from a packet field for plotting.
Definition plot.h:25
_plot_item_t::idx
unsigned idx
Definition plot.h:29
_plot_item_t::rel_cap_ts
double rel_cap_ts
Definition plot.h:27
_plot_item_t::frame_ts
double frame_ts
Definition plot.h:26
_plot_item_t::value
double value
Definition plot.h:30
_plot_item_t::frame_num
uint32_t frame_num
Definition plot.h:28
nstime_t
Definition nstime.h:26
stream
Definition stream.c:41
tap_packet_status
tap_packet_status
Definition tap.h:22