sandboxed-api/oss-internship-2020/curl/curl_wrapper/curl_wrapper.cc

90 lines
3.3 KiB
C++
Raw Normal View History

2020-08-05 18:54:31 +08:00
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2020-08-18 18:44:53 +08:00
#include "curl_wrapper.h"
2020-08-07 22:21:00 +08:00
2020-08-07 16:53:33 +08:00
#include <cstdlib>
2020-08-05 18:54:31 +08:00
#include <iostream>
2020-08-07 16:53:33 +08:00
2020-08-18 18:44:53 +08:00
CURLcode curl_easy_setopt_ptr(CURL* handle, CURLoption option,
2020-08-07 18:14:48 +08:00
void* parameter) {
return curl_easy_setopt(handle, option, parameter);
2020-08-05 18:54:31 +08:00
}
2020-08-18 18:44:53 +08:00
CURLcode curl_easy_setopt_long(CURL* handle, CURLoption option,
2020-08-07 18:14:48 +08:00
long parameter) {
return curl_easy_setopt(handle, option, parameter);
2020-08-05 18:54:31 +08:00
}
2020-08-18 18:44:53 +08:00
CURLcode curl_easy_setopt_curl_off_t(CURL* handle, CURLoption option,
2020-08-07 18:14:48 +08:00
curl_off_t parameter) {
return curl_easy_setopt(handle, option, parameter);
2020-08-05 18:54:31 +08:00
}
2020-08-18 18:44:53 +08:00
CURLcode curl_easy_getinfo_ptr(CURL* handle, CURLINFO option, void* parameter) {
2020-08-07 18:14:48 +08:00
return curl_easy_getinfo(handle, option, parameter);
2020-08-07 05:41:02 +08:00
}
2020-08-13 00:33:45 +08:00
2020-08-18 18:44:53 +08:00
time_t_sapi curl_getdate_sapi(char* datestring, time_t_sapi* now) {
2020-08-13 00:33:45 +08:00
return curl_getdate(datestring, now);
}
2020-08-18 18:44:53 +08:00
CURLMcode curl_multi_fdset_sapi(CURLM* multi_handle, fd_set_sapi* read_fd_set,
fd_set_sapi* write_fd_set,
fd_set_sapi* exc_fd_set, int* max_fd) {
return curl_multi_fdset(multi_handle, read_fd_set, write_fd_set, exc_fd_set,
2020-08-13 00:33:45 +08:00
max_fd);
}
2020-08-18 18:44:53 +08:00
CURLMcode curl_multi_setopt_ptr(CURLM* handle, CURLMoption option,
2020-08-13 00:33:45 +08:00
void* parameter) {
return curl_multi_setopt(handle, option, parameter);
}
2020-08-18 18:44:53 +08:00
CURLMcode curl_multi_setopt_long(CURLM* handle, CURLMoption option,
long parameter) {
2020-08-13 00:33:45 +08:00
return curl_multi_setopt(handle, option, parameter);
}
2020-08-18 18:44:53 +08:00
CURLMcode curl_multi_setopt_curl_off_t(CURLM* handle, CURLMoption option,
curl_off_t parameter) {
2020-08-13 00:33:45 +08:00
return curl_multi_setopt(handle, option, parameter);
}
2020-08-18 18:44:53 +08:00
CURLMcode curl_multi_poll_sapi(CURLM* multi_handle,
2020-08-13 00:33:45 +08:00
struct curl_waitfd* extra_fds,
2020-08-18 18:44:53 +08:00
unsigned int extra_nfds, int timeout_ms,
int* numfds) {
return curl_multi_poll(multi_handle, extra_fds, extra_nfds, timeout_ms,
2020-08-13 00:33:45 +08:00
numfds);
}
2020-08-18 18:44:53 +08:00
CURLMcode curl_multi_wait_sapi(CURLM* multi_handle,
2020-08-13 00:33:45 +08:00
struct curl_waitfd* extra_fds,
2020-08-18 18:44:53 +08:00
unsigned int extra_nfds, int timeout_ms,
int* numfds) {
return curl_multi_wait(multi_handle, extra_fds, extra_nfds, timeout_ms,
2020-08-13 00:33:45 +08:00
numfds);
}
2020-08-18 18:44:53 +08:00
CURLSHcode curl_share_setopt_ptr(CURLSH* handle, CURLSHoption option,
void* parameter) {
2020-08-13 00:33:45 +08:00
return curl_share_setopt(handle, option, parameter);
}
2020-08-18 18:44:53 +08:00
CURLSHcode curl_share_setopt_long(CURLSH* handle, CURLSHoption option,
long parameter) {
2020-08-13 00:33:45 +08:00
return curl_share_setopt(handle, option, parameter);
}