Fixes.
[egate.git] / include / zaccess.h
1 #ifndef ZACCESS_H
2 #define ZACCESS_H
3
4 #define ZASS_DEBUG GW_LOG_DEBUGN(9)
5 #define ZASS_TYPE "zass"
6
7 #define ZASS_ID "EUROPAGATE/DTB/ID"
8 #define ZASS_NAME "EUROPAGATE E-mail/Z39.50 gateway"
9 #define ZASS_VERSION "development 0.1"
10
11 #define ZASS_MAXRECORDSIZE  10000
12 #define ZASS_PREFERREDMESSAGESIZE 10000
13
14 typedef struct zass *ZASS;
15
16 enum present_status
17 {
18     ZASS_PRES_SUCCESS,        /* all records available */
19     ZASS_PRES_PARTIAL_1,      /* subset only 'cause of access control */
20     ZASS_PRES_PARTIAL_2,      /* subset 'cause of max msg size constraints*/
21     ZASS_PRES_PARTIAL_3,      /* subset 'cause of resource control org */
22     ZASS_PRES_PARTIAL_4,      /* subset 'cause of resource control trg */
23     ZASS_PRES_FAILURE         /* check errcode */
24 };
25
26 typedef struct zass_searchent
27 {
28     int num;      /* # hits */
29     int status;   /* status - boolean - qualified by setstatus */
30     enum present_status setstatus; /* consult if status. Value according to Z proto */
31
32     /* These two fields provide info from a diagnostic rec returned with 
33        response */
34     int errcode;           /* bib 1 assumed here. -1 if none provided */
35     char errstring[512];   /* Additional info from diagnostic rec, or "" */
36 } zass_searchent;
37
38 typedef struct zass_record
39 {
40     enum
41     {
42         ZASS_REC_DIAG=0,
43         ZASS_REC_USMARC=10
44     } which;      /* 0 = diagnostic, others according to z3950v3 */
45     char *record;   /* marc or other */
46
47     int errcode;    /* Only valid if which == 0 */
48     char errstring[200];
49
50     struct zass_record *next;
51 } zass_record;
52
53 typedef struct zass_presentent
54 {
55     int num;             /* # of recs returned */
56     int nextpos;         /* next resultset position. 1==first record */
57     enum present_status presentstatus;   /* status of set */
58     struct zass_record *records;
59 } zass_presentent;
60
61 ZASS zass_open(char *host, int port);
62 const struct zass_searchent *zass_search(ZASS a, struct ccl_rpn_node *query,
63     char *resname, char *databases);
64 const struct zass_presentent *zass_present(ZASS a, char *resname, int start,
65     int num);
66
67 #endif