d1b0e2fb3238b8a0e0add36cb373fd26a4262513
[platform/upstream/curl.git] / lib / multiif.h
1 #ifndef HEADER_CURL_MULTIIF_H
2 #define HEADER_CURL_MULTIIF_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
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
27 /*
28  * Prototypes for library-wide functions provided by multi.c
29  */
30 void Curl_expire(struct SessionHandle *data, long milli);
31
32 bool Curl_multi_pipeline_enabled(const struct Curl_multi* multi);
33 void Curl_multi_handlePipeBreak(struct SessionHandle *data);
34
35 /* Internal version of curl_multi_init() accepts size parameters for the
36    socket and connection hashes */
37 struct Curl_multi *Curl_multi_handle(int hashsize, int chashsize);
38
39 /* the write bits start at bit 16 for the *getsock() bitmap */
40 #define GETSOCK_WRITEBITSTART 16
41
42 #define GETSOCK_BLANK 0 /* no bits set */
43
44 /* set the bit for the given sock number to make the bitmap for writable */
45 #define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x)))
46
47 /* set the bit for the given sock number to make the bitmap for readable */
48 #define GETSOCK_READSOCK(x) (1 << (x))
49
50 #ifdef DEBUGBUILD
51  /*
52   * Curl_multi_dump is not a stable public function, this is only meant to
53   * allow easier tracking of the internal handle's state and what sockets
54   * they use. Only for research and development DEBUGBUILD enabled builds.
55   */
56 void Curl_multi_dump(const struct Curl_multi *multi_handle);
57 #endif
58
59 /* Update the current connection of a One_Easy handle */
60 void Curl_multi_set_easy_connection(struct SessionHandle *handle,
61                                     struct connectdata *conn);
62
63 void Curl_multi_process_pending_handles(struct Curl_multi *multi);
64
65 /* Return the value of the CURLMOPT_MAX_HOST_CONNECTIONS option */
66 size_t Curl_multi_max_host_connections(struct Curl_multi *multi);
67
68 /* Return the value of the CURLMOPT_MAX_PIPELINE_LENGTH option */
69 size_t Curl_multi_max_pipeline_length(struct Curl_multi *multi);
70
71 /* Return the value of the CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE option */
72 curl_off_t Curl_multi_content_length_penalty_size(struct Curl_multi *multi);
73
74 /* Return the value of the CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE option */
75 curl_off_t Curl_multi_chunk_length_penalty_size(struct Curl_multi *multi);
76
77 /* Return the value of the CURLMOPT_PIPELINING_SITE_BL option */
78 struct curl_llist *Curl_multi_pipelining_site_bl(struct Curl_multi *multi);
79
80 /* Return the value of the CURLMOPT_PIPELINING_SERVER_BL option */
81 struct curl_llist *Curl_multi_pipelining_server_bl(struct Curl_multi *multi);
82
83 /* Return the value of the CURLMOPT_MAX_TOTAL_CONNECTIONS option */
84 size_t Curl_multi_max_total_connections(struct Curl_multi *multi);
85
86 /*
87  * Curl_multi_closed()
88  *
89  * Used by the connect code to tell the multi_socket code that one of the
90  * sockets we were using have just been closed.  This function will then
91  * remove it from the sockethash for this handle to make the multi_socket API
92  * behave properly, especially for the case when libcurl will create another
93  * socket again and it gets the same file descriptor number.
94  */
95
96 void Curl_multi_closed(struct connectdata *conn, curl_socket_t s);
97
98 #endif /* HEADER_CURL_MULTIIF_H */