trival tweak for gcc 3.2
[yazpp-moved-to-github.git] / include / yaz++ / proxy.h
1 /*
2  * Copyright (c) 1998-2000, Index Data.
3  * See the file LICENSE for details.
4  * 
5  * $Id: proxy.h,v 1.3 2002-11-26 11:13:40 mike Exp $
6  */
7
8 #include <yaz++/z-assoc.h>
9 #include <yaz++/z-query.h>
10 #include <yaz++/z-databases.h>
11
12 class Yaz_Proxy;
13
14 /// Private class
15 class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc {
16     friend class Yaz_Proxy;
17     Yaz_ProxyClient(IYaz_PDU_Observable *the_PDU_Observable);
18     ~Yaz_ProxyClient();
19     void recv_Z_PDU(Z_APDU *apdu);
20     IYaz_PDU_Observer* sessionNotify
21         (IYaz_PDU_Observable *the_PDU_Observable, int fd);
22     void shutdown();
23     Yaz_Proxy *m_server;
24     void failNotify();
25     void timeoutNotify();
26     void connectNotify();
27     char m_cookie[32];
28     Yaz_ProxyClient *m_next;
29     Yaz_ProxyClient **m_prev;
30     int m_init_flag;
31     Yaz_Z_Query *m_last_query;
32     Yaz_Z_Databases m_last_databases;
33     char *m_last_resultSetId;
34     int m_last_ok;
35     int m_last_resultCount;
36     int m_sr_transform;
37     int m_seqno;
38     int m_waiting;
39     ODR m_init_odr;
40     Z_APDU *m_initResponse;
41 };
42
43 /// Information Retrieval Proxy Server.
44 class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
45  private:
46     char *get_cookie(Z_OtherInformation **otherInfo);
47     char *get_proxy(Z_OtherInformation **otherInfo);
48     Yaz_ProxyClient *get_client(Z_APDU *apdu);
49     Z_APDU *result_set_optimize(Z_APDU *apdu);
50     void shutdown();
51     
52     Yaz_ProxyClient *m_client;
53     IYaz_PDU_Observable *m_PDU_Observable;
54     Yaz_ProxyClient *m_clientPool;
55     Yaz_Proxy *m_parent;
56     int m_seqno;
57     int m_max_clients;
58     int m_keepalive;
59     int m_idletime;
60     char *m_proxyTarget;
61     char *m_proxy_authentication;
62     long m_seed;
63     char *m_optimize;
64  public:
65     Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable);
66     ~Yaz_Proxy();
67     void recv_Z_PDU(Z_APDU *apdu);
68     IYaz_PDU_Observer* sessionNotify
69         (IYaz_PDU_Observable *the_PDU_Observable, int fd);
70     void failNotify();
71     void timeoutNotify();
72     void connectNotify();
73     const char *option(const char *name, const char *value);
74     void set_proxy_target(const char *target);
75     void set_proxy_authentication (const char *auth);
76     char *get_proxy_target() { return m_proxyTarget; };
77     void set_max_clients(int m) { m_max_clients = m; };
78     void set_idletime (int t) { m_idletime = (t > 1) ? t : 600; };
79 };
80