2 * Copyright (c) 1998-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: yaz-server.cpp,v $
7 * Revision 1.3 1999-02-02 14:01:22 adam
8 * First WIN32 port of YAZ++.
10 * Revision 1.2 1999/01/28 13:08:47 adam
11 * Yaz_PDU_Assoc better encapsulated. Memory leak fix in
12 * yaz-socket-manager.cc.
14 * Revision 1.1.1.1 1999/01/28 09:41:07 adam
15 * First implementation of YAZ++.
20 #include <yaz-ir-assoc.h>
21 #include <yaz-pdu-assoc.h>
22 #include <yaz-socket-manager.h>
24 class MyServer : public Yaz_IR_Assoc {
26 MyServer(IYaz_PDU_Observable *the_PDU_Observable);
27 void recv_Z_PDU(Z_APDU *apdu);
28 IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
36 void MyServer::recv_Z_PDU(Z_APDU *apdu)
38 logf (LOG_LOG, "recv_Z_PDU");
41 case Z_APDU_initRequest:
42 logf (LOG_LOG, "got InitRequest");
43 apdu = create_Z_PDU(Z_APDU_initResponse);
46 case Z_APDU_searchRequest:
47 logf (LOG_LOG, "got searchRequest");
48 apdu = create_Z_PDU(Z_APDU_searchResponse);
51 case Z_APDU_presentRequest:
52 logf (LOG_LOG, "got presentRequest");
53 apdu = create_Z_PDU(Z_APDU_presentResponse);
60 IYaz_PDU_Observer *MyServer::clone(IYaz_PDU_Observable *the_PDU_Observable)
62 logf (LOG_LOG, "clone %d", m_no);
64 return new MyServer(the_PDU_Observable);
67 MyServer::MyServer(IYaz_PDU_Observable *the_PDU_Observable) :
68 Yaz_IR_Assoc (the_PDU_Observable)
73 void MyServer::failNotify()
78 int main(int argc, char **argv)
80 Yaz_SocketManager mySocketManager;
82 MyServer z(new Yaz_PDU_Assoc(&mySocketManager, 0));
88 for (int i = 1; i < argc; i++)
91 while (!stop && mySocketManager.processEvent() > 0)