Edouard@340
|
1 |
#ifndef __CURL_TYPECHECK_GCC_H
|
Edouard@340
|
2 |
#define __CURL_TYPECHECK_GCC_H
|
Edouard@340
|
3 |
/***************************************************************************
|
Edouard@340
|
4 |
* _ _ ____ _
|
Edouard@340
|
5 |
* Project ___| | | | _ \| |
|
Edouard@340
|
6 |
* / __| | | | |_) | |
|
Edouard@340
|
7 |
* | (__| |_| | _ <| |___
|
Edouard@340
|
8 |
* \___|\___/|_| \_\_____|
|
Edouard@340
|
9 |
*
|
Edouard@340
|
10 |
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
Edouard@340
|
11 |
*
|
Edouard@340
|
12 |
* This software is licensed as described in the file COPYING, which
|
Edouard@340
|
13 |
* you should have received as part of this distribution. The terms
|
Edouard@340
|
14 |
* are also available at http://curl.haxx.se/docs/copyright.html.
|
Edouard@340
|
15 |
*
|
Edouard@340
|
16 |
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
Edouard@340
|
17 |
* copies of the Software, and permit persons to whom the Software is
|
Edouard@340
|
18 |
* furnished to do so, under the terms of the COPYING file.
|
Edouard@340
|
19 |
*
|
Edouard@340
|
20 |
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
Edouard@340
|
21 |
* KIND, either express or implied.
|
Edouard@340
|
22 |
*
|
Edouard@340
|
23 |
***************************************************************************/
|
Edouard@340
|
24 |
|
Edouard@340
|
25 |
/* wraps curl_easy_setopt() with typechecking */
|
Edouard@340
|
26 |
|
Edouard@340
|
27 |
/* To add a new kind of warning, add an
|
Edouard@340
|
28 |
* if(_curl_is_sometype_option(_curl_opt))
|
Edouard@340
|
29 |
* if(!_curl_is_sometype(value))
|
Edouard@340
|
30 |
* _curl_easy_setopt_err_sometype();
|
Edouard@340
|
31 |
* block and define _curl_is_sometype_option, _curl_is_sometype and
|
Edouard@340
|
32 |
* _curl_easy_setopt_err_sometype below
|
Edouard@340
|
33 |
*
|
Edouard@340
|
34 |
* NOTE: We use two nested 'if' statements here instead of the && operator, in
|
Edouard@340
|
35 |
* order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
|
Edouard@340
|
36 |
* when compiling with -Wlogical-op.
|
Edouard@340
|
37 |
*
|
Edouard@340
|
38 |
* To add an option that uses the same type as an existing option, you'll just
|
Edouard@340
|
39 |
* need to extend the appropriate _curl_*_option macro
|
Edouard@340
|
40 |
*/
|
Edouard@340
|
41 |
#define curl_easy_setopt(handle, option, value) \
|
Edouard@340
|
42 |
__extension__ ({ \
|
Edouard@340
|
43 |
__typeof__ (option) _curl_opt = option; \
|
Edouard@340
|
44 |
if(__builtin_constant_p(_curl_opt)) { \
|
Edouard@340
|
45 |
if(_curl_is_long_option(_curl_opt)) \
|
Edouard@340
|
46 |
if(!_curl_is_long(value)) \
|
Edouard@340
|
47 |
_curl_easy_setopt_err_long(); \
|
Edouard@340
|
48 |
if(_curl_is_off_t_option(_curl_opt)) \
|
Edouard@340
|
49 |
if(!_curl_is_off_t(value)) \
|
Edouard@340
|
50 |
_curl_easy_setopt_err_curl_off_t(); \
|
Edouard@340
|
51 |
if(_curl_is_string_option(_curl_opt)) \
|
Edouard@340
|
52 |
if(!_curl_is_string(value)) \
|
Edouard@340
|
53 |
_curl_easy_setopt_err_string(); \
|
Edouard@340
|
54 |
if(_curl_is_write_cb_option(_curl_opt)) \
|
Edouard@340
|
55 |
if(!_curl_is_write_cb(value)) \
|
Edouard@340
|
56 |
_curl_easy_setopt_err_write_callback(); \
|
Edouard@340
|
57 |
if((_curl_opt) == CURLOPT_READFUNCTION) \
|
Edouard@340
|
58 |
if(!_curl_is_read_cb(value)) \
|
Edouard@340
|
59 |
_curl_easy_setopt_err_read_cb(); \
|
Edouard@340
|
60 |
if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
|
Edouard@340
|
61 |
if(!_curl_is_ioctl_cb(value)) \
|
Edouard@340
|
62 |
_curl_easy_setopt_err_ioctl_cb(); \
|
Edouard@340
|
63 |
if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
|
Edouard@340
|
64 |
if(!_curl_is_sockopt_cb(value)) \
|
Edouard@340
|
65 |
_curl_easy_setopt_err_sockopt_cb(); \
|
Edouard@340
|
66 |
if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
|
Edouard@340
|
67 |
if(!_curl_is_opensocket_cb(value)) \
|
Edouard@340
|
68 |
_curl_easy_setopt_err_opensocket_cb(); \
|
Edouard@340
|
69 |
if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
|
Edouard@340
|
70 |
if(!_curl_is_progress_cb(value)) \
|
Edouard@340
|
71 |
_curl_easy_setopt_err_progress_cb(); \
|
Edouard@340
|
72 |
if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
|
Edouard@340
|
73 |
if(!_curl_is_debug_cb(value)) \
|
Edouard@340
|
74 |
_curl_easy_setopt_err_debug_cb(); \
|
Edouard@340
|
75 |
if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
|
Edouard@340
|
76 |
if(!_curl_is_ssl_ctx_cb(value)) \
|
Edouard@340
|
77 |
_curl_easy_setopt_err_ssl_ctx_cb(); \
|
Edouard@340
|
78 |
if(_curl_is_conv_cb_option(_curl_opt)) \
|
Edouard@340
|
79 |
if(!_curl_is_conv_cb(value)) \
|
Edouard@340
|
80 |
_curl_easy_setopt_err_conv_cb(); \
|
Edouard@340
|
81 |
if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
|
Edouard@340
|
82 |
if(!_curl_is_seek_cb(value)) \
|
Edouard@340
|
83 |
_curl_easy_setopt_err_seek_cb(); \
|
Edouard@340
|
84 |
if(_curl_is_cb_data_option(_curl_opt)) \
|
Edouard@340
|
85 |
if(!_curl_is_cb_data(value)) \
|
Edouard@340
|
86 |
_curl_easy_setopt_err_cb_data(); \
|
Edouard@340
|
87 |
if((_curl_opt) == CURLOPT_ERRORBUFFER) \
|
Edouard@340
|
88 |
if(!_curl_is_error_buffer(value)) \
|
Edouard@340
|
89 |
_curl_easy_setopt_err_error_buffer(); \
|
Edouard@340
|
90 |
if((_curl_opt) == CURLOPT_STDERR) \
|
Edouard@340
|
91 |
if(!_curl_is_FILE(value)) \
|
Edouard@340
|
92 |
_curl_easy_setopt_err_FILE(); \
|
Edouard@340
|
93 |
if(_curl_is_postfields_option(_curl_opt)) \
|
Edouard@340
|
94 |
if(!_curl_is_postfields(value)) \
|
Edouard@340
|
95 |
_curl_easy_setopt_err_postfields(); \
|
Edouard@340
|
96 |
if((_curl_opt) == CURLOPT_HTTPPOST) \
|
Edouard@340
|
97 |
if(!_curl_is_arr((value), struct curl_httppost)) \
|
Edouard@340
|
98 |
_curl_easy_setopt_err_curl_httpost(); \
|
Edouard@340
|
99 |
if(_curl_is_slist_option(_curl_opt)) \
|
Edouard@340
|
100 |
if(!_curl_is_arr((value), struct curl_slist)) \
|
Edouard@340
|
101 |
_curl_easy_setopt_err_curl_slist(); \
|
Edouard@340
|
102 |
if((_curl_opt) == CURLOPT_SHARE) \
|
Edouard@340
|
103 |
if(!_curl_is_ptr((value), CURLSH)) \
|
Edouard@340
|
104 |
_curl_easy_setopt_err_CURLSH(); \
|
Edouard@340
|
105 |
} \
|
Edouard@340
|
106 |
curl_easy_setopt(handle, _curl_opt, value); \
|
Edouard@340
|
107 |
})
|
Edouard@340
|
108 |
|
Edouard@340
|
109 |
/* wraps curl_easy_getinfo() with typechecking */
|
Edouard@340
|
110 |
/* FIXME: don't allow const pointers */
|
Edouard@340
|
111 |
#define curl_easy_getinfo(handle, info, arg) \
|
Edouard@340
|
112 |
__extension__ ({ \
|
Edouard@340
|
113 |
__typeof__ (info) _curl_info = info; \
|
Edouard@340
|
114 |
if(__builtin_constant_p(_curl_info)) { \
|
Edouard@340
|
115 |
if(_curl_is_string_info(_curl_info)) \
|
Edouard@340
|
116 |
if(!_curl_is_arr((arg), char *)) \
|
Edouard@340
|
117 |
_curl_easy_getinfo_err_string(); \
|
Edouard@340
|
118 |
if(_curl_is_long_info(_curl_info)) \
|
Edouard@340
|
119 |
if(!_curl_is_arr((arg), long)) \
|
Edouard@340
|
120 |
_curl_easy_getinfo_err_long(); \
|
Edouard@340
|
121 |
if(_curl_is_double_info(_curl_info)) \
|
Edouard@340
|
122 |
if(!_curl_is_arr((arg), double)) \
|
Edouard@340
|
123 |
_curl_easy_getinfo_err_double(); \
|
Edouard@340
|
124 |
if(_curl_is_slist_info(_curl_info)) \
|
Edouard@340
|
125 |
if(!_curl_is_arr((arg), struct curl_slist *)) \
|
Edouard@340
|
126 |
_curl_easy_getinfo_err_curl_slist(); \
|
Edouard@340
|
127 |
} \
|
Edouard@340
|
128 |
curl_easy_getinfo(handle, _curl_info, arg); \
|
Edouard@340
|
129 |
})
|
Edouard@340
|
130 |
|
Edouard@340
|
131 |
/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
|
Edouard@340
|
132 |
* for now just make sure that the functions are called with three
|
Edouard@340
|
133 |
* arguments
|
Edouard@340
|
134 |
*/
|
Edouard@340
|
135 |
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
|
Edouard@340
|
136 |
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
|
Edouard@340
|
137 |
|
Edouard@340
|
138 |
|
Edouard@340
|
139 |
/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
|
Edouard@340
|
140 |
* functions */
|
Edouard@340
|
141 |
|
Edouard@340
|
142 |
/* To define a new warning, use _CURL_WARNING(identifier, "message") */
|
Edouard@340
|
143 |
#define _CURL_WARNING(id, message) \
|
Edouard@340
|
144 |
static void __attribute__((__warning__(message))) \
|
Edouard@340
|
145 |
__attribute__((__unused__)) __attribute__((__noinline__)) \
|
Edouard@340
|
146 |
id(void) { __asm__(""); }
|
Edouard@340
|
147 |
|
Edouard@340
|
148 |
_CURL_WARNING(_curl_easy_setopt_err_long,
|
Edouard@340
|
149 |
"curl_easy_setopt expects a long argument for this option")
|
Edouard@340
|
150 |
_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
|
Edouard@340
|
151 |
"curl_easy_setopt expects a curl_off_t argument for this option")
|
Edouard@340
|
152 |
_CURL_WARNING(_curl_easy_setopt_err_string,
|
Edouard@340
|
153 |
"curl_easy_setopt expects a "
|
Edouard@340
|
154 |
"string (char* or char[]) argument for this option"
|
Edouard@340
|
155 |
)
|
Edouard@340
|
156 |
_CURL_WARNING(_curl_easy_setopt_err_write_callback,
|
Edouard@340
|
157 |
"curl_easy_setopt expects a curl_write_callback argument for this option")
|
Edouard@340
|
158 |
_CURL_WARNING(_curl_easy_setopt_err_read_cb,
|
Edouard@340
|
159 |
"curl_easy_setopt expects a curl_read_callback argument for this option")
|
Edouard@340
|
160 |
_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
|
Edouard@340
|
161 |
"curl_easy_setopt expects a curl_ioctl_callback argument for this option")
|
Edouard@340
|
162 |
_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
|
Edouard@340
|
163 |
"curl_easy_setopt expects a curl_sockopt_callback argument for this option")
|
Edouard@340
|
164 |
_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
|
Edouard@340
|
165 |
"curl_easy_setopt expects a "
|
Edouard@340
|
166 |
"curl_opensocket_callback argument for this option"
|
Edouard@340
|
167 |
)
|
Edouard@340
|
168 |
_CURL_WARNING(_curl_easy_setopt_err_progress_cb,
|
Edouard@340
|
169 |
"curl_easy_setopt expects a curl_progress_callback argument for this option")
|
Edouard@340
|
170 |
_CURL_WARNING(_curl_easy_setopt_err_debug_cb,
|
Edouard@340
|
171 |
"curl_easy_setopt expects a curl_debug_callback argument for this option")
|
Edouard@340
|
172 |
_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
|
Edouard@340
|
173 |
"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
|
Edouard@340
|
174 |
_CURL_WARNING(_curl_easy_setopt_err_conv_cb,
|
Edouard@340
|
175 |
"curl_easy_setopt expects a curl_conv_callback argument for this option")
|
Edouard@340
|
176 |
_CURL_WARNING(_curl_easy_setopt_err_seek_cb,
|
Edouard@340
|
177 |
"curl_easy_setopt expects a curl_seek_callback argument for this option")
|
Edouard@340
|
178 |
_CURL_WARNING(_curl_easy_setopt_err_cb_data,
|
Edouard@340
|
179 |
"curl_easy_setopt expects a "
|
Edouard@340
|
180 |
"private data pointer as argument for this option")
|
Edouard@340
|
181 |
_CURL_WARNING(_curl_easy_setopt_err_error_buffer,
|
Edouard@340
|
182 |
"curl_easy_setopt expects a "
|
Edouard@340
|
183 |
"char buffer of CURL_ERROR_SIZE as argument for this option")
|
Edouard@340
|
184 |
_CURL_WARNING(_curl_easy_setopt_err_FILE,
|
Edouard@340
|
185 |
"curl_easy_setopt expects a FILE* argument for this option")
|
Edouard@340
|
186 |
_CURL_WARNING(_curl_easy_setopt_err_postfields,
|
Edouard@340
|
187 |
"curl_easy_setopt expects a void* or char* argument for this option")
|
Edouard@340
|
188 |
_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
|
Edouard@340
|
189 |
"curl_easy_setopt expects a struct curl_httppost* argument for this option")
|
Edouard@340
|
190 |
_CURL_WARNING(_curl_easy_setopt_err_curl_slist,
|
Edouard@340
|
191 |
"curl_easy_setopt expects a struct curl_slist* argument for this option")
|
Edouard@340
|
192 |
_CURL_WARNING(_curl_easy_setopt_err_CURLSH,
|
Edouard@340
|
193 |
"curl_easy_setopt expects a CURLSH* argument for this option")
|
Edouard@340
|
194 |
|
Edouard@340
|
195 |
_CURL_WARNING(_curl_easy_getinfo_err_string,
|
Edouard@340
|
196 |
"curl_easy_getinfo expects a pointer to char * for this info")
|
Edouard@340
|
197 |
_CURL_WARNING(_curl_easy_getinfo_err_long,
|
Edouard@340
|
198 |
"curl_easy_getinfo expects a pointer to long for this info")
|
Edouard@340
|
199 |
_CURL_WARNING(_curl_easy_getinfo_err_double,
|
Edouard@340
|
200 |
"curl_easy_getinfo expects a pointer to double for this info")
|
Edouard@340
|
201 |
_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
|
Edouard@340
|
202 |
"curl_easy_getinfo expects a pointer to struct curl_slist * for this info")
|
Edouard@340
|
203 |
|
Edouard@340
|
204 |
/* groups of curl_easy_setops options that take the same type of argument */
|
Edouard@340
|
205 |
|
Edouard@340
|
206 |
/* To add a new option to one of the groups, just add
|
Edouard@340
|
207 |
* (option) == CURLOPT_SOMETHING
|
Edouard@340
|
208 |
* to the or-expression. If the option takes a long or curl_off_t, you don't
|
Edouard@340
|
209 |
* have to do anything
|
Edouard@340
|
210 |
*/
|
Edouard@340
|
211 |
|
Edouard@340
|
212 |
/* evaluates to true if option takes a long argument */
|
Edouard@340
|
213 |
#define _curl_is_long_option(option) \
|
Edouard@340
|
214 |
(0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
|
Edouard@340
|
215 |
|
Edouard@340
|
216 |
#define _curl_is_off_t_option(option) \
|
Edouard@340
|
217 |
((option) > CURLOPTTYPE_OFF_T)
|
Edouard@340
|
218 |
|
Edouard@340
|
219 |
/* evaluates to true if option takes a char* argument */
|
Edouard@340
|
220 |
#define _curl_is_string_option(option) \
|
Edouard@340
|
221 |
((option) == CURLOPT_URL || \
|
Edouard@340
|
222 |
(option) == CURLOPT_PROXY || \
|
Edouard@340
|
223 |
(option) == CURLOPT_INTERFACE || \
|
Edouard@340
|
224 |
(option) == CURLOPT_NETRC_FILE || \
|
Edouard@340
|
225 |
(option) == CURLOPT_USERPWD || \
|
Edouard@340
|
226 |
(option) == CURLOPT_USERNAME || \
|
Edouard@340
|
227 |
(option) == CURLOPT_PASSWORD || \
|
Edouard@340
|
228 |
(option) == CURLOPT_PROXYUSERPWD || \
|
Edouard@340
|
229 |
(option) == CURLOPT_PROXYUSERNAME || \
|
Edouard@340
|
230 |
(option) == CURLOPT_PROXYPASSWORD || \
|
Edouard@340
|
231 |
(option) == CURLOPT_NOPROXY || \
|
Edouard@340
|
232 |
(option) == CURLOPT_ACCEPT_ENCODING || \
|
Edouard@340
|
233 |
(option) == CURLOPT_REFERER || \
|
Edouard@340
|
234 |
(option) == CURLOPT_USERAGENT || \
|
Edouard@340
|
235 |
(option) == CURLOPT_COOKIE || \
|
Edouard@340
|
236 |
(option) == CURLOPT_COOKIEFILE || \
|
Edouard@340
|
237 |
(option) == CURLOPT_COOKIEJAR || \
|
Edouard@340
|
238 |
(option) == CURLOPT_COOKIELIST || \
|
Edouard@340
|
239 |
(option) == CURLOPT_FTPPORT || \
|
Edouard@340
|
240 |
(option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
|
Edouard@340
|
241 |
(option) == CURLOPT_FTP_ACCOUNT || \
|
Edouard@340
|
242 |
(option) == CURLOPT_RANGE || \
|
Edouard@340
|
243 |
(option) == CURLOPT_CUSTOMREQUEST || \
|
Edouard@340
|
244 |
(option) == CURLOPT_SSLCERT || \
|
Edouard@340
|
245 |
(option) == CURLOPT_SSLCERTTYPE || \
|
Edouard@340
|
246 |
(option) == CURLOPT_SSLKEY || \
|
Edouard@340
|
247 |
(option) == CURLOPT_SSLKEYTYPE || \
|
Edouard@340
|
248 |
(option) == CURLOPT_KEYPASSWD || \
|
Edouard@340
|
249 |
(option) == CURLOPT_SSLENGINE || \
|
Edouard@340
|
250 |
(option) == CURLOPT_CAINFO || \
|
Edouard@340
|
251 |
(option) == CURLOPT_CAPATH || \
|
Edouard@340
|
252 |
(option) == CURLOPT_RANDOM_FILE || \
|
Edouard@340
|
253 |
(option) == CURLOPT_EGDSOCKET || \
|
Edouard@340
|
254 |
(option) == CURLOPT_SSL_CIPHER_LIST || \
|
Edouard@340
|
255 |
(option) == CURLOPT_KRBLEVEL || \
|
Edouard@340
|
256 |
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
|
Edouard@340
|
257 |
(option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
|
Edouard@340
|
258 |
(option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
|
Edouard@340
|
259 |
(option) == CURLOPT_CRLFILE || \
|
Edouard@340
|
260 |
(option) == CURLOPT_ISSUERCERT || \
|
Edouard@340
|
261 |
(option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
|
Edouard@340
|
262 |
(option) == CURLOPT_SSH_KNOWNHOSTS || \
|
Edouard@340
|
263 |
(option) == CURLOPT_MAIL_FROM || \
|
Edouard@340
|
264 |
(option) == CURLOPT_RTSP_SESSION_ID || \
|
Edouard@340
|
265 |
(option) == CURLOPT_RTSP_STREAM_URI || \
|
Edouard@340
|
266 |
(option) == CURLOPT_RTSP_TRANSPORT || \
|
Edouard@340
|
267 |
(option) == CURLOPT_XOAUTH2_BEARER || \
|
Edouard@340
|
268 |
(option) == CURLOPT_DNS_SERVERS || \
|
Edouard@340
|
269 |
(option) == CURLOPT_DNS_INTERFACE || \
|
Edouard@340
|
270 |
(option) == CURLOPT_DNS_LOCAL_IP4 || \
|
Edouard@340
|
271 |
(option) == CURLOPT_DNS_LOCAL_IP6 || \
|
Edouard@340
|
272 |
(option) == CURLOPT_LOGIN_OPTIONS || \
|
Edouard@340
|
273 |
(option) == CURLOPT_PROXY_SERVICE_NAME || \
|
Edouard@340
|
274 |
(option) == CURLOPT_SERVICE_NAME || \
|
Edouard@340
|
275 |
0)
|
Edouard@340
|
276 |
|
Edouard@340
|
277 |
/* evaluates to true if option takes a curl_write_callback argument */
|
Edouard@340
|
278 |
#define _curl_is_write_cb_option(option) \
|
Edouard@340
|
279 |
((option) == CURLOPT_HEADERFUNCTION || \
|
Edouard@340
|
280 |
(option) == CURLOPT_WRITEFUNCTION)
|
Edouard@340
|
281 |
|
Edouard@340
|
282 |
/* evaluates to true if option takes a curl_conv_callback argument */
|
Edouard@340
|
283 |
#define _curl_is_conv_cb_option(option) \
|
Edouard@340
|
284 |
((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
|
Edouard@340
|
285 |
(option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
|
Edouard@340
|
286 |
(option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
|
Edouard@340
|
287 |
|
Edouard@340
|
288 |
/* evaluates to true if option takes a data argument to pass to a callback */
|
Edouard@340
|
289 |
#define _curl_is_cb_data_option(option) \
|
Edouard@340
|
290 |
((option) == CURLOPT_WRITEDATA || \
|
Edouard@340
|
291 |
(option) == CURLOPT_READDATA || \
|
Edouard@340
|
292 |
(option) == CURLOPT_IOCTLDATA || \
|
Edouard@340
|
293 |
(option) == CURLOPT_SOCKOPTDATA || \
|
Edouard@340
|
294 |
(option) == CURLOPT_OPENSOCKETDATA || \
|
Edouard@340
|
295 |
(option) == CURLOPT_PROGRESSDATA || \
|
Edouard@340
|
296 |
(option) == CURLOPT_HEADERDATA || \
|
Edouard@340
|
297 |
(option) == CURLOPT_DEBUGDATA || \
|
Edouard@340
|
298 |
(option) == CURLOPT_SSL_CTX_DATA || \
|
Edouard@340
|
299 |
(option) == CURLOPT_SEEKDATA || \
|
Edouard@340
|
300 |
(option) == CURLOPT_PRIVATE || \
|
Edouard@340
|
301 |
(option) == CURLOPT_SSH_KEYDATA || \
|
Edouard@340
|
302 |
(option) == CURLOPT_INTERLEAVEDATA || \
|
Edouard@340
|
303 |
(option) == CURLOPT_CHUNK_DATA || \
|
Edouard@340
|
304 |
(option) == CURLOPT_FNMATCH_DATA || \
|
Edouard@340
|
305 |
0)
|
Edouard@340
|
306 |
|
Edouard@340
|
307 |
/* evaluates to true if option takes a POST data argument (void* or char*) */
|
Edouard@340
|
308 |
#define _curl_is_postfields_option(option) \
|
Edouard@340
|
309 |
((option) == CURLOPT_POSTFIELDS || \
|
Edouard@340
|
310 |
(option) == CURLOPT_COPYPOSTFIELDS || \
|
Edouard@340
|
311 |
0)
|
Edouard@340
|
312 |
|
Edouard@340
|
313 |
/* evaluates to true if option takes a struct curl_slist * argument */
|
Edouard@340
|
314 |
#define _curl_is_slist_option(option) \
|
Edouard@340
|
315 |
((option) == CURLOPT_HTTPHEADER || \
|
Edouard@340
|
316 |
(option) == CURLOPT_HTTP200ALIASES || \
|
Edouard@340
|
317 |
(option) == CURLOPT_QUOTE || \
|
Edouard@340
|
318 |
(option) == CURLOPT_POSTQUOTE || \
|
Edouard@340
|
319 |
(option) == CURLOPT_PREQUOTE || \
|
Edouard@340
|
320 |
(option) == CURLOPT_TELNETOPTIONS || \
|
Edouard@340
|
321 |
(option) == CURLOPT_MAIL_RCPT || \
|
Edouard@340
|
322 |
0)
|
Edouard@340
|
323 |
|
Edouard@340
|
324 |
/* groups of curl_easy_getinfo infos that take the same type of argument */
|
Edouard@340
|
325 |
|
Edouard@340
|
326 |
/* evaluates to true if info expects a pointer to char * argument */
|
Edouard@340
|
327 |
#define _curl_is_string_info(info) \
|
Edouard@340
|
328 |
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
|
Edouard@340
|
329 |
|
Edouard@340
|
330 |
/* evaluates to true if info expects a pointer to long argument */
|
Edouard@340
|
331 |
#define _curl_is_long_info(info) \
|
Edouard@340
|
332 |
(CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
|
Edouard@340
|
333 |
|
Edouard@340
|
334 |
/* evaluates to true if info expects a pointer to double argument */
|
Edouard@340
|
335 |
#define _curl_is_double_info(info) \
|
Edouard@340
|
336 |
(CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
|
Edouard@340
|
337 |
|
Edouard@340
|
338 |
/* true if info expects a pointer to struct curl_slist * argument */
|
Edouard@340
|
339 |
#define _curl_is_slist_info(info) \
|
Edouard@340
|
340 |
(CURLINFO_SLIST < (info))
|
Edouard@340
|
341 |
|
Edouard@340
|
342 |
|
Edouard@340
|
343 |
/* typecheck helpers -- check whether given expression has requested type*/
|
Edouard@340
|
344 |
|
Edouard@340
|
345 |
/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
|
Edouard@340
|
346 |
* otherwise define a new macro. Search for __builtin_types_compatible_p
|
Edouard@340
|
347 |
* in the GCC manual.
|
Edouard@340
|
348 |
* NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
|
Edouard@340
|
349 |
* the actual expression passed to the curl_easy_setopt macro. This
|
Edouard@340
|
350 |
* means that you can only apply the sizeof and __typeof__ operators, no
|
Edouard@340
|
351 |
* == or whatsoever.
|
Edouard@340
|
352 |
*/
|
Edouard@340
|
353 |
|
Edouard@340
|
354 |
/* XXX: should evaluate to true iff expr is a pointer */
|
Edouard@340
|
355 |
#define _curl_is_any_ptr(expr) \
|
Edouard@340
|
356 |
(sizeof(expr) == sizeof(void*))
|
Edouard@340
|
357 |
|
Edouard@340
|
358 |
/* evaluates to true if expr is NULL */
|
Edouard@340
|
359 |
/* XXX: must not evaluate expr, so this check is not accurate */
|
Edouard@340
|
360 |
#define _curl_is_NULL(expr) \
|
Edouard@340
|
361 |
(__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
|
Edouard@340
|
362 |
|
Edouard@340
|
363 |
/* evaluates to true if expr is type*, const type* or NULL */
|
Edouard@340
|
364 |
#define _curl_is_ptr(expr, type) \
|
Edouard@340
|
365 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
366 |
__builtin_types_compatible_p(__typeof__(expr), type *) || \
|
Edouard@340
|
367 |
__builtin_types_compatible_p(__typeof__(expr), const type *))
|
Edouard@340
|
368 |
|
Edouard@340
|
369 |
/* evaluates to true if expr is one of type[], type*, NULL or const type* */
|
Edouard@340
|
370 |
#define _curl_is_arr(expr, type) \
|
Edouard@340
|
371 |
(_curl_is_ptr((expr), type) || \
|
Edouard@340
|
372 |
__builtin_types_compatible_p(__typeof__(expr), type []))
|
Edouard@340
|
373 |
|
Edouard@340
|
374 |
/* evaluates to true if expr is a string */
|
Edouard@340
|
375 |
#define _curl_is_string(expr) \
|
Edouard@340
|
376 |
(_curl_is_arr((expr), char) || \
|
Edouard@340
|
377 |
_curl_is_arr((expr), signed char) || \
|
Edouard@340
|
378 |
_curl_is_arr((expr), unsigned char))
|
Edouard@340
|
379 |
|
Edouard@340
|
380 |
/* evaluates to true if expr is a long (no matter the signedness)
|
Edouard@340
|
381 |
* XXX: for now, int is also accepted (and therefore short and char, which
|
Edouard@340
|
382 |
* are promoted to int when passed to a variadic function) */
|
Edouard@340
|
383 |
#define _curl_is_long(expr) \
|
Edouard@340
|
384 |
(__builtin_types_compatible_p(__typeof__(expr), long) || \
|
Edouard@340
|
385 |
__builtin_types_compatible_p(__typeof__(expr), signed long) || \
|
Edouard@340
|
386 |
__builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
|
Edouard@340
|
387 |
__builtin_types_compatible_p(__typeof__(expr), int) || \
|
Edouard@340
|
388 |
__builtin_types_compatible_p(__typeof__(expr), signed int) || \
|
Edouard@340
|
389 |
__builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
|
Edouard@340
|
390 |
__builtin_types_compatible_p(__typeof__(expr), short) || \
|
Edouard@340
|
391 |
__builtin_types_compatible_p(__typeof__(expr), signed short) || \
|
Edouard@340
|
392 |
__builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
|
Edouard@340
|
393 |
__builtin_types_compatible_p(__typeof__(expr), char) || \
|
Edouard@340
|
394 |
__builtin_types_compatible_p(__typeof__(expr), signed char) || \
|
Edouard@340
|
395 |
__builtin_types_compatible_p(__typeof__(expr), unsigned char))
|
Edouard@340
|
396 |
|
Edouard@340
|
397 |
/* evaluates to true if expr is of type curl_off_t */
|
Edouard@340
|
398 |
#define _curl_is_off_t(expr) \
|
Edouard@340
|
399 |
(__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
|
Edouard@340
|
400 |
|
Edouard@340
|
401 |
/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
|
Edouard@340
|
402 |
/* XXX: also check size of an char[] array? */
|
Edouard@340
|
403 |
#define _curl_is_error_buffer(expr) \
|
Edouard@340
|
404 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
405 |
__builtin_types_compatible_p(__typeof__(expr), char *) || \
|
Edouard@340
|
406 |
__builtin_types_compatible_p(__typeof__(expr), char[]))
|
Edouard@340
|
407 |
|
Edouard@340
|
408 |
/* evaluates to true if expr is of type (const) void* or (const) FILE* */
|
Edouard@340
|
409 |
#if 0
|
Edouard@340
|
410 |
#define _curl_is_cb_data(expr) \
|
Edouard@340
|
411 |
(_curl_is_ptr((expr), void) || \
|
Edouard@340
|
412 |
_curl_is_ptr((expr), FILE))
|
Edouard@340
|
413 |
#else /* be less strict */
|
Edouard@340
|
414 |
#define _curl_is_cb_data(expr) \
|
Edouard@340
|
415 |
_curl_is_any_ptr(expr)
|
Edouard@340
|
416 |
#endif
|
Edouard@340
|
417 |
|
Edouard@340
|
418 |
/* evaluates to true if expr is of type FILE* */
|
Edouard@340
|
419 |
#define _curl_is_FILE(expr) \
|
Edouard@340
|
420 |
(__builtin_types_compatible_p(__typeof__(expr), FILE *))
|
Edouard@340
|
421 |
|
Edouard@340
|
422 |
/* evaluates to true if expr can be passed as POST data (void* or char*) */
|
Edouard@340
|
423 |
#define _curl_is_postfields(expr) \
|
Edouard@340
|
424 |
(_curl_is_ptr((expr), void) || \
|
Edouard@340
|
425 |
_curl_is_arr((expr), char))
|
Edouard@340
|
426 |
|
Edouard@340
|
427 |
/* FIXME: the whole callback checking is messy...
|
Edouard@340
|
428 |
* The idea is to tolerate char vs. void and const vs. not const
|
Edouard@340
|
429 |
* pointers in arguments at least
|
Edouard@340
|
430 |
*/
|
Edouard@340
|
431 |
/* helper: __builtin_types_compatible_p distinguishes between functions and
|
Edouard@340
|
432 |
* function pointers, hide it */
|
Edouard@340
|
433 |
#define _curl_callback_compatible(func, type) \
|
Edouard@340
|
434 |
(__builtin_types_compatible_p(__typeof__(func), type) || \
|
Edouard@340
|
435 |
__builtin_types_compatible_p(__typeof__(func), type*))
|
Edouard@340
|
436 |
|
Edouard@340
|
437 |
/* evaluates to true if expr is of type curl_read_callback or "similar" */
|
Edouard@340
|
438 |
#define _curl_is_read_cb(expr) \
|
Edouard@340
|
439 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
440 |
__builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) || \
|
Edouard@340
|
441 |
__builtin_types_compatible_p(__typeof__(expr), curl_read_callback) || \
|
Edouard@340
|
442 |
_curl_callback_compatible((expr), _curl_read_callback1) || \
|
Edouard@340
|
443 |
_curl_callback_compatible((expr), _curl_read_callback2) || \
|
Edouard@340
|
444 |
_curl_callback_compatible((expr), _curl_read_callback3) || \
|
Edouard@340
|
445 |
_curl_callback_compatible((expr), _curl_read_callback4) || \
|
Edouard@340
|
446 |
_curl_callback_compatible((expr), _curl_read_callback5) || \
|
Edouard@340
|
447 |
_curl_callback_compatible((expr), _curl_read_callback6))
|
Edouard@340
|
448 |
typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);
|
Edouard@340
|
449 |
typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);
|
Edouard@340
|
450 |
typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);
|
Edouard@340
|
451 |
typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);
|
Edouard@340
|
452 |
typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);
|
Edouard@340
|
453 |
typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);
|
Edouard@340
|
454 |
|
Edouard@340
|
455 |
/* evaluates to true if expr is of type curl_write_callback or "similar" */
|
Edouard@340
|
456 |
#define _curl_is_write_cb(expr) \
|
Edouard@340
|
457 |
(_curl_is_read_cb(expr) || \
|
Edouard@340
|
458 |
__builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) || \
|
Edouard@340
|
459 |
__builtin_types_compatible_p(__typeof__(expr), curl_write_callback) || \
|
Edouard@340
|
460 |
_curl_callback_compatible((expr), _curl_write_callback1) || \
|
Edouard@340
|
461 |
_curl_callback_compatible((expr), _curl_write_callback2) || \
|
Edouard@340
|
462 |
_curl_callback_compatible((expr), _curl_write_callback3) || \
|
Edouard@340
|
463 |
_curl_callback_compatible((expr), _curl_write_callback4) || \
|
Edouard@340
|
464 |
_curl_callback_compatible((expr), _curl_write_callback5) || \
|
Edouard@340
|
465 |
_curl_callback_compatible((expr), _curl_write_callback6))
|
Edouard@340
|
466 |
typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);
|
Edouard@340
|
467 |
typedef size_t (_curl_write_callback2)(const char *, size_t, size_t,
|
Edouard@340
|
468 |
const void*);
|
Edouard@340
|
469 |
typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);
|
Edouard@340
|
470 |
typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);
|
Edouard@340
|
471 |
typedef size_t (_curl_write_callback5)(const void *, size_t, size_t,
|
Edouard@340
|
472 |
const void*);
|
Edouard@340
|
473 |
typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);
|
Edouard@340
|
474 |
|
Edouard@340
|
475 |
/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
|
Edouard@340
|
476 |
#define _curl_is_ioctl_cb(expr) \
|
Edouard@340
|
477 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
478 |
__builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) || \
|
Edouard@340
|
479 |
_curl_callback_compatible((expr), _curl_ioctl_callback1) || \
|
Edouard@340
|
480 |
_curl_callback_compatible((expr), _curl_ioctl_callback2) || \
|
Edouard@340
|
481 |
_curl_callback_compatible((expr), _curl_ioctl_callback3) || \
|
Edouard@340
|
482 |
_curl_callback_compatible((expr), _curl_ioctl_callback4))
|
Edouard@340
|
483 |
typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);
|
Edouard@340
|
484 |
typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);
|
Edouard@340
|
485 |
typedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);
|
Edouard@340
|
486 |
typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);
|
Edouard@340
|
487 |
|
Edouard@340
|
488 |
/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
|
Edouard@340
|
489 |
#define _curl_is_sockopt_cb(expr) \
|
Edouard@340
|
490 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
491 |
__builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) || \
|
Edouard@340
|
492 |
_curl_callback_compatible((expr), _curl_sockopt_callback1) || \
|
Edouard@340
|
493 |
_curl_callback_compatible((expr), _curl_sockopt_callback2))
|
Edouard@340
|
494 |
typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
|
Edouard@340
|
495 |
typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,
|
Edouard@340
|
496 |
curlsocktype);
|
Edouard@340
|
497 |
|
Edouard@340
|
498 |
/* evaluates to true if expr is of type curl_opensocket_callback or
|
Edouard@340
|
499 |
"similar" */
|
Edouard@340
|
500 |
#define _curl_is_opensocket_cb(expr) \
|
Edouard@340
|
501 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
502 |
__builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\
|
Edouard@340
|
503 |
_curl_callback_compatible((expr), _curl_opensocket_callback1) || \
|
Edouard@340
|
504 |
_curl_callback_compatible((expr), _curl_opensocket_callback2) || \
|
Edouard@340
|
505 |
_curl_callback_compatible((expr), _curl_opensocket_callback3) || \
|
Edouard@340
|
506 |
_curl_callback_compatible((expr), _curl_opensocket_callback4))
|
Edouard@340
|
507 |
typedef curl_socket_t (_curl_opensocket_callback1)
|
Edouard@340
|
508 |
(void *, curlsocktype, struct curl_sockaddr *);
|
Edouard@340
|
509 |
typedef curl_socket_t (_curl_opensocket_callback2)
|
Edouard@340
|
510 |
(void *, curlsocktype, const struct curl_sockaddr *);
|
Edouard@340
|
511 |
typedef curl_socket_t (_curl_opensocket_callback3)
|
Edouard@340
|
512 |
(const void *, curlsocktype, struct curl_sockaddr *);
|
Edouard@340
|
513 |
typedef curl_socket_t (_curl_opensocket_callback4)
|
Edouard@340
|
514 |
(const void *, curlsocktype, const struct curl_sockaddr *);
|
Edouard@340
|
515 |
|
Edouard@340
|
516 |
/* evaluates to true if expr is of type curl_progress_callback or "similar" */
|
Edouard@340
|
517 |
#define _curl_is_progress_cb(expr) \
|
Edouard@340
|
518 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
519 |
__builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) || \
|
Edouard@340
|
520 |
_curl_callback_compatible((expr), _curl_progress_callback1) || \
|
Edouard@340
|
521 |
_curl_callback_compatible((expr), _curl_progress_callback2))
|
Edouard@340
|
522 |
typedef int (_curl_progress_callback1)(void *,
|
Edouard@340
|
523 |
double, double, double, double);
|
Edouard@340
|
524 |
typedef int (_curl_progress_callback2)(const void *,
|
Edouard@340
|
525 |
double, double, double, double);
|
Edouard@340
|
526 |
|
Edouard@340
|
527 |
/* evaluates to true if expr is of type curl_debug_callback or "similar" */
|
Edouard@340
|
528 |
#define _curl_is_debug_cb(expr) \
|
Edouard@340
|
529 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
530 |
__builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) || \
|
Edouard@340
|
531 |
_curl_callback_compatible((expr), _curl_debug_callback1) || \
|
Edouard@340
|
532 |
_curl_callback_compatible((expr), _curl_debug_callback2) || \
|
Edouard@340
|
533 |
_curl_callback_compatible((expr), _curl_debug_callback3) || \
|
Edouard@340
|
534 |
_curl_callback_compatible((expr), _curl_debug_callback4) || \
|
Edouard@340
|
535 |
_curl_callback_compatible((expr), _curl_debug_callback5) || \
|
Edouard@340
|
536 |
_curl_callback_compatible((expr), _curl_debug_callback6) || \
|
Edouard@340
|
537 |
_curl_callback_compatible((expr), _curl_debug_callback7) || \
|
Edouard@340
|
538 |
_curl_callback_compatible((expr), _curl_debug_callback8))
|
Edouard@340
|
539 |
typedef int (_curl_debug_callback1) (CURL *,
|
Edouard@340
|
540 |
curl_infotype, char *, size_t, void *);
|
Edouard@340
|
541 |
typedef int (_curl_debug_callback2) (CURL *,
|
Edouard@340
|
542 |
curl_infotype, char *, size_t, const void *);
|
Edouard@340
|
543 |
typedef int (_curl_debug_callback3) (CURL *,
|
Edouard@340
|
544 |
curl_infotype, const char *, size_t, void *);
|
Edouard@340
|
545 |
typedef int (_curl_debug_callback4) (CURL *,
|
Edouard@340
|
546 |
curl_infotype, const char *, size_t, const void *);
|
Edouard@340
|
547 |
typedef int (_curl_debug_callback5) (CURL *,
|
Edouard@340
|
548 |
curl_infotype, unsigned char *, size_t, void *);
|
Edouard@340
|
549 |
typedef int (_curl_debug_callback6) (CURL *,
|
Edouard@340
|
550 |
curl_infotype, unsigned char *, size_t, const void *);
|
Edouard@340
|
551 |
typedef int (_curl_debug_callback7) (CURL *,
|
Edouard@340
|
552 |
curl_infotype, const unsigned char *, size_t, void *);
|
Edouard@340
|
553 |
typedef int (_curl_debug_callback8) (CURL *,
|
Edouard@340
|
554 |
curl_infotype, const unsigned char *, size_t, const void *);
|
Edouard@340
|
555 |
|
Edouard@340
|
556 |
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
|
Edouard@340
|
557 |
/* this is getting even messier... */
|
Edouard@340
|
558 |
#define _curl_is_ssl_ctx_cb(expr) \
|
Edouard@340
|
559 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
560 |
__builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) || \
|
Edouard@340
|
561 |
_curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \
|
Edouard@340
|
562 |
_curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \
|
Edouard@340
|
563 |
_curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \
|
Edouard@340
|
564 |
_curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \
|
Edouard@340
|
565 |
_curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \
|
Edouard@340
|
566 |
_curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \
|
Edouard@340
|
567 |
_curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \
|
Edouard@340
|
568 |
_curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
|
Edouard@340
|
569 |
typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);
|
Edouard@340
|
570 |
typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
|
Edouard@340
|
571 |
typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
|
Edouard@340
|
572 |
typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);
|
Edouard@340
|
573 |
#ifdef HEADER_SSL_H
|
Edouard@340
|
574 |
/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
|
Edouard@340
|
575 |
* this will of course break if we're included before OpenSSL headers...
|
Edouard@340
|
576 |
*/
|
Edouard@340
|
577 |
typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
|
Edouard@340
|
578 |
typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
|
Edouard@340
|
579 |
typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
|
Edouard@340
|
580 |
typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
|
Edouard@340
|
581 |
const void *);
|
Edouard@340
|
582 |
#else
|
Edouard@340
|
583 |
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
|
Edouard@340
|
584 |
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
|
Edouard@340
|
585 |
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
|
Edouard@340
|
586 |
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
|
Edouard@340
|
587 |
#endif
|
Edouard@340
|
588 |
|
Edouard@340
|
589 |
/* evaluates to true if expr is of type curl_conv_callback or "similar" */
|
Edouard@340
|
590 |
#define _curl_is_conv_cb(expr) \
|
Edouard@340
|
591 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
592 |
__builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) || \
|
Edouard@340
|
593 |
_curl_callback_compatible((expr), _curl_conv_callback1) || \
|
Edouard@340
|
594 |
_curl_callback_compatible((expr), _curl_conv_callback2) || \
|
Edouard@340
|
595 |
_curl_callback_compatible((expr), _curl_conv_callback3) || \
|
Edouard@340
|
596 |
_curl_callback_compatible((expr), _curl_conv_callback4))
|
Edouard@340
|
597 |
typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
|
Edouard@340
|
598 |
typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
|
Edouard@340
|
599 |
typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
|
Edouard@340
|
600 |
typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
|
Edouard@340
|
601 |
|
Edouard@340
|
602 |
/* evaluates to true if expr is of type curl_seek_callback or "similar" */
|
Edouard@340
|
603 |
#define _curl_is_seek_cb(expr) \
|
Edouard@340
|
604 |
(_curl_is_NULL(expr) || \
|
Edouard@340
|
605 |
__builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) || \
|
Edouard@340
|
606 |
_curl_callback_compatible((expr), _curl_seek_callback1) || \
|
Edouard@340
|
607 |
_curl_callback_compatible((expr), _curl_seek_callback2))
|
Edouard@340
|
608 |
typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
|
Edouard@340
|
609 |
typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
|
Edouard@340
|
610 |
|
Edouard@340
|
611 |
|
Edouard@340
|
612 |
#endif /* __CURL_TYPECHECK_GCC_H */
|