YAZ  5.23.1
backend.h
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 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 
327 #define BEND_NAME_MAX 1024
328 
331 {
332  int dynamic;
333  int threads;
334  int one_shot;
335  char apdufile[BEND_NAME_MAX];
336  char logfile[BEND_NAME_MAX];
337  enum oid_proto default_proto;
340  char configname[BEND_NAME_MAX];
341  char setuid[BEND_NAME_MAX];
342  void (*bend_start)(struct statserv_options_block *p);
343  void (*bend_stop)(struct statserv_options_block *p);
344  int (*options_func)(int argc, char **argv);
345  int (*check_ip)(void *cd, const char *addr, int len, int type);
347  int inetd;
349  void *handle;
351  void (*bend_close)(void *handle);
352 #ifdef WIN32
353  /* We only have these members for the windows version */
354  /* They seemed a bit large to have them there in general */
355  char service_name[BEND_NAME_MAX];
356  char app_name[BEND_NAME_MAX];
357  char service_dependencies[BEND_NAME_MAX];
358  char service_display_name[BEND_NAME_MAX];
359 #endif /* WIN32 */
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 
Z_TaskPackage * taskPackage
Definition: backend.h:222
void * server_node_ptr
Definition: backend.h:242
char ** setnames
Definition: backend.h:185
int check_ip_tcpd(void *cd, const char *addr, int len, int type)
Definition: tcpdchk.c:56
int partial_resultset
Definition: backend.h:74
int errcode
Definition: backend.h:150
int statserv_main(int argc, char **argv, bend_initresult *(*bend_init)(bend_initrequest *r), void(*bend_close)(void *handle))
Definition: statserv.c:1504
int surrogate_flag
Definition: backend.h:114
char * errstring
Definition: backend.h:151
Z_OtherInformation * search_info
Definition: backend.h:69
char * term
Definition: backend.h:120
Z_OtherInformation * search_input
Definition: backend.h:77
bend_association association
Definition: backend.h:65
int(* check_ip)(void *cd, const char *addr, int len, int type)
Definition: backend.h:345
Z_ReferenceId * referenceId
Definition: backend.h:101
int records_in_same_charset
whether query_charset also applies to records
Definition: backend.h:286
Z_Segment * segment
Definition: backend.h:227
struct bend_fetch_rr bend_fetch_rr
Information for fetch record handler.
char * uri
Definition: backend.h:176
char * errstring
Definition: backend.h:68
struct association * bend_association
Definition: backend.h:46
char cert_fname[BEND_NAME_MAX]
Definition: backend.h:362
char * errstring
Definition: backend.h:94
Z_ReferenceId * referenceId
Definition: backend.h:59
char * record
Definition: backend.h:109
int replace_set
Definition: backend.h:56
#define YAZ_END_CDECL
Definition: yconfig.h:57
char * extra_request_data
Definition: backend.h:174
struct bend_initresult bend_initresult
result for init handler (must be filled by handler)
Z_ReferenceId * referenceId
Definition: backend.h:202
Z_SRW_extra_arg * extra_args
Definition: backend.h:75
Header for SRW/SRU.
char pid_fname[BEND_NAME_MAX]
Definition: backend.h:360
Z_Query * query
Definition: backend.h:60
char * errstring
Definition: backend.h:221
char * srw_sortKeys
Definition: backend.h:70
Odr_oid * output_format
Definition: backend.h:111
Information for SRU record update handler.
Definition: backend.h:159
result for init handler (must be filled by handler)
Definition: backend.h:320
short Odr_oid
Definition: oid_util.h:42
int num_entries
Definition: backend.h:144
int errcode
Definition: backend.h:122
nmem_int_t Odr_int
Definition: odr.h:47
struct bend_scan_rr bend_scan_rr
Information for SRU / Z39.50 scan handler.
Odr_oid * attributeset
Definition: backend.h:136
char * errstring
Definition: backend.h:123
Information for SRU / Z39.50 scan handler.
Definition: backend.h:133
int * statuses
Definition: backend.h:188
char * display_term
Definition: backend.h:124
int named_result_sets
whether named result sets are supported (0=disable, 1=enable)
Definition: backend.h:316
Information for the Init handler.
Definition: backend.h:251
int bend_assoc_is_alive(bend_association assoc)
Definition: seshigh.c:3514
oid_proto
Definition: oid_util.h:44
Z_SRW_recordVersion * record_versions
Definition: backend.h:168
void(* bend_stop)(struct statserv_options_block *p)
Definition: backend.h:343
char daemon_name[BEND_NAME_MAX]
Definition: backend.h:346
ODR stream
encoding stream (for results)
Definition: backend.h:256
char * extra_record_data
Definition: backend.h:173
Odr_oid * request_format
Definition: backend.h:102
Information for fetch record handler.
Definition: backend.h:98
Header for OID database.
Z_ReferenceId * referenceId
Definition: backend.h:87
void bend_close(void *handle)
Definition: ztest.c:1153
Information for Z39.50 extended services handler.
Definition: backend.h:210
bend_association association
Definition: backend.h:91
Information for Z39.50 segment handler.
Definition: backend.h:226
char * message
Definition: backend.h:177
struct bend_delete_rr bend_delete_rr
Information for Z39.50 delete result set handler.
int estimated_hit_count
Definition: backend.h:73
Header with fundamental macros.
char * srw_setname
Definition: backend.h:71
char * basename
Definition: backend.h:107
Z_ReferenceId * referenceId
reference ID
Definition: backend.h:262
struct scan_entry * entries
Definition: backend.h:148
Z_ReferenceId * referenceId
Definition: backend.h:186
bend_initresult * bend_init(bend_initrequest *q)
Definition: ztest.c:1116
ODR decode
decoding stream (use stream for results)
Definition: backend.h:260
bend_association association
Definition: backend.h:231
enum l_file_type type
Definition: log.c:45
char * database
Definition: backend.h:240
Information for Z39.50 delete result set handler.
Definition: backend.h:182
struct bend_update_rr bend_update_rr
Information for SRU record update handler.
char * query_charset
character set (encoding) for query terms
Definition: backend.h:279
char * extra_response_data
Definition: backend.h:76
int delete_status
Definition: backend.h:187
char * implementation_id
Definition: backend.h:288
Information for SRU Explain handler.
Definition: backend.h:235
char * explain_buf
Definition: backend.h:239
int term_position
Definition: backend.h:143
Odr_oid * format
Definition: backend.h:86
struct bend_esrequest_rr bend_esrequest_rr
Information for Z39.50 extended services handler.
struct bend_initrequest bend_initrequest
Information for the Init handler.
Header for Z39.50 Protocol.
Z_ExtendedServicesRequest * esr
Definition: backend.h:213
char * operation_status
Definition: backend.h:166
char * errstring
Definition: backend.h:206
char * operation
Definition: backend.h:165
Z_ReferenceId * referenceId
Definition: backend.h:218
Definition: odr.h:99
int num_versions
Definition: backend.h:169
char * errstring
Definition: backend.h:323
Information for Z39.50/SRU search handler.
Definition: backend.h:54
Z_ReferenceId * referenceId
Definition: backend.h:162
char * schema
Definition: backend.h:241
char * record_schema
Definition: backend.h:171
Z_RecordComposition * comp
Definition: backend.h:103
ODR stream
Definition: backend.h:200
char * peer_name
peer address of client
Definition: backend.h:264
char * output_setname
Definition: backend.h:198
Z_SortKeySpecList * sort_sequence
Definition: backend.h:199
char * setname
Definition: backend.h:83
Definition: odr.h:124
ODR print
printing stream
Definition: backend.h:258
char * record_packing
Definition: backend.h:170
char * implementation_version
Definition: backend.h:290
int num_setnames
Definition: backend.h:184
char ** basenames
Definition: backend.h:161
Z_External * charneg_response
character negotiation response
Definition: backend.h:273
char * setname
Definition: backend.h:99
char * record_id
Definition: backend.h:167
Z_RecordComposition * comp
Definition: backend.h:88
bend_scan_status status
Definition: backend.h:149
char ** input_setnames
Definition: backend.h:197
struct statserv_options_block statserv_options_block
control block for server
Odr_int present_number
Definition: backend.h:78
control block for server
Definition: backend.h:330
void statserv_setcontrol(statserv_options_block *block)
Definition: statserv.c:1235
int(* options_func)(int argc, char **argv)
Definition: backend.h:344
Z_CharSetandLanguageNegotiation * charneg_request
character set and language negotiation
Definition: backend.h:270
statserv_options_block * statserv_getcontrol(void)
Definition: statserv.c:1215
char ** basenames
Definition: backend.h:135
bend_scan_status
Definition: backend.h:127
char * implementation_name
Definition: backend.h:289
Z_SRW_extra_arg * extra_args
Definition: backend.h:154
structure for all known EXTERNALs
Definition: prt-ext.h:58
#define BEND_NAME_MAX
Definition: backend.h:327
int num_bases
Definition: backend.h:134
int * step_size
Definition: backend.h:142
char ** basenames
Definition: backend.h:58
struct bend_segment_rr bend_segment_rr
Information for Z39.50 segment handler.
Odr_int occurrences
Definition: backend.h:121
char * extra_response_data
Definition: backend.h:175
int sort_status
Definition: backend.h:204
Z_IdAuthentication * auth
user/name/password to be read
Definition: backend.h:254
char xml_config[BEND_NAME_MAX]
Definition: backend.h:363
Z_AttributesPlusTerm * term
Definition: backend.h:138
char * record_data
Definition: backend.h:172
char * extra_response_data
Definition: backend.h:155
char * scanClause
Definition: backend.h:152
char * schema
Definition: backend.h:115
Odr_int hits
Definition: backend.h:66
Information for Z39.50 sort handler.
Definition: backend.h:194
int num_input_setnames
Definition: backend.h:196
Z_ReferenceId * referenceId
Definition: backend.h:137
char * details
Definition: backend.h:178
int errcode
Definition: backend.h:205
struct bend_sort_rr bend_sort_rr
Information for Z39.50 sort handler.
char * setname
Definition: backend.h:153
char * setname
Definition: backend.h:55
char * errstring
Definition: backend.h:113
void * handle
Definition: backend.h:324
int * srw_setnameIdleTime
Definition: backend.h:72
bend_association association
Definition: backend.h:219
Information for scan entry.
Definition: backend.h:119
int last_in_set
Definition: backend.h:110
#define YAZ_BEGIN_CDECL
Definition: yconfig.h:56
Information for present handler. Does not replace bend_fetch.
Definition: backend.h:82
int num_bases
Definition: backend.h:57
ODR stream
Definition: backend.h:139