Work on proxy.
[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.8 1999-11-10 10:02:34 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     Yaz_Proxy *m_server;
22     void failNotify();
23     void timeoutNotify();
24     char m_cookie[32];
25     Yaz_ProxyClient *m_next;
26     Yaz_ProxyClient **m_prev;
27     int m_init_flag;
28     Yaz_Z_Query *m_last_query;
29     int m_last_resultCount;
30     int m_sr_transform;
31 };
32
33 /// Information Retrieval Proxy Server.
34 class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
35  public:
36     Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable);
37     ~Yaz_Proxy();
38     void recv_Z_PDU(Z_APDU *apdu);
39     IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
40     void failNotify();
41     void timeoutNotify();
42     void proxyTarget(const char *target);
43  private:
44     char *get_cookie(Z_OtherInformation **otherInfo);
45     char *get_proxy(Z_OtherInformation **otherInfo);
46     Yaz_ProxyClient *get_client(Z_APDU *apdu);
47     Z_APDU *result_set_optimize(Z_APDU *apdu);
48     
49     Yaz_ProxyClient *m_client;
50     IYaz_PDU_Observable *m_PDU_Observable;
51     Yaz_ProxyClient *m_clientPool;
52     Yaz_Proxy *m_parent;
53     int m_seqno;
54     int m_keepalive;
55     char *m_proxyTarget;
56 };
57