2 * Copyright (c) 1998-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: yaz-z-assoc.h,v 1.7 2000-08-07 14:19:59 adam Exp $
11 #include <yaz-pdu-observer.h>
13 /** Z39.50 Assocation.
14 This object implements the client - and server role of a generic
17 class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer {
19 /// Create object using the PDU Observer specified
20 Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
21 /// Destroy assocation and close PDU Observer
22 virtual ~Yaz_Z_Assoc();
24 void recv_PDU(const char *buf, int len);
25 /// Connect notification
26 virtual void connectNotify() = 0;
27 /// Failure notification
28 virtual void failNotify() = 0;
29 /// Timeout notification
30 virtual void timeoutNotify() = 0;
32 void timeout(int timeout);
33 /// Begin Z39.50 client role
34 void client(const char *addr);
35 /// Begin Z39.50 server role
36 void server(const char *addr);
39 /// Decode Z39.50 PDU.
40 Z_APDU *decode_Z_PDU(const char *buf, int len);
41 /// Encode Z39.50 PDU.
42 int encode_Z_PDU(Z_APDU *apdu, char **buf, int *len);
44 int send_Z_PDU(Z_APDU *apdu);
45 /// Receive Z39.50 PDU
46 virtual void recv_Z_PDU(Z_APDU *apdu) = 0;
47 /// Create Z39.50 PDU with reasonable defaults
48 Z_APDU *create_Z_PDU(int type);
54 void set_APDU_log(const char *fname);
55 const char *get_APDU_log();
58 void get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip);
59 Z_OtherInformationUnit *update_otherInformation (
60 Z_OtherInformation **otherInformationP, int createFlag,
61 int *oid, int categoryValue, int deleteFlag);
62 void set_otherInformationString (
63 Z_OtherInformation **otherInformationP,
64 int *oid, int categoryValue,
66 void set_otherInformationString (
67 Z_OtherInformation **otherInformation,
68 int oidval, int categoryValue,
70 void set_otherInformationString (
72 int oidval, int categoryValue,
75 Z_ReferenceId* getRefID(char* str);
77 const char *get_hostname();
80 static int yaz_init_flag;
81 static int yaz_init_func();
82 IYaz_PDU_Observable *m_PDU_Observable;