File: broadcastreceiver.h

package info (click to toggle)
sinfo 0.0.48-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,332 kB
  • sloc: sh: 11,213; cpp: 6,722; makefile: 271; xml: 151; perl: 149
file content (30 lines) | stat: -rw-r--r-- 806 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef _broadcastreceiver_h
#define _broadcastreceiver_h

#include <boost/asio.hpp>
#include "message.h"
#include "sinfo.h"


class BroadcastReceiver
{
private:
  enum { max_length = 65535 }; // maximum UDP packet size
  char data[max_length];
  boost::asio::ip::udp::endpoint sender_endpoint;

  boost::asio::io_service & ioservice;
  boost::asio::ip::udp::socket sock;

  bool & restartCounterEventFlag;
  std::list < Wsinfo > & wsinfoList;

  void  receiveMessage(std::string inetaddrString, unsigned long inetaddrHostByteOrder, Message & message);

public:
  BroadcastReceiver(boost::asio::io_service& io_service, bool & _restartCounterEventFlag, std::list < Wsinfo > & _wsinfoList);
  void handle_receive_from(const boost::system::error_code& err, size_t length);
};


#endif // _broadcastreceiver_h