Added authentication check facility to zebra.
[idzebra-moved-to-github.git] / index / zebraapi.h
1 /*
2  * Copyright (C) 1994-1998, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: zebraapi.h,v $
7  * Revision 1.3  1998-06-22 11:36:48  adam
8  * Added authentication check facility to zebra.
9  *
10  * Revision 1.2  1998/06/13 00:14:09  adam
11  * Minor changes.
12  *
13  * Revision 1.1  1998/06/12 12:22:13  adam
14  * Work on Zebra API.
15  *
16  */
17
18 #include <odr.h>
19 #include <oid.h>
20 #include <proto.h>
21
22 /* Retrieval Record Descriptor */
23 typedef struct {
24     int errCode;         /* non-zero if error when fetching this */
25     char *errString;     /* error string */
26     int position;        /* position of record in result set (1,2,..) */
27     char *buf;           /* record buffer (void pointer really) */
28     int len;             /* length */
29     oid_value format;    /* record syntax */
30     char *base; 
31 } ZebraRetrievalRecord;
32
33 /* Scan Term Descriptor */
34 typedef struct {
35     int occurrences;     /* scan term occurrences */
36     char *term;          /* scan term string */
37 } ZebraScanEntry;
38
39 typedef struct zebra_info *ZebraHandle;
40
41 /* Open Zebra using file 'configName' (usually zebra.cfg) */
42 YAZ_EXPORT ZebraHandle zebra_open (const char *configName);
43
44 /* Search using RPN-Query */
45 YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR stream,
46                        Z_RPNQuery *query, int num_bases, char **basenames, 
47                        const char *setname);
48
49 /* Retrieve record(s) */
50 YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream,
51                        const char *setname, Z_RecordComposition *comp,
52                        oid_value input_format,
53                        int num_recs, ZebraRetrievalRecord *recs);
54
55 /* Browse */
56 YAZ_EXPORT void zebra_scan (ZebraHandle zh, ODR stream,
57                             Z_AttributesPlusTerm *zapt,
58                             oid_value attributeset,
59                             int num_bases, char **basenames,
60                             int *position, int *num_entries,
61                             ZebraScanEntry **list,
62                             int *is_partial);
63
64 /* Close zebra and destroy handle */
65 YAZ_EXPORT void zebra_close (ZebraHandle zh);
66
67 /* last error code */
68 YAZ_EXPORT int zebra_errCode (ZebraHandle zh);
69 /* string representatio of above */
70 YAZ_EXPORT const char *zebra_errString (ZebraHandle zh);
71
72 /* extra information associated with error */
73 YAZ_EXPORT char *zebra_errAdd (ZebraHandle zh);
74
75 /* number of hits (after search) */
76 YAZ_EXPORT int zebra_hits (ZebraHandle zh);
77
78 /* do authentication */
79 YAZ_EXPORT int zebra_auth (ZebraHandle zh, const char *user, const char *pass);
80