1 /* wireless_timeline.h
2  * GUI to show an 802.11 wireless timeline of packets
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * Copyright 2012 Parc Inc and Samsung Electronics
9  * Copyright 2015, 2016 & 2017 Cisco Inc
10  *
11  * SPDX-License-Identifier: GPL-2.0-or-later
12  */
13 
14 #include <QScrollArea>
15 
16 #ifndef WIRELESSTIMELINE_H
17 #define WIRELESSTIMELINE_H
18 
19 #include <stdio.h>
20 
21 #include <config.h>
22 
23 #include <glib.h>
24 
25 #include "file.h"
26 
27 #include "ui/ws_ui_util.h"
28 
29 #include <epan/prefs.h>
30 #include <epan/plugin_if.h>
31 #include <epan/tap.h>
32 #include <epan/timestamp.h>
33 
34 #include <epan/dissectors/packet-ieee80211-radio.h>
35 
36 #include <QScrollArea>
37 
38 #include "cfile.h"
39 
40 /* pixels height for rendered timeline */
41 #define TIMELINE_HEIGHT 64
42 
43 /* Maximum zoom levels for the timeline */
44 #define TIMELINE_MAX_ZOOM 25.0
45 
46 class WirelessTimeline;
47 class PacketList;
48 
49 class WirelessTimeline : public QWidget
50 {
51     Q_OBJECT
52 
53 public:
54     explicit WirelessTimeline(QWidget *parent);
55     ~WirelessTimeline();
56     void setPacketList(PacketList *packet_list);
57     void captureFileReadStarted(capture_file *cf);
58     void captureFileReadFinished();
59 
60 protected:
61     void resizeEvent(QResizeEvent *event);
62     void paintEvent(QPaintEvent *event);
63     void mousePressEvent (QMouseEvent *event);
64     void mouseMoveEvent (QMouseEvent *event);
65     void mouseReleaseEvent (QMouseEvent *event);
66     bool event(QEvent *event);
67     void wheelEvent(QWheelEvent *event);
68 
69 public slots:
70     void bgColorizationProgress(int first, int last);
71     void appInitialized();
72 
73 protected:
74     static void tap_timeline_reset(void* tapdata);
75     static tap_packet_status tap_timeline_packet(void *tapdata, packet_info* pinfo, epan_dissect_t* edt, const void *data);
76 
77     struct wlan_radio* get_wlan_radio(guint32 packet_num);
78 
79     void clip_tsf();
80     int position(guint64 tsf, float ratio);
81     int find_packet_tsf(guint64 tsf);
82     void doToolTip(struct wlan_radio *wr, QPoint pos, int x);
83     void zoom(double x_fraction);
84     double zoom_level;
85     qreal start_x, last_x;
86     PacketList *packet_list;
87     guint find_packet(qreal x);
88     float rgb[TIMELINE_HEIGHT][3];
89 
90     guint64 start_tsf;
91     guint64 end_tsf;
92     int first_packet; /* first packet displayed */
93     struct wlan_radio *first, *last;
94     capture_file *capfile;
95 
96     GHashTable* radio_packet_list;
97 
98 protected slots:
99     void selectedFrameChanged(QList<int>);
100 };
101 
102 #endif // WIRELESS_TIMELINE_H
103