VirtualBox

source: vbox/trunk/src/libs/curl-8.7.1/lib/connect.h@ 106165

最後變更 在這個檔案從106165是 104083,由 vboxsync 提交於 8 月 前

curl-8.7.1: Applied and adjusted our curl changes to 8.4.0. bugref:10639

  • 屬性 svn:eol-style 設為 native
檔案大小: 5.1 KB
 
1#ifndef HEADER_CURL_CONNECT_H
2#define HEADER_CURL_CONNECT_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#include "curl_setup.h"
27
28#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */
29#include "sockaddr.h"
30#include "timeval.h"
31
32struct Curl_dns_entry;
33struct ip_quadruple;
34
35/* generic function that returns how much time there's left to run, according
36 to the timeouts set */
37timediff_t Curl_timeleft(struct Curl_easy *data,
38 struct curltime *nowp,
39 bool duringconnect);
40
41#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */
42
43/*
44 * Used to extract socket and connectdata struct for the most recent
45 * transfer on the given Curl_easy.
46 *
47 * The returned socket will be CURL_SOCKET_BAD in case of failure!
48 */
49curl_socket_t Curl_getconnectinfo(struct Curl_easy *data,
50 struct connectdata **connp);
51
52bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
53 char *addr, int *port);
54
55void Curl_persistconninfo(struct Curl_easy *data, struct connectdata *conn,
56 struct ip_quadruple *ip);
57
58/*
59 * Curl_conncontrol() marks the end of a connection/stream. The 'closeit'
60 * argument specifies if it is the end of a connection or a stream.
61 *
62 * For stream-based protocols (such as HTTP/2), a stream close will not cause
63 * a connection close. Other protocols will close the connection for both
64 * cases.
65 *
66 * It sets the bit.close bit to TRUE (with an explanation for debug builds),
67 * when the connection will close.
68 */
69
70#define CONNCTRL_KEEP 0 /* undo a marked closure */
71#define CONNCTRL_CONNECTION 1
72#define CONNCTRL_STREAM 2
73
74void Curl_conncontrol(struct connectdata *conn,
75 int closeit
76#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
77 , const char *reason
78#endif
79 );
80
81#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
82#define streamclose(x,y) Curl_conncontrol(x, CONNCTRL_STREAM, y)
83#define connclose(x,y) Curl_conncontrol(x, CONNCTRL_CONNECTION, y)
84#define connkeep(x,y) Curl_conncontrol(x, CONNCTRL_KEEP, y)
85#else /* if !DEBUGBUILD || CURL_DISABLE_VERBOSE_STRINGS */
86#define streamclose(x,y) Curl_conncontrol(x, CONNCTRL_STREAM)
87#define connclose(x,y) Curl_conncontrol(x, CONNCTRL_CONNECTION)
88#define connkeep(x,y) Curl_conncontrol(x, CONNCTRL_KEEP)
89#endif
90
91/**
92 * Create a cfilter for making an "ip" connection to the
93 * given address, using parameters from `conn`. The "ip" connection
94 * can be a TCP socket, a UDP socket or even a QUIC connection.
95 *
96 * It MUST use only the supplied `ai` for its connection attempt.
97 *
98 * Such a filter may be used in "happy eyeball" scenarios, and its
99 * `connect` implementation needs to support non-blocking. Once connected,
100 * it MAY be installed in the connection filter chain to serve transfers.
101 */
102typedef CURLcode cf_ip_connect_create(struct Curl_cfilter **pcf,
103 struct Curl_easy *data,
104 struct connectdata *conn,
105 const struct Curl_addrinfo *ai,
106 int transport);
107
108CURLcode Curl_cf_setup_insert_after(struct Curl_cfilter *cf_at,
109 struct Curl_easy *data,
110 const struct Curl_dns_entry *remotehost,
111 int transport,
112 int ssl_mode);
113
114/**
115 * Setup the cfilters at `sockindex` in connection `conn`.
116 * If no filter chain is installed yet, inspects the configuration
117 * in `data` and `conn? to install a suitable filter chain.
118 */
119CURLcode Curl_conn_setup(struct Curl_easy *data,
120 struct connectdata *conn,
121 int sockindex,
122 const struct Curl_dns_entry *remotehost,
123 int ssl_mode);
124
125extern struct Curl_cftype Curl_cft_happy_eyeballs;
126extern struct Curl_cftype Curl_cft_setup;
127
128#ifdef DEBUGBUILD
129void Curl_debug_set_transport_provider(int transport,
130 cf_ip_connect_create *cf_create);
131#endif
132
133#endif /* HEADER_CURL_CONNECT_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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