1 |
|
---|
2 | #ifndef Z3950PROTO_H
|
---|
3 | #define Z3050PROTO_H
|
---|
4 |
|
---|
5 | #include "recptproto.h"
|
---|
6 |
|
---|
7 | // each server can have one or more databases
|
---|
8 | /*
|
---|
9 | class z3950_DB {
|
---|
10 | protected:
|
---|
11 | text_t name; // Descriptive name
|
---|
12 | text_t database; // name for server
|
---|
13 |
|
---|
14 | public:
|
---|
15 | z3950_DB(); // constructor
|
---|
16 | ~z3950_DB(); // deconstructor
|
---|
17 | const text_t getName() {return name;} // this gets name
|
---|
18 | void setName(text_t newName) {name=newName;} // this sets name
|
---|
19 | // need to get next (for linked list)
|
---|
20 | };
|
---|
21 |
|
---|
22 |
|
---|
23 | typedef vector<z3950_DB> z3950_DB_array;
|
---|
24 | */
|
---|
25 |
|
---|
26 | /*class z3950_DB_Array {
|
---|
27 | protected:
|
---|
28 | int count;
|
---|
29 | // some arraytype...
|
---|
30 | public:
|
---|
31 | z3950_DB first();
|
---|
32 | z3950_DB last();
|
---|
33 | void add(z3950_DB *db);
|
---|
34 | void remove(z3950_DB *db);
|
---|
35 | };
|
---|
36 | */
|
---|
37 |
|
---|
38 |
|
---|
39 | class z3950_server {
|
---|
40 | protected:
|
---|
41 | text_t title; // Descriptive name
|
---|
42 | text_t hostname; // network name (IP or host+domain name)
|
---|
43 | text_tmap meta; // metadata for this collection (ie server/database pair)
|
---|
44 | // this is currently only iconcollection (and iconcollectionsmall)
|
---|
45 | int count;
|
---|
46 | // z3950_DB_array* db;
|
---|
47 | ShortColInfo_t *info; // has (database) name, host and port
|
---|
48 |
|
---|
49 | public:
|
---|
50 | z3950_server();
|
---|
51 | // z3950_DB_array getDBs();
|
---|
52 | const text_t getName() {return title;}
|
---|
53 | void setName(const text_t &newname) {title=newname;}
|
---|
54 | // void setHostname(const text_t &newname) {hostname=newname;}
|
---|
55 | void setInfo(ShortColInfo_t *newinfo) {info=newinfo;}
|
---|
56 | const ShortColInfo_t *getInfo() {return info;}
|
---|
57 | const text_tmap *getMeta() {return &meta;}
|
---|
58 | };
|
---|
59 |
|
---|
60 | typedef vector<z3950_server> z3950_server_array;
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|
65 | class z3950proto : public recptproto {
|
---|
66 | protected:
|
---|
67 | int zserver_count;
|
---|
68 | z3950_server_array zservers;
|
---|
69 | public:
|
---|
70 | z3950proto();
|
---|
71 | virtual ~z3950proto() {}
|
---|
72 |
|
---|
73 | /*
|
---|
74 | void add_collectserver (collectserver *thecserver)
|
---|
75 | {cservers.addcollectserver(thecserver);}
|
---|
76 | */
|
---|
77 |
|
---|
78 | void add_server(const z3950_server& zserver);
|
---|
79 |
|
---|
80 | void configure (const text_t &key, const text_tarray &cfgline);
|
---|
81 |
|
---|
82 | bool init (ostream &logout);
|
---|
83 |
|
---|
84 | text_t get_protocol_name () {return "z3950proto";}
|
---|
85 |
|
---|
86 | void get_collection_list (text_tarray &collist, comerror_t &err,
|
---|
87 | ostream &logout);
|
---|
88 |
|
---|
89 | void has_collection (const text_t &collection, bool &hascollection,
|
---|
90 | comerror_t &err, ostream &logout);
|
---|
91 |
|
---|
92 | void ping (const text_t &collection, bool &wassuccess,
|
---|
93 | comerror_t &err, ostream &logout);
|
---|
94 |
|
---|
95 | void get_collectinfo (const text_t &collection,
|
---|
96 | ColInfoResponse_t &collectinfo,
|
---|
97 | comerror_t &err, ostream &logout);
|
---|
98 |
|
---|
99 | void get_filterinfo (const text_t &collection,
|
---|
100 | InfoFiltersResponse_t &response,
|
---|
101 | comerror_t &err, ostream &logout);
|
---|
102 |
|
---|
103 | /* void get_info (const text_t &collection, const text_tset &metadata,
|
---|
104 | FilterResponse_t &response, ostream &logout);
|
---|
105 | */
|
---|
106 |
|
---|
107 | void filter (const text_t &collection,
|
---|
108 | FilterRequest_t &request,
|
---|
109 | FilterResponse_t &response,
|
---|
110 | comerror_t &err, ostream &logout);
|
---|
111 |
|
---|
112 | void get_document (const text_t &collection,
|
---|
113 | const DocumentRequest_t &request,
|
---|
114 | DocumentResponse_t &response,
|
---|
115 | comerror_t &err, ostream &logout);
|
---|
116 |
|
---|
117 | };
|
---|
118 |
|
---|
119 |
|
---|
120 | #endif
|
---|