2 * Copyright (c) 1998-2003, Index Data.
3 * See the file LICENSE for details.
5 * $Id: proxy.h,v 1.6 2003-09-03 11:25:08 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, int hits);
22 int lookup (ODR o, Z_NamePlusRecordList **npr, int start, int num,
23 Odr_oid *syntax, Z_RecordComposition *comp);
26 void copy_searchRequest(Z_SearchRequest *sr);
27 void copy_presentRequest(Z_PresentRequest *pr);
30 Yaz_RecordCache_Entry *m_entries;
31 Z_SearchRequest *m_searchRequest;
32 Z_PresentRequest *m_presentRequest;
33 int match (Yaz_RecordCache_Entry *entry,
34 Odr_oid *syntax, int offset,
35 Z_RecordComposition *comp);
39 class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc {
40 friend class Yaz_Proxy;
41 Yaz_ProxyClient(IYaz_PDU_Observable *the_PDU_Observable);
43 void recv_Z_PDU(Z_APDU *apdu);
44 IYaz_PDU_Observer* sessionNotify
45 (IYaz_PDU_Observable *the_PDU_Observable, int fd);
52 Yaz_ProxyClient *m_next;
53 Yaz_ProxyClient **m_prev;
55 Yaz_Z_Query *m_last_query;
56 Yaz_Z_Databases m_last_databases;
57 char *m_last_resultSetId;
59 int m_last_resultCount;
63 int m_resultSetStartPoint;
65 Z_APDU *m_initResponse;
66 Yaz_RecordCache m_cache;
69 /// Information Retrieval Proxy Server.
70 class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
72 char *get_cookie(Z_OtherInformation **otherInfo);
73 char *get_proxy(Z_OtherInformation **otherInfo);
74 Yaz_ProxyClient *get_client(Z_APDU *apdu);
75 Z_APDU *result_set_optimize(Z_APDU *apdu);
78 Yaz_ProxyClient *m_client;
79 IYaz_PDU_Observable *m_PDU_Observable;
80 Yaz_ProxyClient *m_clientPool;
87 char *m_proxy_authentication;
91 Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable);
93 void recv_Z_PDU(Z_APDU *apdu);
94 IYaz_PDU_Observer* sessionNotify
95 (IYaz_PDU_Observable *the_PDU_Observable, int fd);
99 const char *option(const char *name, const char *value);
100 void set_proxy_target(const char *target);
101 void set_proxy_authentication (const char *auth);
102 char *get_proxy_target() { return m_proxyTarget; };
103 void set_max_clients(int m) { m_max_clients = m; };
104 void set_idletime (int t) { m_idletime = (t > 1) ? t : 600; };