master
1#ifndef CURLINC_TYPECHECK_GCC_H
2#define CURLINC_TYPECHECK_GCC_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 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.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 ***************************************************************************/
27/* wraps curl_easy_setopt() with type checking */
29/* To add a new kind of warning, add an
30 * if(curlcheck_sometype_option(_curl_opt))
31 * if(!curlcheck_sometype(value))
32 * Wcurl_easy_setopt_err_sometype();
33 * block and define curlcheck_sometype_option, curlcheck_sometype and
34 * Wcurl_easy_setopt_err_sometype below
35 *
36 * NOTE: We use two nested 'if' statements here instead of the && operator, in
37 * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
38 * when compiling with -Wlogical-op.
39 *
40 * To add an option that uses the same type as an existing option, you need
41 * to extend the appropriate _curl_*_option macro
42 */
44#define curl_easy_setopt(handle, option, value) \
45 __extension__({ \
46 if(__builtin_constant_p(option)) { \
47 CURL_IGNORE_DEPRECATION( \
48 if(curlcheck_long_option(option)) \
49 if(!curlcheck_long(value)) \
50 Wcurl_easy_setopt_err_long(); \
51 if(curlcheck_off_t_option(option)) \
52 if(!curlcheck_off_t(value)) \
53 Wcurl_easy_setopt_err_curl_off_t(); \
54 if(curlcheck_string_option(option)) \
55 if(!curlcheck_string(value)) \
56 Wcurl_easy_setopt_err_string(); \
57 if((option) == CURLOPT_PRIVATE) { } \
58 if(curlcheck_write_cb_option(option)) \
59 if(!curlcheck_write_cb(value)) \
60 Wcurl_easy_setopt_err_write_callback(); \
61 if(curlcheck_curl_option(option)) \
62 if(!curlcheck_curl(value)) \
63 Wcurl_easy_setopt_err_curl(); \
64 if((option) == CURLOPT_RESOLVER_START_FUNCTION) \
65 if(!curlcheck_resolver_start_callback(value)) \
66 Wcurl_easy_setopt_err_resolver_start_callback(); \
67 if((option) == CURLOPT_READFUNCTION) \
68 if(!curlcheck_read_cb(value)) \
69 Wcurl_easy_setopt_err_read_cb(); \
70 if((option) == CURLOPT_IOCTLFUNCTION) \
71 if(!curlcheck_ioctl_cb(value)) \
72 Wcurl_easy_setopt_err_ioctl_cb(); \
73 if((option) == CURLOPT_SOCKOPTFUNCTION) \
74 if(!curlcheck_sockopt_cb(value)) \
75 Wcurl_easy_setopt_err_sockopt_cb(); \
76 if((option) == CURLOPT_OPENSOCKETFUNCTION) \
77 if(!curlcheck_opensocket_cb(value)) \
78 Wcurl_easy_setopt_err_opensocket_cb(); \
79 if((option) == CURLOPT_PROGRESSFUNCTION) \
80 if(!curlcheck_progress_cb(value)) \
81 Wcurl_easy_setopt_err_progress_cb(); \
82 if((option) == CURLOPT_XFERINFOFUNCTION) \
83 if(!curlcheck_xferinfo_cb(value)) \
84 Wcurl_easy_setopt_err_xferinfo_cb(); \
85 if((option) == CURLOPT_DEBUGFUNCTION) \
86 if(!curlcheck_debug_cb(value)) \
87 Wcurl_easy_setopt_err_debug_cb(); \
88 if((option) == CURLOPT_SSL_CTX_FUNCTION) \
89 if(!curlcheck_ssl_ctx_cb(value)) \
90 Wcurl_easy_setopt_err_ssl_ctx_cb(); \
91 if(curlcheck_conv_cb_option(option)) \
92 if(!curlcheck_conv_cb(value)) \
93 Wcurl_easy_setopt_err_conv_cb(); \
94 if((option) == CURLOPT_SEEKFUNCTION) \
95 if(!curlcheck_seek_cb(value)) \
96 Wcurl_easy_setopt_err_seek_cb(); \
97 if((option) == CURLOPT_CHUNK_BGN_FUNCTION) \
98 if(!curlcheck_chunk_bgn_cb(value)) \
99 Wcurl_easy_setopt_err_chunk_bgn_cb(); \
100 if((option) == CURLOPT_CHUNK_END_FUNCTION) \
101 if(!curlcheck_chunk_end_cb(value)) \
102 Wcurl_easy_setopt_err_chunk_end_cb(); \
103 if((option) == CURLOPT_CLOSESOCKETFUNCTION) \
104 if(!curlcheck_close_socket_cb(value)) \
105 Wcurl_easy_setopt_err_close_socket_cb(); \
106 if((option) == CURLOPT_FNMATCH_FUNCTION) \
107 if(!curlcheck_fnmatch_cb(value)) \
108 Wcurl_easy_setopt_err_fnmatch_cb(); \
109 if((option) == CURLOPT_HSTSREADFUNCTION) \
110 if(!curlcheck_hstsread_cb(value)) \
111 Wcurl_easy_setopt_err_hstsread_cb(); \
112 if((option) == CURLOPT_HSTSWRITEFUNCTION) \
113 if(!curlcheck_hstswrite_cb(value)) \
114 Wcurl_easy_setopt_err_hstswrite_cb(); \
115 if((option) == CURLOPT_SSH_HOSTKEYFUNCTION) \
116 if(!curlcheck_ssh_hostkey_cb(value)) \
117 Wcurl_easy_setopt_err_ssh_hostkey_cb(); \
118 if((option) == CURLOPT_SSH_KEYFUNCTION) \
119 if(!curlcheck_ssh_key_cb(value)) \
120 Wcurl_easy_setopt_err_ssh_key_cb(); \
121 if((option) == CURLOPT_INTERLEAVEFUNCTION) \
122 if(!curlcheck_interleave_cb(value)) \
123 Wcurl_easy_setopt_err_interleave_cb(); \
124 if((option) == CURLOPT_PREREQFUNCTION) \
125 if(!curlcheck_prereq_cb(value)) \
126 Wcurl_easy_setopt_err_prereq_cb(); \
127 if((option) == CURLOPT_TRAILERFUNCTION) \
128 if(!curlcheck_trailer_cb(value)) \
129 Wcurl_easy_setopt_err_trailer_cb(); \
130 if(curlcheck_cb_data_option(option)) \
131 if(!curlcheck_cb_data(value)) \
132 Wcurl_easy_setopt_err_cb_data(); \
133 if((option) == CURLOPT_ERRORBUFFER) \
134 if(!curlcheck_error_buffer(value)) \
135 Wcurl_easy_setopt_err_error_buffer(); \
136 if((option) == CURLOPT_CURLU) \
137 if(!curlcheck_ptr((value), CURLU)) \
138 Wcurl_easy_setopt_err_curlu(); \
139 if((option) == CURLOPT_STDERR) \
140 if(!curlcheck_FILE(value)) \
141 Wcurl_easy_setopt_err_FILE(); \
142 if(curlcheck_postfields_option(option)) \
143 if(!curlcheck_postfields(value)) \
144 Wcurl_easy_setopt_err_postfields(); \
145 if((option) == CURLOPT_HTTPPOST) \
146 if(!curlcheck_arr((value), struct curl_httppost)) \
147 Wcurl_easy_setopt_err_curl_httpost(); \
148 if((option) == CURLOPT_MIMEPOST) \
149 if(!curlcheck_ptr((value), curl_mime)) \
150 Wcurl_easy_setopt_err_curl_mimepost(); \
151 if(curlcheck_slist_option(option)) \
152 if(!curlcheck_arr((value), struct curl_slist)) \
153 Wcurl_easy_setopt_err_curl_slist(); \
154 if((option) == CURLOPT_SHARE) \
155 if(!curlcheck_ptr((value), CURLSH)) \
156 Wcurl_easy_setopt_err_CURLSH(); \
157 ) \
158 } \
159 (curl_easy_setopt)(handle, option, value); \
160 })
162/* wraps curl_easy_getinfo() with type checking */
163#define curl_easy_getinfo(handle, info, arg) \
164 __extension__({ \
165 if(__builtin_constant_p(info)) { \
166 CURL_IGNORE_DEPRECATION( \
167 if(curlcheck_string_info(info)) \
168 if(!curlcheck_arr((arg), char *)) \
169 Wcurl_easy_getinfo_err_string(); \
170 if(curlcheck_long_info(info)) \
171 if(!curlcheck_arr((arg), long)) \
172 Wcurl_easy_getinfo_err_long(); \
173 if(curlcheck_double_info(info)) \
174 if(!curlcheck_arr((arg), double)) \
175 Wcurl_easy_getinfo_err_double(); \
176 if(curlcheck_slist_info(info)) \
177 if(!curlcheck_arr((arg), struct curl_slist *)) \
178 Wcurl_easy_getinfo_err_curl_slist(); \
179 if(curlcheck_tlssessioninfo_info(info)) \
180 if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
181 Wcurl_easy_getinfo_err_curl_tlssessioninfo(); \
182 if(curlcheck_certinfo_info(info)) \
183 if(!curlcheck_arr((arg), struct curl_certinfo *)) \
184 Wcurl_easy_getinfo_err_curl_certinfo(); \
185 if(curlcheck_socket_info(info)) \
186 if(!curlcheck_arr((arg), curl_socket_t)) \
187 Wcurl_easy_getinfo_err_curl_socket(); \
188 if(curlcheck_off_t_info(info)) \
189 if(!curlcheck_arr((arg), curl_off_t)) \
190 Wcurl_easy_getinfo_err_curl_off_t(); \
191 ) \
192 } \
193 (curl_easy_getinfo)(handle, info, arg); \
194 })
196#define curl_multi_setopt(handle, option, value) \
197 __extension__({ \
198 if(__builtin_constant_p(option)) { \
199 if(curlcheck_long_option(option)) \
200 if(!curlcheck_long(value)) \
201 Wcurl_multi_setopt_err_long(); \
202 if(curlcheck_off_t_option(option)) \
203 if(!curlcheck_off_t(value)) \
204 Wcurl_multi_setopt_err_curl_off_t(); \
205 if(curlcheck_multicb_data_option(option)) \
206 if(!curlcheck_cb_data(value)) \
207 Wcurl_multi_setopt_err_cb_data(); \
208 if(curlcheck_charpp_option(option)) \
209 if(!curlcheck_ptrptr(value, char)) \
210 Wcurl_multi_setopt_err_charpp(); \
211 if((option) == CURLMOPT_NOTIFYFUNCTION) \
212 if(!curlcheck_multinotify_cb(value)) \
213 Wcurl_multi_setopt_err_notifycb(); \
214 if((option) == CURLMOPT_PUSHFUNCTION) \
215 if(!curlcheck_multipush_cb(value)) \
216 Wcurl_multi_setopt_err_pushcb(); \
217 if((option) == CURLMOPT_SOCKETFUNCTION) \
218 if(!curlcheck_multisocket_cb(value)) \
219 Wcurl_multi_setopt_err_socketcb(); \
220 if((option) == CURLMOPT_TIMERFUNCTION) \
221 if(!curlcheck_multitimer_cb(value)) \
222 Wcurl_multi_setopt_err_timercb(); \
223 } \
224 (curl_multi_setopt)(handle, option, value); \
225 })
227/* evaluates to true if the option takes a data argument to pass to a
228 callback */
229#define curlcheck_multicb_data_option(option) \
230 ((option) == CURLMOPT_NOTIFYDATA || \
231 (option) == CURLMOPT_PUSHDATA || \
232 (option) == CURLMOPT_SOCKETDATA || \
233 (option) == CURLMOPT_TIMERDATA || \
234 0)
236/* evaluates to true if the option takes a char ** argument */
237#define curlcheck_charpp_option(option) \
238 ((option) == CURLMOPT_PIPELINING_SERVER_BL || \
239 (option) == CURLMOPT_PIPELINING_SITE_BL || \
240 0)
242/* evaluates to true if expr is of type curl_multi_timer_callback */
243#define curlcheck_multitimer_cb(expr) \
244 (curlcheck_NULL(expr) || \
245 curlcheck_cb_compatible((expr), curl_multi_timer_callback))
247/* evaluates to true if expr is of type curl_socket_callback */
248#define curlcheck_multisocket_cb(expr) \
249 (curlcheck_NULL(expr) || \
250 curlcheck_cb_compatible((expr), curl_socket_callback))
252/* evaluates to true if expr is of type curl_push_callback */
253#define curlcheck_multipush_cb(expr) \
254 (curlcheck_NULL(expr) || \
255 curlcheck_cb_compatible((expr), curl_push_callback))
257/* evaluates to true if expr is of type curl_push_callback */
258#define curlcheck_multinotify_cb(expr) \
259 (curlcheck_NULL(expr) || \
260 curlcheck_cb_compatible((expr), curl_notify_callback))
262/*
263 * Make sure that the functions are called with three arguments
264 */
265#define curl_share_setopt(share, opt, param) \
266 (curl_share_setopt)(share, opt, param)
268/* the actual warnings, triggered by calling the Wcurl_easy_setopt_err*
269 * functions */
271/* To define a new warning, use _CURL_WARNING(identifier, "message") */
272#define CURLWARNING(id, message) \
273 static void __attribute__((__warning__(message))) \
274 __attribute__((__unused__)) __attribute__((__noinline__)) \
275 id(void) { __asm__(""); }
277CURLWARNING(Wcurl_multi_setopt_err_long,
278 "curl_multi_setopt expects a long argument")
279CURLWARNING(Wcurl_multi_setopt_err_curl_off_t,
280 "curl_multi_setopt expects a curl_off_t argument")
281CURLWARNING(Wcurl_multi_setopt_err_cb_data,
282 "curl_multi_setopt expects a 'void *' argument")
283CURLWARNING(Wcurl_multi_setopt_err_charpp,
284 "curl_multi_setopt expects a 'char **' argument")
285CURLWARNING(Wcurl_multi_setopt_err_pushcb,
286 "curl_multi_setopt expects a curl_push_callback argument")
287CURLWARNING(Wcurl_multi_setopt_err_notifycb,
288 "curl_multi_setopt expects a curl_notify_callback argument")
289CURLWARNING(Wcurl_multi_setopt_err_socketcb,
290 "curl_multi_setopt expects a curl_socket_callback argument")
291CURLWARNING(Wcurl_multi_setopt_err_timercb,
292 "curl_multi_setopt expects a curl_multi_timer_callback argument")
294CURLWARNING(Wcurl_easy_setopt_err_long,
295 "curl_easy_setopt expects a long argument")
296CURLWARNING(Wcurl_easy_setopt_err_curl_off_t,
297 "curl_easy_setopt expects a curl_off_t argument")
298CURLWARNING(Wcurl_easy_setopt_err_string,
299 "curl_easy_setopt expects a "
300 "string ('char *' or char[]) argument")
301CURLWARNING(Wcurl_easy_setopt_err_write_callback,
302 "curl_easy_setopt expects a curl_write_callback argument")
303CURLWARNING(Wcurl_easy_setopt_err_resolver_start_callback,
304 "curl_easy_setopt expects a "
305 "curl_resolver_start_callback argument")
306CURLWARNING(Wcurl_easy_setopt_err_read_cb,
307 "curl_easy_setopt expects a curl_read_callback argument")
308CURLWARNING(Wcurl_easy_setopt_err_ioctl_cb,
309 "curl_easy_setopt expects a curl_ioctl_callback argument")
310CURLWARNING(Wcurl_easy_setopt_err_sockopt_cb,
311 "curl_easy_setopt expects a curl_sockopt_callback argument")
312CURLWARNING(Wcurl_easy_setopt_err_opensocket_cb,
313 "curl_easy_setopt expects a "
314 "curl_opensocket_callback argument")
315CURLWARNING(Wcurl_easy_setopt_err_progress_cb,
316 "curl_easy_setopt expects a curl_progress_callback argument")
317CURLWARNING(Wcurl_easy_setopt_err_xferinfo_cb,
318 "curl_easy_setopt expects a curl_xferinfo_callback argument")
319CURLWARNING(Wcurl_easy_setopt_err_debug_cb,
320 "curl_easy_setopt expects a curl_debug_callback argument")
321CURLWARNING(Wcurl_easy_setopt_err_ssl_ctx_cb,
322 "curl_easy_setopt expects a curl_ssl_ctx_callback argument")
323CURLWARNING(Wcurl_easy_setopt_err_conv_cb,
324 "curl_easy_setopt expects a curl_conv_callback argument")
325CURLWARNING(Wcurl_easy_setopt_err_seek_cb,
326 "curl_easy_setopt expects a curl_seek_callback argument")
327CURLWARNING(Wcurl_easy_setopt_err_cb_data,
328 "curl_easy_setopt expects a "
329 "private data pointer as argument")
330CURLWARNING(Wcurl_easy_setopt_err_chunk_bgn_cb,
331 "curl_easy_setopt expects a curl_chunk_bgn_callback argument")
332CURLWARNING(Wcurl_easy_setopt_err_chunk_end_cb,
333 "curl_easy_setopt expects a curl_chunk_end_callback argument")
334CURLWARNING(Wcurl_easy_setopt_err_close_socket_cb,
335 "curl_easy_setopt expects a curl_closesocket_callback argument")
336CURLWARNING(Wcurl_easy_setopt_err_fnmatch_cb,
337 "curl_easy_setopt expects a curl_fnmatch_callback argument")
338CURLWARNING(Wcurl_easy_setopt_err_hstsread_cb,
339 "curl_easy_setopt expects a curl_hstsread_callback argument")
340CURLWARNING(Wcurl_easy_setopt_err_hstswrite_cb,
341 "curl_easy_setopt expects a curl_hstswrite_callback argument")
342CURLWARNING(Wcurl_easy_setopt_err_ssh_key_cb,
343 "curl_easy_setopt expects a curl_sshkeycallback argument")
344CURLWARNING(Wcurl_easy_setopt_err_ssh_hostkey_cb,
345 "curl_easy_setopt expects a curl_sshhostkeycallback argument")
346CURLWARNING(Wcurl_easy_setopt_err_interleave_cb,
347 "curl_easy_setopt expects a curl_interleave_callback argument")
348CURLWARNING(Wcurl_easy_setopt_err_prereq_cb,
349 "curl_easy_setopt expects a curl_prereq_callback argument")
350CURLWARNING(Wcurl_easy_setopt_err_trailer_cb,
351 "curl_easy_setopt expects a curl_trailerfunc_ok argument")
352CURLWARNING(Wcurl_easy_setopt_err_error_buffer,
353 "curl_easy_setopt expects a "
354 "char buffer of CURL_ERROR_SIZE as argument")
355CURLWARNING(Wcurl_easy_setopt_err_curlu,
356 "curl_easy_setopt expects a 'CURLU *' argument")
357CURLWARNING(Wcurl_easy_setopt_err_curl,
358 "curl_easy_setopt expects a 'CURL *' argument")
359CURLWARNING(Wcurl_easy_setopt_err_FILE,
360 "curl_easy_setopt expects a 'FILE *' argument")
361CURLWARNING(Wcurl_easy_setopt_err_postfields,
362 "curl_easy_setopt expects a 'void *' or 'char *' argument")
363CURLWARNING(Wcurl_easy_setopt_err_curl_httpost,
364 "curl_easy_setopt expects a 'struct curl_httppost *' "
365 "argument")
366CURLWARNING(Wcurl_easy_setopt_err_curl_mimepost,
367 "curl_easy_setopt expects a 'curl_mime *' "
368 "argument")
369CURLWARNING(Wcurl_easy_setopt_err_curl_slist,
370 "curl_easy_setopt expects a 'struct curl_slist *' argument")
371CURLWARNING(Wcurl_easy_setopt_err_CURLSH,
372 "curl_easy_setopt expects a CURLSH* argument")
373CURLWARNING(Wcurl_easy_getinfo_err_string,
374 "curl_easy_getinfo expects a pointer to 'char *'")
375CURLWARNING(Wcurl_easy_getinfo_err_long,
376 "curl_easy_getinfo expects a pointer to long")
377CURLWARNING(Wcurl_easy_getinfo_err_double,
378 "curl_easy_getinfo expects a pointer to double")
379CURLWARNING(Wcurl_easy_getinfo_err_curl_slist,
380 "curl_easy_getinfo expects a pointer to 'struct curl_slist *'")
381CURLWARNING(Wcurl_easy_getinfo_err_curl_tlssessioninfo,
382 "curl_easy_getinfo expects a pointer to "
383 "'struct curl_tlssessioninfo *'")
384CURLWARNING(Wcurl_easy_getinfo_err_curl_certinfo,
385 "curl_easy_getinfo expects a pointer to "
386 "'struct curl_certinfo *'")
387CURLWARNING(Wcurl_easy_getinfo_err_curl_socket,
388 "curl_easy_getinfo expects a pointer to curl_socket_t")
389CURLWARNING(Wcurl_easy_getinfo_err_curl_off_t,
390 "curl_easy_getinfo expects a pointer to curl_off_t")
392/* groups of curl_easy_setops options that take the same type of argument */
394/* evaluates to true if option takes a long argument */
395#define curlcheck_long_option(option) \
396 (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
398#define curlcheck_off_t_option(option) \
399 (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB))
401/* option takes a CURL * argument */
402#define curlcheck_curl_option(option) \
403 ((option) == CURLOPT_STREAM_DEPENDS || \
404 (option) == CURLOPT_STREAM_DEPENDS_E || \
405 0)
407/* evaluates to true if option takes a char* argument */
408#define curlcheck_string_option(option) \
409 ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
410 (option) == CURLOPT_ACCEPT_ENCODING || \
411 (option) == CURLOPT_ALTSVC || \
412 (option) == CURLOPT_CAINFO || \
413 (option) == CURLOPT_CAPATH || \
414 (option) == CURLOPT_COOKIE || \
415 (option) == CURLOPT_COOKIEFILE || \
416 (option) == CURLOPT_COOKIEJAR || \
417 (option) == CURLOPT_COOKIELIST || \
418 (option) == CURLOPT_CRLFILE || \
419 (option) == CURLOPT_CUSTOMREQUEST || \
420 (option) == CURLOPT_DEFAULT_PROTOCOL || \
421 (option) == CURLOPT_DNS_INTERFACE || \
422 (option) == CURLOPT_DNS_LOCAL_IP4 || \
423 (option) == CURLOPT_DNS_LOCAL_IP6 || \
424 (option) == CURLOPT_DNS_SERVERS || \
425 (option) == CURLOPT_DOH_URL || \
426 (option) == CURLOPT_ECH || \
427 (option) == CURLOPT_EGDSOCKET || \
428 (option) == CURLOPT_FTP_ACCOUNT || \
429 (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
430 (option) == CURLOPT_FTPPORT || \
431 (option) == CURLOPT_HAPROXY_CLIENT_IP || \
432 (option) == CURLOPT_HSTS || \
433 (option) == CURLOPT_INTERFACE || \
434 (option) == CURLOPT_ISSUERCERT || \
435 (option) == CURLOPT_KEYPASSWD || \
436 (option) == CURLOPT_KRBLEVEL || \
437 (option) == CURLOPT_LOGIN_OPTIONS || \
438 (option) == CURLOPT_MAIL_AUTH || \
439 (option) == CURLOPT_MAIL_FROM || \
440 (option) == CURLOPT_NETRC_FILE || \
441 (option) == CURLOPT_NOPROXY || \
442 (option) == CURLOPT_PASSWORD || \
443 (option) == CURLOPT_PINNEDPUBLICKEY || \
444 (option) == CURLOPT_PRE_PROXY || \
445 (option) == CURLOPT_PROTOCOLS_STR || \
446 (option) == CURLOPT_PROXY || \
447 (option) == CURLOPT_PROXY_CAINFO || \
448 (option) == CURLOPT_PROXY_CAPATH || \
449 (option) == CURLOPT_PROXY_CRLFILE || \
450 (option) == CURLOPT_PROXY_ISSUERCERT || \
451 (option) == CURLOPT_PROXY_KEYPASSWD || \
452 (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
453 (option) == CURLOPT_PROXY_SERVICE_NAME || \
454 (option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
455 (option) == CURLOPT_PROXY_SSLCERT || \
456 (option) == CURLOPT_PROXY_SSLCERTTYPE || \
457 (option) == CURLOPT_PROXY_SSLKEY || \
458 (option) == CURLOPT_PROXY_SSLKEYTYPE || \
459 (option) == CURLOPT_PROXY_TLS13_CIPHERS || \
460 (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
461 (option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
462 (option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
463 (option) == CURLOPT_PROXYPASSWORD || \
464 (option) == CURLOPT_PROXYUSERNAME || \
465 (option) == CURLOPT_PROXYUSERPWD || \
466 (option) == CURLOPT_RANDOM_FILE || \
467 (option) == CURLOPT_RANGE || \
468 (option) == CURLOPT_REDIR_PROTOCOLS_STR || \
469 (option) == CURLOPT_REFERER || \
470 (option) == CURLOPT_REQUEST_TARGET || \
471 (option) == CURLOPT_RTSP_SESSION_ID || \
472 (option) == CURLOPT_RTSP_STREAM_URI || \
473 (option) == CURLOPT_RTSP_TRANSPORT || \
474 (option) == CURLOPT_SASL_AUTHZID || \
475 (option) == CURLOPT_SERVICE_NAME || \
476 (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
477 (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
478 (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 || \
479 (option) == CURLOPT_SSH_KNOWNHOSTS || \
480 (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
481 (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
482 (option) == CURLOPT_SSLCERT || \
483 (option) == CURLOPT_SSLCERTTYPE || \
484 (option) == CURLOPT_SSLENGINE || \
485 (option) == CURLOPT_SSLKEY || \
486 (option) == CURLOPT_SSLKEYTYPE || \
487 (option) == CURLOPT_SSL_CIPHER_LIST || \
488 (option) == CURLOPT_SSL_EC_CURVES || \
489 (option) == CURLOPT_SSL_SIGNATURE_ALGORITHMS || \
490 (option) == CURLOPT_TLS13_CIPHERS || \
491 (option) == CURLOPT_TLSAUTH_PASSWORD || \
492 (option) == CURLOPT_TLSAUTH_TYPE || \
493 (option) == CURLOPT_TLSAUTH_USERNAME || \
494 (option) == CURLOPT_UNIX_SOCKET_PATH || \
495 (option) == CURLOPT_URL || \
496 (option) == CURLOPT_USERAGENT || \
497 (option) == CURLOPT_USERNAME || \
498 (option) == CURLOPT_AWS_SIGV4 || \
499 (option) == CURLOPT_HTTPSIG_HEADERS || \
500 (option) == CURLOPT_HTTPSIG_KEY || \
501 (option) == CURLOPT_HTTPSIG_KEYID || \
502 (option) == CURLOPT_USERPWD || \
503 (option) == CURLOPT_XOAUTH2_BEARER || \
504 0)
506/* evaluates to true if option takes a curl_write_callback argument */
507#define curlcheck_write_cb_option(option) \
508 ((option) == CURLOPT_HEADERFUNCTION || \
509 (option) == CURLOPT_WRITEFUNCTION)
511/* evaluates to true if option takes a curl_conv_callback argument */
512#define curlcheck_conv_cb_option(option) \
513 ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
514 (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
515 (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
517/* evaluates to true if option takes a data argument to pass to a callback */
518#define curlcheck_cb_data_option(option) \
519 ((option) == CURLOPT_CHUNK_DATA || \
520 (option) == CURLOPT_CLOSESOCKETDATA || \
521 (option) == CURLOPT_DEBUGDATA || \
522 (option) == CURLOPT_FNMATCH_DATA || \
523 (option) == CURLOPT_HEADERDATA || \
524 (option) == CURLOPT_HSTSREADDATA || \
525 (option) == CURLOPT_HSTSWRITEDATA || \
526 (option) == CURLOPT_INTERLEAVEDATA || \
527 (option) == CURLOPT_IOCTLDATA || \
528 (option) == CURLOPT_OPENSOCKETDATA || \
529 (option) == CURLOPT_PREREQDATA || \
530 (option) == CURLOPT_XFERINFODATA || \
531 (option) == CURLOPT_READDATA || \
532 (option) == CURLOPT_SEEKDATA || \
533 (option) == CURLOPT_SOCKOPTDATA || \
534 (option) == CURLOPT_SSH_KEYDATA || \
535 (option) == CURLOPT_SSL_CTX_DATA || \
536 (option) == CURLOPT_WRITEDATA || \
537 (option) == CURLOPT_RESOLVER_START_DATA || \
538 (option) == CURLOPT_TRAILERDATA || \
539 (option) == CURLOPT_SSH_HOSTKEYDATA || \
540 0)
542/* evaluates to true if option takes a POST data argument (void* or char*) */
543#define curlcheck_postfields_option(option) \
544 ((option) == CURLOPT_POSTFIELDS || \
545 (option) == CURLOPT_COPYPOSTFIELDS || \
546 0)
548/* evaluates to true if option takes a struct curl_slist * argument */
549#define curlcheck_slist_option(option) \
550 ((option) == CURLOPT_HTTP200ALIASES || \
551 (option) == CURLOPT_HTTPHEADER || \
552 (option) == CURLOPT_MAIL_RCPT || \
553 (option) == CURLOPT_POSTQUOTE || \
554 (option) == CURLOPT_PREQUOTE || \
555 (option) == CURLOPT_PROXYHEADER || \
556 (option) == CURLOPT_QUOTE || \
557 (option) == CURLOPT_RESOLVE || \
558 (option) == CURLOPT_TELNETOPTIONS || \
559 (option) == CURLOPT_CONNECT_TO || \
560 0)
562/* groups of curl_easy_getinfo infos that take the same type of argument */
564/* evaluates to true if info expects a pointer to char * argument */
565#define curlcheck_string_info(info) \
566 (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
567 (info) != CURLINFO_PRIVATE)
569/* evaluates to true if info expects a pointer to long argument */
570#define curlcheck_long_info(info) \
571 (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
573/* evaluates to true if info expects a pointer to double argument */
574#define curlcheck_double_info(info) \
575 (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
577/* true if info expects a pointer to struct curl_slist * argument */
578#define curlcheck_slist_info(info) \
579 (((info) == CURLINFO_SSL_ENGINES) || \
580 ((info) == CURLINFO_COOKIELIST))
582/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
583#define curlcheck_tlssessioninfo_info(info) \
584 (((info) == CURLINFO_TLS_SSL_PTR) || \
585 ((info) == CURLINFO_TLS_SESSION))
587/* true if info expects a pointer to struct curl_certinfo * argument */
588#define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
590/* true if info expects a pointer to struct curl_socket_t argument */
591#define curlcheck_socket_info(info) \
592 (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
594/* true if info expects a pointer to curl_off_t argument */
595#define curlcheck_off_t_info(info) \
596 (CURLINFO_OFF_T < (info))
598/*
599 * typecheck helpers -- check whether given expression has requested type
600 */
602/* For pointers, you can use the curlcheck_ptr/curlcheck_arr macros,
603 * otherwise define a new macro. Search for __builtin_types_compatible_p
604 * in the GCC manual.
605 * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
606 * the actual expression passed to the curl_easy_setopt macro. This
607 * means that you can only apply the sizeof and __typeof__ operators, no
608 * == or whatsoever.
609 */
611/* XXX: should evaluate to true if expr is a pointer or a char[] array */
612#define curlcheck_any_ptr(expr) \
613 (sizeof(expr) == sizeof(void *) || \
614 __builtin_types_compatible_p(__typeof__(expr), char[]))
616/* evaluates to true if expr is NULL */
617/* XXX: must not evaluate expr, so this check is not accurate */
618#define curlcheck_NULL(expr) \
619 (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
621/* evaluates to true if expr is type*, const type* or NULL */
622#define curlcheck_ptr(expr, type) \
623 (curlcheck_NULL(expr) || \
624 __builtin_types_compatible_p(__typeof__(expr), type *) || \
625 __builtin_types_compatible_p(__typeof__(expr), const type *))
627/* evaluates to true if expr is type**, const type** or NULL */
628#define curlcheck_ptrptr(expr, type) \
629 (curlcheck_NULL(expr) || \
630 __builtin_types_compatible_p(__typeof__(expr), type **) || \
631 __builtin_types_compatible_p(__typeof__(expr), type *[]) || \
632 __builtin_types_compatible_p(__typeof__(expr), const type *[]) || \
633 __builtin_types_compatible_p(__typeof__(expr), const type **))
635/* evaluates to true if expr is one of type[], type*, NULL or const type* */
636#define curlcheck_arr(expr, type) \
637 (curlcheck_ptr((expr), type) || \
638 __builtin_types_compatible_p(__typeof__(expr), type []))
640/* evaluates to true if expr is a string */
641#define curlcheck_string(expr) \
642 (curlcheck_arr((expr), char) || \
643 curlcheck_arr((expr), signed char) || \
644 curlcheck_arr((expr), unsigned char))
646/* evaluates to true if expr is a CURL * */
647#define curlcheck_curl(expr) \
648 (curlcheck_NULL(expr) || \
649 __builtin_types_compatible_p(__typeof__(expr), CURL *))
651/* evaluates to true if expr is a long (no matter the signedness)
652 * XXX: for now, int is also accepted (and therefore short and char, which
653 * are promoted to int when passed to a variadic function) */
654#define curlcheck_long(expr) \
655 ( \
656 ((sizeof(long) != sizeof(int)) && \
657 (__builtin_types_compatible_p(__typeof__(expr), long) || \
658 __builtin_types_compatible_p(__typeof__(expr), signed long) || \
659 __builtin_types_compatible_p(__typeof__(expr), unsigned long))) \
660 || \
661 ((sizeof(long) == sizeof(int)) && \
662 (__builtin_types_compatible_p(__typeof__(expr), long) || \
663 __builtin_types_compatible_p(__typeof__(expr), signed long) || \
664 __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
665 __builtin_types_compatible_p(__typeof__(expr), int) || \
666 __builtin_types_compatible_p(__typeof__(expr), signed int) || \
667 __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
668 __builtin_types_compatible_p(__typeof__(expr), short) || \
669 __builtin_types_compatible_p(__typeof__(expr), signed short) || \
670 __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
671 __builtin_types_compatible_p(__typeof__(expr), char) || \
672 __builtin_types_compatible_p(__typeof__(expr), signed char) || \
673 __builtin_types_compatible_p(__typeof__(expr), unsigned char))) \
674 )
676/* evaluates to true if expr is of type curl_off_t */
677#define curlcheck_off_t(expr) \
678 (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
680/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
681/* XXX: also check size of a char[] array? */
682#define curlcheck_error_buffer(expr) \
683 (curlcheck_NULL(expr) || \
684 __builtin_types_compatible_p(__typeof__(expr), char *) || \
685 __builtin_types_compatible_p(__typeof__(expr), char[]))
687/* evaluates to true if expr is of type (const) void* or (const) FILE* */
688#if 0
689#define curlcheck_cb_data(expr) \
690 (curlcheck_ptr((expr), void) || \
691 curlcheck_ptr((expr), FILE))
692#else /* be less strict */
693#define curlcheck_cb_data(expr) \
694 curlcheck_any_ptr(expr)
695#endif
697/* evaluates to true if expr is of type FILE* */
698#define curlcheck_FILE(expr) \
699 (curlcheck_NULL(expr) || \
700 (__builtin_types_compatible_p(__typeof__(expr), FILE *)))
702/* evaluates to true if expr can be passed as POST data (void* or char*) */
703#define curlcheck_postfields(expr) \
704 (curlcheck_ptr((expr), void) || \
705 curlcheck_arr((expr), char) || \
706 curlcheck_arr((expr), unsigned char))
708/* helper: __builtin_types_compatible_p distinguishes between functions and
709 * function pointers, hide it */
710#define curlcheck_cb_compatible(func, type) \
711 (__builtin_types_compatible_p(__typeof__(func), type) || \
712 __builtin_types_compatible_p(__typeof__(func) *, type))
714/* evaluates to true if expr is of type curl_resolver_start_callback */
715#define curlcheck_resolver_start_callback(expr) \
716 (curlcheck_NULL(expr) || \
717 curlcheck_cb_compatible((expr), curl_resolver_start_callback))
719/* evaluates to true if expr is of type curl_read_callback or "similar" */
720#define curlcheck_read_cb(expr) \
721 (curlcheck_NULL(expr) || \
722 curlcheck_cb_compatible((expr), __typeof__(fread) *) || \
723 curlcheck_cb_compatible((expr), curl_read_callback) || \
724 curlcheck_cb_compatible((expr), Wcurl_read_callback1) || \
725 curlcheck_cb_compatible((expr), Wcurl_read_callback2) || \
726 curlcheck_cb_compatible((expr), Wcurl_read_callback3) || \
727 curlcheck_cb_compatible((expr), Wcurl_read_callback4) || \
728 curlcheck_cb_compatible((expr), Wcurl_read_callback5) || \
729 curlcheck_cb_compatible((expr), Wcurl_read_callback6))
730typedef size_t (*Wcurl_read_callback1)(char *, size_t, size_t, void *);
731typedef size_t (*Wcurl_read_callback2)(char *, size_t, size_t, const void *);
732typedef size_t (*Wcurl_read_callback3)(char *, size_t, size_t, FILE *);
733typedef size_t (*Wcurl_read_callback4)(void *, size_t, size_t, void *);
734typedef size_t (*Wcurl_read_callback5)(void *, size_t, size_t, const void *);
735typedef size_t (*Wcurl_read_callback6)(void *, size_t, size_t, FILE *);
737/* evaluates to true if expr is of type curl_write_callback or "similar" */
738#define curlcheck_write_cb(expr) \
739 (curlcheck_read_cb(expr) || \
740 curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \
741 curlcheck_cb_compatible((expr), curl_write_callback) || \
742 curlcheck_cb_compatible((expr), Wcurl_write_callback1) || \
743 curlcheck_cb_compatible((expr), Wcurl_write_callback2) || \
744 curlcheck_cb_compatible((expr), Wcurl_write_callback3) || \
745 curlcheck_cb_compatible((expr), Wcurl_write_callback4) || \
746 curlcheck_cb_compatible((expr), Wcurl_write_callback5) || \
747 curlcheck_cb_compatible((expr), Wcurl_write_callback6))
748typedef size_t (*Wcurl_write_callback1)(const char *, size_t, size_t, void *);
749typedef size_t (*Wcurl_write_callback2)(const char *, size_t, size_t,
750 const void *);
751typedef size_t (*Wcurl_write_callback3)(const char *, size_t, size_t, FILE *);
752typedef size_t (*Wcurl_write_callback4)(const void *, size_t, size_t, void *);
753typedef size_t (*Wcurl_write_callback5)(const void *, size_t, size_t,
754 const void *);
755typedef size_t (*Wcurl_write_callback6)(const void *, size_t, size_t, FILE *);
757/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
758#define curlcheck_ioctl_cb(expr) \
759 (curlcheck_NULL(expr) || \
760 curlcheck_cb_compatible((expr), curl_ioctl_callback) || \
761 curlcheck_cb_compatible((expr), Wcurl_ioctl_callback1) || \
762 curlcheck_cb_compatible((expr), Wcurl_ioctl_callback2) || \
763 curlcheck_cb_compatible((expr), Wcurl_ioctl_callback3) || \
764 curlcheck_cb_compatible((expr), Wcurl_ioctl_callback4))
765typedef curlioerr (*Wcurl_ioctl_callback1)(CURL *, int, void *);
766typedef curlioerr (*Wcurl_ioctl_callback2)(CURL *, int, const void *);
767typedef curlioerr (*Wcurl_ioctl_callback3)(CURL *, curliocmd, void *);
768typedef curlioerr (*Wcurl_ioctl_callback4)(CURL *, curliocmd, const void *);
770/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
771#define curlcheck_sockopt_cb(expr) \
772 (curlcheck_NULL(expr) || \
773 curlcheck_cb_compatible((expr), curl_sockopt_callback) || \
774 curlcheck_cb_compatible((expr), Wcurl_sockopt_callback1) || \
775 curlcheck_cb_compatible((expr), Wcurl_sockopt_callback2))
776typedef int (*Wcurl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
777typedef int (*Wcurl_sockopt_callback2)(const void *, curl_socket_t,
778 curlsocktype);
780/* evaluates to true if expr is of type curl_opensocket_callback or
781 "similar" */
782#define curlcheck_opensocket_cb(expr) \
783 (curlcheck_NULL(expr) || \
784 curlcheck_cb_compatible((expr), curl_opensocket_callback) || \
785 curlcheck_cb_compatible((expr), Wcurl_opensocket_callback1) || \
786 curlcheck_cb_compatible((expr), Wcurl_opensocket_callback2) || \
787 curlcheck_cb_compatible((expr), Wcurl_opensocket_callback3) || \
788 curlcheck_cb_compatible((expr), Wcurl_opensocket_callback4))
789typedef curl_socket_t (*Wcurl_opensocket_callback1)
790 (void *, curlsocktype, struct curl_sockaddr *);
791typedef curl_socket_t (*Wcurl_opensocket_callback2)
792 (void *, curlsocktype, const struct curl_sockaddr *);
793typedef curl_socket_t (*Wcurl_opensocket_callback3)
794 (const void *, curlsocktype, struct curl_sockaddr *);
795typedef curl_socket_t (*Wcurl_opensocket_callback4)
796 (const void *, curlsocktype, const struct curl_sockaddr *);
798/* evaluates to true if expr is of type curl_progress_callback or "similar" */
799#define curlcheck_progress_cb(expr) \
800 (curlcheck_NULL(expr) || \
801 curlcheck_cb_compatible((expr), curl_progress_callback) || \
802 curlcheck_cb_compatible((expr), Wcurl_progress_callback1) || \
803 curlcheck_cb_compatible((expr), Wcurl_progress_callback2))
804typedef int (*Wcurl_progress_callback1)(void *,
805 double, double, double, double);
806typedef int (*Wcurl_progress_callback2)(const void *,
807 double, double, double, double);
809/* evaluates to true if expr is of type curl_xferinfo_callback */
810#define curlcheck_xferinfo_cb(expr) \
811 (curlcheck_NULL(expr) || \
812 curlcheck_cb_compatible((expr), curl_xferinfo_callback))
814/* evaluates to true if expr is of type curl_debug_callback or "similar" */
815#define curlcheck_debug_cb(expr) \
816 (curlcheck_NULL(expr) || \
817 curlcheck_cb_compatible((expr), curl_debug_callback) || \
818 curlcheck_cb_compatible((expr), Wcurl_debug_callback1) || \
819 curlcheck_cb_compatible((expr), Wcurl_debug_callback2) || \
820 curlcheck_cb_compatible((expr), Wcurl_debug_callback3) || \
821 curlcheck_cb_compatible((expr), Wcurl_debug_callback4) || \
822 curlcheck_cb_compatible((expr), Wcurl_debug_callback5) || \
823 curlcheck_cb_compatible((expr), Wcurl_debug_callback6) || \
824 curlcheck_cb_compatible((expr), Wcurl_debug_callback7) || \
825 curlcheck_cb_compatible((expr), Wcurl_debug_callback8))
826typedef int (*Wcurl_debug_callback1)(CURL *,
827 curl_infotype, char *, size_t, void *);
828typedef int (*Wcurl_debug_callback2)(CURL *,
829 curl_infotype, char *, size_t, const void *);
830typedef int (*Wcurl_debug_callback3)(CURL *,
831 curl_infotype, const char *, size_t, void *);
832typedef int (*Wcurl_debug_callback4)(CURL *,
833 curl_infotype, const char *, size_t, const void *);
834typedef int (*Wcurl_debug_callback5)(CURL *,
835 curl_infotype, unsigned char *, size_t, void *);
836typedef int (*Wcurl_debug_callback6)(CURL *,
837 curl_infotype, unsigned char *, size_t, const void *);
838typedef int (*Wcurl_debug_callback7)(CURL *,
839 curl_infotype, const unsigned char *, size_t, void *);
840typedef int (*Wcurl_debug_callback8)(CURL *,
841 curl_infotype, const unsigned char *, size_t, const void *);
843/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
844/* this is getting even messier... */
845#define curlcheck_ssl_ctx_cb(expr) \
846 (curlcheck_NULL(expr) || \
847 curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \
848 curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback1) || \
849 curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback2) || \
850 curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback3) || \
851 curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback4) || \
852 curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback5) || \
853 curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback6) || \
854 curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback7) || \
855 curlcheck_cb_compatible((expr), Wcurl_ssl_ctx_callback8))
856typedef CURLcode (*Wcurl_ssl_ctx_callback1)(CURL *, void *, void *);
857typedef CURLcode (*Wcurl_ssl_ctx_callback2)(CURL *, void *, const void *);
858typedef CURLcode (*Wcurl_ssl_ctx_callback3)(CURL *, const void *, void *);
859typedef CURLcode (*Wcurl_ssl_ctx_callback4)(CURL *, const void *,
860 const void *);
861#ifdef HEADER_SSL_H
862/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
863 * this of course breaks if we are included before OpenSSL headers...
864 */
865typedef CURLcode (*Wcurl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *);
866typedef CURLcode (*Wcurl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *);
867typedef CURLcode (*Wcurl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *);
868typedef CURLcode (*Wcurl_ssl_ctx_callback8)(CURL *, const SSL_CTX *,
869 const void *);
870#else
871typedef Wcurl_ssl_ctx_callback1 Wcurl_ssl_ctx_callback5;
872typedef Wcurl_ssl_ctx_callback1 Wcurl_ssl_ctx_callback6;
873typedef Wcurl_ssl_ctx_callback1 Wcurl_ssl_ctx_callback7;
874typedef Wcurl_ssl_ctx_callback1 Wcurl_ssl_ctx_callback8;
875#endif
877/* evaluates to true if expr is of type curl_conv_callback or "similar" */
878#define curlcheck_conv_cb(expr) \
879 (curlcheck_NULL(expr) || \
880 curlcheck_cb_compatible((expr), curl_conv_callback) || \
881 curlcheck_cb_compatible((expr), Wcurl_conv_callback1) || \
882 curlcheck_cb_compatible((expr), Wcurl_conv_callback2) || \
883 curlcheck_cb_compatible((expr), Wcurl_conv_callback3) || \
884 curlcheck_cb_compatible((expr), Wcurl_conv_callback4))
885typedef CURLcode (*Wcurl_conv_callback1)(char *, size_t length);
886typedef CURLcode (*Wcurl_conv_callback2)(const char *, size_t length);
887typedef CURLcode (*Wcurl_conv_callback3)(void *, size_t length);
888typedef CURLcode (*Wcurl_conv_callback4)(const void *, size_t length);
890/* evaluates to true if expr is of type curl_seek_callback or "similar" */
891#define curlcheck_seek_cb(expr) \
892 (curlcheck_NULL(expr) || \
893 curlcheck_cb_compatible((expr), curl_seek_callback) || \
894 curlcheck_cb_compatible((expr), Wcurl_seek_callback1) || \
895 curlcheck_cb_compatible((expr), Wcurl_seek_callback2))
896typedef CURLcode (*Wcurl_seek_callback1)(void *, curl_off_t, int);
897typedef CURLcode (*Wcurl_seek_callback2)(const void *, curl_off_t, int);
899/* evaluates to true if expr is of type curl_chunk_bgn_callback */
900#define curlcheck_chunk_bgn_cb(expr) \
901 (curlcheck_NULL(expr) || \
902 curlcheck_cb_compatible((expr), curl_chunk_bgn_callback) || \
903 curlcheck_cb_compatible((expr), Wcurl_chunk_bgn_callback1) || \
904 curlcheck_cb_compatible((expr), Wcurl_chunk_bgn_callback2))
905typedef long (*Wcurl_chunk_bgn_callback1)(struct curl_fileinfo *,
906 void *, int);
907typedef long (*Wcurl_chunk_bgn_callback2)(void *, void *, int);
909/* evaluates to true if expr is of type curl_chunk_end_callback */
910#define curlcheck_chunk_end_cb(expr) \
911 (curlcheck_NULL(expr) || \
912 curlcheck_cb_compatible((expr), curl_chunk_end_callback))
914/* evaluates to true if expr is of type curl_closesocket_callback */
915#define curlcheck_close_socket_cb(expr) \
916 (curlcheck_NULL(expr) || \
917 curlcheck_cb_compatible((expr), curl_closesocket_callback))
919/* evaluates to true if expr is of type curl_fnmatch_callback */
920#define curlcheck_fnmatch_cb(expr) \
921 (curlcheck_NULL(expr) || \
922 curlcheck_cb_compatible((expr), curl_fnmatch_callback))
924/* evaluates to true if expr is of type curl_hstsread_callback */
925#define curlcheck_hstsread_cb(expr) \
926 (curlcheck_NULL(expr) || \
927 curlcheck_cb_compatible((expr), curl_hstsread_callback))
929/* evaluates to true if expr is of type curl_hstswrite_callback */
930#define curlcheck_hstswrite_cb(expr) \
931 (curlcheck_NULL(expr) || \
932 curlcheck_cb_compatible((expr), curl_hstswrite_callback))
934/* evaluates to true if expr is of type curl_sshhostkeycallback */
935#define curlcheck_ssh_hostkey_cb(expr) \
936 (curlcheck_NULL(expr) || \
937 curlcheck_cb_compatible((expr), curl_sshhostkeycallback))
939/* evaluates to true if expr is of type curl_sshkeycallback */
940#define curlcheck_ssh_key_cb(expr) \
941 (curlcheck_NULL(expr) || \
942 curlcheck_cb_compatible((expr), curl_sshkeycallback))
944/* evaluates to true if expr is of type curl_interleave_callback */
945#define curlcheck_interleave_cb(expr) \
946 (curlcheck_NULL(expr) || \
947 curlcheck_cb_compatible((expr), Wcurl_interleave_callback1) || \
948 curlcheck_cb_compatible((expr), Wcurl_interleave_callback2))
949typedef size_t (*Wcurl_interleave_callback1)(void *p, size_t s,
950 size_t n, void *u);
951typedef size_t (*Wcurl_interleave_callback2)(char *p, size_t s,
952 size_t n, void *u);
954/* evaluates to true if expr is of type curl_prereq_callback */
955#define curlcheck_prereq_cb(expr) \
956 (curlcheck_NULL(expr) || \
957 curlcheck_cb_compatible((expr), curl_prereq_callback))
959/* evaluates to true if expr is of type curl_trailer_callback */
960#define curlcheck_trailer_cb(expr) \
961 (curlcheck_NULL(expr) || \
962 curlcheck_cb_compatible((expr), curl_trailer_callback))
964#endif /* CURLINC_TYPECHECK_GCC_H */
Diagnostics4 git calls · 24 ms
CallStatusSizeTime024 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=20 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2008.4 KiB · hit20 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=8590 git.response.cache=HIT git.response.duration_ms=20 git.fetch.wants=f2e4542772c534ee8c8bef0d57547d142eb536c7 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=8590 git.pkt.payload.max=8569 git.sideband.band1.bytes=8568 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e2ff924bcaf3c9
- Request
- 71ef172f…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format