New threaded PDU association.
[yazpp-moved-to-github.git] / src / yaz-z-server.cpp
index e534e49..b6b0a10 100644 (file)
@@ -1,9 +1,23 @@
 /*
- * Copyright (c) 2000, Index Data.
+ * Copyright (c) 2000-2001, Index Data.
  * See the file LICENSE for details.
  * 
  * $Log: yaz-z-server.cpp,v $
- * Revision 1.3  2000-09-21 21:43:20  adam
+ * Revision 1.7  2001-03-26 14:43:49  adam
+ * New threaded PDU association.
+ *
+ * Revision 1.6  2001/01/29 11:18:24  adam
+ * Server sets OPTIONS search and present.
+ *
+ * Revision 1.5  2000/10/24 12:29:57  adam
+ * Fixed bug in proxy where a Yaz_ProxyClient could be owned by
+ * two Yaz_Proxy's (fatal).
+ *
+ * Revision 1.4  2000/10/11 11:58:17  adam
+ * Moved header files to include/yaz++. Switched to libtool and automake.
+ * Configure script creates yaz++-config script.
+ *
+ * Revision 1.3  2000/09/21 21:43:20  adam
  * Better high-level server API.
  *
  * Revision 1.2  2000/09/12 12:09:53  adam
@@ -15,7 +29,7 @@
  */
 
 #include <yaz/log.h>
-#include <yaz-z-server.h>
+#include <yaz++/yaz-z-server.h>
 
 
 Yaz_Z_Server::Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable)
@@ -271,12 +285,20 @@ void Yaz_Z_Server::fetch_via_present (Z_PresentRequest *req,
     
 void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request)
 {   
+    Z_Options *req, *res;
     Z_APDU *apdu_response;
     switch (apdu_request->which)
     {
     case Z_APDU_initRequest:
-        logf (LOG_LOG, "got InitRequest");
+        yaz_log (LOG_LOG, "got InitRequest p=%p", this);
        apdu_response = create_Z_PDU(Z_APDU_initResponse);
+        req = apdu_request->u.initRequest->options;
+        res = apdu_response->u.initResponse->options;
+
+        if (ODR_MASK_GET(req, Z_Options_search))
+           ODR_MASK_SET(res, Z_Options_search);
+        if (ODR_MASK_GET(req, Z_Options_present))
+            ODR_MASK_SET(res, Z_Options_present);
        recv_Z_init (apdu_request->u.initRequest,
                     apdu_response->u.initResponse);
        m_preferredMessageSize =
@@ -286,7 +308,7 @@ void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request)
        send_Z_PDU(apdu_response);
         break;
     case Z_APDU_searchRequest:
-        logf (LOG_LOG, "got SearchRequest");
+        yaz_log (LOG_LOG, "got SearchRequest p=%p", this);
        apdu_response = create_Z_PDU(Z_APDU_searchResponse);
        recv_Z_search (apdu_request->u.searchRequest,
                       apdu_response->u.searchResponse);
@@ -298,7 +320,7 @@ void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request)
        send_Z_PDU(apdu_response);
         break;
     case Z_APDU_presentRequest:
-        logf (LOG_LOG, "got PresentRequest");
+        yaz_log (LOG_LOG, "got PresentRequest p=%p", this);
        apdu_response = create_Z_PDU(Z_APDU_presentResponse);
        recv_Z_present (apdu_request->u.presentRequest,
                        apdu_response->u.presentResponse);