2 * Copyright (c) 1998-2000, Index Data.
3 * See the file LICENSE for details.
5 * $Id: yaz-z-assoc.h,v 1.8 2000-09-08 10:23:42 adam Exp $
10 #include <yaz-pdu-observer.h>
12 /** Z39.50 Assocation.
13 This object implements the client - and server role of a generic
16 class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer {
18 /// Create object using the PDU Observer specified
19 Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
20 /// Destroy assocation and close PDU Observer
21 virtual ~Yaz_Z_Assoc();
23 void recv_PDU(const char *buf, int len);
24 /// Connect notification
25 virtual void connectNotify() = 0;
26 /// Failure notification
27 virtual void failNotify() = 0;
28 /// Timeout notification
29 virtual void timeoutNotify() = 0;
31 void timeout(int timeout);
32 /// Begin Z39.50 client role
33 void client(const char *addr);
34 /// Begin Z39.50 server role
35 void server(const char *addr);
38 /// Decode Z39.50 PDU.
39 Z_APDU *decode_Z_PDU(const char *buf, int len);
40 /// Encode Z39.50 PDU.
41 int encode_Z_PDU(Z_APDU *apdu, char **buf, int *len);
43 int send_Z_PDU(Z_APDU *apdu);
44 /// Receive Z39.50 PDU
45 virtual void recv_Z_PDU(Z_APDU *apdu) = 0;
46 /// Create Z39.50 PDU with reasonable defaults
47 Z_APDU *create_Z_PDU(int type);
53 void set_APDU_log(const char *fname);
54 const char *get_APDU_log();
57 void get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip);
58 Z_OtherInformationUnit *update_otherInformation (
59 Z_OtherInformation **otherInformationP, int createFlag,
60 int *oid, int categoryValue, int deleteFlag);
61 void set_otherInformationString (
62 Z_OtherInformation **otherInformationP,
63 int *oid, int categoryValue,
65 void set_otherInformationString (
66 Z_OtherInformation **otherInformation,
67 int oidval, int categoryValue,
69 void set_otherInformationString (
71 int oidval, int categoryValue,
74 Z_ReferenceId* getRefID(char* str);
76 const char *get_hostname();
79 static int yaz_init_flag;
80 static int yaz_init_func();
81 IYaz_PDU_Observable *m_PDU_Observable;