First WIN32 port of YAZ++.
[yazpp-moved-to-github.git] / include / yaz-ir-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-ir-assoc.h,v $
7  * Revision 1.3  1999-02-02 14:01:12  adam
8  * First WIN32 port of YAZ++.
9  *
10  * Revision 1.2  1999/01/28 13:08:39  adam
11  * Yaz_PDU_Assoc better encapsulated. Memory leak fix in
12  * yaz-socket-manager.cc.
13  *
14  * Revision 1.1.1.1  1999/01/28 09:41:07  adam
15  * First implementation of YAZ++.
16  *
17  */
18
19
20 #include <proto.h>
21 #include <odr.h>
22 #include <yaz-pdu-observer.h>
23
24 /** Information Retrieval Assocation.
25     This object implements the client - and server role of a generic
26     Z39.50 Association.
27 */
28 class YAZ_EXPORT Yaz_IR_Assoc : public IYaz_PDU_Observer {
29  public:
30     /// Create object using the PDU Observer specified
31     Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
32     /// Destroy assocation and close PDU Observer
33     virtual ~Yaz_IR_Assoc();
34     /// Receive PDU
35     void recv_PDU(const char *buf, int len);
36     /// Connect notification
37     void connectNotify();
38     /// Failure notification
39     void failNotify();
40     /// Begin Z39.50 client role
41     void client(const char *addr);
42     /// Begin Z39.50 server role
43     void server(const char *addr);
44     /// Decode Z39.50 PDU.
45     Z_APDU *decode_Z_PDU(const char *buf, int len);
46     /// Encode Z39.50 PDU.
47     int encode_Z_PDU(Z_APDU *apdu, char **buf, int *len);
48     /// Send Z39.50 PDU
49     int send_Z_PDU(Z_APDU *apdu);
50     /// Receive Z39.50 PDU
51     virtual void recv_Z_PDU (Z_APDU *apdu) = 0;
52     /// Create Z39.50 with reasonable defaults
53     Z_APDU *create_Z_PDU(int type);
54     static int yaz_init_flag;
55     static int yaz_init_func();
56  private:
57     IYaz_PDU_Observable *m_PDU_Observable;
58     ODR m_odr_in;
59     ODR m_odr_out;
60     ODR m_odr_print;
61 };