summaryrefslogtreecommitdiffstats
path: root/src/dabOutput/edi/Transport.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-05-06 17:22:58 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-05-06 17:22:58 +0200
commit3dc74c15f76e999768643ed4381196292d5376bc (patch)
tree0540853e389062d81084f9735a521b8b6e58feaf /src/dabOutput/edi/Transport.cpp
parent956814cc526bdd245e52c5004bf5661a57d848cc (diff)
downloaddabmux-3dc74c15f76e999768643ed4381196292d5376bc.tar.gz
dabmux-3dc74c15f76e999768643ed4381196292d5376bc.tar.bz2
dabmux-3dc74c15f76e999768643ed4381196292d5376bc.zip
EDI: Implement TCP output
Diffstat (limited to 'src/dabOutput/edi/Transport.cpp')
-rw-r--r--src/dabOutput/edi/Transport.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/dabOutput/edi/Transport.cpp b/src/dabOutput/edi/Transport.cpp
index d433239..d99e987 100644
--- a/src/dabOutput/edi/Transport.cpp
+++ b/src/dabOutput/edi/Transport.cpp
@@ -38,13 +38,17 @@ void configuration_t::print() const
etiLog.level(info) << " verbose " << verbose;
for (auto edi_dest : destinations) {
if (auto udp_dest = dynamic_pointer_cast<edi::udp_destination_t>(edi_dest)) {
- etiLog.level(info) << " to " << udp_dest->dest_addr << ":" << dest_port;
+ etiLog.level(info) << " UDP to " << udp_dest->dest_addr << ":" << dest_port;
if (not udp_dest->source_addr.empty()) {
etiLog.level(info) << " source " << udp_dest->source_addr;
etiLog.level(info) << " ttl " << udp_dest->ttl;
}
etiLog.level(info) << " source port " << udp_dest->source_port;
}
+ else if (auto tcp_dest = dynamic_pointer_cast<edi::tcp_destination_t>(edi_dest)) {
+ etiLog.level(info) << " TCP listening on port " << tcp_dest->listen_port;
+ etiLog.level(info) << " max frames queued " << tcp_dest->max_frames_queued;
+ }
else {
throw std::logic_error("EDI destination not implemented");
}
@@ -80,6 +84,14 @@ Sender::Sender(const configuration_t& conf) :
udp_sockets.emplace(udp_dest.get(), udp_socket);
}
+ else if (auto tcp_dest = dynamic_pointer_cast<edi::tcp_destination_t>(edi_dest)) {
+ auto dispatcher = make_shared<TCPDataDispatcher>(tcp_dest->max_frames_queued);
+ dispatcher->start(tcp_dest->listen_port, "0.0.0.0");
+ tcp_dispatchers.emplace(tcp_dest.get(), dispatcher);
+ }
+ else {
+ throw std::logic_error("EDI destination not implemented");
+ }
}
if (m_conf.interleaver_enabled()) {
@@ -123,6 +135,9 @@ void Sender::write(const TagPacket& tagpacket)
udp_sockets.at(udp_dest.get())->send(edi_frag, addr);
}
+ else if (auto tcp_dest = dynamic_pointer_cast<edi::tcp_destination_t>(dest)) {
+ tcp_dispatchers.at(tcp_dest.get())->write(edi_frag);
+ }
else {
throw std::logic_error("EDI destination not implemented");
}
@@ -149,6 +164,9 @@ void Sender::write(const TagPacket& tagpacket)
udp_sockets.at(udp_dest.get())->send(af_packet, addr);
}
+ else if (auto tcp_dest = dynamic_pointer_cast<edi::tcp_destination_t>(dest)) {
+ tcp_dispatchers.at(tcp_dest.get())->write(af_packet);
+ }
else {
throw std::logic_error("EDI destination not implemented");
}