gets confused otherwise.
-/* $Id: filter_session_shared.cpp,v 1.9 2006-05-16 11:53:54 adam Exp $
+/* $Id: filter_session_shared.cpp,v 1.10 2006-06-09 14:12:13 adam Exp $
Copyright (c) 2005-2006, Index Data.
%LICENSE%
#include <iostream>
namespace mp = metaproxy_1;
-namespace yf = mp::filter;
+namespace yf = metaproxy_1::filter;
namespace metaproxy_1 {
namespace filter {
- int memcmp2(const void *buf1, int len1, const void *buf2, int len2);
class SessionShared::InitKey {
public:
}
}
-int yf::memcmp2(const void *buf1, int len1,
- const void *buf2, int len2)
-{
- int d = len1 - len2;
-
- // compare buffer (common length)
- int c = memcmp(buf1, buf2, d > 0 ? len2 : len1);
- if (c > 0)
- return 1;
- else if (c < 0)
- return -1;
-
- // compare (remaining bytes)
- if (d > 0)
- return 1;
- else if (d < 0)
- return -1;
- return 0;
-}
yf::SessionShared::InitKey::InitKey(Z_InitRequest *req)
{
const
{
int c;
- c = memcmp2((void*) m_idAuthentication_buf, m_idAuthentication_size,
- (void*) k.m_idAuthentication_buf, k.m_idAuthentication_size);
+ c = mp::util::memcmp2(
+ (void*) m_idAuthentication_buf, m_idAuthentication_size,
+ (void*) k.m_idAuthentication_buf, k.m_idAuthentication_size);
if (c < 0)
return true;
else if (c > 0)
return false;
- c = memcmp2((void*) m_otherInfo_buf, m_otherInfo_size,
- (void*) k.m_otherInfo_buf, k.m_otherInfo_size);
+ c = mp::util::memcmp2((void*) m_otherInfo_buf, m_otherInfo_size,
+ (void*) k.m_otherInfo_buf, k.m_otherInfo_size);
if (c < 0)
return true;
else if (c > 0)
mp::util::get_vhost_otherinfo(&req->otherInfo, false, targets);
+ // std::cout << "SessionShared::Frontend::init\n";
if (targets.size() < 1)
{
+ // no targets given, just relay this one and don't deal with it
package.move();
return;
}
-
+ InitKey k(req);
}
yf::SessionShared::SessionShared() : m_p(new SessionShared::Rep)
-/* $Id: thread_pool_observer.cpp,v 1.15 2006-03-29 13:44:45 adam Exp $
+/* $Id: thread_pool_observer.cpp,v 1.16 2006-06-09 14:12:13 adam Exp $
Copyright (c) 2005-2006, Index Data.
%LICENSE%
#include "thread_pool_observer.hpp"
#include "pipe.hpp"
-namespace mp = metaproxy_1;
-
namespace metaproxy_1 {
class ThreadPoolSocketObserver::Worker {
public:
using namespace yazpp_1;
-using namespace mp;
+using namespace metaproxy_1;
-ThreadPoolSocketObserver::Rep::Rep(ISocketObservable *obs)
+ThreadPoolSocketObserver::Rep::Rep(yazpp_1::ISocketObservable *obs)
: m_socketObservable(obs), m_pipe(9123)
{
}
}
-ThreadPoolSocketObserver::ThreadPoolSocketObserver(ISocketObservable *obs,
- int no_threads)
+ThreadPoolSocketObserver::ThreadPoolSocketObserver(
+ yazpp_1::ISocketObservable *obs, int no_threads)
: m_p(new Rep(obs))
{
obs->addObserver(m_p->m_pipe.read_fd(), this);
-/* $Id: util.cpp,v 1.15 2006-05-15 11:43:01 adam Exp $
+/* $Id: util.cpp,v 1.16 2006-06-09 14:12:13 adam Exp $
Copyright (c) 2005-2006, Index Data.
%LICENSE%
namespace mp = metaproxy_1;
-std::string mp::util::database_name_normalize(const std::string &s)
+// Doxygen doesn't like mp::util, so we use this instead
+namespace mp_util = metaproxy_1::util;
+
+int mp_util::memcmp2(const void *buf1, int len1,
+ const void *buf2, int len2)
+{
+ int d = len1 - len2;
+
+ // compare buffer (common length)
+ int c = memcmp(buf1, buf2, d > 0 ? len2 : len1);
+ if (c > 0)
+ return 1;
+ else if (c < 0)
+ return -1;
+
+ // compare (remaining bytes)
+ if (d > 0)
+ return 1;
+ else if (d < 0)
+ return -1;
+ return 0;
+}
+
+
+std::string mp_util::database_name_normalize(const std::string &s)
{
std::string r = s;
size_t i;
}
-void mp::util::piggyback(int smallSetUpperBound,
- int largeSetLowerBound,
- int mediumSetPresentNumber,
- int result_set_size,
- int &number_to_present)
+void mp_util::piggyback(int smallSetUpperBound,
+ int largeSetLowerBound,
+ int mediumSetPresentNumber,
+ int result_set_size,
+ int &number_to_present)
{
// deal with piggyback
}
-bool mp::util::pqf(ODR odr, Z_APDU *apdu, const std::string &q) {
+bool mp_util::pqf(ODR odr, Z_APDU *apdu, const std::string &q)
+{
YAZ_PQF_Parser pqf_parser = yaz_pqf_create();
Z_RPNQuery *rpn = yaz_pqf_parse(pqf_parser, odr, q.c_str());
}
-std::string mp::util::zQueryToString(Z_Query *query)
+std::string mp_util::zQueryToString(Z_Query *query)
{
std::string query_str = "";
return query_str;
}
-void mp::util::get_default_diag(Z_DefaultDiagFormat *r,
- int &error_code, std::string &addinfo)
+void mp_util::get_default_diag(Z_DefaultDiagFormat *r,
+ int &error_code, std::string &addinfo)
{
error_code = *r->condition;
switch (r->which)
}
}
-void mp::util::get_init_diagnostics(Z_InitResponse *initrs,
- int &error_code, std::string &addinfo)
+void mp_util::get_init_diagnostics(
+ Z_InitResponse *initrs, int &error_code, std::string &addinfo)
{
Z_External *uif = initrs->userInformationField;
}
}
-int mp::util::get_vhost_otherinfo(Z_OtherInformation **otherInformation,
- bool remove_flag,
- std::list<std::string> &vhosts)
+int mp_util::get_vhost_otherinfo(
+ Z_OtherInformation **otherInformation,
+ bool remove_flag,
+ std::list<std::string> &vhosts)
{
int cat;
for (cat = 1; ; cat++)
return cat;
}
-void mp::util::set_vhost_otherinfo(Z_OtherInformation **otherInformation,
- ODR odr,
- const std::list<std::string> &vhosts)
+void mp_util::set_vhost_otherinfo(
+ Z_OtherInformation **otherInformation, ODR odr,
+ const std::list<std::string> &vhosts)
{
int cat;
std::list<std::string>::const_iterator it = vhosts.begin();
}
}
-void mp::util::split_zurl(std::string zurl, std::string &host,
- std::list<std::string> &db)
+void mp_util::split_zurl(std::string zurl, std::string &host,
+ std::list<std::string> &db)
{
const char *zurl_cstr = zurl.c_str();
const char *sep = strchr(zurl_cstr, '/');
}
}
-bool mp::util::set_databases_from_zurl(ODR odr, std::string zurl,
- int *db_num, char ***db_strings)
+bool mp_util::set_databases_from_zurl(
+ ODR odr, std::string zurl,
+ int *db_num, char ***db_strings)
{
std::string host;
std::list<std::string> dblist;
return mp::util::create_APDU(m_odr, type, in_apdu);
}
-Z_APDU *mp::util::create_APDU(ODR odr, int type, Z_APDU *in_apdu)
+Z_APDU *mp_util::create_APDU(ODR odr, int type, Z_APDU *in_apdu)
{
Z_APDU *out_apdu = zget_APDU(odr, type);
return gdu;
}
-Z_ReferenceId **mp::util::get_referenceId(Z_APDU *apdu)
+Z_ReferenceId **mp_util::get_referenceId(Z_APDU *apdu)
{
switch (apdu->which)
{
-/* $Id: util.hpp,v 1.14 2006-05-15 11:43:01 adam Exp $
+/* $Id: util.hpp,v 1.15 2006-06-09 14:12:13 adam Exp $
Copyright (c) 2005-2006, Index Data.
%LICENSE%
namespace metaproxy_1 {
namespace util {
+ 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);
-/* $Id: xmlutil.cpp,v 1.5 2006-03-16 10:40:59 adam Exp $
+/* $Id: xmlutil.cpp,v 1.6 2006-06-09 14:12:13 adam Exp $
Copyright (c) 2005-2006, Index Data.
%LICENSE%
#include "xmlutil.hpp"
namespace mp = metaproxy_1;
+// Doxygen doesn't like mp::xml, so we use this instead
+namespace mp_xml = metaproxy_1::xml;
-std::string mp::xml::get_text(const xmlNode *ptr)
+std::string mp_xml::get_text(const xmlNode *ptr)
{
std::string c;
for (ptr = ptr->children; ptr; ptr = ptr->next)
}
-bool mp::xml::is_element(const xmlNode *ptr,
+bool mp_xml::is_element(const xmlNode *ptr,
const std::string &ns,
const std::string &name)
{
return false;
}
-bool mp::xml::is_element_yp2(const xmlNode *ptr,
+bool mp_xml::is_element_yp2(const xmlNode *ptr,
const std::string &name)
{
return mp::xml::is_element(ptr, "http://indexdata.dk/yp2/config/1", name);
}
-bool mp::xml::check_element_yp2(const xmlNode *ptr,
+bool mp_xml::check_element_yp2(const xmlNode *ptr,
const std::string &name)
{
if (!mp::xml::is_element_yp2(ptr, name))
return true;
}
-std::string mp::xml::get_route(const xmlNode *node)
+std::string mp_xml::get_route(const xmlNode *node)
{
std::string route_value;
if (node)
}
-const xmlNode* mp::xml::jump_to_children(const xmlNode* node,
+const xmlNode* mp_xml::jump_to_children(const xmlNode* node,
int xml_node_type)
{
node = node->children;
return node;
}
-const xmlNode* mp::xml::jump_to_next(const xmlNode* node,
+const xmlNode* mp_xml::jump_to_next(const xmlNode* node,
int xml_node_type)
{
node = node->next;
return node;
}
-const xmlNode* mp::xml::jump_to(const xmlNode* node,
+const xmlNode* mp_xml::jump_to(const xmlNode* node,
int xml_node_type)
{
for (; node && node->type != xml_node_type; node = node->next)
return node;
}
-void mp::xml::check_empty(const xmlNode *node)
+void mp_xml::check_empty(const xmlNode *node)
{
if (node)
{