2 * Copyright (c) 1998-2005, Index Data.
3 * See the file LICENSE for details.
5 * $Id: z-assoc.h,v 1.1 2006-03-29 13:14:15 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 int *oid, int categoryValue, int deleteFlag);
67 void set_otherInformationString (
68 Z_OtherInformation **otherInformationP,
69 int *oid, int categoryValue,
71 void set_otherInformationString (
72 Z_OtherInformation **otherInformation,
73 int oidval, int categoryValue,
75 void set_otherInformationString (
77 int oidval, int categoryValue,
80 Z_ReferenceId *getRefID(char* str);
81 Z_ReferenceId **get_referenceIdP(Z_APDU *apdu);
82 void transfer_referenceId(Z_APDU *from, Z_APDU *to);
84 const char *get_hostname();
86 int set_APDU_yazlog(int v);
89 static int yaz_init_flag;
90 static int yaz_init_func();
91 IPDU_Observable *m_PDU_Observable;
107 * indent-tabs-mode: nil
109 * vim: shiftwidth=4 tabstop=8 expandtab