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