2 * Copyright (c) 1998-2005, Index Data.
3 * See the file LICENSE for details.
5 * $Id: z-assoc.h,v 1.4 2007-05-08 12:04:50 adam Exp $
8 #ifndef YAZ_Z_ASSOC_INCLUDED
9 #define YAZ_Z_ASSOC_INCLUDED
12 #include <yaz/proto.h>
14 #include <yazpp/pdu-observer.h>
17 /** Z39.50 Assocation.
18 This object implements the client - and server role of a generic
21 class YAZ_EXPORT Z_Assoc : public IPDU_Observer {
23 /// Create object using the PDU Observer specified
24 Z_Assoc(IPDU_Observable *the_PDU_Observable);
25 /// Destroy assocation and close PDU Observer
28 void recv_PDU(const char *buf, int len);
29 /// Connect notification
30 virtual void connectNotify() = 0;
31 /// Failure notification
32 virtual void failNotify() = 0;
33 /// Timeout notification
34 virtual void timeoutNotify() = 0;
36 void timeout(int timeout);
37 /// Begin Z39.50 client role
38 int client(const char *addr);
39 /// Begin Z39.50 server role
40 int server(const char *addr);
43 /// Decode Z39.50 PDU.
44 Z_GDU *decode_GDU(const char *buf, int len);
45 /// Encode Z39.50 PDU.
46 int encode_GDU(Z_GDU *apdu, char **buf, int *len);
48 int send_Z_PDU(Z_APDU *apdu, int *len);
49 int send_GDU(Z_GDU *apdu, int *len);
50 /// Receive Z39.50 PDU
51 virtual void recv_GDU(Z_GDU *apdu, int len) = 0;
52 /// Create Z39.50 PDU with reasonable defaults
53 Z_APDU *create_Z_PDU(int type);
59 void set_APDU_log(const char *fname);
60 const char *get_APDU_log();
63 void get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip);
64 Z_OtherInformationUnit *update_otherInformation (
65 Z_OtherInformation **otherInformationP, int createFlag,
66 const Odr_oid *oid, int categoryValue, int deleteFlag);
67 void set_otherInformationString(
69 const Odr_oid *oid, int categoryValue, const char *str);
70 void set_otherInformationString (
71 Z_OtherInformation **otherInformationP,
72 const Odr_oid *oid, int categoryValue,
74 Z_ReferenceId *getRefID(char* str);
75 Z_ReferenceId **get_referenceIdP(Z_APDU *apdu);
76 void transfer_referenceId(Z_APDU *from, Z_APDU *to);
78 const char *get_hostname();
80 int set_APDU_yazlog(int v);
83 static int yaz_init_flag;
84 static int yaz_init_func();
85 IPDU_Observable *m_PDU_Observable;
101 * indent-tabs-mode: nil
103 * vim: shiftwidth=4 tabstop=8 expandtab