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