summaryrefslogtreecommitdiffstats
path: root/src/DabMux.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/DabMux.cpp
parent956814cc526bdd245e52c5004bf5661a57d848cc (diff)
downloaddabmux-3dc74c15f76e999768643ed4381196292d5376bc.tar.gz
dabmux-3dc74c15f76e999768643ed4381196292d5376bc.tar.bz2
dabmux-3dc74c15f76e999768643ed4381196292d5376bc.zip
EDI: Implement TCP output
Diffstat (limited to 'src/DabMux.cpp')
-rw-r--r--src/DabMux.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 3d0a7d9..b9ee9fd 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -293,14 +293,26 @@ int main(int argc, char *argv[])
if (outputuid == "edi") {
ptree pt_edi = pt_outputs.get_child("edi");
for (auto pt_edi_dest : pt_edi.get_child("destinations")) {
- auto dest = make_shared<edi::udp_destination_t>();
- dest->dest_addr = pt_edi_dest.second.get<string>("destination");
- dest->ttl = pt_edi_dest.second.get<unsigned int>("ttl", 1);
+ const auto proto = pt_edi_dest.second.get<string>("protocol");
+ if (proto == "udp") {
+ auto dest = make_shared<edi::udp_destination_t>();
+ dest->dest_addr = pt_edi_dest.second.get<string>("destination");
+ dest->ttl = pt_edi_dest.second.get<unsigned int>("ttl", 1);
- dest->source_addr = pt_edi_dest.second.get<string>("source", "");
- dest->source_port = pt_edi_dest.second.get<unsigned int>("sourceport");
+ dest->source_addr = pt_edi_dest.second.get<string>("source", "");
+ dest->source_port = pt_edi_dest.second.get<unsigned int>("sourceport");
- edi_conf.destinations.push_back(dest);
+ edi_conf.destinations.push_back(dest);
+ }
+ else if (proto == "tcp") {
+ auto dest = make_shared<edi::tcp_destination_t>();
+ dest->listen_port = pt_edi_dest.second.get<unsigned int>("listenport");
+ dest->max_frames_queued = pt_edi_dest.second.get<size_t>("max_frames_queued", 500);
+ edi_conf.destinations.push_back(dest);
+ }
+ else {
+ throw runtime_error("Unknown EDI protocol " + proto);
+ }
}
edi_conf.dest_port = pt_edi.get<unsigned int>("port");