Win32 fixes
[yazpp-moved-to-github.git] / include / yaz++ / proxy.h
index e385812..54f93d3 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * Copyright (c) 1998-2000, Index Data.
+ * Copyright (c) 1998-2003, Index Data.
  * See the file LICENSE for details.
  * 
- * $Id: proxy.h,v 1.1 2002-10-09 12:50:26 adam Exp $
+ * $Id: proxy.h,v 1.7 2003-09-04 20:11:03 adam Exp $
  */
 
 #include <yaz++/z-assoc.h>
 
 class Yaz_Proxy;
 
+struct Yaz_RecordCache_Entry;
+
+class YAZ_EXPORT Yaz_RecordCache {
+ public:
+    Yaz_RecordCache ();
+    ~Yaz_RecordCache ();
+    void add (ODR o, Z_NamePlusRecordList *npr, int start, int hits);
+    
+    int lookup (ODR o, Z_NamePlusRecordList **npr, int start, int num,
+               Odr_oid *syntax, Z_RecordComposition *comp);
+    void clear();
+
+    void copy_searchRequest(Z_SearchRequest *sr);
+    void copy_presentRequest(Z_PresentRequest *pr);
+ private:
+    NMEM m_mem;
+    Yaz_RecordCache_Entry *m_entries;
+    Z_SearchRequest *m_searchRequest;
+    Z_PresentRequest *m_presentRequest;
+    int match (Yaz_RecordCache_Entry *entry,
+              Odr_oid *syntax, int offset,
+              Z_RecordComposition *comp);
+};
+
 /// Private class
 class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc {
-    friend Yaz_Proxy;
+    friend class Yaz_Proxy;
     Yaz_ProxyClient(IYaz_PDU_Observable *the_PDU_Observable);
     ~Yaz_ProxyClient();
     void recv_Z_PDU(Z_APDU *apdu);
@@ -24,7 +48,7 @@ class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc {
     void failNotify();
     void timeoutNotify();
     void connectNotify();
-    char m_cookie[32];
+    char *m_cookie;
     Yaz_ProxyClient *m_next;
     Yaz_ProxyClient **m_prev;
     int m_init_flag;
@@ -36,8 +60,10 @@ class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc {
     int m_sr_transform;
     int m_seqno;
     int m_waiting;
+    int m_resultSetStartPoint;
     ODR m_init_odr;
     Z_APDU *m_initResponse;
+    Yaz_RecordCache m_cache;
 };
 
 /// Information Retrieval Proxy Server.
@@ -56,6 +82,7 @@ class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
     int m_seqno;
     int m_max_clients;
     int m_keepalive;
+    int m_idletime;
     char *m_proxyTarget;
     char *m_proxy_authentication;
     long m_seed;
@@ -74,5 +101,6 @@ class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
     void set_proxy_authentication (const char *auth);
     char *get_proxy_target() { return m_proxyTarget; };
     void set_max_clients(int m) { m_max_clients = m; };
+    void set_idletime (int t) { m_idletime = (t > 1) ? t : 600; };
 };