Pool Video Switch v2
Software video switch for distributed remote display in a lecture environment
discoverylistener.h
Go to the documentation of this file.
1 /*
2  * discoverylistener.h
3  *
4  * Created on: 25.01.2013
5  * Author: sr
6  */
7 
8 #ifndef DISCOVERYLISTENER_H_
9 #define DISCOVERYLISTENER_H_
10 
11 #include <QObject>
12 #include <QUdpSocket>
13 #include "../../shared/networkmessage.h"
14 
15 #define SD_PACKET_TABLE_SIZE 20000
16 
17 class QTimerEvent;
18 
19 class DiscoveryListener : public QObject
20 {
21  Q_OBJECT
22 
23 private:
24  QUdpSocket _socket;
27 
28  quint8 _packetCounter[SD_PACKET_TABLE_SIZE]{}; // count packets per source address to ignore spammers
29 
30 protected:
31  void timerEvent(QTimerEvent* event) override;
32 
33 public:
34  explicit DiscoveryListener(QObject *parent);
35  ~DiscoveryListener() override;
36 
37 private slots:
38  void onReadyRead();
39 
40 };
41 
42 #endif /* DISCOVERYLISTENER_H_ */
NetworkMessage _packet
DiscoveryListener(QObject *parent)
DiscoveryListener::DiscoveryListener.
#define SD_PACKET_TABLE_SIZE
void timerEvent(QTimerEvent *event) override
Decrease packet counters per source IP in our "spam protection" table.
quint8 _packetCounter[SD_PACKET_TABLE_SIZE]
void onReadyRead()
Incoming UDP packet on service discovery port - handle.
~DiscoveryListener() override
DiscoveryListener::~DiscoveryListener.