MADARA  3.1.8
TcpTransportReadThread.h
Go to the documentation of this file.
1 #ifndef _MADARA_TCP_TRANSPORT_READ_THREAD_H_
2 #define _MADARA_TCP_TRANSPORT_READ_THREAD_H_
3 
4 #include <string>
5 
14 
15 #include "ace/Task.h"
16 #include "ace/Mutex.h"
17 #include "ace/Barrier.h"
18 #include "ace/Atomic_Op_T.h"
19 #include "ace/Thread_Mutex.h"
20 
21 #include "ace/Synch.h"
22 
23 namespace madara
24 {
25  namespace transport
26  {
33  {
34  public:
47  const TransportSettings & settings,
48  const std::string & id,
49  std::map <std::string, ACE_INET_Addr> & addresses,
50  BandwidthMonitor & send_monitor,
51  BandwidthMonitor & receive_monitor,
52  PacketScheduler & packet_scheduler);
53 
59 
63  void cleanup (void);
64 
68  void run (void);
69 
78  void rebroadcast (
79  const char * print_prefix,
80  MessageHeader * header,
81  const knowledge::KnowledgeMap& records);
82 
83  private:
86 
89 
92 
94  std::map <std::string, ACE_INET_Addr> & addresses_;
95 
98 
99 #ifndef _MADARA_NO_KARL_
102 #endif // _MADARA_NO_KARL_
103 
106 
109 
112  };
113  }
114 }
115 
116 #endif // _MADARA_TCP_TRANSPORT_READ_THREAD_H_
const std::string id_
host:port identifier of this process
madara::knowledge::CompiledExpression on_data_received_
data received rules, defined in Transport settings
BandwidthMonitor & send_monitor_
monitor for sending bandwidth usage
TcpTransportReadThread(const TransportSettings &settings, const std::string &id, std::map< std::string, ACE_INET_Addr > &addresses, BandwidthMonitor &send_monitor, BandwidthMonitor &receive_monitor, PacketScheduler &packet_scheduler)
Constructor.
void rebroadcast(const char *print_prefix, MessageHeader *header, const knowledge::KnowledgeMap &records)
Sends a rebroadcast packet to all peers.
This class stores variables and their values for use by any entity needing state information in a thr...
Provides scheduler for dropping packets.
Holds basic transport settings.
Compiled, optimized KaRL logic.
madara::utility::ScopedArray< char > buffer_
buffer for sending
void run(void)
The main loop internals for the read thread.
Abstract base class for implementing threads.
Definition: BaseThread.h:38
void cleanup(void)
Cleanup function called by thread manager.
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
::std::map< std::string, KnowledgeRecord > KnowledgeMap
static constexpr struct madara::knowledge::tags::string_t string
BandwidthMonitor & receive_monitor_
monitor for receiving bandwidth usage
void init(knowledge::KnowledgeBase &knowledge)
Initializes MADARA context-related items.
Container for quality-of-service settings.
Provides monitoring capability of a transport&#39;s bandwidth.
Provides functions and classes for the distributed knowledge base.
std::map< std::string, ACE_INET_Addr > & addresses_
internet addresses of our peers
Copyright (c) 2015 Carnegie Mellon University.
knowledge::ThreadSafeContext * context_
knowledge context
PacketScheduler & packet_scheduler_
scheduler for mimicking target network conditions
Defines a robust message header which is the default for KaRL messages.
Definition: MessageHeader.h:56
Thread for reading knowledge updates through a TCP socket (unused but planned)
const QoSTransportSettings settings_
Transport settings.