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

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

Added copyright notice.

  • 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
44 public:
45 z3950_server();
46 ~z3950_server();
47 void setName(const text_t &newname);
48 const text_t getName() {return title;}
49 void setMeta(const text_t &key, const text_t &value);
50 const text_tmap *getMeta() {return &meta;}
51 const text_tmap *getFormat() {return &format;}
52 void setInfo(ShortColInfo_t *newinfo) {info=newinfo;}
53 const ShortColInfo_t *getInfo() {return info;}
54 void addcfgAbout(const text_t &lang, const text_t &abouttext);
55 bool getcfgAbout(const text_t &lang, text_t &abouttext);
56 // now the functions that actually talk to the target (ie zserver) over tcp
57 text_t &getzAbout(); // gets any name, id, MOTD, etc from server.
58 text_tarray *getrecordTitles(const text_t &query,
59 const text_t &fields,
60 const int first, const int count,
61 int *nummatches, comerror_t &err);
62 /* only get one record at a time? (Eventually we could buffer them, but
63 for now... */
64 bool getfullrecord(const text_t &query, const text_t &fields,
65 const int ID, text_t &rettitle,
66 text_t &rettext,comerror_t &err);
67 private:
68 void parseQuery(const text_t &query, const text_t &fields,
69 text_t &parsed_query);
70};
71
72typedef vector<z3950_server *> z3950_server_array;
73
74#endif
Note: See TracBrowser for help on using the repository browser.