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.5 1999-04-09 11:47:23 adam
8 * Added object Yaz_Z_Assoc. Much more functional client.
10 * Revision 1.4 1999/03/23 14:17:57 adam
11 * More work on timeout handling. Work on yaz-client.
13 * Revision 1.3 1999/02/02 14:01:14 adam
14 * First WIN32 port of YAZ++.
16 * Revision 1.2 1999/01/28 13:08:41 adam
17 * Yaz_PDU_Assoc better encapsulated. Memory leak fix in
18 * yaz-socket-manager.cc.
20 * Revision 1.1.1.1 1999/01/28 09:41:07 adam
21 * First implementation of YAZ++.
25 #ifndef YAZ_PDU_OBSERVER_H
26 #define YAZ_PDU_OBSERVER_H
28 class IYaz_PDU_Observer;
30 /** Protocol Data Unit Observable.
31 This interface implements a Protocol Data Unit (PDU) network driver.
32 The PDU's is not encoded/decoded by this interface. They are simply
33 transmitted/received over the network. To use this interface the
34 IYaz_PDU_Observer interface must be implemented.
36 class YAZ_EXPORT IYaz_PDU_Observable {
38 /// Send encoded PDU buffer of specified length
39 virtual int send_PDU(const char *buf, int len) = 0;
40 /// Connect with server specified by addr.
41 virtual void connect(IYaz_PDU_Observer *observer, const char *addr) = 0;
42 /// Listen on address addr.
43 virtual void listen(IYaz_PDU_Observer *observer, const char *addr) = 0;
45 virtual void close() = 0;
46 /// Make clone of this object using this interface
47 virtual IYaz_PDU_Observable *clone() = 0;
48 /// Destroy completely
49 virtual void destroy() = 0;
51 virtual void idleTime (int timeout) = 0;
54 /** Protocol Data Unit Observer.
55 This interface is used together with the IYaz_PDU_Observable interface
56 and acts as a callback interface for it.
58 class YAZ_EXPORT IYaz_PDU_Observer {
60 /// A PDU has been received
61 virtual void recv_PDU(const char *buf, int len) = 0;
62 /// Called when Iyaz_PDU_Observabvle::connect was successful.
63 virtual void connectNotify() = 0;
64 /// Called whenever the connection was closed
65 virtual void failNotify() = 0;
66 /// Called whenever there is a timeout
67 virtual void timeoutNotify() = 0;
68 /// Make clone of observer using IYaz_PDU_Observable interface
69 virtual IYaz_PDU_Observer *clone(IYaz_PDU_Observable *the_PDU_Observable) = 0;