tiny-curl: patch set

This commit is contained in:
Daniel Stenberg 2023-08-24 09:24:02 +02:00
parent 50490c0679
commit 1396a6c01f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
22 changed files with 1845 additions and 56 deletions

View file

@ -29,7 +29,8 @@ EXTRA_DIST = Makefile.mk config-win32.h config-win32ce.h config-plan9.h \
config-riscos.h config-mac.h curl_config.h.in config-dos.h \
libcurl.plist libcurl.rc config-amigaos.h config-win32ce.h \
config-os400.h setup-os400.h $(CMAKE_DIST) setup-win32.h .checksrc \
Makefile.soname
Makefile.soname \
config-freertos.h config-micrium.h
lib_LTLIBRARIES = libcurl.la

View file

@ -90,7 +90,8 @@
*/
static void set_ipv6_v6only(curl_socket_t sockfd, int on)
{
(void)setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on));
(void)curl_setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on,
sizeof(on));
}
#else
#define set_ipv6_v6only(x,y)
@ -107,7 +108,7 @@ static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd)
(void) data;
#endif
if(setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff,
if(curl_setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff,
sizeof(onoff)) < 0)
infof(data, "Could not set TCP_NODELAY: %s",
Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
@ -126,7 +127,7 @@ static void nosigpipe(struct Curl_easy *data,
curl_socket_t sockfd)
{
int onoff = 1;
if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff,
if(curl_setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff,
sizeof(onoff)) < 0) {
#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
char buffer[STRERROR_LEN];
@ -163,7 +164,7 @@ tcpkeepalive(struct Curl_easy *data,
int optval = data->set.tcp_keepalive?1:0;
/* only set IDLE and INTVL if setting KEEPALIVE is successful */
if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,
if(curl_setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set SO_KEEPALIVE on fd %d", sockfd);
}
@ -187,7 +188,7 @@ tcpkeepalive(struct Curl_easy *data,
#ifdef TCP_KEEPIDLE
optval = curlx_sltosi(data->set.tcp_keepidle);
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,
if(curl_setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,
(void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPIDLE on fd %d", sockfd);
}
@ -195,7 +196,7 @@ tcpkeepalive(struct Curl_easy *data,
/* Mac OS X style */
optval = curlx_sltosi(data->set.tcp_keepidle);
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE,
if(curl_setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPALIVE on fd %d", sockfd);
}
@ -203,7 +204,7 @@ tcpkeepalive(struct Curl_easy *data,
#ifdef TCP_KEEPINTVL
optval = curlx_sltosi(data->set.tcp_keepintvl);
KEEPALIVE_FACTOR(optval);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,
if(curl_setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,
(void *)&optval, sizeof(optval)) < 0) {
infof(data, "Failed to set TCP_KEEPINTVL on fd %d", sockfd);
}
@ -273,7 +274,7 @@ static CURLcode socket_open(struct Curl_easy *data,
}
else {
/* opensocket callback not set, so simply create the socket now */
*sockfd = socket(addr->family, addr->socktype, addr->protocol);
*sockfd = curl_socket(addr->family, addr->socktype, addr->protocol);
}
if(*sockfd == CURL_SOCKET_BAD)
@ -386,7 +387,8 @@ void Curl_sndbufset(curl_socket_t sockfd)
if(curval > val)
return;
setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val));
curl_setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val,
sizeof(val));
}
#endif
@ -459,7 +461,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
* converted to an IP address and would fail Curl_if2ip. Simply try
* to use it straight away.
*/
if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
if(curl_setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
dev, (curl_socklen_t)strlen(dev) + 1) == 0) {
/* This is typically "errno 1, error: Operation not permitted" if
* you're not running as root or another suitable privileged
@ -608,10 +610,11 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
}
}
#ifdef IP_BIND_ADDRESS_NO_PORT
(void)setsockopt(sockfd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &on, sizeof(on));
(void)curl_setsockopt(sockfd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &on,
sizeof(on));
#endif
for(;;) {
if(bind(sockfd, sock, sizeof_sa) >= 0) {
if(curl_bind(sockfd, sock, sizeof_sa) >= 0) {
/* we succeeded to bind */
struct Curl_sockaddr_storage add;
curl_socklen_t size = sizeof(add);
@ -1081,27 +1084,32 @@ static int do_connect(struct Curl_cfilter *cf, struct Curl_easy *data,
NULL, 0, NULL, NULL);
}
else {
rc = connect(ctx->sock, &ctx->addr.sa_addr, ctx->addr.addrlen);
rc = curl_connect(ctx->sock, data->conn->host.name,
&ctx->addr.sa_addr, ctx->addr.addrlen);
}
# else
rc = connect(ctx->sock, &ctx->addr.sa_addr, ctx->addr.addrlen);
rc = curl_connect(ctx->sock, data->conn->host.name,
&ctx->addr.sa_addr, ctx->addr.addrlen);
# endif /* HAVE_BUILTIN_AVAILABLE */
#elif defined(TCP_FASTOPEN_CONNECT) /* Linux >= 4.11 */
if(setsockopt(ctx->sock, IPPROTO_TCP, TCP_FASTOPEN_CONNECT,
if(curl_setsockopt(ctx->sock, IPPROTO_TCP, TCP_FASTOPEN_CONNECT,
(void *)&optval, sizeof(optval)) < 0)
infof(data, "Failed to enable TCP Fast Open on fd %"
CURL_FORMAT_SOCKET_T, ctx->sock);
rc = connect(ctx->sock, &ctx->addr.sa_addr, ctx->addr.addrlen);
rc = curl_connect(ctx->sock, data->conn->host.name,
&ctx->addr.sa_addr, ctx->addr.addrlen);
#elif defined(MSG_FASTOPEN) /* old Linux */
if(cf->conn->given->flags & PROTOPT_SSL)
rc = connect(ctx->sock, &ctx->addr.sa_addr, ctx->addr.addrlen);
rc = curl_connect(ctx->sock, data->conn->host.name,
&ctx->addr.sa_addr, ctx->addr.addrlen);
else
rc = 0; /* Do nothing */
#endif
}
else {
rc = connect(ctx->sock, &ctx->addr.sa_addr, ctx->addr.addrlen);
rc = curl_connect(ctx->sock, data->conn->host.name,
&ctx->addr.sa_addr, ctx->addr.addrlen);
}
return rc;
}
@ -1576,7 +1584,8 @@ static CURLcode cf_udp_setup_quic(struct Curl_cfilter *cf,
/* QUIC needs a connected socket, nonblocking */
DEBUGASSERT(ctx->sock != CURL_SOCKET_BAD);
rc = connect(ctx->sock, &ctx->addr.sa_addr, ctx->addr.addrlen);
rc = curl_connect(ctx->sock, data->conn->host.name,
&ctx->addr.sa_addr, ctx->addr.addrlen);
if(-1 == rc) {
return socket_connect_result(data, ctx->r_ip, SOCKERRNO);
}
@ -1591,7 +1600,7 @@ static CURLcode cf_udp_setup_quic(struct Curl_cfilter *cf,
#if defined(__linux__) && defined(IP_MTU_DISCOVER)
case AF_INET: {
int val = IP_PMTUDISC_DO;
(void)setsockopt(ctx->sock, IPPROTO_IP, IP_MTU_DISCOVER, &val,
(void)curl_setsockopt(ctx->sock, IPPROTO_IP, IP_MTU_DISCOVER, &val,
sizeof(val));
break;
}
@ -1599,7 +1608,7 @@ static CURLcode cf_udp_setup_quic(struct Curl_cfilter *cf,
#if defined(__linux__) && defined(IPV6_MTU_DISCOVER)
case AF_INET6: {
int val = IPV6_PMTUDISC_DO;
(void)setsockopt(ctx->sock, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &val,
(void)curl_setsockopt(ctx->sock, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &val,
sizeof(val));
break;
}

400
lib/config-freertos.h Normal file
View file

@ -0,0 +1,400 @@
#ifndef CURL_CONFIG_FREERTOS_H
#define CURL_CONFIG_FREERTOS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
***************************************************************************/
/* to disable cookies support */
#define CURL_DISABLE_COOKIES 1
/* disable HTTP authentication */
#define CURL_DISABLE_HTTP_AUTH 1
/* disable DoH */
#define CURL_DISABLE_DOH 1
/* disable mime API */
#define CURL_DISABLE_MIME 1
/* disable date parsing */
#define CURL_DISABLE_PARSEDATE 1
/* disable netrc parsing */
#define CURL_DISABLE_NETRC 1
/* disable DNS shuffling */
#define CURL_DISABLE_SHUFFLE_DNS 1
/* disable progress-meter */
#define CURL_DISABLE_PROGRESS_METER 1
/* to disable cryptographic authentication */
#define CURL_DISABLE_CRYPTO_AUTH 1
/* to disable DICT */
#define CURL_DISABLE_DICT 1
/* to disable FILE */
#define CURL_DISABLE_FILE 1
/* to disable FTP */
#define CURL_DISABLE_FTP 1
/* to disable Gopher */
#define CURL_DISABLE_GOPHER 1
/* to disable IMAP */
#define CURL_DISABLE_IMAP 1
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
/* to disable LDAPS */
#define CURL_DISABLE_LDAPS 1
/* to disable POP3 */
#define CURL_DISABLE_POP3 1
/* to disable proxies */
#define CURL_DISABLE_PROXY 1
/* to disable RTSP */
#define CURL_DISABLE_RTSP 1
/* to disable SMB/CIFS */
#define CURL_DISABLE_SMB 1
/* to disable SMTP */
#define CURL_DISABLE_SMTP 1
/* to disable TELNET */
#define CURL_DISABLE_TELNET 1
/* to disable TFTP */
#define CURL_DISABLE_TFTP 1
/* to disable verbose strings */
#define CURL_DISABLE_VERBOSE_STRINGS 1
/* Definition to make a library symbol externally visible. */
#define CURL_EXTERN_SYMBOL __attribute__ ((__visibility__ ("default")))
/* IP address type in sockaddr */
#define CURL_SA_FAMILY_T uint8_t
/* lack of non-blocking support */
#define USE_BLOCKING_SOCKETS 1
/* Define to the type of arg 2 for gethostname. */
#define GETHOSTNAME_TYPE_ARG2 size_t
/* Specifies the number of arguments to getservbyport_r */
#define GETSERVBYPORT_R_ARGS 6
/* Specifies the size of the buffer to pass to getservbyport_r */
#define GETSERVBYPORT_R_BUFSIZE 4096
/* Define to 1 if you have the <alloca.h> header file. */
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
/* Define to 1 if you have the <arpa/tftp.h> header file. */
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the basename function. */
#define HAVE_BASENAME 1
/* Define to 1 if bool is an available type. */
#define HAVE_BOOL_T 1
/* Define to 1 if you have the connect function. */
#define HAVE_CONNECT 1
/* Define to 1 if you have the <cyassl/error-ssl.h> header file. */
#define HAVE_CYASSL_ERROR_SSL_H 1
/* Define to 1 if you have the <cyassl/options.h> header file. */
#define HAVE_CYASSL_OPTIONS_H 1
/* Define to 1 if you have the declaration of `getpwuid_r', and to 0 if you
don't. */
#define HAVE_DECL_GETPWUID_R 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the gethostbyname function. */
#define HAVE_GETHOSTBYNAME 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <linux/tcp.h> header file. */
/* if your compiler supports LL */
#define HAVE_LL 1
/* Define to 1 if the compiler supports the 'long long' data type. */
#define HAVE_LONGLONG 1
/* Define to 1 if you have the malloc.h header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the memory.h header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <netdb.h> header file. */
/* Define to 1 if you have the <netinet/in.h> header file. */
/* Define to 1 if you have the <netinet/tcp.h> header file. */
/* Define to 1 if you have the <net/if.h> header file. */
/* Define to 1 if you have the recv function. */
#define HAVE_RECV 1
/* Define to 1 if you have the select function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the send function. */
#define HAVE_SEND 1
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
/* Define to 1 if you have the setsockopt function. */
#define HAVE_SETSOCKOPT 1
/* Define to 1 if you have the socket function. */
#define HAVE_SOCKET 1
/* Define to 1 if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the strncasecmp function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the <stropts.h> header file. */
/* Define to 1 if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the strtok_r function. */
#define HAVE_STRTOK_R 1
/* Define to 1 if you have the strtoll function. */
#define HAVE_STRTOLL 1
/* if struct sockaddr_storage is defined */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if you have the timeval struct. */
#define HAVE_STRUCT_TIMEVAL 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <sys/xattr.h> header file. */
#define HAVE_SYS_XATTR_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <termio.h> header file. */
#define HAVE_TERMIO_H 1
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1
/* Define to 1 if you have the `utimes' function. */
#define HAVE_UTIMES 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if compiler supports C99 variadic macro style. */
#define HAVE_VARIADIC_MACROS_C99 1
/* Define to 1 if compiler supports old gcc variadic macro style. */
#define HAVE_VARIADIC_MACROS_GCC 1
/* Define to 1 if you have the `wolfSSL_CTX_UseSupportedCurve' function. */
#define HAVE_WOLFSSL_CTX_USESUPPORTEDCURVE 1
/* Define to 1 if you have the `wolfSSL_get_peer_certificate' function. */
#define HAVE_WOLFSSL_GET_PEER_CERTIFICATE 1
/* Define to 1 if you have the writev function. */
#define HAVE_WRITEV 1
/* cpu-machine-OS */
#define OS "x86_64-freertos"
/* Define to the type of arg 1 for recv. */
#define RECV_TYPE_ARG1 Socket_t
/* Define to the type of arg 2 for recv. */
#define RECV_TYPE_ARG2 void *
/* Define to the type of arg 3 for recv. */
#define RECV_TYPE_ARG3 size_t
/* Define to the type of arg 4 for recv. */
#define RECV_TYPE_ARG4 long
/* Define to the function return type for recv. */
#define RECV_TYPE_RETV long
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to the type qualifier of arg 5 for select. */
#define SELECT_QUAL_ARG5
/* Define to the type of arg 1 for select. */
#define SELECT_TYPE_ARG1 int
/* Define to the type of args 2, 3 and 4 for select. */
#define SELECT_TYPE_ARG234 fd_set *
/* Define to the type of arg 5 for select. */
#define SELECT_TYPE_ARG5 struct timeval *
/* Define to the function return type for select. */
#define SELECT_TYPE_RETV int
/* Define to the type qualifier of arg 2 for send. */
#define SEND_QUAL_ARG2 const
/* Define to the type of arg 1 for send. */
#define SEND_TYPE_ARG1 int
/* Define to the type of arg 2 for send. */
#define SEND_TYPE_ARG2 void *
/* Define to the type of arg 3 for send. */
#define SEND_TYPE_ARG3 size_t
/* Define to the type of arg 4 for send. */
#define SEND_TYPE_ARG4 int
/* Define to the function return type for send. */
#define SEND_TYPE_RETV ssize_t
#define ssize_t int
/* The number of bytes in type curl_off_t */
#define SIZEOF_CURL_OFF_T 8
/* The number of bytes in type int */
#define SIZEOF_INT 4
/* The number of bytes in type long */
#define SIZEOF_LONG 4
/* The number of bytes in type long long */
#define SIZEOF_LONG_LONG 8
/* The number of bytes in type off_t */
#define SIZEOF_OFF_T 8
/* The number of bytes in type short */
#define SIZEOF_SHORT 2
/* The number of bytes in type size_t */
#define SIZEOF_SIZE_T 8
/* The number of bytes in type time_t */
#define SIZEOF_TIME_T 8
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* if CyaSSL/WolfSSL is enabled */
#define USE_CYASSL 1
/* Version number of package */
#define VERSION "-"
/* Define to 1 if OS is AIX. */
#ifndef _ALL_SOURCE
/* # undef _ALL_SOURCE */
#endif
/* Work-around to allow building the Windows FreeRTOS simulator */
#define ALLOW_MSVC6_WITHOUT_PSDK 1
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
#endif /* CURL_CONFIG_FREERTOS_H */

424
lib/config-micrium.h Normal file
View file

@ -0,0 +1,424 @@
#ifndef CURL_CONFIG_MICRIUM_H
#define CURL_CONFIG_MICRIUM_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
***************************************************************************/
#define CURL_DISABLE_SOCKETPAIR 1
/* to disable cookies support */
#define CURL_DISABLE_COOKIES 1
/* disable HTTP authentication */
#define CURL_DISABLE_HTTP_AUTH 1
/* disable DoH */
#define CURL_DISABLE_DOH 1
/* disable mime API */
#define CURL_DISABLE_MIME 1
/* disable date parsing */
#define CURL_DISABLE_PARSEDATE 1
/* disable netrc parsing */
#define CURL_DISABLE_NETRC 1
/* disable DNS shuffling */
#define CURL_DISABLE_SHUFFLE_DNS 1
/* disable progress-meter */
#define CURL_DISABLE_PROGRESS_METER 1
/* to disable cryptographic authentication */
#define CURL_DISABLE_CRYPTO_AUTH 1
/* to disable DICT */
#define CURL_DISABLE_DICT 1
/* to disable FILE */
#define CURL_DISABLE_FILE 1
/* to disable FTP */
#define CURL_DISABLE_FTP 1
/* to disable Gopher */
#define CURL_DISABLE_GOPHER 1
/* to disable IMAP */
#define CURL_DISABLE_IMAP 1
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
/* to disable LDAPS */
#define CURL_DISABLE_LDAPS 1
/* to disable POP3 */
#define CURL_DISABLE_POP3 1
/* to disable proxies */
#define CURL_DISABLE_PROXY 1
/* to disable RTSP */
#define CURL_DISABLE_RTSP 1
/* to disable SMB/CIFS */
#define CURL_DISABLE_SMB 1
/* to disable SMTP */
#define CURL_DISABLE_SMTP 1
/* to disable TELNET */
#define CURL_DISABLE_TELNET 1
/* to disable TFTP */
#define CURL_DISABLE_TFTP 1
/* to disable verbose strings */
#define CURL_DISABLE_VERBOSE_STRINGS 1
/* Definition to make a library symbol externally visible. */
#define CURL_EXTERN_SYMBOL __attribute__ ((__visibility__ ("default")))
/* IP address type in sockaddr */
#define CURL_SA_FAMILY_T uint8_t
/* lack of non-blocking support */
#define USE_BLOCKING_SOCKETS 1
/* Define to the type of arg 2 for gethostname. */
#define GETHOSTNAME_TYPE_ARG2 size_t
/* Specifies the number of arguments to getservbyport_r */
#define GETSERVBYPORT_R_ARGS 6
/* Specifies the size of the buffer to pass to getservbyport_r */
#define GETSERVBYPORT_R_BUFSIZE 4096
/* Define to 1 if you have the <alloca.h> header file. */
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
/* Define to 1 if you have the <arpa/tftp.h> header file. */
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the basename function. */
#define HAVE_BASENAME 1
/* Define to 1 if bool is an available type. */
#define HAVE_BOOL_T 1
/* Define to 1 if you have the connect function. */
#define HAVE_CONNECT 1
/* Define to 1 if you have the <cyassl/error-ssl.h> header file. */
#define HAVE_CYASSL_ERROR_SSL_H 1
/* Define to 1 if you have the <cyassl/options.h> header file. */
#define HAVE_CYASSL_OPTIONS_H 1
/* Define to 1 if you have the declaration of `getpwuid_r', and to 0 if you
don't. */
#define HAVE_DECL_GETPWUID_R 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
#define CURLRES_IPV6
#define HAVE_GETADDRINFO 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <linux/tcp.h> header file. */
/* if your compiler supports LL */
#define HAVE_LL 1
/* Define to 1 if the compiler supports the 'long long' data type. */
#define HAVE_LONGLONG 1
/* Define to 1 if you have the malloc.h header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the memory.h header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
/* Define to 1 if you have the <netinet/tcp.h> header file. */
/* Define to 1 if you have the <net/if.h> header file. */
/* Define to 1 if you have the recv function. */
#define HAVE_RECV 1
/* Define to 1 if you have the select function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the send function. */
#define HAVE_SEND 1
/* Define to 1 if you have the setsockopt function. */
#define HAVE_SETSOCKOPT 1
/* Define to 1 if you have the socket function. */
#define HAVE_SOCKET 1
/* Define to 1 if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the strncasecmp function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the <stropts.h> header file. */
/* Define to 1 if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the strtok_r function. */
#define HAVE_STRTOK_R 1
/* Define to 1 if you have the strtoll function. */
#define HAVE_STRTOLL 1
/* Define to 1 if you have the timeval struct. */
#define HAVE_STRUCT_TIMEVAL 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <sys/xattr.h> header file. */
#define HAVE_SYS_XATTR_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <termio.h> header file. */
#define HAVE_TERMIO_H 1
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1
/* Define to 1 if you have the `utimes' function. */
#define HAVE_UTIMES 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if compiler supports C99 variadic macro style. */
#define HAVE_VARIADIC_MACROS_C99 1
/* Define to 1 if compiler supports old gcc variadic macro style. */
#define HAVE_VARIADIC_MACROS_GCC 1
/* Define to 1 if you have the `wolfSSL_CTX_UseSupportedCurve' function. */
#define HAVE_WOLFSSL_CTX_USESUPPORTEDCURVE 1
/* Define to 1 if you have the `wolfSSL_get_peer_certificate' function. */
#define HAVE_WOLFSSL_GET_PEER_CERTIFICATE 1
/* Define to 1 if you have the writev function. */
#define HAVE_WRITEV 1
/* cpu-machine-OS */
#define OS "x86_64-micrium"
/* Define to the type of arg 1 for recv. */
#define RECV_TYPE_ARG1 int
/* Define to the type of arg 2 for recv. */
#define RECV_TYPE_ARG2 void *
/* Define to the type of arg 3 for recv. */
#define RECV_TYPE_ARG3 size_t
/* Define to the type of arg 4 for recv. */
#define RECV_TYPE_ARG4 long
/* Define to the function return type for recv. */
#define RECV_TYPE_RETV long
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to the type qualifier of arg 5 for select. */
#define SELECT_QUAL_ARG5
/* Define to the type of arg 1 for select. */
#define SELECT_TYPE_ARG1 int
/* Define to the type of args 2, 3 and 4 for select. */
#define SELECT_TYPE_ARG234 fd_set *
/* Define to the type of arg 5 for select. */
#define SELECT_TYPE_ARG5 struct timeval *
/* Define to the function return type for select. */
#define SELECT_TYPE_RETV int
/* Define to the type qualifier of arg 2 for send. */
#define SEND_QUAL_ARG2
/* Define to the type of arg 1 for send. */
#define SEND_TYPE_ARG1 int
/* Define to the type of arg 2 for send. */
#define SEND_TYPE_ARG2 void *
/* Define to the type of arg 3 for send. */
#define SEND_TYPE_ARG3 size_t
/* Define to the type of arg 4 for send. */
#define SEND_TYPE_ARG4 int
/* Define to the function return type for send. */
#define SEND_TYPE_RETV ssize_t
/* The number of bytes in type curl_off_t */
#define SIZEOF_CURL_OFF_T 8
/* The number of bytes in type int */
#define SIZEOF_INT 4
/* The number of bytes in type long */
#define SIZEOF_LONG 4
/* The number of bytes in type long long */
#define SIZEOF_LONG_LONG 8
/* The number of bytes in type off_t */
#define SIZEOF_OFF_T 8
/* The number of bytes in type short */
#define SIZEOF_SHORT 2
/* The number of bytes in type size_t */
#define SIZEOF_SIZE_T 8
/* The number of bytes in type time_t */
#define SIZEOF_TIME_T 8
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* if CyaSSL/WolfSSL is enabled */
#define USE_CYASSL 1
/* Version number of package */
#define VERSION "-"
/* Define to 1 if OS is AIX. */
#ifndef _ALL_SOURCE
/* # undef _ALL_SOURCE */
#endif
/* Work-around to allow building the Windows Micrium simulator */
#define ALLOW_MSVC6_WITHOUT_PSDK 1
/* sys/timeval.h work-arounds */
#define _SUSECONDS_T_DECLARED
#define _TIME_T_DECLARED
#define _TIMEVAL_DEFINED
/* avoid sys/select.h */
#define _SYS_SELECT_H
/* avoid sys/types.h */
#define _SYS_TYPES_H
#if 0
#define _STDIO_H_
typedef void *FILE;
/* these don't actually exist */
#define stdin NULL
#define stdout NULL
#define stderr NULL
#define fwrite NULL
#define fread NULL
#else
typedef long long off_t;
typedef unsigned int clock_t;
#endif
#define USHRT_MAX UINT16_MAX
#define INT_MAX INT32_MAX
#define UINT_MAX UINT32_MAX
#define LONG_MAX INT32_MAX /* ? */
#define LONG_MIN INT32_MIN /* ? */
#define PF_UNSPEC AF_UNSPEC
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
#endif /* CURL_CONFIG_MICRIUM_H */

View file

@ -84,7 +84,6 @@
#include "curl_memory.h"
#include "memdebug.h"
/*
* Curl_timeleft() returns the amount of milliseconds left allowed for the
* transfer/connection. If the value is 0, there's no timeout (ie there's

View file

@ -84,10 +84,18 @@
#else /* HAVE_CONFIG_H */
#ifdef MICRIUM
#include "config-micrium.h"
#endif
#ifdef FreeRTOS
#include "config-freertos.h"
#endif
#ifdef _WIN32_WCE
# include "config-win32ce.h"
#else
# ifdef WIN32
# if defined(WIN32) && !defined(FreeRTOS)
# include "config-win32.h"
# endif
#endif
@ -583,7 +591,7 @@
* Mutually exclusive CURLRES_* definitions.
*/
#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO)
#if defined(HAVE_GETADDRINFO)
# define CURLRES_IPV6
#else
# define CURLRES_IPV4

View file

@ -138,7 +138,8 @@ struct timeval {
#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
(RECV_TYPE_ARG2)(y), \
(RECV_TYPE_ARG3)(z))
#elif defined(FreeRTOS)
#define sread(a,b,c) FreeRTOS_recv(a,b,c,0)
#elif defined(HAVE_RECV)
/*
* The definitions for the return type and arguments types
@ -174,12 +175,14 @@ struct timeval {
#endif
#endif /* HAVE_RECV */
#if defined(__minix)
/* Minix doesn't support send on TCP sockets */
#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \
(SEND_TYPE_ARG2)(y), \
(SEND_TYPE_ARG3)(z))
#elif defined(FreeRTOS)
/* The flags argument (4) marked as 'Not currently used' */
#define swrite(a,b,c) FreeRTOS_send(a,b,c,0)
#elif defined(HAVE_SEND)
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
@ -207,6 +210,8 @@ struct timeval {
# define sclose(x) close_s((x))
#elif defined(USE_LWIPSOCK)
# define sclose(x) lwip_close((x))
#elif defined(FreeRTOS)
# define sclose(x) FreeRTOS_closesocket((x))
#else
# define sclose(x) close((x))
#endif

View file

@ -354,7 +354,7 @@ static size_t hash_fd(void *key, size_t key_length, size_t slots_num)
curl_socket_t fd = *((curl_socket_t *) key);
(void) key_length;
return (fd % slots_num);
return ((long)fd % slots_num); /* weirdo FreeRTOS hack */
}
/*
@ -1087,8 +1087,8 @@ static int multi_getsock(struct Curl_easy *data,
}
CURLMcode curl_multi_fdset(struct Curl_multi *multi,
fd_set *read_fd_set, fd_set *write_fd_set,
fd_set *exc_fd_set, int *max_fd)
curl_fd_set *read_fd_set, curl_fd_set *write_fd_set,
curl_fd_set *exc_fd_set, int *max_fd)
{
/* Scan through all the easy handles to get the file descriptors set.
Some easy handles may not have connected to the remote host yet,
@ -1121,21 +1121,23 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi,
if(!FDSET_SOCK(sockbunch[i]))
/* pretend it doesn't exist */
continue;
FD_SET(sockbunch[i], read_fd_set);
CURL_FD_SET(sockbunch[i], read_fd_set, eSELECT_READ);
s = sockbunch[i];
}
if((bitmap & GETSOCK_WRITESOCK(i)) && VALID_SOCK(sockbunch[i])) {
if(!FDSET_SOCK(sockbunch[i]))
/* pretend it doesn't exist */
continue;
FD_SET(sockbunch[i], write_fd_set);
CURL_FD_SET(sockbunch[i], write_fd_set, eSELECT_WRITE);
s = sockbunch[i];
}
if(s == CURL_SOCKET_BAD)
/* this socket is unused, break out of loop */
break;
#ifndef FreeRTOS
if((int)s > this_max_fd)
this_max_fd = (int)s;
#endif
}
data = data->next; /* check next handle */
@ -1180,8 +1182,8 @@ static CURLMcode multi_wait(struct Curl_multi *multi,
unsigned int curlfds;
long timeout_internal;
int retcode = 0;
struct pollfd a_few_on_stack[NUM_POLLS_ON_STACK];
struct pollfd *ufds = &a_few_on_stack[0];
struct curl_pollfd a_few_on_stack[NUM_POLLS_ON_STACK];
struct curl_pollfd *ufds = &a_few_on_stack[0];
bool ufds_malloc = FALSE;
#ifdef USE_WINSOCK
WSANETWORKEVENTS wsa_events;

View file

@ -122,9 +122,9 @@ int Curl_wait_ms(timediff_t timeout_ms)
* N = number of signalled file descriptors
*/
static int our_select(curl_socket_t maxfd, /* highest socket number */
fd_set *fds_read, /* sockets ready for reading */
fd_set *fds_write, /* sockets ready for writing */
fd_set *fds_err, /* sockets with errors */
curl_fd_set *fds_read, /* sockets ready for reading */
curl_fd_set *fds_write, /* sockets ready for writing */
curl_fd_set *fds_err, /* sockets with errors */
timediff_t timeout_ms) /* milliseconds to wait */
{
struct timeval pending_tv;
@ -159,6 +159,13 @@ static int our_select(curl_socket_t maxfd, /* highest socket number */
fds_read && fds_read->fd_count ? fds_read : NULL,
fds_write && fds_write->fd_count ? fds_write : NULL,
fds_err && fds_err->fd_count ? fds_err : NULL, ptimeout);
#elif defined(FreeRTOS)
{
/* convert the timeout to FreeRTOS ticks */
TickType_t ticks = ptimeout ? ptimeout->tv_sec * configTICK_RATE_HZ : +
(ptimeout->tv_usec * configTICK_RATE_HZ) / 1000000;
return FreeRTOS_select(fds_read, ticks);
}
#else
return select((int)maxfd + 1, fds_read, fds_write, fds_err, ptimeout);
#endif
@ -274,9 +281,9 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
#ifdef HAVE_POLL_FINE
int pending_ms;
#else
fd_set fds_read;
fd_set fds_write;
fd_set fds_err;
curl_fd_set fds_read;
curl_fd_set fds_write;
curl_fd_set fds_err;
curl_socket_t maxfd;
#endif
bool fds_none = TRUE;

View file

@ -88,7 +88,11 @@ int Curl_wait_ms(timediff_t timeout_ms);
With Winsock the valid range is [0..INVALID_SOCKET-1] according to
https://docs.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2
*/
#ifdef USE_WINSOCK
#if defined(FreeRTOS)
#define VALID_SOCK(x) 1
#define VERIFY_SOCK(x) Curl_nop_stmt
#define FDSET_SOCK(x) 1
#elif defined(USE_WINSOCK)
#define VALID_SOCK(s) ((s) < INVALID_SOCKET)
#define FDSET_SOCK(x) 1
#define VERIFY_SOCK(x) do { \

View file

@ -27,6 +27,7 @@
/* This file is for lib internal stuff */
#include "curl_setup.h"
#include <curl/curl.h>
#define PORT_FTP 21
#define PORT_FTPS 990