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.1 1999-01-28 09:41:07 adam
12 #ifndef YAZ_PDU_OBSERVER_H
13 #define YAZ_PDU_OBSERVER_H
15 class IYaz_PDU_Observer;
17 /** Protocol Data Unit Observable.
18 This interface implements a Protocol Data Unit (PDU) network driver.
19 The PDU's is not encoded/decoded by this interface. They are simply
20 transmitted/received over the network. To use this interface the
21 IYaz_PDU_Observer interface must be implemented.
23 class IYaz_PDU_Observable {
25 /// Send encoded PDU buffer of specified length
26 virtual int send_PDU(const char *buf, int len) = 0;
27 /// Connect with server specified by addr.
28 virtual void connect(IYaz_PDU_Observer *observer, const char *addr) = 0;
29 /// Listen on address addr.
30 virtual void listen(IYaz_PDU_Observer *observer, const char *addr) = 0;
32 virtual void close() = 0;
33 /// Make clone of this object using this interface
34 virtual IYaz_PDU_Observable *clone() = 0;
37 /** Protocol Data Unit Observer.
38 This interface is used together with the IYaz_PDU_Observable interface
39 and acts as a callback interface for it.
41 class IYaz_PDU_Observer {
43 /// A PDU has been received
44 virtual void recv_PDU(const char *buf, int len) = 0;
45 /// Called when Iyaz_PDU_Observabvle::connect was successful.
46 virtual void connectNotify() = 0;
47 /// Called whenever the connection was closed
48 virtual void failNotify() = 0;
49 /// Make clone of observer using IYaz_PDU_Observable interface
50 virtual IYaz_PDU_Observer *clone(IYaz_PDU_Observable *the_PDU_Observable) = 0;