Modified for new location of YAZ header files. Experimental threaded
[yazpp-moved-to-github.git] / include / yaz-proxy.h
1 /*
2  * Copyright (c) 1998-1999, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  * 
6  * $Id: yaz-proxy.h,v 1.9 1999-12-06 13:52:45 adam Exp $
7  */
8
9 #include <yaz-z-assoc.h>
10 #include <yaz-z-query.h>
11
12 class Yaz_Proxy;
13
14 /// Private class
15 class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc {
16     friend 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* clone(IYaz_PDU_Observable *the_PDU_Observable);
21     void shutdown();
22     Yaz_Proxy *m_server;
23     void failNotify();
24     void timeoutNotify();
25     void connectNotify();
26     char m_cookie[32];
27     Yaz_ProxyClient *m_next;
28     Yaz_ProxyClient **m_prev;
29     int m_init_flag;
30     Yaz_Z_Query *m_last_query;
31     int m_last_resultCount;
32     int m_sr_transform;
33 };
34
35 /// Information Retrieval Proxy Server.
36 class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
37  private:
38     char *get_cookie(Z_OtherInformation **otherInfo);
39     char *get_proxy(Z_OtherInformation **otherInfo);
40     Yaz_ProxyClient *get_client(Z_APDU *apdu);
41     Z_APDU *result_set_optimize(Z_APDU *apdu);
42     void shutdown();
43     
44     Yaz_ProxyClient *m_client;
45     IYaz_PDU_Observable *m_PDU_Observable;
46     Yaz_ProxyClient *m_clientPool;
47     Yaz_Proxy *m_parent;
48     int m_seqno;
49     int m_keepalive;
50     char *m_proxyTarget;
51  public:
52     Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable);
53     ~Yaz_Proxy();
54     void recv_Z_PDU(Z_APDU *apdu);
55     IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
56     void failNotify();
57     void timeoutNotify();
58     void connectNotify();
59     void set_proxyTarget(const char *target);
60     char *get_proxyTarget() { return m_proxyTarget; };
61 };
62