From a0eb1f9c0c7dbbe12fb2e3ca563a17af956ea5d6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 14 Aug 2020 15:45:59 +0200 Subject: tiny-curl: Micrium support --- include/curl/system.h | 32 ++++ lib/Makefile.am | 2 +- lib/config-micrium.h | 439 ++++++++++++++++++++++++++++++++++++++++++++++++++ lib/curl_setup.h | 6 +- 4 files changed, 477 insertions(+), 2 deletions(-) create mode 100644 lib/config-micrium.h diff --git a/include/curl/system.h b/include/curl/system.h index 3ca918b38..8caa3faa6 100644 --- a/include/curl/system.h +++ b/include/curl/system.h @@ -369,6 +369,27 @@ # define CURL_AVOID_SYS_TYPES_H 1 # define CURL_AVOID_SYS_SOCKET_H 1 +#elif defined(MICRIUM) + +#if (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \ + (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L) +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +#else +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T CPU_INT32S +# define CURL_AVOID_SYS_TYPES_H 1 +# define CURL_AVOID_SYS_SOCKET_H 1 +# define CURL_AVOID_SYS_TIME_H 1 + /* ===================================== */ /* KEEP MSVC THE PENULTIMATE ENTRY */ /* ===================================== */ @@ -472,8 +493,19 @@ typedef SocketSet_t curl_fd_set; #define sa_family sin_family /* use our private pollfd struct alternative */ #define curl_pollfd curl_waitfd +#elif defined(MICRIUM) +#include + +/* make use of the types from net_bsd.h */ +typedef _size_t size_t; +typedef _time_t time_t; + +#define curl_fd_set_typedefed +typedef struct fd_set curl_fd_set; + #endif + /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ /* sys/socket.h is required here to properly make type definitions below. */ #ifdef CURL_PULL_SYS_SOCKET_H diff --git a/lib/Makefile.am b/lib/Makefile.am index 6d8af1572..7fd82f3e9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -31,7 +31,7 @@ EXTRA_DIST = Makefile.m32 config-win32.h config-win32ce.h \ config-tpf.h mk-ca-bundle.pl mk-ca-bundle.vbs $(CMAKE_DIST) \ firefox-db2pem.sh config-vxworks.h Makefile.vxworks checksrc.pl \ setup-win32.h \ - config-freertos.h + config-freertos.h config-micrium.h lib_LTLIBRARIES = libcurl.la diff --git a/lib/config-micrium.h b/lib/config-micrium.h new file mode 100644 index 000000000..931978c74 --- /dev/null +++ b/lib/config-micrium.h @@ -0,0 +1,439 @@ +#ifndef CURL_CONFIG_MICRIUM_H +#define CURL_CONFIG_MICRIUM_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2020, Daniel Stenberg, , 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 . + * + ***************************************************************************/ + +#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 header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ + +/* Define to 1 if you have the header file. */ + +/* Define to 1 if you have the 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 header file. */ +#define HAVE_CYASSL_ERROR_SSL_H 1 + +/* Define to 1 if you have the 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 header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the gethostbyname function. */ +//#define HAVE_GETHOSTBYNAME 1 + +#define CURLRES_IPV6 + +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the 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 header file. */ +#define HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ + +/* Define to 1 if you have the header file. */ + +/* Define to 1 if you have the 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 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 header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the 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 header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the 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 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 header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_XATTR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIO_H 1 + +/* Define to 1 if you have the 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 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 + +//#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 and . */ +#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 */ diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 4abbefe3c..55c81b5be 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -68,6 +68,10 @@ #else /* HAVE_CONFIG_H */ +#ifdef MICRIUM +#include "config-micrium.h" +#endif + #ifdef FreeRTOS #include "config-freertos.h" #endif @@ -541,7 +545,7 @@ * Mutually exclusive CURLRES_* definitions. */ -#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO) +#if defined(HAVE_GETADDRINFO) # define CURLRES_IPV6 #else # define CURLRES_IPV4 -- cgit v1.2.1