Added object Yaz_Z_Assoc. Much more functional client.
[yazpp-moved-to-github.git] / include / yaz-ir-assoc.h
1 /*
2  * Copyright (c) 1998-1999, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  * 
6  * $Log: yaz-ir-assoc.h,v $
7  * Revision 1.5  1999-04-09 11:47:23  adam
8  * Added object Yaz_Z_Assoc. Much more functional client.
9  *
10  */
11
12 #include <yaz-z-assoc.h>
13 #include <yaz-z-query.h>
14
15 /** Information Retrieval Assocation.
16     This object implements the client - and server role of a generic
17     Z39.50 Association.
18 */
19 class YAZ_EXPORT Yaz_IR_Assoc: public Yaz_Z_Assoc {
20  public:
21     /// Create object using the PDU Observer specified
22     Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
23     /// Destroy assocation and close PDU Observer
24     virtual ~Yaz_IR_Assoc();
25     /// Receive Z39.50 PDU
26     void recv_Z_PDU(Z_APDU *apdu);
27     /// Set Database Names
28     void set_databaseNames (int num, const char **list);
29     void set_databaseNames(const char *dblist, const char *sep);
30     /// Get Database Names
31     void get_databaseNames (int *num, char ***list);
32
33     void client(const char *addr);
34
35     /// Set Preferred Record Syntax
36     void set_preferredRecordSyntax (int value);
37     void set_preferredRecordSyntax (const char *syntax);
38     /// Get Preferred Record Syntax
39     void get_preferredRecordSyntax (int *val);
40     void get_preferredRecordSyntax (const char **syntax);
41
42     /// Set ElementSetName
43     void set_elementSetName (const char *elementSetName);
44     /// Get ElementSetName
45     void get_elementSetName (const char **elementSetName);
46     void get_elementSetName (Z_ElementSetNames **elementSetNames);
47
48     int get_lastReceived();
49     void set_lastReceived(int lastReceived);
50
51     /// OtherInformation
52     Z_OtherInformationUnit *set_otherInformation(
53         Z_OtherInformation **otherInformationP, int *oid,
54         int categoryValue);
55     void set_otherInformationString (Z_OtherInformation **otherInformationP,
56                                      int *oid, int categoryValue,
57                                      const char *str);
58
59     /// Settings
60     void set_proxy(const char *str);
61     const char *get_proxy();
62     const char *get_host();
63
64     /// Send Services
65     int send_initRequest();
66     int send_searchRequest(Yaz_Z_Query *query);
67     int send_presentRequest(int start, int number);
68     /// Recv Services
69     virtual void recv_initRequest(Z_InitRequest *initRequest);
70     virtual void recv_initResponse(Z_InitResponse *initResponse);
71     virtual void recv_searchRequest(Z_SearchRequest *searchRequest);
72     virtual void recv_presentRequest(Z_PresentRequest *presentRequest);
73     virtual void recv_searchResponse(Z_SearchResponse *searchResponse);
74     virtual void recv_presentResponse(Z_PresentResponse *presentResponse);
75  private:
76     char *m_proxy;
77     char *m_host;
78     int m_num_databaseNames;
79     char **m_databaseNames;
80     int m_preferredRecordSyntax;
81     Z_ElementSetNames *m_elementSetNames;
82     int m_lastReceived;
83 };