Source
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/* See https://curl.se/libcurl/c/symbols-by-name.html for information in which version a symbol was added. */
/* added in 7.85.0 (0x075500) */
static unsigned int libcurl_version_num(void)
{
return curl_version_info(CURLVERSION_NOW)->version_num;
}
static const char *libcurl_version_str(void)
{
return curl_version_info(CURLVERSION_NOW)->version;
}
static const char *libcurl_ssl_version(void)
{
return curl_version_info(CURLVERSION_NOW)->ssl_version;
}
/* curl_multi_wait() was added in cURL 7.28.0 (0x071c00). Since we support cURL library >= 7.19.1 */
/* we want to be able to compile against older cURL library. This is a wrapper that detects if the */
/* function is available at runtime. It should never be called for older library versions because */
/* detect the version before. When cURL library requirement goes to >= 7.28.0 this function and */
/* the structure declaration should be removed and curl_multi_wait() be used directly. */
CURLMcode zbx_curl_multi_wait(CURLM *multi_handle, int timeout_ms, int *numfds)
{
struct curl_waitfd
{
curl_socket_t fd;
short events;
short revents;
};
static void *handle;
static CURLMcode (*fptr)(CURLM *, struct curl_waitfd *, unsigned int, int, int *) = NULL;
if (NULL == fptr)
{
/* this check must be performed before calling this function */