44#undef curl_easy_setopt
45#undef curl_easy_getinfo
46#undef curl_multi_setopt
47#undef curl_share_setopt
51void * curl_dl_handle =
nullptr;
52pthread_once_t curl_dl_once = PTHREAD_ONCE_INIT;
54extern "C" void curl_dl_open()
56 curl_dl_handle = dlopen(
"libcurl.so.4", RTLD_LAZY | RTLD_LOCAL );
57 if ( !curl_dl_handle )
58 fprintf( stderr,
"libzypp: dlopen(libcurl.so.4): %s\n", dlerror() );
61void * curl_dl_sym(
const char * name )
63 pthread_once( &curl_dl_once, curl_dl_open );
64 return curl_dl_handle ? dlsym( curl_dl_handle, name ) : nullptr;
70#define CURL_DL_FN( ret, name, proto, args, errret ) \
73 static ret (*fn) proto; \
75 *(void **)&fn = curl_dl_sym( #name ); \
82#define CURL_DL_FN_VOID( name, proto, args ) \
85 static void (*fn) proto; \
87 *(void **)&fn = curl_dl_sym( #name ); \
92CURL_DL_FN( CURLcode, curl_global_init, (
long flags), (flags), CURLE_FAILED_INIT )
97CURL_DL_FN( const
char *, curl_easy_strerror, (CURLcode code), (code),
"libcurl is not available" )
110CURL_DL_FN( CURLMsg *, curl_multi_info_read, (CURLM *
multi,
int *msgs_in_queue), (
multi, msgs_in_queue),
nullptr )
111CURL_DL_FN( CURLMcode,
curl_multi_socket_action, (CURLM *
multi, curl_socket_t
s,
int ev_bitmask,
int *
running_handles), (
multi,
s,
ev_bitmask,
running_handles), CURLM_INTERNAL_ERROR )
112CURL_DL_FN( const
char *, curl_multi_strerror, (CURLMcode code), (code),
"libcurl is not available" )
117CURLcode curl_easy_getinfo( CURL *
handle, CURLINFO
info, ... )
119 static CURLcode (*
fn)( CURL *, CURLINFO, ... );
123 *(
void **)&
fn = curl_dl_sym(
"curl_easy_getinfo" );
125 return CURLE_FAILED_INIT;
127 arg = va_arg(
ap,
void * );
134 static CURLcode (*
fn)( CURL *, CURLoption, ... );
138 *(
void **)&
fn = curl_dl_sym(
"curl_easy_setopt" );
140 return CURLE_FAILED_INIT;
142 if ( option < CURLOPTTYPE_OBJECTPOINT )
143 ret =
fn(
handle, option, va_arg(
ap,
long ) );
144 else if ( option < CURLOPTTYPE_OFF_T )
145 ret =
fn(
handle, option, va_arg(
ap,
void * ) );
146 else if ( option < CURLOPTTYPE_BLOB )
147 ret =
fn(
handle, option, va_arg(
ap, curl_off_t ) );
149 ret =
fn(
handle, option, va_arg(
ap,
void * ) );
156 static CURLMcode (*
fn)( CURLM *, CURLMoption, ... );
160 *(
void **)&
fn = curl_dl_sym(
"curl_multi_setopt" );
162 return CURLM_INTERNAL_ERROR;
164 if ( option < CURLOPTTYPE_OBJECTPOINT )
165 ret =
fn(
multi, option, va_arg(
ap,
long ) );
166 else if ( option < CURLOPTTYPE_OFF_T )
167 ret =
fn(
multi, option, va_arg(
ap,
void * ) );
168 else if ( option < CURLOPTTYPE_BLOB )
169 ret =
fn(
multi, option, va_arg(
ap, curl_off_t ) );
171 ret =
fn(
multi, option, va_arg(
ap,
void * ) );
nullptr CURL handle void p curl_version_info
nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t s
nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int ev_bitmask
nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR curl_multi_remove_handle
nullptr CURL handle void p CURLversion nullptr struct curl_slist list curl_multi_cleanup
nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR curl_multi_socket_action
#define CURL_DL_FN(ret, name, proto, args, errret)
CURLcode curl_easy_setopt(CURL *handle, CURLoption option,...)
nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int CURLM_INTERNAL_ERROR CURLINFO info
nullptr CURL handle void p CURLversion nullptr struct curl_slist * list
nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM * multi
nullptr CURL handle void * p
nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int CURLM_INTERNAL_ERROR CURLINFO va_list ap
nullptr CURL handle void p CURLversion age
CURLMcode curl_multi_setopt(CURLM *multi, CURLMoption option,...)
#define CURL_DL_FN_VOID(name, proto, args)
return fn(handle, info, arg)
nullptr CURL handle void p CURLversion nullptr struct curl_slist list CURLM CURLM_INTERNAL_ERROR CURLM CURL CURLM_INTERNAL_ERROR CURLM curl_socket_t int int * running_handles
String related utilities and Regular expression matching.