Implemented various stuff for client and proxy. Updated calls
[yazpp-moved-to-github.git] / include / yaz-pdu-observer.h
1 /*
2  * Copyright (c) 1998-1999, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  * 
6  * $Id: yaz-pdu-observer.h,v 1.6 1999-04-20 10:30:05 adam Exp $
7  */
8
9 #ifndef YAZ_PDU_OBSERVER_H
10 #define YAZ_PDU_OBSERVER_H
11
12 class IYaz_PDU_Observer;
13
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.
19  */
20 class YAZ_EXPORT IYaz_PDU_Observable {
21  public:
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;
28     /// Close connection
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;
34     /// Set Idle Time
35     virtual void idleTime (int timeout) = 0;
36 };
37
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.
41  */
42 class YAZ_EXPORT IYaz_PDU_Observer {
43  public:
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;
54 };
55
56 #endif