rogue
Loading...
Searching...
No Matches
TcpCore.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_INTERFACES_STREAM_TCP_CORE_H__
18#define __ROGUE_INTERFACES_STREAM_TCP_CORE_H__
19#include "rogue/Directives.h"
20
21#include <stdint.h>
22
23#include <memory>
24#include <string>
25#include <thread>
26
27#include "rogue/Logging.h"
31
32namespace rogue {
33namespace interfaces {
34namespace stream {
35
52 protected:
53 // Inbound Address
54 std::string pullAddr_;
55
56 // Outbound Address
57 std::string pushAddr_;
58
59 // Zeromq Context
60 void* zmqCtx_;
61
62 // Zeromq inbound port
63 void* zmqPull_;
64
65 // Zeromq outbound port
66 void* zmqPush_;
67
68 // Thread background
69 void runThread();
70
71 // Log
72 std::shared_ptr<rogue::Logging> bridgeLog_;
73
74 // Thread
75 std::thread* thread_;
77
78 // Lock
79 std::mutex bridgeMtx_;
80
81 public:
98 static std::shared_ptr<rogue::interfaces::stream::TcpCore> create(const std::string& addr, uint16_t port, bool server);
99
101 static void setup_python();
102
121 TcpCore(const std::string& addr, uint16_t port, bool server);
122
124 ~TcpCore();
125
127 void close();
128
130 void stop();
131
137 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
138};
139
141typedef std::shared_ptr<rogue::interfaces::stream::TcpCore> TcpCorePtr;
142
143} // namespace stream
144} // namespace interfaces
145}; // namespace rogue
146
147#endif
Stream master endpoint.
Definition Master.h:65
static std::shared_ptr< rogue::interfaces::stream::Master > create()
Creates a stream master.
Definition Master.cpp:40
Stream slave endpoint and default frame pool.
Definition Slave.h:72
Stream TCP bridge core implementation.
Definition TcpCore.h:51
void close()
Closes active bridge connections.
Definition TcpCore.cpp:152
std::shared_ptr< rogue::Logging > bridgeLog_
Definition TcpCore.h:72
static void setup_python()
Registers this type with Python bindings.
Definition TcpCore.cpp:292
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Receives a frame from upstream and forwards over the TCP bridge.
Definition TcpCore.cpp:168
~TcpCore()
Destroys the bridge core and releases resources.
Definition TcpCore.cpp:147
void stop()
Stops the interface and worker thread.
Definition TcpCore.cpp:156
std::shared_ptr< rogue::interfaces::stream::TcpCore > TcpCorePtr
Shared pointer alias for TcpCore.
Definition TcpCore.h:141