OpenDaVINCI  4.16.0
POSIXUDPReceiver.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_CORE_WRAPPER_POSIX_POSIXUDPRECEIVER_H_
21 #define OPENDAVINCI_CORE_WRAPPER_POSIX_POSIXUDPRECEIVER_H_
22 
23 #include <netinet/in.h>
24 #include <sys/socket.h>
25 
26 #include <map>
27 #include <memory>
28 #include <string>
29 
34 
35 namespace odcore { namespace wrapper { class Thread; } }
36 namespace odcore { namespace wrapper { template <odcore::wrapper::NetworkLibraryProducts product> class UDPFactoryWorker; } }
37 
38 namespace odcore {
39  namespace wrapper {
40  namespace POSIX {
41 
42  using namespace std;
43 
50  private:
52 
60  POSIXUDPReceiver(const string &address, const uint32_t &port, const bool &isMulticast);
61 
62  private:
63  enum {
64  BUFFER_SIZE = 65535
65  };
66 
67  private:
74 
80  POSIXUDPReceiver& operator=(const POSIXUDPReceiver &);
81 
82  public:
83  virtual ~POSIXUDPReceiver();
84 
85  virtual void start();
86 
87  virtual void stop();
88 
89  virtual void setSenderPortToIgnore(const uint16_t &portToIgnore);
90 
91  private:
92  map<unsigned long, bool> m_mapOfIPAddresses;
93  uint16_t m_portToIgnore;
94  bool m_isMulticast;
95  struct sockaddr_in m_address;
96  struct ip_mreq m_mreq;
97  int32_t m_fd;
98  char *m_buffer;
99  unique_ptr<Thread> m_thread;
100 
101  virtual void run();
102 
103  virtual bool isRunning();
104 
105  void getIPAddresses();
106  };
107 
108  }
109  }
110 } // odcore::wrapper::POSIX
111 
112 #endif /*OPENDAVINCI_CORE_WRAPPER_POSIX_POSIXUDPRECEIVER_H_*/
Definition: POSIXUDPReceiver.h:49
Definition: Runnable.h:35
Definition: NetworkLibraryProducts.h:28
Definition: UDPReceiver.h:82
Definition: POSIXUDPReceiver.h:36