mirror of
https://github.com/curl/curl.git
synced 2026-04-19 21:31:14 +03:00
tiny-curl: base and FreeRTOS support
This commit is contained in:
parent
9d954e49bc
commit
ceda8d10ea
17 changed files with 1430 additions and 67 deletions
|
|
@ -54,9 +54,11 @@
|
|||
#include <osreldate.h>
|
||||
#endif
|
||||
|
||||
#ifndef CURL_AVOID_SYS_TYPES_H
|
||||
/* The include stuff here below is mainly for time_t! */
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if defined(CURL_WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
|
||||
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || \
|
||||
|
|
@ -79,11 +81,13 @@
|
|||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#if !defined(CURL_WIN32) && !defined(_WIN32_WCE)
|
||||
#if !defined(CURL_WIN32) && !defined(_WIN32_WCE) && \
|
||||
!defined(CURL_AVOID_SYS_SOCKET_H)
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if !defined(CURL_WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
|
||||
#if !defined(CURL_WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) && \
|
||||
!defined(CURL_AVOID_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -130,7 +134,10 @@ typedef void CURLSH;
|
|||
|
||||
#ifndef curl_socket_typedef
|
||||
/* socket typedef */
|
||||
#if defined(CURL_WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
|
||||
#ifdef FreeRTOS
|
||||
typedef Socket_t curl_socket_t;
|
||||
#define CURL_SOCKET_BAD FREERTOS_INVALID_SOCKET
|
||||
#elif defined(CURL_WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
|
||||
typedef SOCKET curl_socket_t;
|
||||
#define CURL_SOCKET_BAD INVALID_SOCKET
|
||||
#else
|
||||
|
|
@ -408,7 +415,7 @@ struct curl_sockaddr {
|
|||
unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
|
||||
turned really ugly and painful on the systems that
|
||||
lack this type */
|
||||
struct sockaddr addr;
|
||||
struct curl_struct_sockaddr addr;
|
||||
};
|
||||
|
||||
typedef curl_socket_t
|
||||
|
|
|
|||
|
|
@ -156,9 +156,9 @@ CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
|||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
fd_set *exc_fd_set,
|
||||
curl_fd_set *read_fd_set,
|
||||
curl_fd_set *write_fd_set,
|
||||
curl_fd_set *exc_fd_set,
|
||||
int *max_fd);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -348,6 +348,27 @@
|
|||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
#elif defined(FreeRTOS) /* Life on FreeRTOS */
|
||||
|
||||
#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_FREERTOS_SOCKETS_H 1
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T uint32_t
|
||||
# define CURL_AVOID_SYS_TYPES_H 1
|
||||
# define CURL_AVOID_SYS_SOCKET_H 1
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP MSVC THE PENULTIMATE ENTRY */
|
||||
/* ===================================== */
|
||||
|
|
@ -430,6 +451,29 @@
|
|||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FREERTOS_SOCKETS_H
|
||||
# include <FreeRTOS.h>
|
||||
# include <FreeRTOS_Sockets.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
/* for the base type etc */
|
||||
#include "portmacro.h"
|
||||
#define curl_fd_set_typedefed
|
||||
typedef SocketSet_t curl_fd_set;
|
||||
#define curl_struct_sockaddr freertos_sockaddr
|
||||
#define curl_setsockopt(a,b,c,d,e) FreeRTOS_setsockopt(a,b,c,d,e)
|
||||
#define curl_connect(a,b,c) FreeRTOS_connect(a,b,c)
|
||||
#define curl_bind(a,b,c) FreeRTOS_bind(a,b,c)
|
||||
#define curl_recv(a,b,c,d) FreeRTOS_recv(a,b,c,d)
|
||||
#define curl_socket(a,b,c) FreeRTOS_socket(a,b,c)
|
||||
/* not quite socket-style API */
|
||||
#define CURL_FD_SET(a,b,c) FreeRTOS_FD_SET(a,b,c)
|
||||
/* struct sockaddr "fix" */
|
||||
#define sa_family sin_family
|
||||
/* use our private pollfd struct alternative */
|
||||
#define curl_pollfd curl_waitfd
|
||||
#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
|
||||
|
|
@ -479,6 +523,38 @@
|
|||
#undef CURL_ISOCPP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For the standard systems
|
||||
*/
|
||||
#ifndef curl_struct_sockaddr
|
||||
#define curl_struct_sockaddr sockaddr
|
||||
#endif
|
||||
#ifndef curl_fd_set_typedefed
|
||||
#define curl_fd_set_typedefed
|
||||
typedef fd_set curl_fd_set;
|
||||
#endif
|
||||
#ifndef curl_pollfd
|
||||
#define curl_pollfd pollfd
|
||||
#endif
|
||||
#ifndef curl_setsockopt
|
||||
#define curl_setsockopt(a,b,c,d,e) setsockopt(a,b,c,d,e)
|
||||
#endif
|
||||
#ifndef curl_bind
|
||||
#define curl_bind(a,b,c) bind(a,b,c)
|
||||
#endif
|
||||
#ifndef curl_connect
|
||||
#define curl_connect(a,b,c) connect(a,b,c)
|
||||
#endif
|
||||
#ifndef curl_recv
|
||||
#define curl_recv(a,b,c,d) recv(a,b,c,d)
|
||||
#endif
|
||||
#ifndef curl_socket
|
||||
#define curl_socket(a,b,c) socket(a,b,c)
|
||||
#endif
|
||||
#ifndef CURL_FD_SET
|
||||
#define CURL_FD_SET(a,b,c) FD_SET(a,b)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue