multihandle.h
Go to the documentation of this file.
1 #ifndef HEADER_CURL_MULTIHANDLE_H
2 #define HEADER_CURL_MULTIHANDLE_H
3 /***************************************************************************
4  * _ _ ____ _
5  * Project ___| | | | _ \| |
6  * / __| | | | |_) | |
7  * | (__| |_| | _ <| |___
8  * \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2017, 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 #include "conncache.h"
26 
27 struct Curl_message {
29  /* the 'CURLMsg' is the part that is visible to the external user */
30  struct CURLMsg extmsg;
31 };
32 
33 /* NOTE: if you add a state here, add the name to the statename[] array as
34  well!
35 */
36 typedef enum {
37  CURLM_STATE_INIT, /* 0 - start in this state */
38  CURLM_STATE_CONNECT_PEND, /* 1 - no connections, waiting for one */
39  CURLM_STATE_CONNECT, /* 2 - resolve/connect has been sent off */
40  CURLM_STATE_WAITRESOLVE, /* 3 - awaiting the resolve to finalize */
41  CURLM_STATE_WAITCONNECT, /* 4 - awaiting the TCP connect to finalize */
42  CURLM_STATE_WAITPROXYCONNECT, /* 5 - awaiting HTTPS proxy SSL initialization
43  to complete and/or proxy CONNECT to
44  finalize */
45  CURLM_STATE_SENDPROTOCONNECT, /* 6 - initiate protocol connect procedure */
46  CURLM_STATE_PROTOCONNECT, /* 7 - completing the protocol-specific connect
47  phase */
48  CURLM_STATE_WAITDO, /* 8 - wait for our turn to send the request */
49  CURLM_STATE_DO, /* 9 - start send off the request (part 1) */
50  CURLM_STATE_DOING, /* 10 - sending off the request (part 1) */
51  CURLM_STATE_DO_MORE, /* 11 - send off the request (part 2) */
52  CURLM_STATE_DO_DONE, /* 12 - done sending off request */
53  CURLM_STATE_WAITPERFORM, /* 13 - wait for our turn to read the response */
54  CURLM_STATE_PERFORM, /* 14 - transfer data */
55  CURLM_STATE_TOOFAST, /* 15 - wait because limit-rate exceeded */
56  CURLM_STATE_DONE, /* 16 - post data transfer operation */
57  CURLM_STATE_COMPLETED, /* 17 - operation complete */
58  CURLM_STATE_MSGSENT, /* 18 - the operation complete message is sent */
59  CURLM_STATE_LAST /* 19 - not a true state, never use this */
60 } CURLMstate;
61 
62 /* we support N sockets per easy handle. Set the corresponding bit to what
63  action we should wait for */
64 #define MAX_SOCKSPEREASYHANDLE 5
65 #define GETSOCK_READABLE (0x00ff)
66 #define GETSOCK_WRITABLE (0xff00)
67 
68 #define CURLPIPE_ANY (CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX)
69 
70 /* This is the struct known as CURLM on the outside */
71 struct Curl_multi {
72  /* First a simple identifier to easier detect if a user mix up
73  this multi handle with an easy handle. Set this to CURL_MULTI_HANDLE. */
74  long type;
75 
76  /* We have a doubly-linked circular list with easy handles */
77  struct Curl_easy *easyp;
78  struct Curl_easy *easylp; /* last node */
79 
80  int num_easy; /* amount of entries in the linked list above. */
81  int num_alive; /* amount of easy handles that are added but have not yet
82  reached COMPLETE state */
83 
84  struct curl_llist msglist; /* a list of messages from completed transfers */
85 
86  struct curl_llist pending; /* Curl_easys that are in the
87  CURLM_STATE_CONNECT_PEND state */
88 
89  /* callback function and user data pointer for the *socket() API */
91  void *socket_userp;
92 
93  /* callback function and user data pointer for server push */
95  void *push_userp;
96 
97  /* Hostname cache */
98  struct curl_hash hostcache;
99 
100  /* timetree points to the splay-tree of time nodes to figure out expire
101  times of all currently set timers */
103 
104  /* 'sockhash' is the lookup hash for socket descriptor => easy handles (note
105  the pluralis form, there can be more than one easy handle waiting on the
106  same actual socket) */
107  struct curl_hash sockhash;
108 
109  /* pipelining wanted bits (CURLPIPE*) */
111 
112  bool recheckstate; /* see Curl_multi_connchanged */
113 
114  /* Shared connection cache (bundles)*/
115  struct conncache conn_cache;
116 
117  /* This handle will be used for closing the cached connections in
118  curl_multi_cleanup() */
120 
121  long maxconnects; /* if >0, a fixed limit of the maximum number of entries
122  we're allowed to grow the connection cache to */
123 
124  long max_host_connections; /* if >0, a fixed limit of the maximum number
125  of connections per host */
126 
127  long max_total_connections; /* if >0, a fixed limit of the maximum number
128  of connections in total */
129 
130  long max_pipeline_length; /* if >0, maximum number of requests in a
131  pipeline */
132 
133  long content_length_penalty_size; /* a connection with a
134  content-length bigger than
135  this is not considered
136  for pipelining */
137 
138  long chunk_length_penalty_size; /* a connection with a chunk length
139  bigger than this is not
140  considered for pipelining */
141 
142  struct curl_llist pipelining_site_bl; /* List of sites that are blacklisted
143  from pipelining */
144 
145  struct curl_llist pipelining_server_bl; /* List of server types that are
146  blacklisted from pipelining */
147 
148  /* timer callback and user data pointer for the *socket() API */
150  void *timer_userp;
151  struct curltime timer_lastcall; /* the fixed time for the timeout for the
152  previous callback */
153 };
154 
155 #endif /* HEADER_CURL_MULTIHANDLE_H */
Definition: hash.h:46
struct Curl_easy * closure_handle
Definition: multihandle.h:119
bool recheckstate
Definition: multihandle.h:112
void * push_userp
Definition: multihandle.h:95
int num_alive
Definition: multihandle.h:81
Definition: multi.h:93
struct CURLMsg extmsg
Definition: multihandle.h:30
void * socket_userp
Definition: multihandle.h:91
void * timer_userp
Definition: multihandle.h:150
int(* curl_socket_callback)(CURL *easy, curl_socket_t s, int what, void *userp, void *socketp)
Definition: multi.h:268
int(* curl_multi_timer_callback)(CURLM *multi, long timeout_ms, void *userp)
Definition: multi.h:285
long content_length_penalty_size
Definition: multihandle.h:133
long max_pipeline_length
Definition: multihandle.h:130
curl_socket_callback socket_cb
Definition: multihandle.h:90
long chunk_length_penalty_size
Definition: multihandle.h:138
long maxconnects
Definition: multihandle.h:121
int num_easy
Definition: multihandle.h:80
curl_push_callback push_cb
Definition: multihandle.h:94
struct Curl_easy * easyp
Definition: multihandle.h:77
long max_total_connections
Definition: multihandle.h:127
long pipelining
Definition: multihandle.h:110
curl_multi_timer_callback timer_cb
Definition: multihandle.h:149
struct Curl_easy * easylp
Definition: multihandle.h:78
struct Curl_tree * timetree
Definition: multihandle.h:102
struct curl_llist_element list
Definition: multihandle.h:28
int(* curl_push_callback)(CURL *parent, CURL *easy, size_t num_headers, struct curl_pushheaders *headers, void *userp)
Definition: multi.h:429
long max_host_connections
Definition: multihandle.h:124
CURLMstate
Definition: multihandle.h:36


rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:16