1 /* $Id: util.hpp,v 1.17 2006-06-19 23:54:02 adam Exp $
2 Copyright (c) 2005-2006, Index Data.
4 See the LICENSE file for details
10 #include <yaz/z-core.h>
15 #include <boost/utility.hpp>
16 #include <boost/scoped_ptr.hpp>
17 #include "package.hpp"
19 namespace metaproxy_1 {
21 int memcmp2(const void *buf1, int len1, const void *buf2, int len2);
23 std::string database_name_normalize(const std::string &s);
25 bool pqf(ODR odr, Z_APDU *apdu, const std::string &q);
27 std::string zQueryToString(Z_Query *query);
29 Z_ReferenceId **get_referenceId(const Z_APDU *apdu);
31 void transfer_referenceId(ODR odr, const Z_APDU *src, Z_APDU *dst);
33 Z_APDU *create_APDU(ODR odr, int type, const Z_APDU *in_apdu);
35 bool set_databases_from_zurl(ODR odr, std::string zurl,
36 int *db_num, char ***db_strings);
38 void split_zurl(std::string zurl, std::string &host,
39 std::list<std::string> &db);
41 int get_vhost_otherinfo(Z_OtherInformation **otherInformation,
43 std::list<std::string> &vhosts);
45 void set_vhost_otherinfo(Z_OtherInformation **otherInformation,
47 const std::list<std::string> &vhosts);
49 void get_init_diagnostics(Z_InitResponse *res,
50 int &error_code, std::string &addinfo);
52 void get_default_diag(Z_DefaultDiagFormat *r,
53 int &error_code, std::string &addinfo);
55 void piggyback(int smallSetUpperBound,
56 int largeSetLowerBound,
57 int mediumSetPresentNumber,
59 int &number_to_present);
62 class odr : public boost::noncopyable {
68 Z_APDU *create_close(const Z_APDU *in_apdu,
69 int reason, const char *addinfo);
70 Z_APDU *create_initResponse(const Z_APDU *in_apdu,
71 int error, const char *addinfo);
72 Z_APDU *create_searchResponse(const Z_APDU *in_apdu,
73 int error, const char *addinfo);
74 Z_APDU *create_presentResponse(const Z_APDU *in_apdu,
75 int error, const char *addinfo);
76 Z_APDU *create_scanResponse(const Z_APDU *in_apdu,
77 int error, const char *addinfo);
78 Z_APDU *create_APDU(int type, const Z_APDU *in_apdu);
80 Z_GDU *create_HTTP_Response(metaproxy_1::Session &session,
81 Z_HTTP_Request *req, int code);
88 boost::scoped_ptr<Rep> m_p;
92 bool open(const std::string &fname);
93 bool getline(std::vector<std::string> &args);
100 * indent-tabs-mode: nil
101 * c-file-style: "stroustrup"
103 * vim: shiftwidth=4 tabstop=8 expandtab