From 3dc74c15f76e999768643ed4381196292d5376bc Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 6 May 2019 17:22:58 +0200 Subject: EDI: Implement TCP output --- src/DabMux.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/DabMux.cpp') 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(); - dest->dest_addr = pt_edi_dest.second.get("destination"); - dest->ttl = pt_edi_dest.second.get("ttl", 1); + const auto proto = pt_edi_dest.second.get("protocol"); + if (proto == "udp") { + auto dest = make_shared(); + dest->dest_addr = pt_edi_dest.second.get("destination"); + dest->ttl = pt_edi_dest.second.get("ttl", 1); - dest->source_addr = pt_edi_dest.second.get("source", ""); - dest->source_port = pt_edi_dest.second.get("sourceport"); + dest->source_addr = pt_edi_dest.second.get("source", ""); + dest->source_port = pt_edi_dest.second.get("sourceport"); - edi_conf.destinations.push_back(dest); + edi_conf.destinations.push_back(dest); + } + else if (proto == "tcp") { + auto dest = make_shared(); + dest->listen_port = pt_edi_dest.second.get("listenport"); + dest->max_frames_queued = pt_edi_dest.second.get("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("port"); -- cgit v1.2.3