1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * z3950proto.h --
|
---|
4 | * Copyright (C) 2000 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *********************************************************************/
|
---|
25 |
|
---|
26 | #ifndef Z3950PROTO_H
|
---|
27 | #define Z3950PROTO_H
|
---|
28 |
|
---|
29 | #include "recptproto.h"
|
---|
30 |
|
---|
31 | // each server can have one or more databases
|
---|
32 | /*
|
---|
33 | class z3950_DB {
|
---|
34 | protected:
|
---|
35 | text_t name; // Descriptive name
|
---|
36 | text_t database; // name for server
|
---|
37 |
|
---|
38 | public:
|
---|
39 | z3950_DB(); // constructor
|
---|
40 | ~z3950_DB(); // deconstructor
|
---|
41 | const text_t getName() {return name;} // this gets name
|
---|
42 | void setName(text_t newName) {name=newName;} // this sets name
|
---|
43 | // need to get next (for linked list)
|
---|
44 | };
|
---|
45 |
|
---|
46 |
|
---|
47 | typedef vector<z3950_DB> z3950_DB_array;
|
---|
48 | */
|
---|
49 |
|
---|
50 | /*class z3950_DB_Array {
|
---|
51 | protected:
|
---|
52 | int count;
|
---|
53 | // some arraytype...
|
---|
54 | public:
|
---|
55 | z3950_DB first();
|
---|
56 | z3950_DB last();
|
---|
57 | void add(z3950_DB *db);
|
---|
58 | void remove(z3950_DB *db);
|
---|
59 | };
|
---|
60 | */
|
---|
61 |
|
---|
62 |
|
---|
63 | class z3950_server {
|
---|
64 | protected:
|
---|
65 | text_t title; // Descriptive name
|
---|
66 | text_t hostname; // network name (IP or host+domain name)
|
---|
67 | text_tmap meta; // metadata for this collection (ie server/database pair)
|
---|
68 | // this is currently only iconcollection (and iconcollectionsmall)
|
---|
69 | int count;
|
---|
70 | // z3950_DB_array* db;
|
---|
71 | ShortColInfo_t *info; // has (database) name, host and port
|
---|
72 |
|
---|
73 | public:
|
---|
74 | z3950_server();
|
---|
75 | // z3950_DB_array getDBs();
|
---|
76 | const text_t getName() {return title;}
|
---|
77 | void setName(const text_t &newname) {title=newname;}
|
---|
78 | // void setHostname(const text_t &newname) {hostname=newname;}
|
---|
79 | void setInfo(ShortColInfo_t *newinfo) {info=newinfo;}
|
---|
80 | const ShortColInfo_t *getInfo() {return info;}
|
---|
81 | const text_tmap *getMeta() {return &meta;}
|
---|
82 | };
|
---|
83 |
|
---|
84 | typedef vector<z3950_server> z3950_server_array;
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 |
|
---|
89 | class z3950proto : public recptproto {
|
---|
90 | protected:
|
---|
91 | int zserver_count;
|
---|
92 | z3950_server_array zservers;
|
---|
93 | public:
|
---|
94 | z3950proto();
|
---|
95 | virtual ~z3950proto() {}
|
---|
96 |
|
---|
97 | /*
|
---|
98 | void add_collectserver (collectserver *thecserver)
|
---|
99 | {cservers.addcollectserver(thecserver);}
|
---|
100 | */
|
---|
101 |
|
---|
102 | void add_server(const z3950_server& zserver);
|
---|
103 |
|
---|
104 | void configure (const text_t &key, const text_tarray &cfgline);
|
---|
105 |
|
---|
106 | bool init (ostream &logout);
|
---|
107 |
|
---|
108 | text_t get_protocol_name () {return "z3950proto";}
|
---|
109 |
|
---|
110 | void get_collection_list (text_tarray &collist, comerror_t &err,
|
---|
111 | ostream &logout);
|
---|
112 |
|
---|
113 | void has_collection (const text_t &collection, bool &hascollection,
|
---|
114 | comerror_t &err, ostream &logout);
|
---|
115 |
|
---|
116 | void ping (const text_t &collection, bool &wassuccess,
|
---|
117 | comerror_t &err, ostream &logout);
|
---|
118 |
|
---|
119 | void get_collectinfo (const text_t &collection,
|
---|
120 | ColInfoResponse_t &collectinfo,
|
---|
121 | comerror_t &err, ostream &logout);
|
---|
122 |
|
---|
123 | void get_filterinfo (const text_t &collection,
|
---|
124 | InfoFiltersResponse_t &response,
|
---|
125 | comerror_t &err, ostream &logout);
|
---|
126 |
|
---|
127 | /* void get_info (const text_t &collection, const text_tset &metadata,
|
---|
128 | FilterResponse_t &response, ostream &logout);
|
---|
129 | */
|
---|
130 |
|
---|
131 | void filter (const text_t &collection,
|
---|
132 | FilterRequest_t &request,
|
---|
133 | FilterResponse_t &response,
|
---|
134 | comerror_t &err, ostream &logout);
|
---|
135 |
|
---|
136 | void get_document (const text_t &collection,
|
---|
137 | const DocumentRequest_t &request,
|
---|
138 | DocumentResponse_t &response,
|
---|
139 | comerror_t &err, ostream &logout);
|
---|
140 |
|
---|
141 | };
|
---|
142 |
|
---|
143 |
|
---|
144 | #endif
|
---|