From 7a056ef2cb94fb2fa45d8ecaed9dd97e99749fde Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 22 Aug 2014 11:38:14 +0200 Subject: Add experimental EDI to configuration file --- src/ParserConfigfile.cpp | 62 ++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 23 deletions(-) (limited to 'src/ParserConfigfile.cpp') diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp index f4c1075..2ae6555 100644 --- a/src/ParserConfigfile.cpp +++ b/src/ParserConfigfile.cpp @@ -128,7 +128,8 @@ void parse_configfile(string configuration_file, bool* factumAnalyzer, unsigned long* limit, BaseRemoteController** rc, - int* statsServerPort + int* statsServerPort, + edi_configuration_t* edi ) { using boost::property_tree::ptree; @@ -479,40 +480,55 @@ void parse_configfile(string configuration_file, } - /******************** READ OUTPUT PARAMETERS ***************/ map alloutputs; ptree pt_outputs = pt.get_child("outputs"); for (ptree::iterator it = pt_outputs.begin(); it != pt_outputs.end(); ++it) { string outputuid = it->first; - string uri = pt_outputs.get(outputuid); - size_t proto_pos = uri.find("://"); - if (proto_pos == std::string::npos) { - stringstream ss; - ss << "Output with uid " << outputuid << " no protocol defined!"; - throw runtime_error(ss.str()); + if (outputuid == "edi") { + ptree pt_edi = pt_outputs.get_child("edi"); + + edi->enabled = true; + + edi->dest_addr = pt_edi.get("destination"); + edi->dest_port = pt_edi.get("port"); + edi->source_port = pt_edi.get("sourceport"); + + edi->dump = pt_edi.get("dump"); + edi->enable_pft = pt_edi.get("enable_pft"); + edi->verbose = pt_edi.get("verbose"); } + else { + string uri = pt_outputs.get(outputuid); - char* uri_c = new char[512]; - memset(uri_c, 0, 512); - uri.copy(uri_c, 511); + size_t proto_pos = uri.find("://"); + if (proto_pos == std::string::npos) { + stringstream ss; + ss << "Output with uid " << outputuid << " no protocol defined!"; + throw runtime_error(ss.str()); + } - uri_c[proto_pos] = '\0'; + char* uri_c = new char[512]; + memset(uri_c, 0, 512); + uri.copy(uri_c, 511); - char* outputName = uri_c + proto_pos + 3; + uri_c[proto_pos] = '\0'; - dabOutput* output = new dabOutput(uri_c, outputName); - outputs.push_back(output); + char* outputName = uri_c + proto_pos + 3; - // keep outputs in map, and check for uniqueness of the uid - if (alloutputs.count(outputuid) == 0) { - alloutputs[outputuid] = output; - } - else { - stringstream ss; - ss << "output with uid " << outputuid << " not unique!"; - throw runtime_error(ss.str()); + dabOutput* output = new dabOutput(uri_c, outputName); + outputs.push_back(output); + + // keep outputs in map, and check for uniqueness of the uid + if (alloutputs.count(outputuid) == 0) { + alloutputs[outputuid] = output; + } + else { + stringstream ss; + ss << "output with uid " << outputuid << " not unique!"; + throw runtime_error(ss.str()); + } } } -- cgit v1.2.3