blob: c8fb5ca0d1c6a1e0109df90d5b60649c770af866 [file] [log] [blame]
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001#ifndef HEADER_CURL_MULTIIF_H
2#define HEADER_CURL_MULTIIF_H
Kristian Monsen5ab50182010-05-14 18:53:44 +01003/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
Elliott Hughes1ef06ba2018-05-30 15:43:58 -070010 * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
Kristian Monsen5ab50182010-05-14 18:53:44 +010011 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
Alex Deymod15eaac2016-06-28 14:49:26 -070014 * are also available at https://curl.haxx.se/docs/copyright.html.
Kristian Monsen5ab50182010-05-14 18:53:44 +010015 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ***************************************************************************/
24
25/*
26 * Prototypes for library-wide functions provided by multi.c
27 */
Elliott Hughes82be86d2017-09-20 17:00:17 -070028
Elliott Hughes1ef06ba2018-05-30 15:43:58 -070029void Curl_updatesocket(struct Curl_easy *data);
Elliott Hughes82be86d2017-09-20 17:00:17 -070030void Curl_expire(struct Curl_easy *data, time_t milli, expire_id);
Elliott Hughescee03382017-06-23 12:17:18 -070031void Curl_expire_clear(struct Curl_easy *data);
Elliott Hughes82be86d2017-09-20 17:00:17 -070032void Curl_expire_done(struct Curl_easy *data, expire_id id);
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070033bool Curl_pipeline_wanted(const struct Curl_multi* multi, int bits);
Alex Deymoe3149cc2016-10-05 11:18:42 -070034void Curl_multi_handlePipeBreak(struct Curl_easy *data);
Elliott Hughescac39802018-04-27 16:19:43 -070035void Curl_set_in_callback(struct Curl_easy *data, bool value);
36bool Curl_is_in_callback(struct Curl_easy *easy);
Kristian Monsen5ab50182010-05-14 18:53:44 +010037
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070038/* Internal version of curl_multi_init() accepts size parameters for the
39 socket and connection hashes */
40struct Curl_multi *Curl_multi_handle(int hashsize, int chashsize);
41
Kristian Monsen5ab50182010-05-14 18:53:44 +010042/* the write bits start at bit 16 for the *getsock() bitmap */
43#define GETSOCK_WRITEBITSTART 16
44
45#define GETSOCK_BLANK 0 /* no bits set */
46
47/* set the bit for the given sock number to make the bitmap for writable */
48#define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x)))
49
50/* set the bit for the given sock number to make the bitmap for readable */
51#define GETSOCK_READSOCK(x) (1 << (x))
52
53#ifdef DEBUGBUILD
54 /*
55 * Curl_multi_dump is not a stable public function, this is only meant to
56 * allow easier tracking of the internal handle's state and what sockets
57 * they use. Only for research and development DEBUGBUILD enabled builds.
58 */
Alex Deymoe3149cc2016-10-05 11:18:42 -070059void Curl_multi_dump(struct Curl_multi *multi);
Kristian Monsen5ab50182010-05-14 18:53:44 +010060#endif
61
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070062/* Return the value of the CURLMOPT_MAX_HOST_CONNECTIONS option */
63size_t Curl_multi_max_host_connections(struct Curl_multi *multi);
64
65/* Return the value of the CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE option */
66curl_off_t Curl_multi_content_length_penalty_size(struct Curl_multi *multi);
67
68/* Return the value of the CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE option */
69curl_off_t Curl_multi_chunk_length_penalty_size(struct Curl_multi *multi);
70
71/* Return the value of the CURLMOPT_PIPELINING_SITE_BL option */
72struct curl_llist *Curl_multi_pipelining_site_bl(struct Curl_multi *multi);
73
74/* Return the value of the CURLMOPT_PIPELINING_SERVER_BL option */
75struct curl_llist *Curl_multi_pipelining_server_bl(struct Curl_multi *multi);
76
77/* Return the value of the CURLMOPT_MAX_TOTAL_CONNECTIONS option */
78size_t Curl_multi_max_total_connections(struct Curl_multi *multi);
79
80void Curl_multi_connchanged(struct Curl_multi *multi);
81
82/*
83 * Curl_multi_closed()
84 *
85 * Used by the connect code to tell the multi_socket code that one of the
86 * sockets we were using is about to be closed. This function will then
87 * remove it from the sockethash for this handle to make the multi_socket API
88 * behave properly, especially for the case when libcurl will create another
89 * socket again and it gets the same file descriptor number.
90 */
91
92void Curl_multi_closed(struct connectdata *conn, curl_socket_t s);
93
Alex Deymod15eaac2016-06-28 14:49:26 -070094/*
95 * Add a handle and move it into PERFORM state at once. For pushed streams.
96 */
97CURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
Alex Deymoe3149cc2016-10-05 11:18:42 -070098 struct Curl_easy *data,
Alex Deymod15eaac2016-06-28 14:49:26 -070099 struct connectdata *conn);
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700100#endif /* HEADER_CURL_MULTIIF_H */