+void mp::filter::FrontendNet::configure(const xmlNode * ptr, bool test_only)
+{
+ if (!ptr || !ptr->children)
+ {
+ throw mp::filter::FilterException("No ports for Frontend");
+ }
+ std::vector<std::string> ports;
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ if (ptr->type != XML_ELEMENT_NODE)
+ continue;
+ if (!strcmp((const char *) ptr->name, "port"))
+ {
+ std::string 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->children, 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)
+{
+ m_p->m_ports = ports;
+
+ m_p->az = new mp::ZAssocServer *[m_p->m_ports.size()];
+
+ // Create mp::ZAssocServer for each port
+ size_t i;
+ for (i = 0; i<m_p->m_ports.size(); i++)
+ {
+ // create a PDU assoc object (one per mp::ZAssocServer)
+ yazpp_1::PDU_Assoc *as = new yazpp_1::PDU_Assoc(&m_p->mySocketManager);
+
+ // create ZAssoc with PDU Assoc
+ m_p->az[i] = new mp::ZAssocServer(as,
+ m_p->m_session_timeout,
+ m_p->m_connect_max);
+ if (m_p->az[i]->server(m_p->m_ports[i].c_str()))
+ {
+ throw mp::filter::FilterException("Unable to bind to address "
+ + std::string(m_p->m_ports[i]));
+ }
+ }
+}
+
+void mp::filter::FrontendNet::set_listen_duration(int d)