Implemented various stuff for client and proxy. Updated calls
[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  * $Id: yaz-z-assoc.h,v 1.2 1999-04-20 10:30:05 adam Exp $
7  */
8
9 #include <proto.h>
10 #include <odr.h>
11 #include <yaz-pdu-observer.h>
12
13 /** Z39.50 Assocation.
14     This object implements the client - and server role of a generic
15     Z39.50 Association.
16 */
17 class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer {
18  public:
19     /// Create object using the PDU Observer specified
20     Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
21     /// Destroy assocation and close PDU Observer
22     virtual ~Yaz_Z_Assoc();
23     /// Receive PDU
24     void recv_PDU(const char *buf, int len);
25     /// Connect notification
26     void connectNotify();
27     /// Failure notification
28     void failNotify();
29     /// Timeout notification
30     void timeoutNotify();
31     /// Begin Z39.50 client role
32     void client(const char *addr);
33     /// Begin Z39.50 server role
34     void server(const char *addr);
35     /// Close connection
36     void close();
37     /// Decode Z39.50 PDU.
38     Z_APDU *decode_Z_PDU(const char *buf, int len);
39     /// Encode Z39.50 PDU.
40     int encode_Z_PDU(Z_APDU *apdu, char **buf, int *len);
41     /// Send Z39.50 PDU
42     int send_Z_PDU(Z_APDU *apdu);
43     /// Receive Z39.50 PDU
44     virtual void recv_Z_PDU(Z_APDU *apdu) = 0;
45     /// Create Z39.50 PDU with reasonable defaults
46     Z_APDU *create_Z_PDU(int type);
47     /// Request Alloc
48     ODR odr_encode ();
49     ODR odr_decode ();
50     ODR odr_print ();
51     /// OtherInformation
52     Z_OtherInformationUnit *update_otherInformation (
53         Z_OtherInformation **otherInformationP, int createFlag,
54         int *oid, int categoryValue);
55  private:
56     static int yaz_init_flag;
57     static int yaz_init_func();
58     IYaz_PDU_Observable *m_PDU_Observable;
59     ODR m_odr_in;
60     ODR m_odr_out;
61     ODR m_odr_print;
62 };