* 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 <stdlib.h>
#include <yaz/log.h>
+#include <yaz/diagbib1.h>
#include <yaz/options.h>
#include <yaz++/z-server.h>
#include <yaz++/pdu-assoc.h>
#include <yaz++/socket-manager.h>
+using namespace yazpp_1;
+
class MyILL : public Yaz_Facility_ILL {
public:
void ill_service (Z_ExtendedServicesRequest *req,
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();
{
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++;
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;
}
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;
}
#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);