IE proof checks for response XML doc.
[pazpar2-moved-to-github.git] / src / client.h
1 /* This file is part of Pazpar2.
2    Copyright (C) 2006-2008 Index Data
3
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18 */
19
20 /** \file client.h
21     \brief Z39.50 client 
22 */
23
24 #ifndef CLIENT_H
25 #define CLIENT_H
26
27 struct client;
28 struct connection;
29
30 enum client_state
31 {
32     Client_Connecting,
33     Client_Connected,
34     Client_Idle,
35     Client_Working,
36     Client_Error,
37     Client_Failed,
38     Client_Disconnected,
39     Client_Stopped,
40     Client_Continue
41 };
42
43 int client_show_raw_begin(struct client *cl, int position,
44                           const char *syntax, const char *esn,
45                           void *data,
46                           void (*error_handler)(void *data, const char *addinfo),
47                           void (*record_handler)(void *data, const char *buf,
48                                                  size_t sz),
49                           void **data2,
50                           int binary);
51 void client_show_raw_remove(struct client *cl, void *rr);
52
53 const char *client_get_state_str(struct client *cl);
54 enum client_state client_get_state(struct client *cl);
55 void client_set_state(struct client *cl, enum client_state st);
56 void client_fatal(struct client *cl);
57 struct connection *client_get_connection(struct client *cl);
58 struct session_database *client_get_database(struct client *cl);
59 void client_set_database(struct client *cl, struct session_database *db);
60 struct session *client_get_session(struct client *cl);
61 const char *client_get_pquery(struct client *cl);
62
63 void client_set_requestid(struct client *cl, int id);
64
65 void client_init_response(struct client *cl, Z_APDU *a);
66 void client_search_response(struct client *cl);
67 void client_record_response(struct client *cl);
68 void client_close_response(struct client *cl, Z_APDU *a);
69
70 int client_is_our_response(struct client *cl);
71
72 void client_continue(struct client *cl);
73
74 struct client *client_create(void);
75 void client_destroy(struct client *c);
76
77 void client_set_connection(struct client *cl, struct connection *con);
78 void client_disconnect(struct client *cl);
79 int client_prep_connection(struct client *cl);
80 void client_start_search(struct client *cl);
81 void client_set_session(struct client *cl, struct session *se);
82 int client_is_active(struct client *cl);
83 struct client *client_next_in_session(struct client *cl);
84
85 int client_parse_query(struct client *cl, const char *query);
86 int client_get_hits(struct client *cl);
87 int client_get_num_records(struct client *cl);
88 int client_get_diagnostic(struct client *cl);
89 void client_set_database(struct client *cl, struct session_database *db);
90 struct host *client_get_host(struct client *cl);
91 const char *client_get_url(struct client *cl);
92
93 #endif
94
95 /*
96  * Local variables:
97  * c-basic-offset: 4
98  * indent-tabs-mode: nil
99  * End:
100  * vim: shiftwidth=4 tabstop=8 expandtab
101  */