client_start_search only takes client argument again
[pazpar2-moved-to-github.git] / src / client.h
1 /* This file is part of Pazpar2.
2    Copyright (C) 2006-2011 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 #include "facet_limit.h"
28
29 struct client;
30 struct connection;
31
32 enum client_state
33 {
34     Client_Connecting,
35     Client_Idle,
36     Client_Working,
37     Client_Error,
38     Client_Failed,
39     Client_Disconnected
40 };
41
42 int client_show_raw_begin(struct client *cl, int position,
43                           const char *syntax, const char *esn,
44                           void *data,
45                           void (*error_handler)(void *data, const char *addinfo),
46                           void (*record_handler)(void *data, const char *buf,
47                                                  size_t sz),
48                           int binary);
49
50 void client_show_raw_remove(struct client *cl, void *rr);
51
52 const char *client_get_state_str(struct client *cl);
53 enum client_state client_get_state(struct client *cl);
54 void client_set_state(struct client *cl, enum client_state st);
55 void client_set_state_nb(struct client *cl, enum client_state st);
56 struct connection *client_get_connection(struct client *cl);
57 struct session_database *client_get_database(struct client *cl);
58 void client_set_database(struct client *cl, struct session_database *db);
59 struct session *client_get_session(struct client *cl);
60 const char *client_get_pquery(struct client *cl);
61
62 void client_init_response(struct client *cl, Z_APDU *a);
63 void client_search_response(struct client *cl);
64 void client_record_response(struct client *cl);
65 void client_close_response(struct client *cl, Z_APDU *a);
66
67 int client_is_our_response(struct client *cl);
68
69 void client_continue(struct client *cl);
70
71 struct client *client_create(const char *url);
72 int client_destroy(struct client *c);
73
74 void client_set_connection(struct client *cl, struct connection *con);
75 void client_disconnect(struct client *cl);
76 int client_prep_connection(struct client *cl,
77                            int operation_timeout, int session_timeout,
78                            iochan_man_t iochan,
79                            const struct timeval *abstime);
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 int client_is_active_preferred(struct client *cl);
84 struct client *client_next_in_session(struct client *cl);
85
86 int client_parse_query(struct client *cl, const char *query,
87                        facet_limits_t facet_limits);
88 Odr_int client_get_hits(struct client *cl);
89 int client_get_num_records(struct client *cl);
90 int client_get_diagnostic(struct client *cl);
91 void client_set_diagnostic(struct client *cl, int diagnostic);
92 void client_set_database(struct client *cl, struct session_database *db);
93 const char *client_get_id(struct client *cl);
94 void client_set_maxrecs(struct client *cl, int v);
95 int  client_get_maxrecs(struct client *cl);
96 void client_set_startrecs(struct client *cl, int v);
97 void client_remove_from_session(struct client *c);
98 void client_incref(struct client *c);
99 void client_got_records(struct client *c);
100 void client_lock(struct client *c);
101 void client_unlock(struct client *c);
102
103 int client_has_facet(struct client *cl, const char *name);
104 void client_check_preferred_watch(struct client *cl);
105
106 #endif
107
108 /*
109  * Local variables:
110  * c-basic-offset: 4
111  * c-file-style: "Stroustrup"
112  * indent-tabs-mode: nil
113  * End:
114  * vim: shiftwidth=4 tabstop=8 expandtab
115  */
116