X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Ffilter_frontend_net.cpp;h=71fb5d1fa6c0343bd5b6d3df6d52549273af8356;hb=11dbf51bcfc1565ad3a58f8ecf6b8abc8bfd848a;hp=68f28ba88dacc0efa6e41a9edf162f86c22df03f;hpb=d8ae25e485e2b560d7990fadbd061c45e70b69a6;p=metaproxy-moved-to-github.git diff --git a/src/filter_frontend_net.cpp b/src/filter_frontend_net.cpp index 68f28ba..71fb5d1 100644 --- a/src/filter_frontend_net.cpp +++ b/src/filter_frontend_net.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_frontend_net.cpp,v 1.9 2005-11-07 21:57:10 adam Exp $ +/* $Id: filter_frontend_net.cpp,v 1.13 2006-01-09 18:18:07 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -7,6 +7,7 @@ #include "config.hpp" +#include "xmlutil.hpp" #include "pipe.hpp" #include "filter.hpp" #include "router.hpp" @@ -242,6 +243,9 @@ void yp2::My_Timer_Thread::socketNotify(int event) } void yp2::filter::FrontendNet::process(Package &package) const { + if (m_ports.size() == 0) + return; + yazpp_1::SocketManager mySocketManager; My_Timer_Thread *tt = 0; @@ -275,6 +279,33 @@ void yp2::filter::FrontendNet::process(Package &package) const { delete tt; } +void yp2::filter::FrontendNet::configure(const xmlNode * ptr) +{ + if (!ptr || !ptr->children) + { + throw yp2::filter::FilterException("No ports for Frontend"); + } + std::vector 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 = yp2::xml::get_text(ptr); + ports.push_back(port); + + } + else + { + throw yp2::filter::FilterException("Bad element " + + std::string((const char *) + ptr->name)); + } + } + m_ports = ports; +} + std::vector &yp2::filter::FrontendNet::ports() { return m_ports; @@ -285,6 +316,19 @@ int &yp2::filter::FrontendNet::listen_duration() return m_listen_duration; } +static yp2::filter::Base* filter_creator() +{ + return new yp2::filter::FrontendNet; +} + +extern "C" { + struct yp2_filter_struct yp2_filter_frontend_net = { + 0, + "frontend_net", + filter_creator + }; +} + /* * Local variables: * c-basic-offset: 4