Added piggyback support for filters backend_test + multi.
[metaproxy-moved-to-github.git] / src / util.hpp
1 /* $Id: util.hpp,v 1.8 2006-01-17 17:55:40 adam Exp $
2    Copyright (c) 2005, Index Data.
3
4 %LICENSE%
5  */
6
7 #ifndef YP2_UTIL_HPP
8 #define YP2_UTIL_HPP
9
10 #include <yaz/z-core.h>
11 #include <string>
12 #include <list>
13
14 #include <boost/utility.hpp>
15
16 namespace yp2 {
17     namespace util  {
18         bool pqf(ODR odr, Z_APDU *apdu, const std::string &q);
19         Z_ReferenceId **get_referenceId(Z_APDU *apdu);
20         Z_APDU *create_APDU(ODR odr, int type, Z_APDU *in_apdu);
21         bool set_databases_from_zurl(ODR odr, std::string zurl,
22                                      int *db_num, char ***db_strings);
23         void split_zurl(std::string zurl, std::string &host,
24                         std::list<std::string> &db);
25
26         int get_vhost_otherinfo(Z_OtherInformation **otherInformation,
27                                 bool remove_flag,
28                                 std::list<std::string> &vhosts);
29         void get_init_diagnostics(Z_InitResponse *res,
30                                   int &error_code, std::string &addinfo);
31         void get_default_diag(Z_DefaultDiagFormat *r,
32                               int &error_code, std::string &addinfo);
33
34         void piggyback(int smallSetUpperBound,
35                        int largeSetLowerBound,
36                        int mediumSetPresentNumber,
37                        int result_set_size,
38                        int &number_to_present);
39     };
40
41     class odr : public boost::noncopyable {
42     public:
43         odr(int type);
44         odr();
45         ~odr();
46         operator ODR() const;
47         Z_APDU *create_close(Z_APDU *in_apdu, 
48                              int reason, const char *addinfo);
49         Z_APDU *create_initResponse(Z_APDU *in_apdu, 
50                                     int error, const char *addinfo);
51         Z_APDU *create_searchResponse(Z_APDU *in_apdu,
52                                       int error, const char *addinfo);
53         Z_APDU *create_presentResponse(Z_APDU *in_apdu,
54                                        int error, const char *addinfo);
55         Z_APDU *create_scanResponse(Z_APDU *in_apdu,
56                                     int error, const char *addinfo);
57         Z_APDU *create_APDU(int type, Z_APDU *in_apdu);
58     private:
59         ODR m_odr;
60     };
61         
62 }
63 #endif
64 /*
65  * Local variables:
66  * c-basic-offset: 4
67  * indent-tabs-mode: nil
68  * c-file-style: "stroustrup"
69  * End:
70  * vim: shiftwidth=4 tabstop=8 expandtab
71  */