Added basic HTTP server logic
[pazpar2-moved-to-github.git] / pazpar2.h
1 #ifndef PAZPAR2_H
2 #define PAZPAR2_H
3
4 #include <yaz/pquery.h>
5
6 struct record {
7     struct target *target;
8     int target_offset;
9     char *buf;
10     char *merge_key;
11     struct record *next_cluster;
12 };
13
14 struct session {
15     struct target *targets;
16     YAZ_PQF_Parser pqf_parser;
17     int requestid; 
18     char query[1024];
19     NMEM nmem;
20     WRBUF wrbuf;
21     struct record **recheap;
22     int recheap_size;
23     int recheap_max;
24     int recheap_scratch;
25     yaz_marc_t yaz_marc;
26 };
27
28 struct statistics {
29     int num_connections;
30     int num_no_connection;
31     int num_connecting;
32     int num_initializing;
33     int num_searching;
34     int num_presenting;
35     int num_idle;
36     int num_failed;
37     int num_error;
38 };
39
40 struct hitsbytarget {
41     char id[256];
42     int hits;
43     int diagnostic;
44     int records;
45     char* state;
46 };
47
48 struct hitsbytarget *hitsbytarget(struct session *s, int *count);
49 struct session *new_session();
50 void session_destroy(struct session *s);
51 int load_targets(struct session *s, const char *fn);
52 void statistics(struct session *s, struct statistics *stat);
53 void search(struct session *s, char *query);
54 struct record **show(struct session *s, int start, int *num);
55
56 #endif
57
58 /*
59  * Local variables:
60  * c-basic-offset: 4
61  * indent-tabs-mode: nil
62  * End:
63  * vim: shiftwidth=4 tabstop=8 expandtab
64  */