113498266Sopenharmony_ci#ifndef HEADER_CURL_MULTIIF_H
213498266Sopenharmony_ci#define HEADER_CURL_MULTIIF_H
313498266Sopenharmony_ci/***************************************************************************
413498266Sopenharmony_ci *                                  _   _ ____  _
513498266Sopenharmony_ci *  Project                     ___| | | |  _ \| |
613498266Sopenharmony_ci *                             / __| | | | |_) | |
713498266Sopenharmony_ci *                            | (__| |_| |  _ <| |___
813498266Sopenharmony_ci *                             \___|\___/|_| \_\_____|
913498266Sopenharmony_ci *
1013498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
1113498266Sopenharmony_ci *
1213498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which
1313498266Sopenharmony_ci * you should have received as part of this distribution. The terms
1413498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html.
1513498266Sopenharmony_ci *
1613498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1713498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is
1813498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file.
1913498266Sopenharmony_ci *
2013498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2113498266Sopenharmony_ci * KIND, either express or implied.
2213498266Sopenharmony_ci *
2313498266Sopenharmony_ci * SPDX-License-Identifier: curl
2413498266Sopenharmony_ci *
2513498266Sopenharmony_ci ***************************************************************************/
2613498266Sopenharmony_ci
2713498266Sopenharmony_ci/*
2813498266Sopenharmony_ci * Prototypes for library-wide functions provided by multi.c
2913498266Sopenharmony_ci */
3013498266Sopenharmony_ci
3113498266Sopenharmony_ciCURLcode Curl_updatesocket(struct Curl_easy *data);
3213498266Sopenharmony_civoid Curl_expire(struct Curl_easy *data, timediff_t milli, expire_id);
3313498266Sopenharmony_civoid Curl_expire_clear(struct Curl_easy *data);
3413498266Sopenharmony_civoid Curl_expire_done(struct Curl_easy *data, expire_id id);
3513498266Sopenharmony_ciCURLMcode Curl_update_timer(struct Curl_multi *multi) WARN_UNUSED_RESULT;
3613498266Sopenharmony_civoid Curl_attach_connection(struct Curl_easy *data,
3713498266Sopenharmony_ci                             struct connectdata *conn);
3813498266Sopenharmony_civoid Curl_detach_connection(struct Curl_easy *data);
3913498266Sopenharmony_cibool Curl_multiplex_wanted(const struct Curl_multi *multi);
4013498266Sopenharmony_civoid Curl_set_in_callback(struct Curl_easy *data, bool value);
4113498266Sopenharmony_cibool Curl_is_in_callback(struct Curl_easy *easy);
4213498266Sopenharmony_ciCURLcode Curl_preconnect(struct Curl_easy *data);
4313498266Sopenharmony_ci
4413498266Sopenharmony_civoid Curl_multi_connchanged(struct Curl_multi *multi);
4513498266Sopenharmony_ci
4613498266Sopenharmony_ci/* Internal version of curl_multi_init() accepts size parameters for the
4713498266Sopenharmony_ci   socket, connection and dns hashes */
4813498266Sopenharmony_cistruct Curl_multi *Curl_multi_handle(int hashsize, int chashsize,
4913498266Sopenharmony_ci                                     int dnssize);
5013498266Sopenharmony_ci
5113498266Sopenharmony_ci/* the write bits start at bit 16 for the *getsock() bitmap */
5213498266Sopenharmony_ci#define GETSOCK_WRITEBITSTART 16
5313498266Sopenharmony_ci
5413498266Sopenharmony_ci#define GETSOCK_BLANK 0 /* no bits set */
5513498266Sopenharmony_ci
5613498266Sopenharmony_ci/* set the bit for the given sock number to make the bitmap for writable */
5713498266Sopenharmony_ci#define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x)))
5813498266Sopenharmony_ci
5913498266Sopenharmony_ci/* set the bit for the given sock number to make the bitmap for readable */
6013498266Sopenharmony_ci#define GETSOCK_READSOCK(x) (1 << (x))
6113498266Sopenharmony_ci
6213498266Sopenharmony_ci/* mask for checking if read and/or write is set for index x */
6313498266Sopenharmony_ci#define GETSOCK_MASK_RW(x) (GETSOCK_READSOCK(x)|GETSOCK_WRITESOCK(x))
6413498266Sopenharmony_ci
6513498266Sopenharmony_ci/* Return the value of the CURLMOPT_MAX_HOST_CONNECTIONS option */
6613498266Sopenharmony_cisize_t Curl_multi_max_host_connections(struct Curl_multi *multi);
6713498266Sopenharmony_ci
6813498266Sopenharmony_ci/* Return the value of the CURLMOPT_MAX_TOTAL_CONNECTIONS option */
6913498266Sopenharmony_cisize_t Curl_multi_max_total_connections(struct Curl_multi *multi);
7013498266Sopenharmony_ci
7113498266Sopenharmony_civoid Curl_multiuse_state(struct Curl_easy *data,
7213498266Sopenharmony_ci                         int bundlestate); /* use BUNDLE_* defines */
7313498266Sopenharmony_ci
7413498266Sopenharmony_ci/*
7513498266Sopenharmony_ci * Curl_multi_closed()
7613498266Sopenharmony_ci *
7713498266Sopenharmony_ci * Used by the connect code to tell the multi_socket code that one of the
7813498266Sopenharmony_ci * sockets we were using is about to be closed.  This function will then
7913498266Sopenharmony_ci * remove it from the sockethash for this handle to make the multi_socket API
8013498266Sopenharmony_ci * behave properly, especially for the case when libcurl will create another
8113498266Sopenharmony_ci * socket again and it gets the same file descriptor number.
8213498266Sopenharmony_ci */
8313498266Sopenharmony_ci
8413498266Sopenharmony_civoid Curl_multi_closed(struct Curl_easy *data, curl_socket_t s);
8513498266Sopenharmony_ci
8613498266Sopenharmony_ci/*
8713498266Sopenharmony_ci * Add a handle and move it into PERFORM state at once. For pushed streams.
8813498266Sopenharmony_ci */
8913498266Sopenharmony_ciCURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
9013498266Sopenharmony_ci                                 struct Curl_easy *data,
9113498266Sopenharmony_ci                                 struct connectdata *conn);
9213498266Sopenharmony_ci
9313498266Sopenharmony_ci
9413498266Sopenharmony_ci/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option */
9513498266Sopenharmony_ciunsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi);
9613498266Sopenharmony_ci
9713498266Sopenharmony_ci#endif /* HEADER_CURL_MULTIIF_H */
98