+void mp::filter::FrontendNet::configure(const xmlNode * ptr, bool test_only,
+ const char *path)
+{
+ if (!ptr || !ptr->children)
+ {
+ throw mp::filter::FilterException("No ports for Frontend");
+ }
+ std::vector<Port> ports;
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ if (ptr->type != XML_ELEMENT_NODE)
+ continue;
+ if (!strcmp((const char *) ptr->name, "port"))
+ {
+ Port port;
+ const struct _xmlAttr *attr;
+ for (attr = ptr->properties; attr; attr = attr->next)
+ {
+ if (!strcmp((const char *) attr->name, "route"))
+ port.route = mp::xml::get_text(attr);
+ }
+ port.port = mp::xml::get_text(ptr);
+ ports.push_back(port);
+
+ }
+ else if (!strcmp((const char *) ptr->name, "threads"))
+ {
+ std::string threads_str = mp::xml::get_text(ptr);
+ int threads = atoi(threads_str.c_str());
+ if (threads < 1)
+ throw mp::filter::FilterException("Bad value for threads: "
+ + threads_str);
+ m_p->m_no_threads = threads;
+ }
+ else if (!strcmp((const char *) ptr->name, "timeout"))
+ {
+ std::string timeout_str = mp::xml::get_text(ptr);
+ int timeout = atoi(timeout_str.c_str());
+ if (timeout < 1)
+ throw mp::filter::FilterException("Bad value for timeout: "
+ + timeout_str);
+ m_p->m_session_timeout = timeout;
+ }
+ else if (!strcmp((const char *) ptr->name, "connect-max"))
+ {
+ m_p->m_connect_max = mp::xml::get_int(ptr, 0);
+ }
+ else
+ {
+ throw mp::filter::FilterException("Bad element "
+ + std::string((const char *)
+ ptr->name));
+ }
+ }
+ if (test_only)
+ return;
+ set_ports(ports);
+}
+
+void mp::filter::FrontendNet::set_ports(std::vector<std::string> &ports)
+{
+ std::vector<Port> nports;
+ size_t i;
+
+ for (i = 0; i < ports.size(); i++)
+ {
+ Port nport;
+
+ nport.port = ports[i];
+
+ nports.push_back(nport);
+ }
+ set_ports(nports);
+}
+
+
+void mp::filter::FrontendNet::set_ports(std::vector<Port> &ports)