Updates for yaz/ylog.h
[yazpp-moved-to-github.git] / src / yaz-z-server.cpp
index 0af5836..b2fac81 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2000-2001, Index Data.
+ * Copyright (c) 2000-2003, Index Data.
  * See the file LICENSE for details.
  * 
- * $Id: yaz-z-server.cpp,v 1.14 2002-04-24 12:21:03 adam Exp $
+ * $Id: yaz-z-server.cpp,v 1.19 2004-11-30 21:10:31 adam Exp $
  */
 
-#include <yaz/log.h>
-#include <yaz++/yaz-z-server.h>
+#include <yaz/ylog.h>
+#include <yaz++/z-server.h>
 
 Yaz_Z_Server::Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable)
     : Yaz_Z_Assoc(the_PDU_Observable)
@@ -48,7 +48,15 @@ void Yaz_Z_Server::facility_add(IYaz_Server_Facility *facility,
     (*p)->m_facility = facility;
 }
 
-void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request)
+void Yaz_Z_Server::recv_GDU (Z_GDU *apdu, int len)
+{
+    if (apdu->which == Z_GDU_Z3950)
+       recv_Z_PDU(apdu->u.z3950, len);
+    else
+       delete this;
+}
+
+void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request, int len)
 {   
     Yaz_Z_Server_Facility_Info *f = m_facilities;
     
@@ -77,7 +85,7 @@ void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request)
            f = f->m_next;
        }
        transfer_referenceId(apdu_request, apdu_response);
-       send_Z_PDU(apdu_response);
+       send_Z_PDU(apdu_response, 0);
     }
     else
     {
@@ -92,7 +100,7 @@ void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request)
        }
        if (!taken)
        {
-           yaz_log (LOG_WARN, "unhandled request = %d", apdu_request->which);
+           yaz_log (YLOG_WARN, "unhandled request = %d", apdu_request->which);
            delete this;
        }
     }
@@ -123,7 +131,7 @@ void Yaz_Z_ServerUtility::create_surrogateDiagnostics(
     Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)
        odr_malloc (odr, sizeof(*dr));
     
-    yaz_log(LOG_DEBUG, "SurrogateDiagnotic: %d -- %s", error, addinfo);
+    yaz_log(YLOG_DEBUG, "SurrogateDiagnotic: %d -- %s", error, addinfo);
     *err = error;
     rec->databaseName = dbname ? odr_strdup (odr, dbname) : 0;
     rec->which = Z_NamePlusRecord_surrogateDiagnostic;