1 #ifndef HEADER_CURL_MULTIIF_H
2 #define HEADER_CURL_MULTIIF_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2019, 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 https://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  * Prototypes for library-wide functions provided by multi.c
27  */
28 
29 void Curl_updatesocket(struct Curl_easy *data);
30 void Curl_expire(struct Curl_easy *data, time_t milli, expire_id);
31 void Curl_expire_clear(struct Curl_easy *data);
32 void Curl_expire_done(struct Curl_easy *data, expire_id id);
33 bool Curl_pipeline_wanted(const struct Curl_multi* multi, int bits);
34 void Curl_detach_connnection(struct Curl_easy *data);
35 void Curl_attach_connnection(struct Curl_easy *data,
36                              struct connectdata *conn);
37 void Curl_set_in_callback(struct Curl_easy *data, bool value);
38 bool Curl_is_in_callback(struct Curl_easy *easy);
39 
40 /* Internal version of curl_multi_init() accepts size parameters for the
41    socket and connection hashes */
42 struct Curl_multi *Curl_multi_handle(int hashsize, int chashsize);
43 
44 /* the write bits start at bit 16 for the *getsock() bitmap */
45 #define GETSOCK_WRITEBITSTART 16
46 
47 #define GETSOCK_BLANK 0 /* no bits set */
48 
49 /* set the bit for the given sock number to make the bitmap for writable */
50 #define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x)))
51 
52 /* set the bit for the given sock number to make the bitmap for readable */
53 #define GETSOCK_READSOCK(x) (1 << (x))
54 
55 #ifdef DEBUGBUILD
56  /*
57   * Curl_multi_dump is not a stable public function, this is only meant to
58   * allow easier tracking of the internal handle's state and what sockets
59   * they use. Only for research and development DEBUGBUILD enabled builds.
60   */
61 void Curl_multi_dump(struct Curl_multi *multi);
62 #endif
63 
64 /* Return the value of the CURLMOPT_MAX_HOST_CONNECTIONS option */
65 size_t Curl_multi_max_host_connections(struct Curl_multi *multi);
66 
67 /* Return the value of the CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE option */
68 curl_off_t Curl_multi_content_length_penalty_size(struct Curl_multi *multi);
69 
70 /* Return the value of the CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE option */
71 curl_off_t Curl_multi_chunk_length_penalty_size(struct Curl_multi *multi);
72 
73 /* Return the value of the CURLMOPT_PIPELINING_SITE_BL option */
74 struct curl_llist *Curl_multi_pipelining_site_bl(struct Curl_multi *multi);
75 
76 /* Return the value of the CURLMOPT_PIPELINING_SERVER_BL option */
77 struct curl_llist *Curl_multi_pipelining_server_bl(struct Curl_multi *multi);
78 
79 /* Return the value of the CURLMOPT_MAX_TOTAL_CONNECTIONS option */
80 size_t Curl_multi_max_total_connections(struct Curl_multi *multi);
81 
82 void Curl_multi_connchanged(struct Curl_multi *multi);
83 
84 /*
85  * Curl_multi_closed()
86  *
87  * Used by the connect code to tell the multi_socket code that one of the
88  * sockets we were using is about to be closed.  This function will then
89  * remove it from the sockethash for this handle to make the multi_socket API
90  * behave properly, especially for the case when libcurl will create another
91  * socket again and it gets the same file descriptor number.
92  */
93 
94 void Curl_multi_closed(struct Curl_easy *data, curl_socket_t s);
95 
96 /*
97  * Add a handle and move it into PERFORM state at once. For pushed streams.
98  */
99 CURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
100                                  struct Curl_easy *data,
101                                  struct connectdata *conn);
102 
103 CURLMcode Curl_multi_wait(struct Curl_multi *multi,
104                           struct curl_waitfd extra_fds[],
105                           unsigned int extra_nfds,
106                           int timeout_ms,
107                           int *ret,
108                           bool *gotsocket); /* if any socket was checked */
109 
110 #endif /* HEADER_CURL_MULTIIF_H */
111