xref: /aosp_15_r20/external/sandboxed-api/oss-internship-2020/curl/curl_wrapper/curl_wrapper.h (revision ec63e07ab9515d95e79c211197c445ef84cefa6a)
1 // Copyright 2020 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 // Wrapper for curl library
16 
17 #ifndef CURL_WRAPPER_H_
18 #define CURL_WRAPPER_H_
19 
20 #include <curl/curl.h>
21 
22 extern "C" {
23 
24 // The wrapper method is needed to make the variadic argument explicit
25 CURLcode curl_easy_setopt_ptr(CURL* handle, CURLoption option, void* parameter);
26 
27 // The wrapper method is needed to make the variadic argument explicit
28 CURLcode curl_easy_setopt_long(CURL* handle, CURLoption option, long parameter);
29 
30 // The wrapper method is needed to make the variadic argument explicit
31 CURLcode curl_easy_setopt_curl_off_t(CURL* handle, CURLoption option,
32                                      curl_off_t parameter);
33 
34 // The wrapper method is needed to make the variadic argument explicit
35 CURLcode curl_easy_getinfo_ptr(CURL* handle, CURLINFO option, void* parameter);
36 
37 // The typedef and wrapper method are needed because the original method has
38 // some conflicts in curl_sapi.sapi.h
39 typedef time_t time_t_sapi;
40 time_t_sapi curl_getdate_sapi(char* datestring, time_t_sapi* now);
41 
42 // The typedef and wrapper method are needed because the original method has
43 // some conflicts in curl_sapi.sapi.h
44 typedef fd_set fd_set_sapi;
45 CURLMcode curl_multi_fdset_sapi(CURLM* multi_handle, fd_set_sapi* read_fd_set,
46                                 fd_set_sapi* write_fd_set,
47                                 fd_set_sapi* exc_fd_set, int* max_fd);
48 
49 // The wrapper method is needed to make the variadic argument explicit
50 CURLMcode curl_multi_setopt_ptr(CURLM* handle, CURLMoption option,
51                                 void* parameter);
52 
53 // The wrapper method is needed to make the variadic argument explicit
54 CURLMcode curl_multi_setopt_long(CURLM* handle, CURLMoption option,
55                                  long parameter);
56 
57 // The wrapper method is needed to make the variadic argument explicit
58 CURLMcode curl_multi_setopt_curl_off_t(CURLM* handle, CURLMoption option,
59                                        curl_off_t parameter);
60 
61 // The wrapper method is needed because incomplete array type is not supported
62 CURLMcode curl_multi_poll_sapi(CURLM* multi_handle,
63                                struct curl_waitfd* extra_fds,
64                                unsigned int extra_nfds, int timeout_ms,
65                                int* numfds);
66 
67 // The wrapper method is needed because incomplete array type is not supported
68 CURLMcode curl_multi_wait_sapi(CURLM* multi_handle,
69                                struct curl_waitfd* extra_fds,
70                                unsigned int extra_nfds, int timeout_ms,
71                                int* numfds);
72 
73 // The wrapper method is needed to make the variadic argument explicit
74 CURLSHcode curl_share_setopt_ptr(CURLSH* handle, CURLSHoption option,
75                                  void* parameter);
76 
77 // The wrapper method is needed to make the variadic argument explicit
78 CURLSHcode curl_share_setopt_long(CURLSH* handle, CURLSHoption option,
79                                   long parameter);
80 
81 }  // extern "C"
82 
83 #endif  // CURL_WRAPPER_H_
84