1 /* $Id: util.hpp,v 1.14 2006-05-15 11:43:01 adam Exp $
2 Copyright (c) 2005-2006, Index Data.
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 std::string database_name_normalize(const std::string &s);
23 bool pqf(ODR odr, Z_APDU *apdu, const std::string &q);
25 std::string zQueryToString(Z_Query *query);
27 Z_ReferenceId **get_referenceId(Z_APDU *apdu);
29 Z_APDU *create_APDU(ODR odr, int type, Z_APDU *in_apdu);
31 bool set_databases_from_zurl(ODR odr, std::string zurl,
32 int *db_num, char ***db_strings);
34 void split_zurl(std::string zurl, std::string &host,
35 std::list<std::string> &db);
37 int get_vhost_otherinfo(Z_OtherInformation **otherInformation,
39 std::list<std::string> &vhosts);
41 void set_vhost_otherinfo(Z_OtherInformation **otherInformation,
43 const std::list<std::string> &vhosts);
45 void get_init_diagnostics(Z_InitResponse *res,
46 int &error_code, std::string &addinfo);
48 void get_default_diag(Z_DefaultDiagFormat *r,
49 int &error_code, std::string &addinfo);
51 void piggyback(int smallSetUpperBound,
52 int largeSetLowerBound,
53 int mediumSetPresentNumber,
55 int &number_to_present);
58 class odr : public boost::noncopyable {
64 Z_APDU *create_close(Z_APDU *in_apdu,
65 int reason, const char *addinfo);
66 Z_APDU *create_initResponse(Z_APDU *in_apdu,
67 int error, const char *addinfo);
68 Z_APDU *create_searchResponse(Z_APDU *in_apdu,
69 int error, const char *addinfo);
70 Z_APDU *create_presentResponse(Z_APDU *in_apdu,
71 int error, const char *addinfo);
72 Z_APDU *create_scanResponse(Z_APDU *in_apdu,
73 int error, const char *addinfo);
74 Z_APDU *create_APDU(int type, Z_APDU *in_apdu);
75 Z_GDU *create_HTTP_Response(metaproxy_1::Session &session,
76 Z_HTTP_Request *req, int code);
83 boost::scoped_ptr<Rep> m_p;
87 bool open(const std::string &fname);
88 bool getline(std::vector<std::string> &args);
95 * indent-tabs-mode: nil
96 * c-file-style: "stroustrup"
98 * vim: shiftwidth=4 tabstop=8 expandtab