1 | #ifndef Z3950SERVER_H
|
---|
2 | #define Z3050SERVER_H
|
---|
3 |
|
---|
4 | #include "comtypes.h"
|
---|
5 |
|
---|
6 | // each "server" (ie collection) consists of a {z39.50 server + database} pair.
|
---|
7 | class z3950_server {
|
---|
8 | protected:
|
---|
9 | text_t title; // Descriptive name
|
---|
10 | text_t z_initstr; // a string returned when the connection is initialised.
|
---|
11 | text_tmap meta; // metadata for this collection (ie server/database pair)
|
---|
12 | text_tmap about; // langauge/abouttext pair for collection.
|
---|
13 | ShortColInfo_t *info; // has (database) name, host and port
|
---|
14 | text_tarray *titles;
|
---|
15 | bool connect();
|
---|
16 | bool connected; // tcp connection to the z39.50 server (target)
|
---|
17 |
|
---|
18 | public:
|
---|
19 | z3950_server();
|
---|
20 | ~z3950_server();
|
---|
21 | void setName(const text_t &newname);
|
---|
22 | const text_t getName() {return title;}
|
---|
23 | void setMeta(const text_t &key, const text_t &value);
|
---|
24 | const text_tmap *getMeta() {return &meta;}
|
---|
25 | void setInfo(ShortColInfo_t *newinfo) {info=newinfo;}
|
---|
26 | const ShortColInfo_t *getInfo() {return info;}
|
---|
27 | void addcfgAbout(const text_t &lang, const text_t &abouttext);
|
---|
28 | bool getcfgAbout(const text_t &lang, text_t &abouttext);
|
---|
29 | // now the functions that actually talk to the target (ie zserver) over tcp
|
---|
30 | text_t &getzAbout(); // gets any name, id, MOTD, etc from server.
|
---|
31 | text_tarray *getbriefrecords(const text_t &query,
|
---|
32 | const int first, const int count,
|
---|
33 | int *nummatches, comerror_t &err);
|
---|
34 | /* only get one record at a time? (Eventually we could buffer them, but
|
---|
35 | for now... */
|
---|
36 | bool getfullrecord(const int ID, text_t &rettitle,
|
---|
37 | text_t &rettext,comerror_t &err);
|
---|
38 | };
|
---|
39 |
|
---|
40 | typedef vector<z3950_server *> z3950_server_array;
|
---|
41 |
|
---|
42 | #endif
|
---|