Added object Yaz_Z_Assoc. Much more functional client.
[yazpp-moved-to-github.git] / include / yaz-z-assoc.h
1 /*
2  * Copyright (c) 1998-1999, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  * 
6  * $Log: yaz-z-assoc.h,v $
7  * Revision 1.1  1999-04-09 11:47:23  adam
8  * Added object Yaz_Z_Assoc. Much more functional client.
9  *
10  */
11
12 #include <proto.h>
13 #include <odr.h>
14 #include <yaz-pdu-observer.h>
15
16 /** Z39.50 Assocation.
17     This object implements the client - and server role of a generic
18     Z39.50 Association.
19 */
20 class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer {
21  public:
22     /// Create object using the PDU Observer specified
23     Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
24     /// Destroy assocation and close PDU Observer
25     virtual ~Yaz_Z_Assoc();
26     /// Receive PDU
27     void recv_PDU(const char *buf, int len);
28     /// Connect notification
29     void connectNotify();
30     /// Failure notification
31     void failNotify();
32     /// Timeout notification
33     void timeoutNotify();
34     /// Begin Z39.50 client role
35     void client(const char *addr);
36     /// Begin Z39.50 server role
37     void server(const char *addr);
38     /// Close connection
39     void close();
40     /// Decode Z39.50 PDU.
41     Z_APDU *decode_Z_PDU(const char *buf, int len);
42     /// Encode Z39.50 PDU.
43     int encode_Z_PDU(Z_APDU *apdu, char **buf, int *len);
44     /// Send Z39.50 PDU
45     int send_Z_PDU(Z_APDU *apdu);
46     /// Receive Z39.50 PDU
47     virtual void recv_Z_PDU(Z_APDU *apdu) = 0;
48     /// Create Z39.50 PDU with reasonable defaults
49     Z_APDU *create_Z_PDU(int type);
50     /// Request Alloc
51     ODR odr_encode ();
52  private:
53     static int yaz_init_flag;
54     static int yaz_init_func();
55     IYaz_PDU_Observable *m_PDU_Observable;
56     ODR m_odr_in;
57     ODR m_odr_out;
58     ODR m_odr_print;
59 };