2016-04-25 20:33:48 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2015
|
|
|
|
* by Dimok
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty. In no event will the authors be held liable for any
|
|
|
|
* damages arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any
|
|
|
|
* purpose, including commercial applications, and to alter it and
|
|
|
|
* redistribute it freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you
|
|
|
|
* must not claim that you wrote the original software. If you use
|
|
|
|
* this software in a product, an acknowledgment in the product
|
|
|
|
* documentation would be appreciated but is not required.
|
|
|
|
*
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and
|
|
|
|
* must not be misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any source
|
|
|
|
* distribution.
|
|
|
|
***************************************************************************/
|
|
|
|
#include "os_functions.h"
|
|
|
|
#include "curl_functions.h"
|
|
|
|
|
2017-03-30 17:51:11 +02:00
|
|
|
u32 libcurl_handle __attribute__((section(".data"))) = 0;
|
2016-04-25 20:33:48 +02:00
|
|
|
|
|
|
|
EXPORT_DECL(CURLcode, n_curl_global_init, long flags);
|
|
|
|
EXPORT_DECL(CURL *, n_curl_easy_init, void);
|
|
|
|
EXPORT_DECL(CURLcode, n_curl_easy_setopt, CURL *curl, CURLoption option, ...);
|
|
|
|
EXPORT_DECL(CURLcode, n_curl_easy_perform, CURL *curl);
|
|
|
|
EXPORT_DECL(void, n_curl_easy_cleanup, CURL *curl);
|
2017-10-29 09:16:43 +01:00
|
|
|
EXPORT_DECL(void, n_curl_easy_reset, CURL *curl);
|
2016-04-25 20:33:48 +02:00
|
|
|
EXPORT_DECL(CURLcode, n_curl_easy_getinfo, CURL *curl, CURLINFO info, ...);
|
2017-10-29 09:16:43 +01:00
|
|
|
EXPORT_DECL(CURLFORMcode, n_curl_formadd, struct curl_httppost **firstitem, struct curl_httppost **lastitem, ...);
|
|
|
|
EXPORT_DECL(void, n_curl_formfree, struct curl_httppost *form);
|
|
|
|
EXPORT_DECL(struct curl_slist *, n_curl_slist_append, struct curl_slist *list, const char *string);
|
|
|
|
EXPORT_DECL(void, n_curl_slist_free_all, struct curl_slist *list);
|
2016-04-25 20:33:48 +02:00
|
|
|
|
2018-03-11 16:46:31 +01:00
|
|
|
void InitAcquireCurl(void) {
|
|
|
|
if(coreinit_handle == 0) {
|
|
|
|
InitAcquireOS();
|
|
|
|
};
|
2016-04-25 20:33:48 +02:00
|
|
|
OSDynLoad_Acquire("nlibcurl", &libcurl_handle);
|
|
|
|
}
|
|
|
|
|
2018-03-11 16:46:31 +01:00
|
|
|
void InitCurlFunctionPointers(void) {
|
2016-04-25 20:33:48 +02:00
|
|
|
InitAcquireCurl();
|
2017-04-10 11:04:06 +02:00
|
|
|
u32 *funcPointer = 0;
|
2016-04-25 20:33:48 +02:00
|
|
|
|
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_global_init, n_curl_global_init);
|
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_init, n_curl_easy_init);
|
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_setopt, n_curl_easy_setopt);
|
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_perform, n_curl_easy_perform);
|
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_cleanup, n_curl_easy_cleanup);
|
2017-10-29 09:16:43 +01:00
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_reset, n_curl_easy_reset);
|
2016-04-25 20:33:48 +02:00
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_getinfo, n_curl_easy_getinfo);
|
2017-10-29 09:16:43 +01:00
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_formadd, n_curl_formadd);
|
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_formfree, n_curl_formfree);
|
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_slist_append, n_curl_slist_append);
|
|
|
|
OS_FIND_EXPORT_EX(libcurl_handle, curl_slist_free_all, n_curl_slist_free_all);
|
2016-04-25 20:33:48 +02:00
|
|
|
|
|
|
|
n_curl_global_init(CURL_GLOBAL_ALL);
|
|
|
|
}
|