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.2 1999-01-28 13:08:47 adam
8 * Yaz_PDU_Assoc better encapsulated. Memory leak fix in
9 * yaz-socket-manager.cc.
11 * Revision 1.1.1.1 1999/01/28 09:41:07 adam
12 * First implementation of YAZ++.
17 #include <yaz-ir-assoc.h>
18 #include <yaz-pdu-assoc.h>
19 #include <yaz-socket-manager.h>
21 class MyServer : public Yaz_IR_Assoc {
23 MyServer(IYaz_PDU_Observable *the_PDU_Observable);
24 void recv_Z_PDU(Z_APDU *apdu);
25 IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
33 void MyServer::recv_Z_PDU(Z_APDU *apdu)
35 logf (LOG_LOG, "recv_Z_PDU");
38 case Z_APDU_initRequest:
39 logf (LOG_LOG, "got InitRequest");
40 apdu = create_Z_PDU(Z_APDU_initResponse);
43 case Z_APDU_searchRequest:
44 logf (LOG_LOG, "got searchRequest");
45 apdu = create_Z_PDU(Z_APDU_searchResponse);
48 case Z_APDU_presentRequest:
49 logf (LOG_LOG, "got presentRequest");
50 apdu = create_Z_PDU(Z_APDU_presentResponse);
57 IYaz_PDU_Observer *MyServer::clone(IYaz_PDU_Observable *the_PDU_Observable)
59 logf (LOG_LOG, "clone %d", m_no);
61 return new MyServer(the_PDU_Observable);
64 MyServer::MyServer(IYaz_PDU_Observable *the_PDU_Observable) :
65 Yaz_IR_Assoc (the_PDU_Observable)
70 void MyServer::failNotify()
75 int main(int argc, char **argv)
77 Yaz_SocketManager mySocketManager;
79 MyServer z(new Yaz_PDU_Assoc(&mySocketManager, 0));
85 for (int i = 1; i < argc; i++)
88 while (!stop && mySocketManager.processEvent() > 0)