Minor changes.
[egate.git] / kernel / kernel.h
1 /* Gateway kernel
2  * Europagate, 1995
3  *
4  * $Log: kernel.h,v $
5  * Revision 1.16  1995/05/03 07:37:37  adam
6  * CCL commands stop/continue implemented. New functions gw_res_{int,bool}
7  * are used when possible.
8  *
9  * Revision 1.15  1995/04/19  13:19:08  adam
10  * New command: account - for authentication.
11  *
12  * Revision 1.14  1995/04/19  10:46:18  adam
13  * Persistency works much better now. New command: status - history-like
14  *
15  * Revision 1.13  1995/04/19  07:31:04  adam
16  * First work on Z39.50 persistence.
17  *
18  * Revision 1.12  1995/04/17  09:34:29  adam
19  * Timeout (idletime) adjustable. Minor changes in kernel.
20  *
21  * Revision 1.11  1995/03/28  11:42:34  adam
22  * First use of string-queue utility.
23  *
24  * Revision 1.10  1995/03/27  08:24:01  adam
25  * First use of gip interface and gw-db.
26  * First work on eti program.
27  *
28  * Revision 1.9  1995/03/03  17:19:13  adam
29  * Smarter presentation. Bug fix in email header interpretation.
30  *
31  * Revision 1.8  1995/03/01  14:32:24  adam
32  * Better diagnostics. Default is, that only one database selected when
33  * several are known.
34  *
35  * Revision 1.7  1995/02/23  08:32:16  adam
36  * Changed header.
37  *
38  * Revision 1.5  1995/02/22  15:22:32  adam
39  * Much more checking of run-time state. Show command never retrieves
40  * more records than indicated by the previous search request. Help
41  * command available. The maximum number of records retrieved can be
42  * controlled now.
43  *
44  * Revision 1.4  1995/02/20  21:16:18  adam
45  * FML support. Bug fixes. Profile for drewdb.
46  *
47  * Revision 1.3  1995/02/16  18:35:08  adam
48  * First use of Zdist library. Search requests are supported.
49  * Present requests are not supported yet.
50  *
51  * Revision 1.2  1995/02/16  13:20:59  adam
52  * Organization of resource files for targets and conversion
53  * language implemented.
54  *
55  * Revision 1.1  1995/02/15  17:45:29  adam
56  * First version of email gateway kernel. Email requests are read
57  * from stdin. The output is transferred to an MTA if 'From' is
58  * found in the header - or stdout if absent. No Z39.50 client is used.
59  *
60  */
61
62 #include <gw-res.h>
63 #include <gw-log.h>
64 #include <ccl.h>
65 #include <zaccess.h>
66
67 #include <iso2709.h>
68 #if USE_FML
69 #include <fmlmarc.h>
70 #endif
71 #include <strqueue.h>
72
73 #define LINE_MAX 1024
74
75 struct gw_user_set {
76     char   *name;               /* name of result set */
77     int    hits;                /* -1 on error */
78     char   *database;           /* database(s) in which we search */
79     struct ccl_rpn_node *rpn;   /* rpn request */
80     int    present_flag;        /* present in target (presistency) */
81     char   *search_str;         /* find request string */
82     struct gw_user_set *prev;
83 };
84
85 struct gw_kernel_info {
86     CCL_bibset bibset;
87     GwRes kernel_res;
88     const char *default_res; 
89     const char *override_res;
90     char target[128];
91     char hostname[128];
92     char account[128];
93     int  port;
94     const char *lang;
95     const char *override_portno;
96     const char *override_hostname;
97     char *databases;
98     char *database;
99     ZASS  zass;
100     int command_no;
101     char  from_str[LINE_MAX+1];
102     const char *reply_fname;
103     int setno;
104     int next_position;
105 #if USE_FML
106     Fml   fml;
107 #endif
108     struct gw_user_set *sets;
109 };
110
111 extern struct gw_kernel_info info;
112
113 extern FILE *reply_fd;
114
115 int  urp_start   (int continuation, struct str_queue *queue);
116 int  urp_command (struct str_queue *queue);
117 void urp_end     (void);
118
119 void read_kernel_res (void);
120
121 struct gw_user_set *user_set_add (const char *name, int hits,
122                                   const char *database,
123                                   struct ccl_rpn_node *rpn,
124                                   int present_flag,
125                                   const char *search_str);
126 struct gw_user_set *user_set_search (const char *name);
127 void user_set_init (void);
128
129 int lgets (char *buf, int max, int fd);
130
131 const struct zass_searchent *zass_p_search (ZASS zass, 
132                                       struct ccl_rpn_node *rpn,
133                                       const char *result_set,
134                                       const char *database,
135                                       struct gw_user_set *sets);
136 const struct zass_presentent *zass_p_present (ZASS zass,
137                                       const char *result_set,
138                                       int offset, int number);
139
140 int load_p_state (int userid);
141 int save_p_state (int userid);
142 void del_p_state (int userid);
143 int reopen_target (void);
144
145 #define KERNEL_LOG "kernel"