## This file is part of Metaproxy
## Copyright (C) 2005-2010 Index Data
-SUBDIRS = xml src etc doc
+SUBDIRS = xml include src etc doc
ACLOCAL_AMFLAGS = -I m4
AC_CONFIG_FILES([
Doxyfile
Makefile
+ include/Makefile include/metaproxy/Makefile
src/Makefile
xml/Makefile
xml/schema/Makefile
--- /dev/null
+## This file is part of Metaproxy
+## Copyright (C) 2005-2010 Index Data
+
+SUBDIRS = metaproxy
+
--- /dev/null
+## This file is part of Metaproxy
+## Copyright (C) 2005-2010 Index Data
+
+pkginclude_HEADERS= filter.hpp origin.hpp package.hpp \
+ router.hpp session.hpp util.hpp xmlutil.hpp
+
--- /dev/null
+/* This file is part of Metaproxy.
+ Copyright (C) 2005-2010 Index Data
+
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef FILTER_HPP
+#define FILTER_HPP
+
+#include <string>
+#include <stdexcept>
+#include <libxml/tree.h>
+#include "xmlutil.hpp"
+
+namespace metaproxy_1 {
+
+ class Package;
+
+ namespace filter {
+ class Base {
+ public:
+ virtual ~Base(){};
+
+ ///sends Package off to next Filter, returns altered Package
+ virtual void process(Package & package) const = 0;
+
+ /// configuration during filter load
+ virtual void configure(const xmlNode * ptr, bool test_only);
+ };
+
+ class FilterException : public std::runtime_error {
+ public:
+ FilterException(const std::string message)
+ : std::runtime_error("FilterException: " + message){
+ };
+ };
+ }
+}
+
+struct metaproxy_1_filter_struct {
+ int ver;
+ const char *type;
+ metaproxy_1::filter::Base* (*creator)();
+};
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
--- /dev/null
+/* This file is part of Metaproxy.
+ Copyright (C) 2005-2010 Index Data
+
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef YP2_ORIGIN_HPP
+#define YP2_ORIGIN_HPP
+
+#include <iosfwd>
+#include <string>
+
+namespace metaproxy_1 {
+ class Origin;
+}
+
+namespace std {
+ std::ostream& operator<<(std::ostream& os, metaproxy_1::Origin& o);
+}
+
+namespace metaproxy_1 {
+
+ class Origin {
+ public:
+ Origin(std::string listen_host = "", unsigned int listen_port = 0);
+
+ /// get function - right val in assignment
+ std::string listen_host() const;
+
+ /// set function - left val in assignment
+ std::string & listen_host();
+
+ /// get function - right val in assignment
+ unsigned int listen_port() const;
+
+ /// set function - left val in assignment
+ unsigned int & listen_port();
+
+ /// set client IP info - left val in assignment
+ void set_tcpip_address(std::string addr, unsigned long id);
+
+ /// set max sockets (for outgoing connections to a given target)
+ void set_max_sockets(int max_sockets);
+
+ /// set max sockets (for outgoing connections to a given target)
+ int get_max_sockets();
+
+ /// get tcpip address
+ std::string get_address();
+ private:
+ friend std::ostream&
+ std::operator<<(std::ostream& os, metaproxy_1::Origin& o);
+
+ enum origin_t {
+ API,
+ UNIX,
+ TCPIP
+ } m_type;
+ std::string m_address; // UNIX+TCPIP
+ unsigned int m_origin_id;
+ std::string m_listen_host;
+ unsigned int m_listen_port;
+ int m_max_sockets;
+ };
+
+}
+
+
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
--- /dev/null
+/* This file is part of Metaproxy.
+ Copyright (C) 2005-2010 Index Data
+
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef YP2_PACKAGE_HPP
+#define YP2_PACKAGE_HPP
+
+#include <iosfwd>
+
+#include <yazpp/gdu.h>
+
+#include "router.hpp"
+#include "filter.hpp"
+#include "session.hpp"
+#include "origin.hpp"
+
+namespace metaproxy_1 {
+ class Package;
+}
+
+
+namespace std
+{
+ std::ostream& operator<<(std::ostream& os, metaproxy_1::Package& p);
+}
+
+namespace metaproxy_1 {
+
+ class Package {
+ public:
+ Package();
+
+ ~Package();
+
+ Package(metaproxy_1::Session &session,
+ const metaproxy_1::Origin &origin);
+
+ /// shallow copy constructor which only copies the filter chain info
+ Package & copy_filter(const Package &p);
+
+ /// send Package to it's next Filter defined in Router
+ void move();
+
+ /// send Package to other route
+ void move(std::string route);
+
+ /// access session - left val in assignment
+ metaproxy_1::Session & session();
+
+ /// get function - right val in assignment
+ Origin origin() const;
+
+ /// set function - left val in assignment
+ Origin & origin();
+
+ /// set function - can be chained
+ Package & origin(const Origin & origin);
+
+ /// set function - can be chained
+ Package & router(const Router &router);
+
+ yazpp_1::GDU &request();
+
+ yazpp_1::GDU &response();
+
+ /// get function - right val in assignment
+ Session session() const;
+
+ private:
+ Session m_session;
+ Origin m_origin;
+
+ RoutePos *m_route_pos;
+
+ //int m_data;
+
+ yazpp_1::GDU m_request_gdu;
+ yazpp_1::GDU m_response_gdu;
+ };
+}
+
+
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
--- /dev/null
+/* This file is part of Metaproxy.
+ Copyright (C) 2005-2010 Index Data
+
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef ROUTER_HPP
+#define ROUTER_HPP
+
+#include <boost/noncopyable.hpp>
+#include <string>
+#include <stdexcept>
+
+namespace metaproxy_1
+{
+ namespace filter {
+ class Base;
+ }
+ class RoutePos;
+
+ class RouterException : public std::runtime_error {
+ public:
+ RouterException(const std::string message)
+ : std::runtime_error("RouterException: " + message){};
+ };
+
+ class Router : boost::noncopyable {
+ public:
+ Router(){};
+ virtual ~Router(){};
+
+ virtual RoutePos *createpos() const = 0;
+ };
+
+ class RoutePos : boost::noncopyable {
+ public:
+ virtual const filter::Base *move(const char *route) = 0;
+ virtual RoutePos *clone() = 0;
+ virtual ~RoutePos() {};
+ };
+}
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
--- /dev/null
+/* This file is part of Metaproxy.
+ Copyright (C) 2005-2010 Index Data
+
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef SESSION_HPP
+#define SESSION_HPP
+
+//#include <stdexcept>
+#include <map>
+#include <boost/thread/mutex.hpp>
+
+namespace metaproxy_1 {
+
+ class Session
+ {
+ //typedef unsigned long type;
+ public:
+
+ /// create new session with new unique id
+ Session() {
+ boost::mutex::scoped_lock scoped_lock(m_mutex);
+ ++m_global_id;
+ m_id = m_global_id;
+ m_close = false;
+ }
+
+ /// copy session including old id
+ Session(const Session &s) : m_id(s.m_id), m_close(s.m_close) {};
+
+ Session& operator=(const Session &s) {
+ if (this != &s)
+ {
+ m_id = s.m_id;
+ m_close = s.m_close;
+ }
+ return *this;
+ }
+
+ bool operator<(const Session &s) const {
+ return m_id < s.m_id ? true : false;
+ }
+
+ unsigned long id() const {
+ return m_id;
+ }
+
+ bool is_closed() const {
+ return m_close;
+ }
+
+ /// mark session closed, can not be unset
+ void close() {
+ m_close = true;
+ }
+
+ bool operator == (Session &ses) const {
+ return ses.m_id == m_id;
+ }
+
+ private:
+
+ unsigned long int m_id;
+ bool m_close;
+
+ /// static mutex to lock static m_id
+ static boost::mutex m_mutex;
+
+ /// static m_id to make sure that there is only one id counter
+ static unsigned long int m_global_id;
+
+ };
+
+ template <class T> class session_map {
+ public:
+ void create(T &t, const metaproxy_1::Session &s) {
+ boost::mutex::scoped_lock lock(m_map_mutex);
+ m_map[s] = SessionItem(t);
+ };
+ void release(const metaproxy_1::Session &s) {
+ boost::mutex::scoped_lock lock(m_map_mutex);
+
+ m_map.erase(s);
+ };
+#if 0
+ T &get_session_data(const metaproxy_1::Session &s) {
+ boost::mutex::scoped_lock lock(m_map_mutex);
+
+ typename std::map<metaproxy_1::Session,SessionItem>::const_iterator it;
+ it = m_map.find(s);
+ if (it == m_map.end())
+ return 0;
+ boost::mutx::scoped_lock *scoped_ptr =
+ new boost::mutex::scoped_lock(it->second->m_item_mutex);
+ };
+#endif
+ bool exist(const metaproxy_1::Session &s) {
+ typename std::map<metaproxy_1::Session,SessionItem>::const_iterator it;
+ it = m_map.find(s);
+ return it == m_map.end() ? false : true;
+ }
+ private:
+ class SessionItem {
+ public:
+ SessionItem() {};
+ SessionItem(T &t) : m_t(t) {};
+ SessionItem &operator =(const SessionItem &s) {
+ if (this != &s) {
+ m_t = s.m_t;
+ }
+ return *this;
+ };
+ SessionItem(const SessionItem &s) {
+ m_t = s.m_t;
+ };
+ T m_t;
+ boost::mutex m_item_mutex;
+ };
+ private:
+ boost::mutex m_map_mutex;
+ std::map<metaproxy_1::Session,SessionItem>m_map;
+ };
+
+}
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
--- /dev/null
+/* This file is part of Metaproxy.
+ Copyright (C) 2005-2010 Index Data
+
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef YP2_UTIL_HPP
+#define YP2_UTIL_HPP
+
+#include "package.hpp"
+
+#include <yaz/z-core.h>
+
+#include <boost/utility.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <list>
+#include <vector>
+#include <sstream>
+#include <string>
+
+
+namespace metaproxy_1 {
+ namespace util {
+
+
+ template<typename T>
+ std::string to_string(const T& t)
+ {
+ std::ostringstream o;
+ if(o << t)
+ return o.str();
+ return std::string();
+ };
+
+ const char *
+ record_composition_to_esn(Z_RecordComposition *comp);
+
+ std::string http_header_value(const Z_HTTP_Header* header,
+ const std::string name);
+
+ std::string http_headers_debug(const Z_HTTP_Request &http_req);
+
+ void http_response(metaproxy_1::Package &package,
+ const std::string &content,
+ int http_code = 200);
+
+
+ int memcmp2(const void *buf1, int len1, const void *buf2, int len2);
+
+ std::string database_name_normalize(const std::string &s);
+
+ bool pqf(ODR odr, Z_APDU *apdu, const std::string &q);
+
+ std::string zQueryToString(Z_Query *query);
+
+ Z_ReferenceId **get_referenceId(const Z_APDU *apdu);
+
+ void transfer_referenceId(ODR odr, const Z_APDU *src, Z_APDU *dst);
+
+ Z_APDU *create_APDU(ODR odr, int type, const Z_APDU *in_apdu);
+
+ bool set_databases_from_zurl(ODR odr, std::string zurl,
+ int *db_num, char ***db_strings);
+
+ void split_zurl(std::string zurl, std::string &host,
+ std::list<std::string> &db);
+
+ void get_vhost_otherinfo(Z_OtherInformation *otherInformation,
+ std::list<std::string> &vhosts);
+
+ int remove_vhost_otherinfo(Z_OtherInformation **otherInformation,
+ std::list<std::string> &vhosts);
+
+ void set_vhost_otherinfo(Z_OtherInformation **otherInformation,
+ ODR odr,
+ const std::string vhost,
+ const int cat);
+
+ void set_vhost_otherinfo(Z_OtherInformation **otherInformation,
+ ODR odr,
+ const std::list<std::string> &vhosts);
+
+ int get_or_remove_vhost_otherinfo(
+ Z_OtherInformation **otherInformation,
+ bool remove_flag,
+ std::list<std::string> &vhosts);
+
+ void get_init_diagnostics(Z_InitResponse *res,
+ int &error_code, std::string &addinfo);
+
+ void get_default_diag(Z_DefaultDiagFormat *r,
+ int &error_code, std::string &addinfo);
+
+ void piggyback(int smallSetUpperBound,
+ int largeSetLowerBound,
+ int mediumSetPresentNumber,
+ int result_set_size,
+ int &number_to_present);
+
+ };
+
+ class odr : public boost::noncopyable {
+ public:
+ odr(int type);
+ odr();
+ ~odr();
+ operator ODR() const;
+ Z_APDU *create_close(const Z_APDU *in_apdu,
+ int reason, const char *addinfo);
+ Z_APDU *create_initResponse(const Z_APDU *in_apdu,
+ int error, const char *addinfo);
+ Z_APDU *create_searchResponse(const Z_APDU *in_apdu,
+ int error, const char *addinfo);
+ Z_APDU *create_presentResponse(const Z_APDU *in_apdu,
+ int error, const char *addinfo);
+ Z_APDU *create_scanResponse(const Z_APDU *in_apdu,
+ int error, const char *addinfo);
+ Z_APDU *create_APDU(int type, const Z_APDU *in_apdu);
+
+ Z_GDU *create_HTTP_Response(metaproxy_1::Session &session,
+ Z_HTTP_Request *req, int code);
+ private:
+ ODR m_odr;
+ };
+
+ class PlainFile {
+ class Rep;
+ boost::scoped_ptr<Rep> m_p;
+ public:
+ PlainFile();
+ ~PlainFile();
+ bool open(const std::string &fname);
+ bool getline(std::vector<std::string> &args);
+ };
+}
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
--- /dev/null
+/* This file is part of Metaproxy.
+ Copyright (C) 2005-2010 Index Data
+
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef XML_UTIL_HPP
+#define XML_UTIL_HPP
+
+#include <string>
+#include <stdexcept>
+#include <libxml/tree.h>
+
+namespace metaproxy_1 {
+ namespace xml {
+ std::string get_text(const struct _xmlAttr *ptr);
+ std::string get_text(const xmlNode *ptr);
+ bool get_bool(const xmlNode *ptr, bool default_value);
+ int get_int(const xmlNode *ptr, int default_value);
+ bool check_attribute(const _xmlAttr *ptr,
+ const std::string &ns,
+ const std::string &name);
+ bool is_attribute(const _xmlAttr *ptr,
+ const std::string &ns,
+ const std::string &name);
+ bool is_element(const xmlNode *ptr,
+ const std::string &ns,
+ const std::string &name);
+ bool is_element_mp(const xmlNode *ptr, const std::string &name);
+ bool check_element_mp(const xmlNode *ptr,
+ const std::string &name);
+ std::string get_route(const xmlNode *node);
+
+ const xmlNode* jump_to(const xmlNode* node, int node_type);
+
+ const xmlNode* jump_to_next(const xmlNode* node, int node_type);
+
+ const xmlNode* jump_to_children(const xmlNode* node, int node_type);
+
+ void check_empty(const xmlNode *node);
+
+ }
+ class XMLError : public std::runtime_error {
+ public:
+ XMLError(const std::string msg) :
+ std::runtime_error("XMLError : " + msg) {} ;
+ };
+}
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
AM_CXXFLAGS = $(BOOST_CPPFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
AM_LDFLAGS =
# Rules for the library..
libmetaproxy_la_SOURCES = \
factory_filter.cpp factory_filter.hpp \
factory_static.cpp factory_static.hpp \
- filter.hpp filter.cpp \
+ filter.cpp \
filter_auth_simple.cpp filter_auth_simple.hpp \
filter_backend_test.cpp filter_backend_test.hpp \
filter_bounce.cpp filter_bounce.hpp \
filter_z3950_client.cpp filter_z3950_client.hpp \
filter_zeerex_explain.cpp filter_zeerex_explain.hpp \
gduutil.cpp gduutil.hpp \
- origin.cpp origin.hpp \
- package.cpp package.hpp \
+ origin.cpp \
+ package.cpp \
pipe.cpp pipe.hpp \
plainfile.cpp \
- router.hpp router_chain.hpp router_chain.cpp \
+ router_chain.hpp router_chain.cpp \
router_flexml.hpp router_flexml.cpp \
- session.cpp session.hpp \
+ session.cpp \
sru_util.cpp sru_util.hpp \
thread_pool_observer.cpp thread_pool_observer.hpp \
- util.cpp util.hpp \
- xmlutil.cpp xmlutil.hpp
+ util.cpp \
+ xmlutil.cpp
libmetaproxy_la_LIBADD = $(YAZPPLALIB) $(BOOST_LIB) $(BOOST_THREAD_LIB)
#include <stdexcept>
#include <yaz/options.h>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "filter_frontend_net.hpp"
#include "filter_z3950_client.hpp"
#include "filter_virt_db.hpp"
#include "filter_log.hpp"
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
namespace mp = metaproxy_1;
#include <iostream>
#include <stdexcept>
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include "router_flexml.hpp"
#include "factory_static.hpp"
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
class FactoryFilter : public boost::noncopyable
#include "factory_static.hpp"
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include "factory_filter.hpp"
#include <stdexcept>
#include "config.hpp"
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace mp = metaproxy_1;
+++ /dev/null
-/* This file is part of Metaproxy.
- Copyright (C) 2005-2010 Index Data
-
-Metaproxy is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef FILTER_HPP
-#define FILTER_HPP
-
-#include <string>
-#include <stdexcept>
-#include <libxml/tree.h>
-#include "xmlutil.hpp"
-
-namespace metaproxy_1 {
-
- class Package;
-
- namespace filter {
- class Base {
- public:
- virtual ~Base(){};
-
- ///sends Package off to next Filter, returns altered Package
- virtual void process(Package & package) const = 0;
-
- /// configuration during filter load
- virtual void configure(const xmlNode * ptr, bool test_only);
- };
-
- class FilterException : public std::runtime_error {
- public:
- FilterException(const std::string message)
- : std::runtime_error("FilterException: " + message){
- };
- };
- }
-}
-
-struct metaproxy_1_filter_struct {
- int ver;
- const char *type;
- metaproxy_1::filter::Base* (*creator)();
-};
-
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/algorithm/string.hpp>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "filter_auth_simple.hpp"
#include <yaz/zgdu.h>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
-#include "util.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include "filter_backend_test.hpp"
#include <stdexcept>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "filter_bounce.hpp"
-#include "package.hpp"
-#include "util.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include "gduutil.hpp"
#include <yaz/zgdu.h>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "config.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include "filter_cql_to_rpn.hpp"
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
namespace mp = metaproxy_1;
#include "config.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "pipe.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include "thread_pool_observer.hpp"
#include "filter_frontend_net.hpp"
#include <yazpp/z-assoc.h>
#include <stdexcept>
#include <vector>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
-#include "util.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include "filter_http_file.hpp"
#include <yaz/zgdu.h>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
#include <time.h>
#include <yaz/log.h>
#include <yazpp/timestat.h>
-#include "package.hpp"
-#include "util.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
namespace mp = metaproxy_1;
namespace yf = mp::filter;
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "config.hpp"
-#include "session.hpp"
-#include "package.hpp"
-#include "filter.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/filter.hpp>
#include "filter_load_balance.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "filter_log.hpp"
#include "config.hpp"
-#include "package.hpp"
+#include "filter_log.hpp"
+#include <metaproxy/package.hpp>
#include <string>
#include <sstream>
#include <boost/thread/mutex.hpp>
#include "gduutil.hpp"
-#include "util.hpp"
-#include "xmlutil.hpp"
+#include <metaproxy/util.hpp>
+#include <metaproxy/xmlutil.hpp>
#include <yaz/zgdu.h>
#include <yaz/wrbuf.h>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/shared_ptr.hpp>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "filter_multi.hpp"
#include <yaz/zgdu.h>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
-#include "util.hpp"
-#include "xmlutil.hpp"
+#include <metaproxy/util.hpp>
#include "filter_query_rewrite.hpp"
#include <yaz/zgdu.h>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "config.hpp"
-#include "filter.hpp"
#include "filter_record_transform.hpp"
-#include "package.hpp"
-#include "util.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include "gduutil.hpp"
-#include "xmlutil.hpp"
#include <yaz/diagbib1.h>
#include <yaz/zgdu.h>
#include <yaz/retrieval.h>
-//#include <boost/thread/mutex.hpp>
-
#include <iostream>
namespace mp = metaproxy_1;
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/format.hpp>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "filter_session_shared.hpp"
#include <yaz/log.h>
#include <list>
#include <map>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
#define NOMINMAX 1
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
-#include "util.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include "gduutil.hpp"
#include "sru_util.hpp"
#include "filter_sru_to_z3950.hpp"
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "config.hpp"
-#include "filter.hpp"
#include "filter_template.hpp"
-#include "package.hpp"
-#include "util.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include "filter_virt_db.hpp"
+#include <metaproxy/package.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/shared_ptr.hpp>
-#include "util.hpp"
-#include "filter_virt_db.hpp"
+#include <metaproxy/util.hpp>
#include <yaz/zgdu.h>
#include <yaz/otherinfo.h>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
-#include "util.hpp"
#include "filter_z3950_client.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include <map>
#include <stdexcept>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
-#include "util.hpp"
+#include "filter_zeerex_explain.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
#include "gduutil.hpp"
#include "sru_util.hpp"
-#include "filter_zeerex_explain.hpp"
#include <yaz/zgdu.h>
#include <yaz/z-core.h>
#include <boost/scoped_ptr.hpp>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
namespace metaproxy_1 {
namespace filter {
*/
#include "gduutil.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include <yaz/wrbuf.h>
#include <yaz/oid_db.h>
#include <stdexcept>
#include <libxml/xinclude.h>
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include "router_flexml.hpp"
#include "factory_static.hpp"
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//#include "config.hpp"
-#include "origin.hpp"
+#include "config.hpp"
+#include <metaproxy/origin.hpp>
#include <iostream>
+++ /dev/null
-/* This file is part of Metaproxy.
- Copyright (C) 2005-2010 Index Data
-
-Metaproxy is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef YP2_ORIGIN_HPP
-#define YP2_ORIGIN_HPP
-
-#include <iosfwd>
-#include <string>
-
-namespace metaproxy_1 {
- class Origin;
-}
-
-namespace std {
- std::ostream& operator<<(std::ostream& os, metaproxy_1::Origin& o);
-}
-
-namespace metaproxy_1 {
-
- class Origin {
- public:
- Origin(std::string listen_host = "", unsigned int listen_port = 0);
-
- /// get function - right val in assignment
- std::string listen_host() const;
-
- /// set function - left val in assignment
- std::string & listen_host();
-
- /// get function - right val in assignment
- unsigned int listen_port() const;
-
- /// set function - left val in assignment
- unsigned int & listen_port();
-
- /// set client IP info - left val in assignment
- void set_tcpip_address(std::string addr, unsigned long id);
-
- /// set max sockets (for outgoing connections to a given target)
- void set_max_sockets(int max_sockets);
-
- /// set max sockets (for outgoing connections to a given target)
- int get_max_sockets();
-
- /// get tcpip address
- std::string get_address();
- private:
- friend std::ostream&
- std::operator<<(std::ostream& os, metaproxy_1::Origin& o);
-
- enum origin_t {
- API,
- UNIX,
- TCPIP
- } m_type;
- std::string m_address; // UNIX+TCPIP
- unsigned int m_origin_id;
- std::string m_listen_host;
- unsigned int m_listen_port;
- int m_max_sockets;
- };
-
-}
-
-
-
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
*/
#include "config.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#include <iostream>
+++ /dev/null
-/* This file is part of Metaproxy.
- Copyright (C) 2005-2010 Index Data
-
-Metaproxy is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef YP2_PACKAGE_HPP
-#define YP2_PACKAGE_HPP
-
-#include <iosfwd>
-
-#include <yazpp/gdu.h>
-
-#include "router.hpp"
-#include "filter.hpp"
-#include "session.hpp"
-#include "origin.hpp"
-
-namespace metaproxy_1 {
- class Package;
-}
-
-
-namespace std
-{
- std::ostream& operator<<(std::ostream& os, metaproxy_1::Package& p);
-}
-
-namespace metaproxy_1 {
-
- class Package {
- public:
- Package();
-
- ~Package();
-
- Package(metaproxy_1::Session &session,
- const metaproxy_1::Origin &origin);
-
- /// shallow copy constructor which only copies the filter chain info
- Package & copy_filter(const Package &p);
-
- /// send Package to it's next Filter defined in Router
- void move();
-
- /// send Package to other route
- void move(std::string route);
-
- /// access session - left val in assignment
- metaproxy_1::Session & session();
-
- /// get function - right val in assignment
- Origin origin() const;
-
- /// set function - left val in assignment
- Origin & origin();
-
- /// set function - can be chained
- Package & origin(const Origin & origin);
-
- /// set function - can be chained
- Package & router(const Router &router);
-
- yazpp_1::GDU &request();
-
- yazpp_1::GDU &response();
-
- /// get function - right val in assignment
- Session session() const;
-
- private:
- Session m_session;
- Origin m_origin;
-
- RoutePos *m_route_pos;
-
- //int m_data;
-
- yazpp_1::GDU m_request_gdu;
- yazpp_1::GDU m_response_gdu;
- };
-}
-
-
-
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
#include <iostream>
#include <fstream>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#define PLAINFILE_MAX_LINE 256
+++ /dev/null
-/* This file is part of Metaproxy.
- Copyright (C) 2005-2010 Index Data
-
-Metaproxy is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef ROUTER_HPP
-#define ROUTER_HPP
-
-#include <boost/noncopyable.hpp>
-#include <string>
-#include <stdexcept>
-
-namespace metaproxy_1
-{
- namespace filter {
- class Base;
- }
- class RoutePos;
-
- class RouterException : public std::runtime_error {
- public:
- RouterException(const std::string message)
- : std::runtime_error("RouterException: " + message){};
- };
-
- class Router : boost::noncopyable {
- public:
- Router(){};
- virtual ~Router(){};
-
- virtual RoutePos *createpos() const = 0;
- };
-
- class RoutePos : boost::noncopyable {
- public:
- virtual const filter::Base *move(const char *route) = 0;
- virtual RoutePos *clone() = 0;
- virtual ~RoutePos() {};
- };
-}
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
#define ROUTER_CHAIN_HPP
-#include "router.hpp"
+#include <metaproxy/router.hpp>
#include <boost/scoped_ptr.hpp>
#include <stdexcept>
*/
#include "config.hpp"
-#include "xmlutil.hpp"
+#include <metaproxy/xmlutil.hpp>
#include "router_flexml.hpp"
#include "factory_filter.hpp"
#include "factory_static.hpp"
#ifndef ROUTER_FLEXML_HPP
#define ROUTER_FLEXML_HPP
-#include "router.hpp"
+#include <metaproxy/router.hpp>
#include "factory_filter.hpp"
#include <stdexcept>
-#include "session.hpp"
+#include <metaproxy/session.hpp>
#include <boost/thread/mutex.hpp>
#include "config.hpp"
+++ /dev/null
-/* This file is part of Metaproxy.
- Copyright (C) 2005-2010 Index Data
-
-Metaproxy is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef SESSION_HPP
-#define SESSION_HPP
-
-//#include <stdexcept>
-#include <map>
-#include <boost/thread/mutex.hpp>
-
-namespace metaproxy_1 {
-
- class Session
- {
- //typedef unsigned long type;
- public:
-
- /// create new session with new unique id
- Session() {
- boost::mutex::scoped_lock scoped_lock(m_mutex);
- ++m_global_id;
- m_id = m_global_id;
- m_close = false;
- }
-
- /// copy session including old id
- Session(const Session &s) : m_id(s.m_id), m_close(s.m_close) {};
-
- Session& operator=(const Session &s) {
- if (this != &s)
- {
- m_id = s.m_id;
- m_close = s.m_close;
- }
- return *this;
- }
-
- bool operator<(const Session &s) const {
- return m_id < s.m_id ? true : false;
- }
-
- unsigned long id() const {
- return m_id;
- }
-
- bool is_closed() const {
- return m_close;
- }
-
- /// mark session closed, can not be unset
- void close() {
- m_close = true;
- }
-
- bool operator == (Session &ses) const {
- return ses.m_id == m_id;
- }
-
- private:
-
- unsigned long int m_id;
- bool m_close;
-
- /// static mutex to lock static m_id
- static boost::mutex m_mutex;
-
- /// static m_id to make sure that there is only one id counter
- static unsigned long int m_global_id;
-
- };
-
- template <class T> class session_map {
- public:
- void create(T &t, const metaproxy_1::Session &s) {
- boost::mutex::scoped_lock lock(m_map_mutex);
- m_map[s] = SessionItem(t);
- };
- void release(const metaproxy_1::Session &s) {
- boost::mutex::scoped_lock lock(m_map_mutex);
-
- m_map.erase(s);
- };
-#if 0
- T &get_session_data(const metaproxy_1::Session &s) {
- boost::mutex::scoped_lock lock(m_map_mutex);
-
- typename std::map<metaproxy_1::Session,SessionItem>::const_iterator it;
- it = m_map.find(s);
- if (it == m_map.end())
- return 0;
- boost::mutx::scoped_lock *scoped_ptr =
- new boost::mutex::scoped_lock(it->second->m_item_mutex);
- };
-#endif
- bool exist(const metaproxy_1::Session &s) {
- typename std::map<metaproxy_1::Session,SessionItem>::const_iterator it;
- it = m_map.find(s);
- return it == m_map.end() ? false : true;
- }
- private:
- class SessionItem {
- public:
- SessionItem() {};
- SessionItem(T &t) : m_t(t) {};
- SessionItem &operator =(const SessionItem &s) {
- if (this != &s) {
- m_t = s.m_t;
- }
- return *this;
- };
- SessionItem(const SessionItem &s) {
- m_t = s.m_t;
- };
- T m_t;
- boost::mutex m_item_mutex;
- };
- private:
- boost::mutex m_map_mutex;
- std::map<metaproxy_1::Session,SessionItem>m_map;
- };
-
-}
-
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
*/
#include "sru_util.hpp"
-#include "util.hpp"
-
-//#include <yaz/wrbuf.h>
-//#include <yaz/querytowrbuf.h>
+#include <metaproxy/util.hpp>
#include <iostream>
#include <string>
#ifndef YP2_SDU_UTIL_HPP
#define YP2_SDU_UTIL_HPP
-#include "util.hpp"
-#include "package.hpp"
+#include <metaproxy/util.hpp>
+#include <metaproxy/package.hpp>
-//#include <yaz/zgdu.h>
-//#include <yaz/z-core.h>
#include <yaz/srw.h>
#include <iosfwd>
#include <iostream>
#include <stdexcept>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.hpp"
+
#include <libxml/parser.h>
#include <libxml/tree.h>
-#include "config.hpp"
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
#include "router_chain.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#include <iostream>
#include <stdexcept>
#include "filter_auth_simple.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <iostream>
#include <stdexcept>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "filter_backend_test.hpp"
#include "filter_log.hpp"
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#include <yaz/zgdu.h>
#include <yaz/pquery.h>
#include "config.hpp"
#include "filter_bounce.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "gduutil.hpp"
-//#include "sru_util.hpp"
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#include <iostream>
#include <stdexcept>
#include <stdexcept>
#include "config.hpp"
-#include "filter.hpp"
-#include "package.hpp"
+#include <metaproxy/filter.hpp>
+#include <metaproxy/package.hpp>
#include "factory_filter.hpp"
#include <iostream>
#include <stdexcept>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "filter_frontend_net.hpp"
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <stdexcept>
#include "filter_log.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <stdexcept>
#include "filter_multi.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <stdexcept>
#include "filter_query_rewrite.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include "config.hpp"
#include "filter_record_transform.hpp"
-//#include "util.hpp"
-//#include "sru_util.hpp"
-#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
-//#include <iostream>
-//#include <stdexcept>
+#include "router_chain.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include "config.hpp"
#include "filter_sru_to_z3950.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "sru_util.hpp"
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#include <iostream>
#include <stdexcept>
#include <iostream>
#include <stdexcept>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "filter_virt_db.hpp"
#include "filter_backend_test.hpp"
#include "filter_log.hpp"
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <stdexcept>
#include "filter_z3950_client.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <iostream>
#include <stdexcept>
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <iostream>
#include <stdexcept>
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include "pipe.hpp"
#define BOOST_AUTO_TEST_MAIN
#include <iostream>
#include <stdexcept>
-#include "filter.hpp"
+#include <metaproxy/filter.hpp>
#include "router_flexml.hpp"
#include "factory_static.hpp"
#include <iostream>
#include <stdexcept>
-#include "router.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/package.hpp>
#include <map>
*/
#include "config.hpp"
-#include "session.hpp"
+#include <metaproxy/session.hpp>
#include <iostream>
*/
#include "config.hpp"
-#include "session.hpp"
+#include <metaproxy/session.hpp>
#include <iostream>
#include <list>
*/
#include "config.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
#include <yaz/odr.h>
#include <yaz/pquery.h>
+++ /dev/null
-/* This file is part of Metaproxy.
- Copyright (C) 2005-2010 Index Data
-
-Metaproxy is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef YP2_UTIL_HPP
-#define YP2_UTIL_HPP
-
-#include "package.hpp"
-
-#include <yaz/z-core.h>
-
-#include <boost/utility.hpp>
-#include <boost/scoped_ptr.hpp>
-
-#include <list>
-#include <vector>
-#include <sstream>
-#include <string>
-
-
-namespace metaproxy_1 {
- namespace util {
-
-
- template<typename T>
- std::string to_string(const T& t)
- {
- std::ostringstream o;
- if(o << t)
- return o.str();
- return std::string();
- };
-
- const char *
- record_composition_to_esn(Z_RecordComposition *comp);
-
- std::string http_header_value(const Z_HTTP_Header* header,
- const std::string name);
-
- std::string http_headers_debug(const Z_HTTP_Request &http_req);
-
- void http_response(metaproxy_1::Package &package,
- const std::string &content,
- int http_code = 200);
-
-
- int memcmp2(const void *buf1, int len1, const void *buf2, int len2);
-
- std::string database_name_normalize(const std::string &s);
-
- bool pqf(ODR odr, Z_APDU *apdu, const std::string &q);
-
- std::string zQueryToString(Z_Query *query);
-
- Z_ReferenceId **get_referenceId(const Z_APDU *apdu);
-
- void transfer_referenceId(ODR odr, const Z_APDU *src, Z_APDU *dst);
-
- Z_APDU *create_APDU(ODR odr, int type, const Z_APDU *in_apdu);
-
- bool set_databases_from_zurl(ODR odr, std::string zurl,
- int *db_num, char ***db_strings);
-
- void split_zurl(std::string zurl, std::string &host,
- std::list<std::string> &db);
-
- void get_vhost_otherinfo(Z_OtherInformation *otherInformation,
- std::list<std::string> &vhosts);
-
- int remove_vhost_otherinfo(Z_OtherInformation **otherInformation,
- std::list<std::string> &vhosts);
-
- void set_vhost_otherinfo(Z_OtherInformation **otherInformation,
- ODR odr,
- const std::string vhost,
- const int cat);
-
- void set_vhost_otherinfo(Z_OtherInformation **otherInformation,
- ODR odr,
- const std::list<std::string> &vhosts);
-
- int get_or_remove_vhost_otherinfo(
- Z_OtherInformation **otherInformation,
- bool remove_flag,
- std::list<std::string> &vhosts);
-
- void get_init_diagnostics(Z_InitResponse *res,
- int &error_code, std::string &addinfo);
-
- void get_default_diag(Z_DefaultDiagFormat *r,
- int &error_code, std::string &addinfo);
-
- void piggyback(int smallSetUpperBound,
- int largeSetLowerBound,
- int mediumSetPresentNumber,
- int result_set_size,
- int &number_to_present);
-
- };
-
- class odr : public boost::noncopyable {
- public:
- odr(int type);
- odr();
- ~odr();
- operator ODR() const;
- Z_APDU *create_close(const Z_APDU *in_apdu,
- int reason, const char *addinfo);
- Z_APDU *create_initResponse(const Z_APDU *in_apdu,
- int error, const char *addinfo);
- Z_APDU *create_searchResponse(const Z_APDU *in_apdu,
- int error, const char *addinfo);
- Z_APDU *create_presentResponse(const Z_APDU *in_apdu,
- int error, const char *addinfo);
- Z_APDU *create_scanResponse(const Z_APDU *in_apdu,
- int error, const char *addinfo);
- Z_APDU *create_APDU(int type, const Z_APDU *in_apdu);
-
- Z_GDU *create_HTTP_Response(metaproxy_1::Session &session,
- Z_HTTP_Request *req, int code);
- private:
- ODR m_odr;
- };
-
- class PlainFile {
- class Rep;
- boost::scoped_ptr<Rep> m_p;
- public:
- PlainFile();
- ~PlainFile();
- bool open(const std::string &fname);
- bool getline(std::vector<std::string> &args);
- };
-}
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "xmlutil.hpp"
+#include <metaproxy/xmlutil.hpp>
#include <string.h>
+++ /dev/null
-/* This file is part of Metaproxy.
- Copyright (C) 2005-2010 Index Data
-
-Metaproxy is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef XML_UTIL_HPP
-#define XML_UTIL_HPP
-
-#include <string>
-#include <stdexcept>
-#include <libxml/tree.h>
-
-namespace metaproxy_1 {
- namespace xml {
- std::string get_text(const struct _xmlAttr *ptr);
- std::string get_text(const xmlNode *ptr);
- bool get_bool(const xmlNode *ptr, bool default_value);
- int get_int(const xmlNode *ptr, int default_value);
- bool check_attribute(const _xmlAttr *ptr,
- const std::string &ns,
- const std::string &name);
- bool is_attribute(const _xmlAttr *ptr,
- const std::string &ns,
- const std::string &name);
- bool is_element(const xmlNode *ptr,
- const std::string &ns,
- const std::string &name);
- bool is_element_mp(const xmlNode *ptr, const std::string &name);
- bool check_element_mp(const xmlNode *ptr,
- const std::string &name);
- std::string get_route(const xmlNode *node);
-
- const xmlNode* jump_to(const xmlNode* node, int node_type);
-
- const xmlNode* jump_to_next(const xmlNode* node, int node_type);
-
- const xmlNode* jump_to_children(const xmlNode* node, int node_type);
-
- void check_empty(const xmlNode *node);
-
- }
- class XMLError : public std::runtime_error {
- public:
- XMLError(const std::string msg) :
- std::runtime_error("XMLError : " + msg) {} ;
- };
-}
-
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-