OpenDaVINCI  4.16.0
UDPReceiver.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_CORE_IO_UDP_UDPRECEIVER_H_
21 #define OPENDAVINCI_CORE_IO_UDP_UDPRECEIVER_H_
22 
27 #include "opendavinci/generated/odcore/data/Packet.h"
28 
29 namespace odcore { namespace io { class PacketListener; } }
30 namespace odcore { namespace io { class StringListener; } }
31 
32 namespace odcore {
33  namespace io {
34  namespace udp {
35 
36  using namespace std;
37 
82  class UDPReceiver : public PacketObserver, public StringObserver {
83  private:
89  UDPReceiver(const UDPReceiver &);
90 
96  UDPReceiver& operator=(const UDPReceiver &);
97 
98  protected:
102  UDPReceiver();
103 
104  public:
105  virtual ~UDPReceiver();
106 
111  virtual void start() = 0;
112 
117  virtual void stop() = 0;
118 
119  virtual void setStringListener(StringListener *sl);
120 
121  virtual void setPacketListener(PacketListener *pl);
122 
129  void setSynchronousPacketListener(PacketListener *pl);
130 
138  virtual void setSenderPortToIgnore(const uint16_t &portToIgnore) = 0;
139 
140  protected:
145  void nextPacket(const odcore::data::Packet &p);
146 
147  private:
148  odcore::base::Mutex m_listenerMutex;
149  StringListener *m_stringListener;
150  PacketListener *m_synchronousPacketListener;
151 
152  PacketPipeline m_packetPipeline;
153  };
154 
155  }
156  }
157 } // odcore::io::udp
158 
159 #endif /*OPENDAVINCI_CORE_IO_UDP_UDPRECEIVER_H_*/
Definition: PacketObserver.h:34
Definition: base/Mutex.h:49
Definition: PacketListener.h:33
Definition: PacketPipeline.h:41
Definition: StringListener.h:36
Definition: StringObserver.h:34
Definition: UDPReceiver.h:82