Initial revision
[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.1  1999-01-28 09:41:07  adam
8  * Initial revision
9  *
10  */
11
12
13 #include <proto.h>
14 #include <odr.h>
15 #include <yaz-pdu-observer.h>
16
17 /** Information Retrieval Assocation.
18     This object implements the client - and server role of a generic
19     Z39.50 Association.
20  */
21 class Yaz_IR_Assoc : public IYaz_PDU_Observer {
22  public:
23     /// Create object using the PDU Observer specified
24     Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
25     /// Destroy assocation and close PDU Observer
26     virtual ~Yaz_IR_Assoc();
27     /// Receive PDU
28     void recv_PDU(const char *buf, int len);
29     /// Connect notification
30     void connectNotify();
31     /// Failure notification
32     void failNotify();
33     /// Begin Z39.50 client role
34     void client(const char *addr);
35     /// Begin Z39.50 server role
36     void server(const char *addr);
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 with reasonable defaults
46    Z_APDU *create_Z_PDU(int type);
47  private:
48     IYaz_PDU_Observable *m_PDU_Observable;
49     ODR m_odr_in;
50     ODR m_odr_out;
51     ODR m_odr_print;
52 };