MADARA  3.1.8
ZMQTransportReadThread.h
Go to the documentation of this file.
1 #ifndef _MADARA_ZEROMQ_TRANSPORT_READ_THREAD_H_
2 #define _MADARA_ZEROMQ_TRANSPORT_READ_THREAD_H_
3 
12 #include <string>
13 
22 
23 #include "ace/Task.h"
24 #include "ace/Mutex.h"
25 #include "ace/Barrier.h"
26 #include "ace/Atomic_Op_T.h"
27 #include "ace/Thread_Mutex.h"
28 
29 #include <zmq.h>
30 
31 #include "ace/Synch.h"
32 
33 namespace madara
34 {
35  namespace transport
36  {
43  {
44  public:
57  const TransportSettings & settings,
58  const std::string & id,
59  void * write_socket,
60  BandwidthMonitor & send_monitor,
61  BandwidthMonitor & receive_monitor,
62  PacketScheduler & packet_scheduler);
63 
69 
73  void cleanup (void);
74 
78  void run (void);
79 
88  void rebroadcast (
89  const char * print_prefix,
90  MessageHeader * header,
91  const knowledge::KnowledgeMap& records);
92 
93  private:
96 
99 
102 
105 
107  void * read_socket_;
108 
109 #ifndef _MADARA_NO_KARL_
112 #endif // _MADARA_NO_KARL_
113 
116 
119 
122 
125  };
126  }
127 }
128 
129 #endif // _MADARA_ZEROMQ_TRANSPORT_READ_THREAD_H_
const QoSTransportSettings settings_
quality-of-service transport settings
void init(knowledge::KnowledgeBase &knowledge)
Initializes MADARA context-related items.
const std::string id_
host:port identifier of this process
BandwidthMonitor & send_monitor_
monitor for sending bandwidth usage
madara::knowledge::CompiledExpression on_data_received_
data received rules, defined in Transport settings
void * read_socket_
The multicast socket we are reading from.
knowledge::ThreadSafeContext * context_
knowledge context
void * write_socket_
underlying socket for sending
This class stores variables and their values for use by any entity needing state information in a thr...
Provides scheduler for dropping packets.
BandwidthMonitor & receive_monitor_
monitor for receiving bandwidth usage
void cleanup(void)
Cleanup function called by thread manager.
Holds basic transport settings.
Compiled, optimized KaRL logic.
ZMQTransportReadThread(const TransportSettings &settings, const std::string &id, void *write_socket, BandwidthMonitor &send_monitor, BandwidthMonitor &receive_monitor, PacketScheduler &packet_scheduler)
Constructor.
Abstract base class for implementing threads.
Definition: BaseThread.h:38
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
::std::map< std::string, KnowledgeRecord > KnowledgeMap
Thread for reading knowledge updates through a ZMQ datagram socket.
static constexpr struct madara::knowledge::tags::string_t string
Container for quality-of-service settings.
Provides monitoring capability of a transport&#39;s bandwidth.
Provides functions and classes for the distributed knowledge base.
Copyright (c) 2015 Carnegie Mellon University.
PacketScheduler & packet_scheduler_
scheduler for mimicking target network conditions
void rebroadcast(const char *print_prefix, MessageHeader *header, const knowledge::KnowledgeMap &records)
Sends a rebroadcast packet.
Defines a robust message header which is the default for KaRL messages.
Definition: MessageHeader.h:56
void run(void)
The main loop internals for the read thread.
madara::utility::ScopedArray< char > buffer_
buffer for receiving