YAZ  4.2.57
backend.h
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2013 Index Data.
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
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.
15  *
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.
26  */
27 
36 #ifndef BACKEND_H
37 #define BACKEND_H
38 
39 #include <yaz/yconfig.h>
40 #include <yaz/proto.h>
41 #include <yaz/srw.h>
42 #include <yaz/oid_db.h>
43 
45 
46 typedef struct association *bend_association;
47 
54 typedef struct {
55  char *setname;
57  int num_bases;
58  char **basenames;
65  bend_association association;
67  int errcode;
68  char *errstring;
70  char *srw_sortKeys;
71  char *srw_setname;
80 
82 typedef struct {
83  char *setname;
84  int start;
85  int number;
91  bend_association association;
93  int errcode;
94  char *errstring;
96 
98 typedef struct bend_fetch_rr {
99  char *setname;
100  int number;
107  char *basename;
108  int len;
109  char *record;
112  int errcode;
113  char *errstring;
115  char *schema;
116 } bend_fetch_rr;
117 
119 struct scan_entry {
120  char *term;
122  int errcode;
123  char *errstring;
125 };
126 
127 typedef enum {
131 
133 typedef struct bend_scan_rr {
134  int num_bases;
135  char **basenames;
142  int *step_size;
146  /* scan term entries. The called handler does not have
147  to allocate this. Size of entries is num_entries (see above) */
150  int errcode;
151  char *errstring;
152  char *scanClause;
153  char *setname;
156 } bend_scan_rr;
157 
159 typedef struct bend_update_rr {
160  int num_bases;
161  char **basenames;
165  char *operation;
167  char *record_id;
172  char *record_data;
176  char *uri;
177  char *message;
178  char *details;
180 
182 typedef struct bend_delete_rr {
183  int function;
185  char **setnames;
188  int *statuses;
192 
194 typedef struct bend_sort_rr
195 {
203 
205  int errcode;
206  char *errstring;
207 } bend_sort_rr;
208 
210 typedef struct bend_esrequest_rr
211 {
212  int ItemNo;
214 
215  ODR stream; /* encoding stream */
216  ODR decode; /* decoding stream */
217  ODR print; /* printing stream */
218  Z_ReferenceId *referenceId;/* reference ID */
219  bend_association association;
220  int errcode; /* 0==success, -1==accepted, >0 = failure */
221  char *errstring; /* system error string or NULL */
224 
226 typedef struct bend_segment_rr {
231  bend_association association;
233 
235 typedef struct {
239  char *explain_buf;
240  char *database;
241  char *schema;
244 
251 typedef struct bend_initrequest
252 {
264  char *peer_name;
265 
271 
274 
280 
287 
291 
293  int (*bend_sort)(void *handle, bend_sort_rr *rr);
295  int (*bend_search)(void *handle, bend_search_rr *rr);
297  int (*bend_fetch)(void *handle, bend_fetch_rr *rr);
299  int (*bend_present)(void *handle, bend_present_rr *rr);
301  int (*bend_esrequest) (void *handle, bend_esrequest_rr *rr);
303  int (*bend_delete)(void *handle, bend_delete_rr *rr);
305  int (*bend_scan)(void *handle, bend_scan_rr *rr);
307  int (*bend_segment)(void *handle, bend_segment_rr *rr);
309  int (*bend_explain)(void *handle, bend_explain_rr *rr);
311  int (*bend_srw_scan)(void *handle, bend_scan_rr *rr);
313  int (*bend_srw_update)(void *handle, bend_update_rr *rr);
314 
318 
320 typedef struct bend_initresult
321 {
322  int errcode; /* 0==OK */
323  char *errstring; /* system error string or NULL */
324  void *handle; /* private handle to the backend module */
326 
329 {
330  int dynamic;
331  int threads;
332  int one_shot;
335  char default_listen[1024];
340  char setuid[ODR_MAXNAME+1];
341  void (*bend_start)(struct statserv_options_block *p);
342  void (*bend_stop)(struct statserv_options_block *p);
343  int (*options_func)(int argc, char **argv);
344  int (*check_ip)(void *cd, const char *addr, int len, int type);
345  char daemon_name[128];
346  int inetd;
348  void *handle;
350  void (*bend_close)(void *handle);
351 #ifdef WIN32
352  /* We only have these members for the windows version */
353  /* They seemed a bit large to have them there in general */
354  char service_name[128];
355  char app_name[128];
356  char service_dependencies[128];
357  char service_display_name[128];
358 #endif /* WIN32 */
359  struct bend_soap_handler *soap_handlers;
360  char pid_fname[128];
362  char cert_fname[128];
363  char xml_config[128];
364  int keepalive;
366 
367 YAZ_EXPORT int statserv_main(
368  int argc, char **argv,
370  void (*bend_close)(void *handle));
371 
373 YAZ_EXPORT void statserv_setcontrol(statserv_options_block *block);
374 YAZ_EXPORT int check_ip_tcpd(void *cd, const char *addr, int len, int type);
375 
376 YAZ_EXPORT int bend_assoc_is_alive(bend_association assoc);
377 
379 
380 #endif
381 /*
382  * Local variables:
383  * c-basic-offset: 4
384  * c-file-style: "Stroustrup"
385  * indent-tabs-mode: nil
386  * End:
387  * vim: shiftwidth=4 tabstop=8 expandtab
388  */
389