113498266Sopenharmony_ci#ifndef CURLINC_MULTI_H
213498266Sopenharmony_ci#define CURLINC_MULTI_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  This is an "external" header file. Don't give away any internals here!
2813498266Sopenharmony_ci
2913498266Sopenharmony_ci  GOALS
3013498266Sopenharmony_ci
3113498266Sopenharmony_ci  o Enable a "pull" interface. The application that uses libcurl decides where
3213498266Sopenharmony_ci    and when to ask libcurl to get/send data.
3313498266Sopenharmony_ci
3413498266Sopenharmony_ci  o Enable multiple simultaneous transfers in the same thread without making it
3513498266Sopenharmony_ci    complicated for the application.
3613498266Sopenharmony_ci
3713498266Sopenharmony_ci  o Enable the application to select() on its own file descriptors and curl's
3813498266Sopenharmony_ci    file descriptors simultaneous easily.
3913498266Sopenharmony_ci
4013498266Sopenharmony_ci*/
4113498266Sopenharmony_ci
4213498266Sopenharmony_ci/*
4313498266Sopenharmony_ci * This header file should not really need to include "curl.h" since curl.h
4413498266Sopenharmony_ci * itself includes this file and we expect user applications to do #include
4513498266Sopenharmony_ci * <curl/curl.h> without the need for especially including multi.h.
4613498266Sopenharmony_ci *
4713498266Sopenharmony_ci * For some reason we added this include here at one point, and rather than to
4813498266Sopenharmony_ci * break existing (wrongly written) libcurl applications, we leave it as-is
4913498266Sopenharmony_ci * but with this warning attached.
5013498266Sopenharmony_ci */
5113498266Sopenharmony_ci#include "curl.h"
5213498266Sopenharmony_ci
5313498266Sopenharmony_ci#ifdef  __cplusplus
5413498266Sopenharmony_ciextern "C" {
5513498266Sopenharmony_ci#endif
5613498266Sopenharmony_ci
5713498266Sopenharmony_ci#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
5813498266Sopenharmony_citypedef struct Curl_multi CURLM;
5913498266Sopenharmony_ci#else
6013498266Sopenharmony_citypedef void CURLM;
6113498266Sopenharmony_ci#endif
6213498266Sopenharmony_ci
6313498266Sopenharmony_citypedef enum {
6413498266Sopenharmony_ci  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
6513498266Sopenharmony_ci                                    curl_multi_socket*() soon */
6613498266Sopenharmony_ci  CURLM_OK,
6713498266Sopenharmony_ci  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */
6813498266Sopenharmony_ci  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
6913498266Sopenharmony_ci  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */
7013498266Sopenharmony_ci  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */
7113498266Sopenharmony_ci  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */
7213498266Sopenharmony_ci  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */
7313498266Sopenharmony_ci  CURLM_ADDED_ALREADY,   /* an easy handle already added to a multi handle was
7413498266Sopenharmony_ci                            attempted to get added - again */
7513498266Sopenharmony_ci  CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
7613498266Sopenharmony_ci                               callback */
7713498266Sopenharmony_ci  CURLM_WAKEUP_FAILURE,  /* wakeup is unavailable or failed */
7813498266Sopenharmony_ci  CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */
7913498266Sopenharmony_ci  CURLM_ABORTED_BY_CALLBACK,
8013498266Sopenharmony_ci  CURLM_UNRECOVERABLE_POLL,
8113498266Sopenharmony_ci  CURLM_LAST
8213498266Sopenharmony_ci} CURLMcode;
8313498266Sopenharmony_ci
8413498266Sopenharmony_ci/* just to make code nicer when using curl_multi_socket() you can now check
8513498266Sopenharmony_ci   for CURLM_CALL_MULTI_SOCKET too in the same style it works for
8613498266Sopenharmony_ci   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
8713498266Sopenharmony_ci#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
8813498266Sopenharmony_ci
8913498266Sopenharmony_ci/* bitmask bits for CURLMOPT_PIPELINING */
9013498266Sopenharmony_ci#define CURLPIPE_NOTHING   0L
9113498266Sopenharmony_ci#define CURLPIPE_HTTP1     1L
9213498266Sopenharmony_ci#define CURLPIPE_MULTIPLEX 2L
9313498266Sopenharmony_ci
9413498266Sopenharmony_citypedef enum {
9513498266Sopenharmony_ci  CURLMSG_NONE, /* first, not used */
9613498266Sopenharmony_ci  CURLMSG_DONE, /* This easy handle has completed. 'result' contains
9713498266Sopenharmony_ci                   the CURLcode of the transfer */
9813498266Sopenharmony_ci  CURLMSG_LAST /* last, not used */
9913498266Sopenharmony_ci} CURLMSG;
10013498266Sopenharmony_ci
10113498266Sopenharmony_cistruct CURLMsg {
10213498266Sopenharmony_ci  CURLMSG msg;       /* what this message means */
10313498266Sopenharmony_ci  CURL *easy_handle; /* the handle it concerns */
10413498266Sopenharmony_ci  union {
10513498266Sopenharmony_ci    void *whatever;    /* message-specific data */
10613498266Sopenharmony_ci    CURLcode result;   /* return code for transfer */
10713498266Sopenharmony_ci  } data;
10813498266Sopenharmony_ci};
10913498266Sopenharmony_citypedef struct CURLMsg CURLMsg;
11013498266Sopenharmony_ci
11113498266Sopenharmony_ci/* Based on poll(2) structure and values.
11213498266Sopenharmony_ci * We don't use pollfd and POLL* constants explicitly
11313498266Sopenharmony_ci * to cover platforms without poll(). */
11413498266Sopenharmony_ci#define CURL_WAIT_POLLIN    0x0001
11513498266Sopenharmony_ci#define CURL_WAIT_POLLPRI   0x0002
11613498266Sopenharmony_ci#define CURL_WAIT_POLLOUT   0x0004
11713498266Sopenharmony_ci
11813498266Sopenharmony_cistruct curl_waitfd {
11913498266Sopenharmony_ci  curl_socket_t fd;
12013498266Sopenharmony_ci  short events;
12113498266Sopenharmony_ci  short revents;
12213498266Sopenharmony_ci};
12313498266Sopenharmony_ci
12413498266Sopenharmony_ci/*
12513498266Sopenharmony_ci * Name:    curl_multi_init()
12613498266Sopenharmony_ci *
12713498266Sopenharmony_ci * Desc:    initialize multi-style curl usage
12813498266Sopenharmony_ci *
12913498266Sopenharmony_ci * Returns: a new CURLM handle to use in all 'curl_multi' functions.
13013498266Sopenharmony_ci */
13113498266Sopenharmony_ciCURL_EXTERN CURLM *curl_multi_init(void);
13213498266Sopenharmony_ci
13313498266Sopenharmony_ci/*
13413498266Sopenharmony_ci * Name:    curl_multi_add_handle()
13513498266Sopenharmony_ci *
13613498266Sopenharmony_ci * Desc:    add a standard curl handle to the multi stack
13713498266Sopenharmony_ci *
13813498266Sopenharmony_ci * Returns: CURLMcode type, general multi error code.
13913498266Sopenharmony_ci */
14013498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
14113498266Sopenharmony_ci                                            CURL *curl_handle);
14213498266Sopenharmony_ci
14313498266Sopenharmony_ci /*
14413498266Sopenharmony_ci  * Name:    curl_multi_remove_handle()
14513498266Sopenharmony_ci  *
14613498266Sopenharmony_ci  * Desc:    removes a curl handle from the multi stack again
14713498266Sopenharmony_ci  *
14813498266Sopenharmony_ci  * Returns: CURLMcode type, general multi error code.
14913498266Sopenharmony_ci  */
15013498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
15113498266Sopenharmony_ci                                               CURL *curl_handle);
15213498266Sopenharmony_ci
15313498266Sopenharmony_ci /*
15413498266Sopenharmony_ci  * Name:    curl_multi_fdset()
15513498266Sopenharmony_ci  *
15613498266Sopenharmony_ci  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or
15713498266Sopenharmony_ci  *          poll() on. We want curl_multi_perform() called as soon as one of
15813498266Sopenharmony_ci  *          them are ready.
15913498266Sopenharmony_ci  *
16013498266Sopenharmony_ci  * Returns: CURLMcode type, general multi error code.
16113498266Sopenharmony_ci  */
16213498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
16313498266Sopenharmony_ci                                       fd_set *read_fd_set,
16413498266Sopenharmony_ci                                       fd_set *write_fd_set,
16513498266Sopenharmony_ci                                       fd_set *exc_fd_set,
16613498266Sopenharmony_ci                                       int *max_fd);
16713498266Sopenharmony_ci
16813498266Sopenharmony_ci/*
16913498266Sopenharmony_ci * Name:     curl_multi_wait()
17013498266Sopenharmony_ci *
17113498266Sopenharmony_ci * Desc:     Poll on all fds within a CURLM set as well as any
17213498266Sopenharmony_ci *           additional fds passed to the function.
17313498266Sopenharmony_ci *
17413498266Sopenharmony_ci * Returns:  CURLMcode type, general multi error code.
17513498266Sopenharmony_ci */
17613498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
17713498266Sopenharmony_ci                                      struct curl_waitfd extra_fds[],
17813498266Sopenharmony_ci                                      unsigned int extra_nfds,
17913498266Sopenharmony_ci                                      int timeout_ms,
18013498266Sopenharmony_ci                                      int *ret);
18113498266Sopenharmony_ci
18213498266Sopenharmony_ci/*
18313498266Sopenharmony_ci * Name:     curl_multi_poll()
18413498266Sopenharmony_ci *
18513498266Sopenharmony_ci * Desc:     Poll on all fds within a CURLM set as well as any
18613498266Sopenharmony_ci *           additional fds passed to the function.
18713498266Sopenharmony_ci *
18813498266Sopenharmony_ci * Returns:  CURLMcode type, general multi error code.
18913498266Sopenharmony_ci */
19013498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle,
19113498266Sopenharmony_ci                                      struct curl_waitfd extra_fds[],
19213498266Sopenharmony_ci                                      unsigned int extra_nfds,
19313498266Sopenharmony_ci                                      int timeout_ms,
19413498266Sopenharmony_ci                                      int *ret);
19513498266Sopenharmony_ci
19613498266Sopenharmony_ci/*
19713498266Sopenharmony_ci * Name:     curl_multi_wakeup()
19813498266Sopenharmony_ci *
19913498266Sopenharmony_ci * Desc:     wakes up a sleeping curl_multi_poll call.
20013498266Sopenharmony_ci *
20113498266Sopenharmony_ci * Returns:  CURLMcode type, general multi error code.
20213498266Sopenharmony_ci */
20313498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle);
20413498266Sopenharmony_ci
20513498266Sopenharmony_ci /*
20613498266Sopenharmony_ci  * Name:    curl_multi_perform()
20713498266Sopenharmony_ci  *
20813498266Sopenharmony_ci  * Desc:    When the app thinks there's data available for curl it calls this
20913498266Sopenharmony_ci  *          function to read/write whatever there is right now. This returns
21013498266Sopenharmony_ci  *          as soon as the reads and writes are done. This function does not
21113498266Sopenharmony_ci  *          require that there actually is data available for reading or that
21213498266Sopenharmony_ci  *          data can be written, it can be called just in case. It returns
21313498266Sopenharmony_ci  *          the number of handles that still transfer data in the second
21413498266Sopenharmony_ci  *          argument's integer-pointer.
21513498266Sopenharmony_ci  *
21613498266Sopenharmony_ci  * Returns: CURLMcode type, general multi error code. *NOTE* that this only
21713498266Sopenharmony_ci  *          returns errors etc regarding the whole multi stack. There might
21813498266Sopenharmony_ci  *          still have occurred problems on individual transfers even when
21913498266Sopenharmony_ci  *          this returns OK.
22013498266Sopenharmony_ci  */
22113498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
22213498266Sopenharmony_ci                                         int *running_handles);
22313498266Sopenharmony_ci
22413498266Sopenharmony_ci /*
22513498266Sopenharmony_ci  * Name:    curl_multi_cleanup()
22613498266Sopenharmony_ci  *
22713498266Sopenharmony_ci  * Desc:    Cleans up and removes a whole multi stack. It does not free or
22813498266Sopenharmony_ci  *          touch any individual easy handles in any way. We need to define
22913498266Sopenharmony_ci  *          in what state those handles will be if this function is called
23013498266Sopenharmony_ci  *          in the middle of a transfer.
23113498266Sopenharmony_ci  *
23213498266Sopenharmony_ci  * Returns: CURLMcode type, general multi error code.
23313498266Sopenharmony_ci  */
23413498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
23513498266Sopenharmony_ci
23613498266Sopenharmony_ci/*
23713498266Sopenharmony_ci * Name:    curl_multi_info_read()
23813498266Sopenharmony_ci *
23913498266Sopenharmony_ci * Desc:    Ask the multi handle if there's any messages/informationals from
24013498266Sopenharmony_ci *          the individual transfers. Messages include informationals such as
24113498266Sopenharmony_ci *          error code from the transfer or just the fact that a transfer is
24213498266Sopenharmony_ci *          completed. More details on these should be written down as well.
24313498266Sopenharmony_ci *
24413498266Sopenharmony_ci *          Repeated calls to this function will return a new struct each
24513498266Sopenharmony_ci *          time, until a special "end of msgs" struct is returned as a signal
24613498266Sopenharmony_ci *          that there is no more to get at this point.
24713498266Sopenharmony_ci *
24813498266Sopenharmony_ci *          The data the returned pointer points to will not survive calling
24913498266Sopenharmony_ci *          curl_multi_cleanup().
25013498266Sopenharmony_ci *
25113498266Sopenharmony_ci *          The 'CURLMsg' struct is meant to be very simple and only contain
25213498266Sopenharmony_ci *          very basic information. If more involved information is wanted,
25313498266Sopenharmony_ci *          we will provide the particular "transfer handle" in that struct
25413498266Sopenharmony_ci *          and that should/could/would be used in subsequent
25513498266Sopenharmony_ci *          curl_easy_getinfo() calls (or similar). The point being that we
25613498266Sopenharmony_ci *          must never expose complex structs to applications, as then we'll
25713498266Sopenharmony_ci *          undoubtably get backwards compatibility problems in the future.
25813498266Sopenharmony_ci *
25913498266Sopenharmony_ci * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
26013498266Sopenharmony_ci *          of structs. It also writes the number of messages left in the
26113498266Sopenharmony_ci *          queue (after this read) in the integer the second argument points
26213498266Sopenharmony_ci *          to.
26313498266Sopenharmony_ci */
26413498266Sopenharmony_ciCURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
26513498266Sopenharmony_ci                                          int *msgs_in_queue);
26613498266Sopenharmony_ci
26713498266Sopenharmony_ci/*
26813498266Sopenharmony_ci * Name:    curl_multi_strerror()
26913498266Sopenharmony_ci *
27013498266Sopenharmony_ci * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode
27113498266Sopenharmony_ci *          value into the equivalent human readable error string.  This is
27213498266Sopenharmony_ci *          useful for printing meaningful error messages.
27313498266Sopenharmony_ci *
27413498266Sopenharmony_ci * Returns: A pointer to a null-terminated error message.
27513498266Sopenharmony_ci */
27613498266Sopenharmony_ciCURL_EXTERN const char *curl_multi_strerror(CURLMcode);
27713498266Sopenharmony_ci
27813498266Sopenharmony_ci/*
27913498266Sopenharmony_ci * Name:    curl_multi_socket() and
28013498266Sopenharmony_ci *          curl_multi_socket_all()
28113498266Sopenharmony_ci *
28213498266Sopenharmony_ci * Desc:    An alternative version of curl_multi_perform() that allows the
28313498266Sopenharmony_ci *          application to pass in one of the file descriptors that have been
28413498266Sopenharmony_ci *          detected to have "action" on them and let libcurl perform.
28513498266Sopenharmony_ci *          See man page for details.
28613498266Sopenharmony_ci */
28713498266Sopenharmony_ci#define CURL_POLL_NONE   0
28813498266Sopenharmony_ci#define CURL_POLL_IN     1
28913498266Sopenharmony_ci#define CURL_POLL_OUT    2
29013498266Sopenharmony_ci#define CURL_POLL_INOUT  3
29113498266Sopenharmony_ci#define CURL_POLL_REMOVE 4
29213498266Sopenharmony_ci
29313498266Sopenharmony_ci#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
29413498266Sopenharmony_ci
29513498266Sopenharmony_ci#define CURL_CSELECT_IN   0x01
29613498266Sopenharmony_ci#define CURL_CSELECT_OUT  0x02
29713498266Sopenharmony_ci#define CURL_CSELECT_ERR  0x04
29813498266Sopenharmony_ci
29913498266Sopenharmony_citypedef int (*curl_socket_callback)(CURL *easy,      /* easy handle */
30013498266Sopenharmony_ci                                    curl_socket_t s, /* socket */
30113498266Sopenharmony_ci                                    int what,        /* see above */
30213498266Sopenharmony_ci                                    void *userp,     /* private callback
30313498266Sopenharmony_ci                                                        pointer */
30413498266Sopenharmony_ci                                    void *socketp);  /* private socket
30513498266Sopenharmony_ci                                                        pointer */
30613498266Sopenharmony_ci/*
30713498266Sopenharmony_ci * Name:    curl_multi_timer_callback
30813498266Sopenharmony_ci *
30913498266Sopenharmony_ci * Desc:    Called by libcurl whenever the library detects a change in the
31013498266Sopenharmony_ci *          maximum number of milliseconds the app is allowed to wait before
31113498266Sopenharmony_ci *          curl_multi_socket() or curl_multi_perform() must be called
31213498266Sopenharmony_ci *          (to allow libcurl's timed events to take place).
31313498266Sopenharmony_ci *
31413498266Sopenharmony_ci * Returns: The callback should return zero.
31513498266Sopenharmony_ci */
31613498266Sopenharmony_citypedef int (*curl_multi_timer_callback)(CURLM *multi,    /* multi handle */
31713498266Sopenharmony_ci                                         long timeout_ms, /* see above */
31813498266Sopenharmony_ci                                         void *userp);    /* private callback
31913498266Sopenharmony_ci                                                             pointer */
32013498266Sopenharmony_ci
32113498266Sopenharmony_ciCURL_EXTERN CURLMcode CURL_DEPRECATED(7.19.5, "Use curl_multi_socket_action()")
32213498266Sopenharmony_cicurl_multi_socket(CURLM *multi_handle, curl_socket_t s, int *running_handles);
32313498266Sopenharmony_ci
32413498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
32513498266Sopenharmony_ci                                               curl_socket_t s,
32613498266Sopenharmony_ci                                               int ev_bitmask,
32713498266Sopenharmony_ci                                               int *running_handles);
32813498266Sopenharmony_ci
32913498266Sopenharmony_ciCURL_EXTERN CURLMcode CURL_DEPRECATED(7.19.5, "Use curl_multi_socket_action()")
33013498266Sopenharmony_cicurl_multi_socket_all(CURLM *multi_handle, int *running_handles);
33113498266Sopenharmony_ci
33213498266Sopenharmony_ci#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
33313498266Sopenharmony_ci/* This macro below was added in 7.16.3 to push users who recompile to use
33413498266Sopenharmony_ci   the new curl_multi_socket_action() instead of the old curl_multi_socket()
33513498266Sopenharmony_ci*/
33613498266Sopenharmony_ci#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
33713498266Sopenharmony_ci#endif
33813498266Sopenharmony_ci
33913498266Sopenharmony_ci/*
34013498266Sopenharmony_ci * Name:    curl_multi_timeout()
34113498266Sopenharmony_ci *
34213498266Sopenharmony_ci * Desc:    Returns the maximum number of milliseconds the app is allowed to
34313498266Sopenharmony_ci *          wait before curl_multi_socket() or curl_multi_perform() must be
34413498266Sopenharmony_ci *          called (to allow libcurl's timed events to take place).
34513498266Sopenharmony_ci *
34613498266Sopenharmony_ci * Returns: CURLM error code.
34713498266Sopenharmony_ci */
34813498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
34913498266Sopenharmony_ci                                         long *milliseconds);
35013498266Sopenharmony_ci
35113498266Sopenharmony_citypedef enum {
35213498266Sopenharmony_ci  /* This is the socket callback function pointer */
35313498266Sopenharmony_ci  CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1),
35413498266Sopenharmony_ci
35513498266Sopenharmony_ci  /* This is the argument passed to the socket callback */
35613498266Sopenharmony_ci  CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2),
35713498266Sopenharmony_ci
35813498266Sopenharmony_ci    /* set to 1 to enable pipelining for this multi handle */
35913498266Sopenharmony_ci  CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3),
36013498266Sopenharmony_ci
36113498266Sopenharmony_ci   /* This is the timer callback function pointer */
36213498266Sopenharmony_ci  CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4),
36313498266Sopenharmony_ci
36413498266Sopenharmony_ci  /* This is the argument passed to the timer callback */
36513498266Sopenharmony_ci  CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5),
36613498266Sopenharmony_ci
36713498266Sopenharmony_ci  /* maximum number of entries in the connection cache */
36813498266Sopenharmony_ci  CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6),
36913498266Sopenharmony_ci
37013498266Sopenharmony_ci  /* maximum number of (pipelining) connections to one host */
37113498266Sopenharmony_ci  CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7),
37213498266Sopenharmony_ci
37313498266Sopenharmony_ci  /* maximum number of requests in a pipeline */
37413498266Sopenharmony_ci  CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8),
37513498266Sopenharmony_ci
37613498266Sopenharmony_ci  /* a connection with a content-length longer than this
37713498266Sopenharmony_ci     will not be considered for pipelining */
37813498266Sopenharmony_ci  CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9),
37913498266Sopenharmony_ci
38013498266Sopenharmony_ci  /* a connection with a chunk length longer than this
38113498266Sopenharmony_ci     will not be considered for pipelining */
38213498266Sopenharmony_ci  CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10),
38313498266Sopenharmony_ci
38413498266Sopenharmony_ci  /* a list of site names(+port) that are blocked from pipelining */
38513498266Sopenharmony_ci  CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11),
38613498266Sopenharmony_ci
38713498266Sopenharmony_ci  /* a list of server types that are blocked from pipelining */
38813498266Sopenharmony_ci  CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12),
38913498266Sopenharmony_ci
39013498266Sopenharmony_ci  /* maximum number of open connections in total */
39113498266Sopenharmony_ci  CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13),
39213498266Sopenharmony_ci
39313498266Sopenharmony_ci   /* This is the server push callback function pointer */
39413498266Sopenharmony_ci  CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14),
39513498266Sopenharmony_ci
39613498266Sopenharmony_ci  /* This is the argument passed to the server push callback */
39713498266Sopenharmony_ci  CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15),
39813498266Sopenharmony_ci
39913498266Sopenharmony_ci  /* maximum number of concurrent streams to support on a connection */
40013498266Sopenharmony_ci  CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16),
40113498266Sopenharmony_ci
40213498266Sopenharmony_ci  CURLMOPT_LASTENTRY /* the last unused */
40313498266Sopenharmony_ci} CURLMoption;
40413498266Sopenharmony_ci
40513498266Sopenharmony_ci
40613498266Sopenharmony_ci/*
40713498266Sopenharmony_ci * Name:    curl_multi_setopt()
40813498266Sopenharmony_ci *
40913498266Sopenharmony_ci * Desc:    Sets options for the multi handle.
41013498266Sopenharmony_ci *
41113498266Sopenharmony_ci * Returns: CURLM error code.
41213498266Sopenharmony_ci */
41313498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
41413498266Sopenharmony_ci                                        CURLMoption option, ...);
41513498266Sopenharmony_ci
41613498266Sopenharmony_ci
41713498266Sopenharmony_ci/*
41813498266Sopenharmony_ci * Name:    curl_multi_assign()
41913498266Sopenharmony_ci *
42013498266Sopenharmony_ci * Desc:    This function sets an association in the multi handle between the
42113498266Sopenharmony_ci *          given socket and a private pointer of the application. This is
42213498266Sopenharmony_ci *          (only) useful for curl_multi_socket uses.
42313498266Sopenharmony_ci *
42413498266Sopenharmony_ci * Returns: CURLM error code.
42513498266Sopenharmony_ci */
42613498266Sopenharmony_ciCURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
42713498266Sopenharmony_ci                                        curl_socket_t sockfd, void *sockp);
42813498266Sopenharmony_ci
42913498266Sopenharmony_ci/*
43013498266Sopenharmony_ci * Name:    curl_multi_get_handles()
43113498266Sopenharmony_ci *
43213498266Sopenharmony_ci * Desc:    Returns an allocated array holding all handles currently added to
43313498266Sopenharmony_ci *          the multi handle. Marks the final entry with a NULL pointer. If
43413498266Sopenharmony_ci *          there is no easy handle added to the multi handle, this function
43513498266Sopenharmony_ci *          returns an array with the first entry as a NULL pointer.
43613498266Sopenharmony_ci *
43713498266Sopenharmony_ci * Returns: NULL on failure, otherwise a CURL **array pointer
43813498266Sopenharmony_ci */
43913498266Sopenharmony_ciCURL_EXTERN CURL **curl_multi_get_handles(CURLM *multi_handle);
44013498266Sopenharmony_ci
44113498266Sopenharmony_ci/*
44213498266Sopenharmony_ci * Name: curl_push_callback
44313498266Sopenharmony_ci *
44413498266Sopenharmony_ci * Desc: This callback gets called when a new stream is being pushed by the
44513498266Sopenharmony_ci *       server. It approves or denies the new stream. It can also decide
44613498266Sopenharmony_ci *       to completely fail the connection.
44713498266Sopenharmony_ci *
44813498266Sopenharmony_ci * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT
44913498266Sopenharmony_ci */
45013498266Sopenharmony_ci#define CURL_PUSH_OK       0
45113498266Sopenharmony_ci#define CURL_PUSH_DENY     1
45213498266Sopenharmony_ci#define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */
45313498266Sopenharmony_ci
45413498266Sopenharmony_cistruct curl_pushheaders;  /* forward declaration only */
45513498266Sopenharmony_ci
45613498266Sopenharmony_ciCURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
45713498266Sopenharmony_ci                                        size_t num);
45813498266Sopenharmony_ciCURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
45913498266Sopenharmony_ci                                         const char *name);
46013498266Sopenharmony_ci
46113498266Sopenharmony_citypedef int (*curl_push_callback)(CURL *parent,
46213498266Sopenharmony_ci                                  CURL *easy,
46313498266Sopenharmony_ci                                  size_t num_headers,
46413498266Sopenharmony_ci                                  struct curl_pushheaders *headers,
46513498266Sopenharmony_ci                                  void *userp);
46613498266Sopenharmony_ci
46713498266Sopenharmony_ci#ifdef __cplusplus
46813498266Sopenharmony_ci} /* end of extern "C" */
46913498266Sopenharmony_ci#endif
47013498266Sopenharmony_ci
47113498266Sopenharmony_ci#endif
472