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.3 1999-02-02 14:01:14 adam
8 * First WIN32 port of YAZ++.
10 * Revision 1.2 1999/01/28 13:08:41 adam
11 * Yaz_PDU_Assoc better encapsulated. Memory leak fix in
12 * yaz-socket-manager.cc.
14 * Revision 1.1.1.1 1999/01/28 09:41:07 adam
15 * First implementation of YAZ++.
19 #ifndef YAZ_PDU_OBSERVER_H
20 #define YAZ_PDU_OBSERVER_H
22 class IYaz_PDU_Observer;
24 /** Protocol Data Unit Observable.
25 This interface implements a Protocol Data Unit (PDU) network driver.
26 The PDU's is not encoded/decoded by this interface. They are simply
27 transmitted/received over the network. To use this interface the
28 IYaz_PDU_Observer interface must be implemented.
30 class YAZ_EXPORT IYaz_PDU_Observable {
32 /// Send encoded PDU buffer of specified length
33 virtual int send_PDU(const char *buf, int len) = 0;
34 /// Connect with server specified by addr.
35 virtual void connect(IYaz_PDU_Observer *observer, const char *addr) = 0;
36 /// Listen on address addr.
37 virtual void listen(IYaz_PDU_Observer *observer, const char *addr) = 0;
39 virtual void close() = 0;
40 /// Make clone of this object using this interface
41 virtual IYaz_PDU_Observable *clone() = 0;
42 /// Destroy completely
43 virtual void destroy() = 0;
46 /** Protocol Data Unit Observer.
47 This interface is used together with the IYaz_PDU_Observable interface
48 and acts as a callback interface for it.
50 class YAZ_EXPORT IYaz_PDU_Observer {
52 /// A PDU has been received
53 virtual void recv_PDU(const char *buf, int len) = 0;
54 /// Called when Iyaz_PDU_Observabvle::connect was successful.
55 virtual void connectNotify() = 0;
56 /// Called whenever the connection was closed
57 virtual void failNotify() = 0;
58 /// Make clone of observer using IYaz_PDU_Observable interface
59 virtual IYaz_PDU_Observer *clone(IYaz_PDU_Observable *the_PDU_Observable) = 0;