From e1c7fdb3e2ff41fb43ea3dd2c540b6d568dee851 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 30 Aug 2006 12:27:34 +0000 Subject: [PATCH] Change forms of get_vhost functions.. get_vhost_otherinfo returns vhost info. remove_vhost_otherinfo removes and returns (old) value. --- src/filter_auth_simple.cpp | 4 ++-- src/filter_multi.cpp | 4 ++-- src/filter_virt_db.cpp | 4 ++-- src/filter_z3950_client.cpp | 5 ++--- src/util.cpp | 18 ++++++++++++++++-- src/util.hpp | 17 ++++++++++++----- 6 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/filter_auth_simple.cpp b/src/filter_auth_simple.cpp index 63356cf..dca3558 100644 --- a/src/filter_auth_simple.cpp +++ b/src/filter_auth_simple.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_auth_simple.cpp,v 1.20 2006-06-10 14:29:12 adam Exp $ +/* $Id: filter_auth_simple.cpp,v 1.21 2006-08-30 12:27:34 adam Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -343,7 +343,7 @@ void yf::AuthSimple::check_targets(mp::Package & package) const std::list targets; Z_OtherInformation *otherInfo = initReq->otherInfo; - mp::util::get_vhost_otherinfo(&otherInfo, 1, targets); + mp::util::get_vhost_otherinfo(otherInfo, targets); // Check each of the targets specified in the otherInfo package std::list::iterator i; diff --git a/src/filter_multi.cpp b/src/filter_multi.cpp index 30d6d18..87ab481 100644 --- a/src/filter_multi.cpp +++ b/src/filter_multi.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_multi.cpp,v 1.23 2006-08-09 12:27:18 adam Exp $ +/* $Id: filter_multi.cpp,v 1.24 2006-08-30 12:27:34 adam Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -336,7 +336,7 @@ void yf::Multi::Frontend::init(mp::Package &package, Z_GDU *gdu) std::list targets; - mp::util::get_vhost_otherinfo(&req->otherInfo, false, targets); + mp::util::get_vhost_otherinfo(req->otherInfo, targets); if (targets.size() < 1) { diff --git a/src/filter_virt_db.cpp b/src/filter_virt_db.cpp index cf666d2..692d361 100644 --- a/src/filter_virt_db.cpp +++ b/src/filter_virt_db.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_virt_db.cpp,v 1.44 2006-08-01 13:24:53 adam Exp $ +/* $Id: filter_virt_db.cpp,v 1.45 2006-08-30 12:27:34 adam Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -681,7 +681,7 @@ void yf::Virt_db::process(mp::Package &package) const Z_InitRequest *req = gdu->u.z3950->u.initRequest; std::list vhosts; - mp::util::get_vhost_otherinfo(&req->otherInfo, false, vhosts); + mp::util::get_vhost_otherinfo(req->otherInfo, vhosts); if (vhosts.size() == 0) { f->m_init_gdu = gdu; diff --git a/src/filter_z3950_client.cpp b/src/filter_z3950_client.cpp index 0f0b92f..2d9e6a6 100644 --- a/src/filter_z3950_client.cpp +++ b/src/filter_z3950_client.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_z3950_client.cpp,v 1.27 2006-06-21 14:34:16 adam Exp $ +/* $Id: filter_z3950_client.cpp,v 1.28 2006-08-30 12:27:34 adam Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -227,8 +227,7 @@ yf::Z3950Client::Assoc *yf::Z3950Client::Rep::get_assoc(Package &package) return 0; } std::list vhosts; - mp::util::get_vhost_otherinfo(&apdu->u.initRequest->otherInfo, - true, vhosts); + mp::util::remove_vhost_otherinfo(&apdu->u.initRequest->otherInfo, vhosts); size_t no_vhosts = vhosts.size(); if (no_vhosts == 0) { diff --git a/src/util.cpp b/src/util.cpp index 2cc2759..e177410 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,4 +1,4 @@ -/* $Id: util.cpp,v 1.18 2006-06-19 23:54:02 adam Exp $ +/* $Id: util.cpp,v 1.19 2006-08-30 12:27:34 adam Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -191,7 +191,7 @@ void mp_util::get_init_diagnostics( } } -int mp_util::get_vhost_otherinfo( +int mp_util::get_or_remove_vhost_otherinfo( Z_OtherInformation **otherInformation, bool remove_flag, std::list &vhosts) @@ -213,6 +213,20 @@ int mp_util::get_vhost_otherinfo( return cat; } +void mp_util::get_vhost_otherinfo( + Z_OtherInformation *otherInformation, + std::list &vhosts) +{ + get_or_remove_vhost_otherinfo(&otherInformation, false, vhosts); +} + +int mp_util::remove_vhost_otherinfo( + Z_OtherInformation **otherInformation, + std::list &vhosts) +{ + return get_or_remove_vhost_otherinfo(otherInformation, true, vhosts); +} + void mp_util::set_vhost_otherinfo( Z_OtherInformation **otherInformation, ODR odr, const std::list &vhosts) diff --git a/src/util.hpp b/src/util.hpp index e985a40..ba89bfd 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -1,4 +1,4 @@ -/* $Id: util.hpp,v 1.17 2006-06-19 23:54:02 adam Exp $ +/* $Id: util.hpp,v 1.18 2006-08-30 12:27:34 adam Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -37,15 +37,22 @@ namespace metaproxy_1 { void split_zurl(std::string zurl, std::string &host, std::list &db); - - int get_vhost_otherinfo(Z_OtherInformation **otherInformation, - bool remove_flag, - std::list &vhosts); + + void get_vhost_otherinfo(Z_OtherInformation *otherInformation, + std::list &vhosts); + + int remove_vhost_otherinfo(Z_OtherInformation **otherInformation, + std::list &vhosts); void set_vhost_otherinfo(Z_OtherInformation **otherInformation, ODR odr, const std::list &vhosts); + int get_or_remove_vhost_otherinfo( + Z_OtherInformation **otherInformation, + bool remove_flag, + std::list &vhosts); + void get_init_diagnostics(Z_InitResponse *res, int &error_code, std::string &addinfo); -- 1.7.10.4