VirtualBox

source: vbox/trunk/src/libs/curl-8.11.1/lib/multiif.h@ 108333

最後變更 在這個檔案從108333是 108048,由 vboxsync 提交於 7 週 前

curl-8.11.1: Applied and adjusted our curl changes to 8.7.1. jiraref:VBP-1535

  • 屬性 svn:eol-style 設為 native
檔案大小: 7.4 KB
 
1#ifndef HEADER_CURL_MULTIIF_H
2#define HEADER_CURL_MULTIIF_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) Daniel Stenberg, <[email protected]>, 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.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 * SPDX-License-Identifier: curl
24 *
25 ***************************************************************************/
26
27/*
28 * Prototypes for library-wide functions provided by multi.c
29 */
30
31CURLcode Curl_updatesocket(struct Curl_easy *data);
32void Curl_expire(struct Curl_easy *data, timediff_t milli, expire_id);
33bool Curl_expire_clear(struct Curl_easy *data);
34void Curl_expire_done(struct Curl_easy *data, expire_id id);
35CURLMcode Curl_update_timer(struct Curl_multi *multi) WARN_UNUSED_RESULT;
36void Curl_attach_connection(struct Curl_easy *data,
37 struct connectdata *conn);
38void Curl_detach_connection(struct Curl_easy *data);
39bool Curl_multiplex_wanted(const struct Curl_multi *multi);
40void Curl_set_in_callback(struct Curl_easy *data, bool value);
41bool Curl_is_in_callback(struct Curl_easy *data);
42CURLcode Curl_preconnect(struct Curl_easy *data);
43
44void Curl_multi_connchanged(struct Curl_multi *multi);
45
46/* Internal version of curl_multi_init() accepts size parameters for the
47 socket, connection and dns hashes */
48struct Curl_multi *Curl_multi_handle(size_t hashsize,
49 size_t chashsize,
50 size_t dnssize);
51
52/* the write bits start at bit 16 for the *getsock() bitmap */
53#define GETSOCK_WRITEBITSTART 16
54
55#define GETSOCK_BLANK 0 /* no bits set */
56
57/* set the bit for the given sock number to make the bitmap for writable */
58#define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x)))
59
60/* set the bit for the given sock number to make the bitmap for readable */
61#define GETSOCK_READSOCK(x) (1 << (x))
62
63/* mask for checking if read and/or write is set for index x */
64#define GETSOCK_MASK_RW(x) (GETSOCK_READSOCK(x)|GETSOCK_WRITESOCK(x))
65
66/*
67 * Curl_multi_closed()
68 *
69 * Used by the connect code to tell the multi_socket code that one of the
70 * sockets we were using is about to be closed. This function will then
71 * remove it from the sockethash for this handle to make the multi_socket API
72 * behave properly, especially for the case when libcurl will create another
73 * socket again and it gets the same file descriptor number.
74 */
75
76void Curl_multi_closed(struct Curl_easy *data, curl_socket_t s);
77
78/* Compare the two pollsets to notify the multi_socket API of changes
79 * in socket polling, e.g calling multi->socket_cb() with the changes if
80 * differences are seen.
81 */
82CURLMcode Curl_multi_pollset_ev(struct Curl_multi *multi,
83 struct Curl_easy *data,
84 struct easy_pollset *ps,
85 struct easy_pollset *last_ps);
86
87/*
88 * Add a handle and move it into PERFORM state at once. For pushed streams.
89 */
90CURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
91 struct Curl_easy *data,
92 struct connectdata *conn);
93
94
95/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option */
96unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi);
97
98/**
99 * Borrow the transfer buffer from the multi, suitable
100 * for the given transfer `data`. The buffer may only be used in one
101 * multi processing of the easy handle. It MUST be returned to the
102 * multi before it can be borrowed again.
103 * Pointers into the buffer remain only valid as long as it is borrowed.
104 *
105 * @param data the easy handle
106 * @param pbuf on return, the buffer to use or NULL on error
107 * @param pbuflen on return, the size of *pbuf or 0 on error
108 * @return CURLE_OK when buffer is available and is returned.
109 * CURLE_OUT_OF_MEMORy on failure to allocate the buffer,
110 * CURLE_FAILED_INIT if the easy handle is without multi.
111 * CURLE_AGAIN if the buffer is borrowed already.
112 */
113CURLcode Curl_multi_xfer_buf_borrow(struct Curl_easy *data,
114 char **pbuf, size_t *pbuflen);
115/**
116 * Release the borrowed buffer. All references into the buffer become
117 * invalid after this.
118 * @param buf the buffer pointer borrowed for coding error checks.
119 */
120void Curl_multi_xfer_buf_release(struct Curl_easy *data, char *buf);
121
122/**
123 * Borrow the upload buffer from the multi, suitable
124 * for the given transfer `data`. The buffer may only be used in one
125 * multi processing of the easy handle. It MUST be returned to the
126 * multi before it can be borrowed again.
127 * Pointers into the buffer remain only valid as long as it is borrowed.
128 *
129 * @param data the easy handle
130 * @param pbuf on return, the buffer to use or NULL on error
131 * @param pbuflen on return, the size of *pbuf or 0 on error
132 * @return CURLE_OK when buffer is available and is returned.
133 * CURLE_OUT_OF_MEMORy on failure to allocate the buffer,
134 * CURLE_FAILED_INIT if the easy handle is without multi.
135 * CURLE_AGAIN if the buffer is borrowed already.
136 */
137CURLcode Curl_multi_xfer_ulbuf_borrow(struct Curl_easy *data,
138 char **pbuf, size_t *pbuflen);
139
140/**
141 * Release the borrowed upload buffer. All references into the buffer become
142 * invalid after this.
143 * @param buf the upload buffer pointer borrowed for coding error checks.
144 */
145void Curl_multi_xfer_ulbuf_release(struct Curl_easy *data, char *buf);
146
147/**
148 * Borrow the socket scratch buffer from the multi, suitable
149 * for the given transfer `data`. The buffer may only be used for
150 * direct socket I/O operation by one connection at a time and MUST be
151 * returned to the multi before the I/O call returns.
152 * Pointers into the buffer remain only valid as long as it is borrowed.
153 *
154 * @param data the easy handle
155 * @param blen requested length of the buffer
156 * @param pbuf on return, the buffer to use or NULL on error
157 * @return CURLE_OK when buffer is available and is returned.
158 * CURLE_OUT_OF_MEMORy on failure to allocate the buffer,
159 * CURLE_FAILED_INIT if the easy handle is without multi.
160 * CURLE_AGAIN if the buffer is borrowed already.
161 */
162CURLcode Curl_multi_xfer_sockbuf_borrow(struct Curl_easy *data,
163 size_t blen, char **pbuf);
164/**
165 * Release the borrowed buffer. All references into the buffer become
166 * invalid after this.
167 * @param buf the buffer pointer borrowed for coding error checks.
168 */
169void Curl_multi_xfer_sockbuf_release(struct Curl_easy *data, char *buf);
170
171/**
172 * Get the transfer handle for the given id. Returns NULL if not found.
173 */
174struct Curl_easy *Curl_multi_get_handle(struct Curl_multi *multi,
175 curl_off_t id);
176
177#endif /* HEADER_CURL_MULTIIF_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette