1 /* This file is part of the yazpp toolkit.
2 * Copyright (C) 1998-2009 Index Data and Mike Taylor
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of Index Data nor the names of its contributors
13 * may be used to endorse or promote products derived from this
14 * software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #include <yazpp/z-assoc.h>
34 class YAZ_EXPORT Z_ServerUtility {
36 void create_databaseRecord (ODR odr, Z_NamePlusRecord *rec,
37 const char *dbname, const Odr_oid *format,
38 const void *buf, int len);
39 void create_surrogateDiagnostics(ODR odr, Z_NamePlusRecord *rec,
40 const char *dbname, int error,
43 Z_Records *create_nonSurrogateDiagnostics (ODR odr, int error,
46 void create_diagnostics (
47 ODR odr, int error, const char *addinfo,
48 Z_DiagRec ***dreca, int *num);
50 virtual ~Z_ServerUtility() = 0;
53 class YAZ_EXPORT IServer_Facility {
55 virtual int init(Z_Server *server,
56 Z_InitRequest *initRequest,
57 Z_InitResponse *initResponse) = 0;
58 virtual int recv(Z_Server *server, Z_APDU *apdu) = 0;
60 virtual ~IServer_Facility() = 0;
63 class YAZ_EXPORT Yaz_Facility_ILL : public IServer_Facility {
65 virtual void ill_service (Z_ExtendedServicesRequest *req,
67 Z_ExtendedServicesResponse *res) = 0;
69 int init(Z_Server *server,
70 Z_InitRequest *initRequest,
71 Z_InitResponse *initResponse);
72 int recv(Z_Server *server, Z_APDU *apdu);
75 class YAZ_EXPORT Yaz_Facility_Update : public IServer_Facility {
77 virtual void update_service (Z_ExtendedServicesRequest *req,
79 Z_ExtendedServicesResponse *res) = 0;
81 virtual void update_service0 (Z_ExtendedServicesRequest *req,
83 Z_ExtendedServicesResponse *res) = 0;
85 int init(Z_Server *server,
86 Z_InitRequest *initRequest,
87 Z_InitResponse *initResponse);
88 int recv(Z_Server *server, Z_APDU *apdu);
92 class YAZ_EXPORT Yaz_Facility_Retrieval : public IServer_Facility,
93 public Z_ServerUtility {
96 virtual int sr_init (Z_InitRequest *initRequest,
97 Z_InitResponse *initResponse) = 0;
98 virtual void sr_search (Z_SearchRequest *searchRequest,
99 Z_SearchResponse *searchResponse) = 0;
100 virtual void sr_present (Z_PresentRequest *presentRequest,
101 Z_PresentResponse *presentResponse) = 0;
102 virtual void sr_record (const char *resultSetName,
105 Z_RecordComposition *comp,
106 Z_NamePlusRecord *namePlusRecord,
107 Z_Records *diagnostics) = 0;
108 int init(Z_Server *server,
109 Z_InitRequest *initRequest,
110 Z_InitResponse *initResponse);
111 int recv(Z_Server *server, Z_APDU *apdu);
116 Z_Records *pack_records (Z_Server *s,
117 const char *resultSetName,
119 Z_RecordComposition *comp,
120 int *next, int *pres,
123 void fetch_via_piggyback (Z_Server *s,
124 Z_SearchRequest *searchRequest,
125 Z_SearchResponse *searchResponse);
126 void fetch_via_present (Z_Server *s,
127 Z_PresentRequest *req, Z_PresentResponse *res);
129 int m_preferredMessageSize;
130 int m_maximumRecordSize;
135 class YAZ_EXPORT Z_Server_Facility_Info {
136 friend class Z_Server;
137 IServer_Facility *m_facility;
139 Z_Server_Facility_Info *m_next;
144 class YAZ_EXPORT Z_Server : public Z_Assoc {
146 Z_Server(IPDU_Observable *the_PDU_Observable);
148 void recv_Z_PDU(Z_APDU *apdu, int len);
149 virtual void recv_GDU(Z_GDU *apdu, int len);
150 void facility_add(IServer_Facility *facility, const char *name);
151 void facility_reset ();
155 Z_Server_Facility_Info *m_facilities;
158 class YAZ_EXPORT Yaz_USMARC {
160 const char *get_record(size_t position);
166 * indent-tabs-mode: nil
168 * vim: shiftwidth=4 tabstop=8 expandtab