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.1 1999-01-28 09:41:07 adam
13 #include <yaz-ir-assoc.h>
14 #include <yaz-pdu-assoc.h>
15 #include <yaz-socket-manager.h>
17 class MyServer : public Yaz_IR_Assoc {
19 MyServer(IYaz_PDU_Observable *the_PDU_Observable);
20 void recv_Z_PDU(Z_APDU *apdu);
21 IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable);
26 void MyServer::recv_Z_PDU(Z_APDU *apdu)
28 logf (LOG_LOG, "recv_Z_PDU");
31 case Z_APDU_initRequest:
32 logf (LOG_LOG, "got InitRequest");
33 apdu = create_Z_PDU(Z_APDU_initResponse);
36 case Z_APDU_searchRequest:
37 logf (LOG_LOG, "got searchRequest");
38 apdu = create_Z_PDU(Z_APDU_searchResponse);
41 case Z_APDU_presentRequest:
42 logf (LOG_LOG, "got presentRequest");
43 apdu = create_Z_PDU(Z_APDU_presentResponse);
50 IYaz_PDU_Observer *MyServer::clone(IYaz_PDU_Observable *the_PDU_Observable)
52 return new MyServer(the_PDU_Observable);
55 MyServer::MyServer(IYaz_PDU_Observable *the_PDU_Observable) :
56 Yaz_IR_Assoc (the_PDU_Observable)
61 int main(int argc, char **argv)
63 Yaz_SocketManager mySocketManager;
65 Yaz_PDU_Assoc my_PDU_Assoc(&mySocketManager, 0);
66 MyServer z(&my_PDU_Assoc);
70 while (!stop && mySocketManager.processEvent() > 0)