MADARA  3.2.3
UdpTransport.h
Go to the documentation of this file.
1 #ifndef _MADARA_UDP_TRANSPORT_H_
2 #define _MADARA_UDP_TRANSPORT_H_
3 
4 #include <string>
5 
6 #include "madara/MadaraExport.h"
10 
11 #include <string>
12 #include <map>
13 
14 #include "madara/Boost.h"
15 
16 
17 namespace madara
18 {
19  namespace transport
20  {
21  namespace asio = boost::asio;
22  namespace ip = boost::asio::ip;
23  using udp = boost::asio::ip::udp;
24 
37  class MADARA_EXPORT UdpTransport : public BasicASIOTransport
38  {
39  public:
40  UdpTransport (const std::string & id,
42  TransportSettings & config, bool launch_transport);
43 
48  int reliability (void) const;
49 
54  int reliability (const int & setting);
55 
61  long send_data (const madara::knowledge::VariableReferenceMap & updates) override;
62 
63  protected:
64  int setup_read_socket () override;
65  int setup_write_socket () override;
66  int setup_read_thread (double hertz, const std::string &name) override;
67 
68  long send_message (const char *buf, size_t size);
69  long send_buffer (const udp::endpoint &target, const char *buf, size_t size);
70  virtual bool pre_send_buffer (size_t addr_index) { return addr_index != 0; }
71 
72  friend class UdpTransportReadThread;
73  };
74  }
75 }
76 
78 
79 #endif // _MADARA_UDP_TRANSPORT_H_
This class stores variables and their values for use by any entity needing state information in a thr...
Holds basic transport settings.
virtual bool pre_send_buffer(size_t addr_index)
Definition: UdpTransport.h:70
static struct madara::knowledge::tags::string_t string
std::map< const char *, VariableReference, VariableReferenceMapCompare > VariableReferenceMap
a map of variable references
Copyright (c) 2015 Carnegie Mellon University.
UDP-based transport for knowledge.
Definition: UdpTransport.h:37
Thread for reading knowledge updates through a UDP socket.
boost::asio::ip::udp udp