X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fyaz-my-server.cpp;h=421aa4d9d56b5003dda1d436e8e3dd4582d609a8;hb=75f7c460d6d10961f3d2ed841b757d6d6b7725d7;hp=bd9d7f6d5c2c57a304aeb1f447926901d262f675;hpb=29d5f0cb70a5a61924e3b729f6ce5998cd6485ab;p=yazpp-moved-to-github.git diff --git a/src/yaz-my-server.cpp b/src/yaz-my-server.cpp index bd9d7f6..421aa4d 100644 --- a/src/yaz-my-server.cpp +++ b/src/yaz-my-server.cpp @@ -2,16 +2,19 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-my-server.cpp,v 1.15 2005-01-17 09:55:58 adam Exp $ + * $Id: yaz-my-server.cpp,v 1.18 2005-06-08 13:28:06 adam Exp $ */ #include #include +#include #include #include #include #include +using namespace yazpp_1; + class MyILL : public Yaz_Facility_ILL { public: void ill_service (Z_ExtendedServicesRequest *req, @@ -46,12 +49,12 @@ public: Z_Records *records); }; -class MyServer : public Yaz_Z_Server { +class MyServer : public Z_Server { public: ~MyServer(); - MyServer(IYaz_PDU_Observable *the_PDU_Observable); - IYaz_PDU_Observer* sessionNotify(IYaz_PDU_Observable *the_PDU_Observable, - int fd); + MyServer(IPDU_Observable *the_PDU_Observable); + IPDU_Observer* sessionNotify(IPDU_Observable *the_PDU_Observable, + int fd); void failNotify(); void timeoutNotify(); void connectNotify(); @@ -127,16 +130,20 @@ void MyRetrieval::sr_record (const char *resultSetName, { yaz_log (YLOG_LOG, "MyServer::recv_Z_record"); const char *rec = get_record(position); - create_databaseRecord (odr_encode(), namePlusRecord, 0, VAL_USMARC, rec, - strlen(rec)); + if (rec) + create_databaseRecord (odr_encode(), namePlusRecord, 0, + VAL_USMARC, rec, strlen(rec)); + else + create_surrogateDiagnostics(odr_encode(), namePlusRecord, 0, + YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE, 0); } MyServer::~MyServer() { } -IYaz_PDU_Observer *MyServer::sessionNotify( - IYaz_PDU_Observable *the_PDU_Observable, int fd) +IPDU_Observer *MyServer::sessionNotify( + IPDU_Observable *the_PDU_Observable, int fd) { MyServer *new_server; m_no++; @@ -150,8 +157,8 @@ IYaz_PDU_Observer *MyServer::sessionNotify( return new_server; } -MyServer::MyServer(IYaz_PDU_Observable *the_PDU_Observable) : - Yaz_Z_Server (the_PDU_Observable) +MyServer::MyServer(IPDU_Observable *the_PDU_Observable) : + Z_Server (the_PDU_Observable) { m_no = 0; } @@ -186,9 +193,9 @@ int main(int argc, char **argv) const char *addr = "tcp:@:9999"; char *apdu_log = 0; - Yaz_SocketManager mySocketManager; + SocketManager mySocketManager; - Yaz_PDU_Assoc *my_PDU_Assoc = 0; + PDU_Assoc *my_PDU_Assoc = 0; MyServer *z = 0; int ret; @@ -216,11 +223,11 @@ int main(int argc, char **argv) } #if YAZ_POSIX_THREADS if (thread_flag) - my_PDU_Assoc = new Yaz_PDU_AssocThread(&mySocketManager); + my_PDU_Assoc = new PDU_AssocThread(&mySocketManager); else - my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager); + my_PDU_Assoc = new PDU_Assoc(&mySocketManager); #else - my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager); + my_PDU_Assoc = new PDU_Assoc(&mySocketManager); #endif z = new MyServer(my_PDU_Assoc);