mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
plat: baremetal and rpi pico support
This commit is contained in:
parent
65f16d737e
commit
135234bd39
17 changed files with 224 additions and 74 deletions
|
@ -22,7 +22,11 @@
|
|||
# IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
if (PICO_SDK_PATH)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
else()
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
endif()
|
||||
include(CheckFunctionExists)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckIncludeFile)
|
||||
|
@ -30,6 +34,10 @@ include(CheckIncludeFiles)
|
|||
include(CheckLibraryExists)
|
||||
include(CheckTypeSize)
|
||||
include(CheckCSourceCompiles)
|
||||
if (PICO_SDK_PATH)
|
||||
include(cmake/pico_sdk_import.cmake)
|
||||
endif()
|
||||
|
||||
|
||||
if (POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
|
@ -66,6 +74,10 @@ endif()
|
|||
project(libwebsockets C CXX)
|
||||
include(CTest)
|
||||
|
||||
if (PICO_SDK_PATH)
|
||||
pico_sdk_init()
|
||||
endif()
|
||||
|
||||
if (ESP_PLATFORM)
|
||||
include_directories(
|
||||
$ENV{IDF_PATH}/components/esp_hw_support/include/soc/
|
||||
|
@ -221,6 +233,7 @@ option(LWS_WITH_ESP32 "Build for ESP32" OFF)
|
|||
option(LWS_PLAT_OPTEE "Build for OPTEE" OFF)
|
||||
option(LWS_PLAT_FREERTOS "Build for FreeRTOS" OFF)
|
||||
option(LWS_PLAT_ANDROID "Android flavour of unix platform" OFF)
|
||||
option(LWS_PLAT_BAREMETAL "Build for deeply embedded baremetal" OFF)
|
||||
|
||||
#
|
||||
# Client / Server / Test Apps build control
|
||||
|
@ -557,6 +570,10 @@ CHECK_C_SOURCE_COMPILES(
|
|||
int main(int argc, char **argv) { return (int)malloc_usable_size((void *)0); }
|
||||
" LWS_HAVE_MALLOC_USABLE_SIZE)
|
||||
|
||||
if (PICO_SDK_PATH)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "-Dxxexit=exit")
|
||||
endif()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(fork LWS_HAVE_FORK)
|
||||
CHECK_FUNCTION_EXISTS(getenv LWS_HAVE_GETENV)
|
||||
CHECK_FUNCTION_EXISTS(malloc LWS_HAVE_MALLOC)
|
||||
|
@ -583,6 +600,26 @@ CHECK_FUNCTION_EXISTS(getgrnam_r LWS_HAVE_GETGRNAM_R)
|
|||
CHECK_FUNCTION_EXISTS(getpwuid_r LWS_HAVE_GETPWUID_R)
|
||||
CHECK_FUNCTION_EXISTS(getpwnam_r LWS_HAVE_GETPWNAM_R)
|
||||
CHECK_FUNCTION_EXISTS(timegm LWS_HAVE_TIMEGM)
|
||||
CHECK_C_SOURCE_COMPILES("#include <malloc.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_IN6ADDR_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <memory.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_MEMORY_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <netinet/in.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_NETINET_IN_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <stdint.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_STDINT_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <stdlib.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_STDLIB_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <strings.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_STRINGS_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <string.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_STRING_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/prctl.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_SYS_PRCTL_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/socket.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_SYS_SOCKET_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/sockio.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_SYS_SOCKIO_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/stat.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_SYS_STAT_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/types.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_SYS_TYPES_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <unistd.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_UNISTD_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <vfork.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_VFORK_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/capability.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_SYS_CAPABILITY_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <malloc.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_MALLOC_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <pthread.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_PTHREAD_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <inttypes.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_INTTYPES_H)
|
||||
CHECK_C_SOURCE_COMPILES("#include <sys/resource.h>\nvoid main(void) { while(1) ; } void xxexit(void){}" LWS_HAVE_SYS_RESOURCE_H)
|
||||
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
if(CMAKE_OSX_DEPLOYMENT_TARGET LESS "10.12")
|
||||
|
@ -623,26 +660,6 @@ if (LWS_WITH_PLUGINS_API AND UNIX AND CMAKE_DL_LIBS AND NOT (${CMAKE_SYSTEM_NAME
|
|||
endif()
|
||||
|
||||
|
||||
CHECK_INCLUDE_FILE(in6addr.h LWS_HAVE_IN6ADDR_H)
|
||||
CHECK_INCLUDE_FILE(memory.h LWS_HAVE_MEMORY_H)
|
||||
CHECK_INCLUDE_FILE(netinet/in.h LWS_HAVE_NETINET_IN_H)
|
||||
CHECK_INCLUDE_FILE(stdint.h LWS_HAVE_STDINT_H)
|
||||
CHECK_INCLUDE_FILE(stdlib.h LWS_HAVE_STDLIB_H)
|
||||
CHECK_INCLUDE_FILE(strings.h LWS_HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE(string.h LWS_HAVE_STRING_H)
|
||||
CHECK_INCLUDE_FILE(sys/prctl.h LWS_HAVE_SYS_PRCTL_H)
|
||||
CHECK_INCLUDE_FILE(sys/socket.h LWS_HAVE_SYS_SOCKET_H)
|
||||
CHECK_INCLUDE_FILE(sys/sockio.h LWS_HAVE_SYS_SOCKIO_H)
|
||||
CHECK_INCLUDE_FILE(sys/stat.h LWS_HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE(sys/types.h LWS_HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE(unistd.h LWS_HAVE_UNISTD_H)
|
||||
CHECK_INCLUDE_FILE(vfork.h LWS_HAVE_VFORK_H)
|
||||
CHECK_INCLUDE_FILE(sys/capability.h LWS_HAVE_SYS_CAPABILITY_H)
|
||||
CHECK_INCLUDE_FILE(malloc.h LWS_HAVE_MALLOC_H)
|
||||
CHECK_INCLUDE_FILE(pthread.h LWS_HAVE_PTHREAD_H)
|
||||
CHECK_INCLUDE_FILE(inttypes.h LWS_HAVE_INTTYPES_H)
|
||||
CHECK_INCLUDE_FILE(sys/resource.h LWS_HAVE_SYS_RESOURCE_H)
|
||||
|
||||
if (WIN32 OR MSVC)
|
||||
CHECK_C_SOURCE_COMPILES("#include <winsock2.h>
|
||||
#include <afunix.h>
|
||||
|
@ -795,6 +812,10 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG)
|
|||
set(CMAKE_C_FLAGS "-Wall -Wsign-compare ${VISIBILITY_FLAG} ${GCOV_FLAGS} ${CMAKE_C_FLAGS}" )
|
||||
endif()
|
||||
|
||||
if (PICO_SDK_PATH)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wconversion -Wsign-compare -Wstrict-aliasing -Wundef -nolibc")
|
||||
endif()
|
||||
|
||||
if ("${DISABLE_WERROR}" STREQUAL "OFF")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
endif()
|
||||
|
@ -992,6 +1013,10 @@ if (NOT LWS_WITH_PLUGINS_BUILTIN)
|
|||
add_subdirectory(plugins)
|
||||
endif()
|
||||
add_subdirectory(lwsws)
|
||||
if (PICO_SDK_PATH)
|
||||
link_libraries(pico_stdlib PRIVATE)
|
||||
endif()
|
||||
|
||||
|
||||
# Generate the lws_config.h that includes all the public compilation settings.
|
||||
configure_file(
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
#cmakedefine LWS_HAVE_SSL_SESSION_up_ref
|
||||
#cmakedefine LWS_HAVE__STAT32I64
|
||||
#cmakedefine LWS_HAVE_STDINT_H
|
||||
#cmakedefine LWS_HAVE_SYS_TYPES_H
|
||||
#cmakedefine LWS_HAVE_SYS_CAPABILITY_H
|
||||
#cmakedefine LWS_HAVE_TIMEGM
|
||||
#cmakedefine LWS_HAVE_TLS_CLIENT_METHOD
|
||||
|
@ -122,6 +123,7 @@
|
|||
#cmakedefine LWS_PLAT_OPTEE
|
||||
#cmakedefine LWS_PLAT_UNIX
|
||||
#cmakedefine LWS_PLAT_FREERTOS
|
||||
#cmakedefine LWS_PLAT_BAREMETAL
|
||||
#cmakedefine LWS_ROLE_CGI
|
||||
#cmakedefine LWS_ROLE_DBUS
|
||||
#cmakedefine LWS_ROLE_H1
|
||||
|
@ -237,4 +239,5 @@
|
|||
#cmakedefine LWS_WITH_LIBUV_INTERNAL
|
||||
#cmakedefine LWS_WITH_PLUGINS_API
|
||||
#cmakedefine LWS_HAVE_RTA_PREF
|
||||
#cmakedefine PICO_SDK_PATH
|
||||
|
||||
|
|
|
@ -92,11 +92,11 @@
|
|||
*/
|
||||
#undef LT_OBJDIR // We're not using libtool
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#cmakedefine malloc
|
||||
///* Define to rpl_malloc if the replacement function should be used. */
|
||||
//#cmakedefine malloc
|
||||
|
||||
/* Define to rpl_realloc if the replacement function should be used. */
|
||||
#cmakedefine realloc
|
||||
//#cmakedefine realloc
|
||||
|
||||
/* Define to 1 if we have getifaddrs */
|
||||
#cmakedefine LWS_HAVE_GETIFADDRS
|
||||
|
|
62
cmake/pico_sdk_import.cmake
Normal file
62
cmake/pico_sdk_import.cmake
Normal file
|
@ -0,0 +1,62 @@
|
|||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG master
|
||||
)
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
FetchContent_Populate(pico_sdk)
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
|
@ -36,10 +36,16 @@ extern "C" {
|
|||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include "lws_config.h"
|
||||
|
||||
#ifdef LWS_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lws_config.h"
|
||||
|
||||
#if defined(LWS_SUPPRESS_DEPRECATED_API_WARNINGS)
|
||||
#define OPENSSL_USE_DEPRECATED
|
||||
|
@ -153,7 +159,7 @@ typedef int suseconds_t;
|
|||
#define LWS_O_CREAT O_CREAT
|
||||
#define LWS_O_TRUNC O_TRUNC
|
||||
|
||||
#if !defined(LWS_PLAT_OPTEE) && !defined(OPTEE_TA) && !defined(LWS_PLAT_FREERTOS)
|
||||
#if !defined(LWS_PLAT_OPTEE) && !defined(OPTEE_TA) && !defined(LWS_PLAT_FREERTOS) && !defined(LWS_PLAT_BAREMETAL)
|
||||
#include <poll.h>
|
||||
#include <netdb.h>
|
||||
#define LWS_INVALID_FILE -1
|
||||
|
@ -562,6 +568,25 @@ struct lws_pollargs {
|
|||
int prev_events; /**< the previous event mask */
|
||||
};
|
||||
|
||||
#if !defined(LWS_SIZEOFPTR)
|
||||
#define LWS_SIZEOFPTR ((int)sizeof (void *))
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#define _LWS_PAD_SIZE 16 /* Intel recommended for best performance */
|
||||
#else
|
||||
#define _LWS_PAD_SIZE LWS_SIZEOFPTR /* Size of a pointer on the target arch */
|
||||
#endif
|
||||
#define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ? \
|
||||
((n) + (_LWS_PAD_SIZE - ((n) % _LWS_PAD_SIZE))) : (n))
|
||||
/* last 2 is for lws-meta */
|
||||
#define LWS_PRE _LWS_PAD(4 + 10 + 2)
|
||||
/* used prior to 1.7 and retained for backward compatibility */
|
||||
#define LWS_SEND_BUFFER_PRE_PADDING LWS_PRE
|
||||
#define LWS_SEND_BUFFER_POST_PADDING 0
|
||||
|
||||
|
||||
|
||||
struct lws_extension; /* needed even with ws exts disabled for create context */
|
||||
struct lws_token_limits;
|
||||
struct lws_protocols;
|
||||
|
@ -581,18 +606,23 @@ struct lws;
|
|||
#endif
|
||||
#include <libwebsockets/lws-state.h>
|
||||
#include <libwebsockets/lws-retry.h>
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
#include <libwebsockets/lws-adopt.h>
|
||||
#include <libwebsockets/lws-network-helper.h>
|
||||
#include <libwebsockets/lws-metrics.h>
|
||||
#endif
|
||||
|
||||
#include <libwebsockets/lws-system.h>
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
#include <libwebsockets/lws-ws-close.h>
|
||||
#include <libwebsockets/lws-callbacks.h>
|
||||
#include <libwebsockets/lws-ws-state.h>
|
||||
#include <libwebsockets/lws-ws-ext.h>
|
||||
#include <libwebsockets/lws-protocols-plugins.h>
|
||||
|
||||
#endif
|
||||
#include <libwebsockets/lws-context-vhost.h>
|
||||
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
#if defined(LWS_WITH_CONMON)
|
||||
#include <libwebsockets/lws-conmon.h>
|
||||
#endif
|
||||
|
@ -603,16 +633,21 @@ struct lws;
|
|||
#include <libwebsockets/lws-client.h>
|
||||
#include <libwebsockets/lws-http.h>
|
||||
#include <libwebsockets/lws-spa.h>
|
||||
#endif
|
||||
#include <libwebsockets/lws-purify.h>
|
||||
#include <libwebsockets/lws-misc.h>
|
||||
#include <libwebsockets/lws-dsh.h>
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
#include <libwebsockets/lws-service.h>
|
||||
#include <libwebsockets/lws-write.h>
|
||||
#include <libwebsockets/lws-writeable.h>
|
||||
#endif
|
||||
#include <libwebsockets/lws-ring.h>
|
||||
#include <libwebsockets/lws-sha1-base64.h>
|
||||
#include <libwebsockets/lws-x509.h>
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
#include <libwebsockets/lws-cgi.h>
|
||||
#endif
|
||||
#if defined(LWS_WITH_FILE_OPS)
|
||||
#include <libwebsockets/lws-vfs.h>
|
||||
#endif
|
||||
|
@ -662,7 +697,9 @@ struct lws;
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
#include <libwebsockets/lws-eventlib-exports.h>
|
||||
#endif
|
||||
#include <libwebsockets/lws-i2c.h>
|
||||
#include <libwebsockets/lws-spi.h>
|
||||
#include <libwebsockets/lws-gpio.h>
|
||||
|
@ -675,8 +712,9 @@ struct lws;
|
|||
#include <libwebsockets/lws-ssd1306-i2c.h>
|
||||
#include <libwebsockets/lws-ili9341-spi.h>
|
||||
#include <libwebsockets/lws-settings.h>
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
#include <libwebsockets/lws-netdev.h>
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -255,9 +255,11 @@ struct lws_metric_policy;
|
|||
|
||||
typedef int (*lws_context_ready_cb_t)(struct lws_context *context);
|
||||
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
typedef int (*lws_peer_limits_notify_t)(struct lws_context *ctx,
|
||||
lws_sockfd_type sockfd,
|
||||
lws_sockaddr46 *sa46);
|
||||
#endif
|
||||
|
||||
/** struct lws_context_creation_info - parameters to create context and /or vhost with
|
||||
*
|
||||
|
|
|
@ -133,13 +133,16 @@ LWS_VISIBLE LWS_EXTERN struct lws_log_cx *
|
|||
lwsl_wsi_get_cx(struct lws *wsi);
|
||||
#if defined(LWS_WITH_SECURE_STREAMS)
|
||||
struct lws_ss_handle;
|
||||
struct lws_sspc_handle;
|
||||
LWS_VISIBLE LWS_EXTERN struct lws_log_cx *
|
||||
lwsl_ss_get_cx(struct lws_ss_handle *ss);
|
||||
#endif
|
||||
#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)
|
||||
struct lws_sspc_handle;
|
||||
LWS_VISIBLE LWS_EXTERN struct lws_log_cx *
|
||||
lwsl_sspc_get_cx(struct lws_sspc_handle *ss);
|
||||
#endif
|
||||
|
||||
|
||||
LWS_VISIBLE LWS_EXTERN void
|
||||
lws_log_emit_cx_file(struct lws_log_cx *cx, int level, const char *line,
|
||||
size_t len);
|
||||
|
@ -156,6 +159,8 @@ lws_log_prepend_wsi(struct lws_log_cx *cx, void *obj, char **p, char *e);
|
|||
#if defined(LWS_WITH_SECURE_STREAMS)
|
||||
LWS_VISIBLE LWS_EXTERN void
|
||||
lws_log_prepend_ss(struct lws_log_cx *cx, void *obj, char **p, char *e);
|
||||
#endif
|
||||
#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)
|
||||
LWS_VISIBLE LWS_EXTERN void
|
||||
lws_log_prepend_sspc(struct lws_log_cx *cx, void *obj, char **p, char *e);
|
||||
#endif
|
||||
|
|
|
@ -265,7 +265,9 @@ lws_sspc_proxy_create(struct lws_context *context);
|
|||
LWS_VISIBLE LWS_EXTERN struct lws_context *
|
||||
lws_sspc_get_context(struct lws_sspc_handle *h);
|
||||
|
||||
LWS_VISIBLE extern const struct lws_protocols lws_sspc_protocols[2];
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
extern const struct lws_protocols lws_sspc_protocols[2];
|
||||
#endif
|
||||
|
||||
LWS_VISIBLE LWS_EXTERN const char *
|
||||
lws_sspc_rideshare(struct lws_sspc_handle *h);
|
||||
|
|
|
@ -187,11 +187,12 @@ typedef struct lws_system_ops {
|
|||
* by calling lws_captive_portal_detect_result() api
|
||||
*/
|
||||
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
int (*metric_report)(lws_metric_pub_t *mdata);
|
||||
/**< metric \p item is reporting an event of kind \p rpt,
|
||||
* held in \p mdata... return 0 to leave the metric object as it is,
|
||||
* or nonzero to reset it. */
|
||||
|
||||
#endif
|
||||
int (*jit_trust_query)(struct lws_context *cx, const uint8_t *skid,
|
||||
size_t skid_len, void *got_opaque);
|
||||
/**< user defined trust store search, if we do trust a cert with SKID
|
||||
|
@ -309,6 +310,7 @@ enum {
|
|||
_LWSDH_SA46_COUNT,
|
||||
};
|
||||
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
typedef struct lws_dhcpc_ifstate {
|
||||
char ifname[16];
|
||||
char domain[64];
|
||||
|
@ -397,3 +399,6 @@ lws_system_cpd_set(struct lws_context *context, lws_cpd_result_t result);
|
|||
*/
|
||||
LWS_EXTERN LWS_VISIBLE lws_cpd_result_t
|
||||
lws_system_cpd_state_get(struct lws_context *context);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -27,23 +27,6 @@
|
|||
APIs related to writing data on a connection
|
||||
*/
|
||||
//@{
|
||||
#if !defined(LWS_SIZEOFPTR)
|
||||
#define LWS_SIZEOFPTR ((int)sizeof (void *))
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#define _LWS_PAD_SIZE 16 /* Intel recommended for best performance */
|
||||
#else
|
||||
#define _LWS_PAD_SIZE LWS_SIZEOFPTR /* Size of a pointer on the target arch */
|
||||
#endif
|
||||
#define _LWS_PAD(n) (((n) % _LWS_PAD_SIZE) ? \
|
||||
((n) + (_LWS_PAD_SIZE - ((n) % _LWS_PAD_SIZE))) : (n))
|
||||
/* last 2 is for lws-meta */
|
||||
#define LWS_PRE _LWS_PAD(4 + 10 + 2)
|
||||
/* used prior to 1.7 and retained for backward compatibility */
|
||||
#define LWS_SEND_BUFFER_PRE_PADDING LWS_PRE
|
||||
#define LWS_SEND_BUFFER_POST_PADDING 0
|
||||
|
||||
#define LWS_WRITE_RAW LWS_WRITE_HTTP
|
||||
|
||||
/*
|
||||
|
|
|
@ -74,13 +74,17 @@ if (LWS_PLAT_FREERTOS)
|
|||
endif()
|
||||
|
||||
else()
|
||||
if (LWS_PLAT_OPTEE)
|
||||
add_subdir_include_dirs(plat/optee)
|
||||
if (LWS_PLAT_BAREMETAL)
|
||||
add_subdir_include_dirs(plat/baremetal)
|
||||
else()
|
||||
if (WIN32)
|
||||
add_subdir_include_dirs(plat/windows)
|
||||
if (LWS_PLAT_OPTEE)
|
||||
add_subdir_include_dirs(plat/optee)
|
||||
else()
|
||||
add_subdir_include_dirs(plat/unix)
|
||||
if (WIN32)
|
||||
add_subdir_include_dirs(plat/windows)
|
||||
else()
|
||||
add_subdir_include_dirs(plat/unix)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -403,8 +403,9 @@ lws_create_context(const struct lws_context_creation_info *info)
|
|||
#endif
|
||||
size = sizeof(struct lws_context);
|
||||
#endif
|
||||
|
||||
#if !defined(LWS_PLAT_BAREMETAL)
|
||||
int n;
|
||||
#endif
|
||||
unsigned int lpf = info->fd_limit_per_thread;
|
||||
#if defined(LWS_WITH_EVLIB_PLUGINS) && defined(LWS_WITH_EVENT_LIBS)
|
||||
struct lws_plugin *evlib_plugin_list = NULL;
|
||||
|
@ -921,7 +922,7 @@ lws_create_context(const struct lws_context_creation_info *info)
|
|||
|
||||
context->options = info->options;
|
||||
|
||||
#if !defined(LWS_PLAT_FREERTOS) && !defined(LWS_PLAT_OPTEE) && !defined(WIN32)
|
||||
#if !defined(LWS_PLAT_FREERTOS) && !defined(LWS_PLAT_OPTEE) && !defined(WIN32) && !defined(LWS_PLAT_BAREMETAL)
|
||||
/*
|
||||
* If asked, try to set the rlimit / ulimit for process sockets / files.
|
||||
* We read the effective limit in a moment, so we will find out the
|
||||
|
@ -1072,7 +1073,9 @@ lws_create_context(const struct lws_context_creation_info *info)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(LWS_PLAT_BAREMETAL)
|
||||
n = 0;
|
||||
#endif
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
|
||||
context->default_retry.retry_ms_table = default_backoff_table;
|
||||
|
|
|
@ -195,7 +195,7 @@ lws_hex_random(struct lws_context *context, char *dest, size_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(LWS_PLAT_OPTEE)
|
||||
#if !defined(LWS_PLAT_OPTEE) && !defined(LWS_PLAT_BAREMETAL)
|
||||
|
||||
#if defined(LWS_WITH_FILE_OPS)
|
||||
int lws_open(const char *__file, int __oflag, ...)
|
||||
|
|
|
@ -302,7 +302,7 @@ lwsl_emit_stderr_notimestamp(int level, const char *line)
|
|||
_lwsl_emit_stderr(level, line);
|
||||
}
|
||||
|
||||
#if !defined(LWS_PLAT_FREERTOS) && !defined(LWS_PLAT_OPTEE)
|
||||
#if !defined(LWS_PLAT_FREERTOS) && !defined(LWS_PLAT_OPTEE) && !defined(LWS_PLAT_BAREMETAL)
|
||||
|
||||
/*
|
||||
* Helper to emit to a file
|
||||
|
|
|
@ -40,6 +40,16 @@
|
|||
#endif
|
||||
*/
|
||||
|
||||
#ifdef LWS_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if !defined(PICO_SDK_PATH)
|
||||
#ifdef LWS_HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -49,15 +59,8 @@
|
|||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef LWS_HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef LWS_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if defined(LWS_HAVE_SYS_STAT_H) && !defined(LWS_PLAT_OPTEE)
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
@ -117,16 +120,19 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#if defined(LWS_PLAT_FREERTOS)
|
||||
#include "private-lib-plat-freertos.h"
|
||||
#if defined(LWS_PLAT_BAREMETAL)
|
||||
#else
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#include "private-lib-plat-windows.h"
|
||||
#if defined(LWS_PLAT_FREERTOS)
|
||||
#include "private-lib-plat-freertos.h"
|
||||
#else
|
||||
#if defined(LWS_PLAT_OPTEE)
|
||||
#include "private-lib-plat.h"
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#include "private-lib-plat-windows.h"
|
||||
#else
|
||||
#include "private-lib-plat-unix.h"
|
||||
#if defined(LWS_PLAT_OPTEE)
|
||||
#include "private-lib-plat.h"
|
||||
#else
|
||||
#include "private-lib-plat-unix.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@ -311,10 +317,14 @@ struct lws_ring {
|
|||
struct lws_protocols;
|
||||
struct lws;
|
||||
|
||||
#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)
|
||||
#include "private-lib-secure-streams.h"
|
||||
#endif
|
||||
|
||||
#if defined(LWS_WITH_NETWORK) /* network */
|
||||
#include "private-lib-event-libs.h"
|
||||
|
||||
#if defined(LWS_WITH_SECURE_STREAMS)
|
||||
#if defined(LWS_WITH_SECURE_STREAMS) || defined(LWS_WITH_SECURE_STREAMS_PROXY_API)
|
||||
#include "private-lib-secure-streams.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ if (LWS_WITH_FSMOUNT AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|||
list(APPEND SOURCES misc/fsmount.c)
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_DIR)
|
||||
if (LWS_WITH_DIR AND NOT LWS_PLAT_BAREMETAL)
|
||||
list(APPEND SOURCES misc/dir.c)
|
||||
endif()
|
||||
|
||||
|
@ -92,7 +92,7 @@ endif()
|
|||
if (LWS_WITH_LWSAC)
|
||||
list(APPEND SOURCES
|
||||
misc/lwsac/lwsac.c)
|
||||
if (NOT LWS_PLAT_FREERTOS)
|
||||
if (NOT LWS_PLAT_FREERTOS AND NOT LWS_PLAT_BAREMETAL)
|
||||
list(APPEND SOURCES
|
||||
misc/lwsac/cached-file.c)
|
||||
endif()
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if !defined(__LWS_PRIVATE_SS_H__)
|
||||
#define __LWS_PRIVATE_SS_H__
|
||||
|
||||
/* current SS Serialization protocol version */
|
||||
#define LWS_SSS_CLIENT_PROTOCOL_VERSION 1
|
||||
|
||||
|
@ -560,14 +563,18 @@ lws_ss_assert_extant(struct lws_context *cx, int tsi, struct lws_ss_handle *h);
|
|||
#define lws_ss_assert_extant(_a, _b, _c)
|
||||
#endif
|
||||
|
||||
#if defined(LWS_WITH_SECURE_STREAMS)
|
||||
typedef int (* const secstream_protocol_connect_munge_t)(lws_ss_handle_t *h,
|
||||
char *buf, size_t len, struct lws_client_connect_info *i,
|
||||
union lws_ss_contemp *ct);
|
||||
#endif
|
||||
|
||||
typedef int (* const secstream_protocol_add_txcr_t)(lws_ss_handle_t *h, int add);
|
||||
|
||||
typedef int (* const secstream_protocol_get_txcr_t)(lws_ss_handle_t *h);
|
||||
|
||||
#if defined(LWS_WITH_SECURE_STREAMS)
|
||||
|
||||
struct ss_pcols {
|
||||
const char *name;
|
||||
const char *alpn;
|
||||
|
@ -576,6 +583,7 @@ struct ss_pcols {
|
|||
secstream_protocol_add_txcr_t tx_cr_add;
|
||||
secstream_protocol_get_txcr_t tx_cr_est;
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Because both sides of the connection share the conn, we allocate it
|
||||
|
|
Loading…
Add table
Reference in a new issue