2 * Copyright (c) 1998-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: yaz-pdu-observer.h,v $
7 * Revision 1.2 1999-01-28 13:08:41 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++.
16 #ifndef YAZ_PDU_OBSERVER_H
17 #define YAZ_PDU_OBSERVER_H
19 class IYaz_PDU_Observer;
21 /** Protocol Data Unit Observable.
22 This interface implements a Protocol Data Unit (PDU) network driver.
23 The PDU's is not encoded/decoded by this interface. They are simply
24 transmitted/received over the network. To use this interface the
25 IYaz_PDU_Observer interface must be implemented.
27 class IYaz_PDU_Observable {
29 /// Send encoded PDU buffer of specified length
30 virtual int send_PDU(const char *buf, int len) = 0;
31 /// Connect with server specified by addr.
32 virtual void connect(IYaz_PDU_Observer *observer, const char *addr) = 0;
33 /// Listen on address addr.
34 virtual void listen(IYaz_PDU_Observer *observer, const char *addr) = 0;
36 virtual void close() = 0;
37 /// Make clone of this object using this interface
38 virtual IYaz_PDU_Observable *clone() = 0;
39 /// Destroy completely
40 virtual void destroy() = 0;
43 /** Protocol Data Unit Observer.
44 This interface is used together with the IYaz_PDU_Observable interface
45 and acts as a callback interface for it.
47 class IYaz_PDU_Observer {
49 /// A PDU has been received
50 virtual void recv_PDU(const char *buf, int len) = 0;
51 /// Called when Iyaz_PDU_Observabvle::connect was successful.
52 virtual void connectNotify() = 0;
53 /// Called whenever the connection was closed
54 virtual void failNotify() = 0;
55 /// Make clone of observer using IYaz_PDU_Observable interface
56 virtual IYaz_PDU_Observer *clone(IYaz_PDU_Observable *the_PDU_Observable) = 0;