2 * Copyright (c) 1998-2003, Index Data.
3 * See the file LICENSE for details.
5 * $Id: proxy.h,v 1.4 2003-07-18 13:27:20 adam Exp $
8 #include <yaz++/z-assoc.h>
9 #include <yaz++/z-query.h>
10 #include <yaz++/z-databases.h>
14 class Yaz_RecordCache_Entry;
16 class YAZ_EXPORT Yaz_RecordCache {
20 void add (ODR o, Z_NamePlusRecordList *npr, int start);
21 int lookup (ODR o, Z_NamePlusRecordList **npr, int start, int num,
26 Yaz_RecordCache_Entry *m_entries;
30 class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc {
31 friend class Yaz_Proxy;
32 Yaz_ProxyClient(IYaz_PDU_Observable *the_PDU_Observable);
34 void recv_Z_PDU(Z_APDU *apdu);
35 IYaz_PDU_Observer* sessionNotify
36 (IYaz_PDU_Observable *the_PDU_Observable, int fd);
43 Yaz_ProxyClient *m_next;
44 Yaz_ProxyClient **m_prev;
46 Yaz_Z_Query *m_last_query;
47 Yaz_Z_Databases m_last_databases;
48 char *m_last_resultSetId;
50 int m_last_resultCount;
54 int m_resultSetStartPoint;
56 Z_APDU *m_initResponse;
57 Yaz_RecordCache m_cache;
60 /// Information Retrieval Proxy Server.
61 class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
63 char *get_cookie(Z_OtherInformation **otherInfo);
64 char *get_proxy(Z_OtherInformation **otherInfo);
65 Yaz_ProxyClient *get_client(Z_APDU *apdu);
66 Z_APDU *result_set_optimize(Z_APDU *apdu);
69 Yaz_ProxyClient *m_client;
70 IYaz_PDU_Observable *m_PDU_Observable;
71 Yaz_ProxyClient *m_clientPool;
78 char *m_proxy_authentication;
82 Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable);
84 void recv_Z_PDU(Z_APDU *apdu);
85 IYaz_PDU_Observer* sessionNotify
86 (IYaz_PDU_Observable *the_PDU_Observable, int fd);
90 const char *option(const char *name, const char *value);
91 void set_proxy_target(const char *target);
92 void set_proxy_authentication (const char *auth);
93 char *get_proxy_target() { return m_proxyTarget; };
94 void set_max_clients(int m) { m_max_clients = m; };
95 void set_idletime (int t) { m_idletime = (t > 1) ? t : 600; };