2 * Copyright (c) 1998-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: yaz-pdu-observer.h,v 1.6 1999-04-20 10:30:05 adam Exp $
9 #ifndef YAZ_PDU_OBSERVER_H
10 #define YAZ_PDU_OBSERVER_H
12 class IYaz_PDU_Observer;
14 /** Protocol Data Unit Observable.
15 This interface implements a Protocol Data Unit (PDU) network driver.
16 The PDU's is not encoded/decoded by this interface. They are simply
17 transmitted/received over the network. To use this interface the
18 IYaz_PDU_Observer interface must be implemented.
20 class YAZ_EXPORT IYaz_PDU_Observable {
22 /// Send encoded PDU buffer of specified length
23 virtual int send_PDU(const char *buf, int len) = 0;
24 /// Connect with server specified by addr.
25 virtual void connect(IYaz_PDU_Observer *observer, const char *addr) = 0;
26 /// Listen on address addr.
27 virtual void listen(IYaz_PDU_Observer *observer, const char *addr) = 0;
29 virtual void close() = 0;
30 /// Make clone of this object using this interface
31 virtual IYaz_PDU_Observable *clone() = 0;
32 /// Destroy completely
33 virtual void destroy() = 0;
35 virtual void idleTime (int timeout) = 0;
38 /** Protocol Data Unit Observer.
39 This interface is used together with the IYaz_PDU_Observable interface
40 and acts as a callback interface for it.
42 class YAZ_EXPORT IYaz_PDU_Observer {
44 /// A PDU has been received
45 virtual void recv_PDU(const char *buf, int len) = 0;
46 /// Called when Iyaz_PDU_Observabvle::connect was successful.
47 virtual void connectNotify() = 0;
48 /// Called whenever the connection was closed
49 virtual void failNotify() = 0;
50 /// Called whenever there is a timeout
51 virtual void timeoutNotify() = 0;
52 /// Make clone of observer using IYaz_PDU_Observable interface
53 virtual IYaz_PDU_Observer *clone(IYaz_PDU_Observable *the_PDU_Observable) = 0;