- for (size_t i = 0; i < params.moduleParams.size(); ++i)
- if (params.moduleParams[i].param == paramName)
- return toInt<T>(params.moduleParams[i].value);
- return 0;
+ size_t pos = address.find_first_of(':');
+ if (pos == std::string::npos)
+ throw ParserError(0, "Connection type is not specified. Should be either 'unix' or 'tcp'.");
+ return address.substr(pos + 1);
+}
+
+Config::Type parseConnectionType(const std::string& address)
+{
+ size_t pos = address.find_first_of(':');
+ if (pos == std::string::npos)
+ throw ParserError(0, "Connection type is not specified. Should be either 'unix' or 'tcp'.");
+ std::string type = ToLower(address.substr(0, pos));
+ if (type == "unix")
+ return Config::UNIX;
+ else if (type == "tcp")
+ return Config::TCP;
+ throw ParserError(0, "Invalid connection type. Should be either 'unix' or 'tcp', got '" + type + "'");
+}
+
+Config::Section parseSection(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+{
+ for (size_t i = 0; i < params.size(); ++i)
+ if (params[i].param == paramName)
+ return Config::Section(parseVector("match", params[i].sections),
+ parseVector("modify", params[i].sections),
+ parseVector("reply", params[i].sections));
+ return Config::Section();