2 * Copyright (c) 1998-2000, Index Data.
3 * See the file LICENSE for details.
5 * $Id: yaz-z-assoc.h,v 1.2 2001-04-25 18:59:30 adam Exp $
8 #ifndef YAZ_Z_ASSOC_INCLUDED
9 #define YAZ_Z_ASSOC_INCLUDED
11 #include <yaz/proto.h>
13 #include <yaz++/yaz-pdu-observer.h>
15 /** Z39.50 Assocation.
16 This object implements the client - and server role of a generic
19 class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer {
21 /// Create object using the PDU Observer specified
22 Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
23 /// Destroy assocation and close PDU Observer
24 virtual ~Yaz_Z_Assoc();
26 void recv_PDU(const char *buf, int len);
27 /// Connect notification
28 virtual void connectNotify() = 0;
29 /// Failure notification
30 virtual void failNotify() = 0;
31 /// Timeout notification
32 virtual void timeoutNotify() = 0;
34 void timeout(int timeout);
35 /// Begin Z39.50 client role
36 void client(const char *addr);
37 /// Begin Z39.50 server role
38 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);
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 PDU with reasonable defaults
50 Z_APDU *create_Z_PDU(int type);
56 void set_APDU_log(const char *fname);
57 const char *get_APDU_log();
60 void get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip);
61 Z_OtherInformationUnit *update_otherInformation (
62 Z_OtherInformation **otherInformationP, int createFlag,
63 int *oid, int categoryValue, int deleteFlag);
64 void set_otherInformationString (
65 Z_OtherInformation **otherInformationP,
66 int *oid, int categoryValue,
68 void set_otherInformationString (
69 Z_OtherInformation **otherInformation,
70 int oidval, int categoryValue,
72 void set_otherInformationString (
74 int oidval, int categoryValue,
77 Z_ReferenceId *getRefID(char* str);
78 Z_ReferenceId **get_referenceIdP(Z_APDU *apdu);
79 void transfer_referenceId(Z_APDU *from, Z_APDU *to);
81 const char *get_hostname();
84 static int yaz_init_flag;
85 static int yaz_init_func();
86 IYaz_PDU_Observable *m_PDU_Observable;