source: trunk/gsdl/src/recpt/z3950server.h@ 1617

Last change on this file since 1617 was 1617, checked in by jrm21, 24 years ago

Added some flags so we don't connect to the z-server as often as we were...
z3950proto::filter is called 8 times for a get document request!!!!!
Actually, this also fixed a problem I was having connecting to a particular
zserver, as the server was returning an error on about the 7th call to filter()

  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/**********************************************************************
2 *
3 * z3950server.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 Z3950SERVER_H
27#define Z3050SERVER_H
28
29#include "comtypes.h"
30
31// each "server" (ie collection) consists of a {z39.50 server + database} pair.
32class z3950_server {
33 protected:
34 text_t title; // Descriptive name
35 text_t z_initstr; // a string returned when the connection is initialised.
36 text_tmap meta; // metadata for this collection (ie server/database pair)
37 text_tmap format;
38 text_tmap about; // langauge/abouttext pair for collection.
39 ShortColInfo_t *info; // has (database) name, host and port
40 text_tarray *titles;
41 bool connect();
42 bool connected; // tcp connection to the z39.50 server (target)
43 bool gotsinglerecord; // if we do, then we don't need all titles...
44
45 public:
46 z3950_server();
47 ~z3950_server();
48 void setName(const text_t &newname);
49 const text_t getName() {return title;}
50 void setMeta(const text_t &key, const text_t &value);
51 const text_tmap *getMeta() {return &meta;}
52 const text_tmap *getFormat() {return &format;}
53 void setInfo(ShortColInfo_t *newinfo) {info=newinfo;}
54 const ShortColInfo_t *getInfo() {return info;}
55 void addcfgAbout(const text_t &lang, const text_t &abouttext);
56 bool getcfgAbout(const text_t &lang, text_t &abouttext);
57 // now the functions that actually talk to the target (ie zserver) over tcp
58 text_t &getzAbout(); // gets any name, id, MOTD, etc from server.
59 text_tarray *getrecordTitles(const text_t &query,
60 const text_t &fields,
61 const int first, const int count,
62 int *nummatches, comerror_t &err);
63 /* only get one record at a time? (Eventually we could buffer them, but
64 for now... */
65 bool getfullrecord(const text_t &query, const text_t &fields,
66 const int ID, text_t &rettitle,
67 text_t &rettext,comerror_t &err);
68 private:
69 void parseQuery(const text_t &query, const text_t &fields,
70 text_t &parsed_query);
71};
72
73typedef vector<z3950_server *> z3950_server_array;
74
75#endif
Note: See TracBrowser for help on using the repository browser.