CMake: convert all LWS_USE_... to LWS_WITH_...
Almost all the CMake options begin with LWS_WITH_..., but many of the symbols passed to lws are LWS_USE_... , this causes neededless confusion, compounded by the fact that a few CMake options also begin with LWS_USE_. This patch globally converts all LWS_USE_... to LWS_WITH_..., so there is only one prefix to remember in both CMake and the code. The affected public CMake options are LWS_USE_BORINGSSL -> LWS_WITH_BORINGSSL LWS_USE_CYASSL -> LWS_WITH_CYASSL LWS_USE_WOLFSSL -> LWS_WITH_WOLFSSL LWS_USE_MBEDTLS -> LWS_WITH_MBEDTLS LWS_USE_BUNDLED_ZLIB -> LWS_WITH_BUNDLED_ZLIB
This commit is contained in:
parent
7597ac3766
commit
fc995df480
27 changed files with 238 additions and 238 deletions
|
@ -61,23 +61,23 @@ if(GIT_EXECUTABLE)
|
|||
message("Git commit hash: ${LWS_BUILD_HASH}")
|
||||
endif()
|
||||
|
||||
set(LWS_USE_BUNDLED_ZLIB_DEFAULT OFF)
|
||||
set(LWS_WITH_BUNDLED_ZLIB_DEFAULT OFF)
|
||||
if(WIN32)
|
||||
set(LWS_USE_BUNDLED_ZLIB_DEFAULT ON)
|
||||
set(LWS_WITH_BUNDLED_ZLIB_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
option(LWS_WITH_STATIC "Build the static version of the library" ON)
|
||||
option(LWS_WITH_SHARED "Build the shared version of the library" ON)
|
||||
option(LWS_WITH_SSL "Include SSL support (default OpenSSL, wolfSSL if LWS_USE_WOLFSSL is set)" ON)
|
||||
option(LWS_USE_BORINGSSL "Use BoringSSL replacement for OpenSSL" OFF)
|
||||
option(LWS_USE_CYASSL "Use CyaSSL replacement for OpenSSL. When setting this, you also need to specify LWS_CYASSL_LIBRARIES and LWS_CYASSL_INCLUDE_DIRS" OFF)
|
||||
option(LWS_USE_WOLFSSL "Use wolfSSL replacement for OpenSSL. When setting this, you also need to specify LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS" OFF)
|
||||
option(LWS_USE_MBEDTLS "Use mbedTLS (>=2.0) replacement for OpenSSL. When setting this, you also need to specify LWS_MBEDTLS_LIBRARIES and LWS_MBEDTLS_INCLUDE_DIRS" OFF)
|
||||
option(LWS_WITH_SSL "Include SSL support (default OpenSSL, wolfSSL if LWS_WITH_WOLFSSL is set)" ON)
|
||||
option(LWS_WITH_BORINGSSL "Use BoringSSL replacement for OpenSSL" OFF)
|
||||
option(LWS_WITH_CYASSL "Use CyaSSL replacement for OpenSSL. When setting this, you also need to specify LWS_CYASSL_LIBRARIES and LWS_CYASSL_INCLUDE_DIRS" OFF)
|
||||
option(LWS_WITH_WOLFSSL "Use wolfSSL replacement for OpenSSL. When setting this, you also need to specify LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS" OFF)
|
||||
option(LWS_WITH_MBEDTLS "Use mbedTLS (>=2.0) replacement for OpenSSL. When setting this, you also need to specify LWS_MBEDTLS_LIBRARIES and LWS_MBEDTLS_INCLUDE_DIRS" OFF)
|
||||
option(LWS_WITH_ZLIB "Include zlib support (required for extensions)" ON)
|
||||
option(LWS_WITH_LIBEV "Compile with support for libev" OFF)
|
||||
option(LWS_WITH_LIBUV "Compile with support for libuv" OFF)
|
||||
option(LWS_WITH_LIBEVENT "Compile with support for libevent" OFF)
|
||||
option(LWS_USE_BUNDLED_ZLIB "Use bundled zlib version (Windows only)" ${LWS_USE_BUNDLED_ZLIB_DEFAULT})
|
||||
option(LWS_WITH_BUNDLED_ZLIB "Use bundled zlib version (Windows only)" ${LWS_WITH_BUNDLED_ZLIB_DEFAULT})
|
||||
option(LWS_SSL_CLIENT_USE_OS_CA_CERTS "SSL support should make use of the OS-installed CA root certs" ON)
|
||||
option(LWS_WITHOUT_BUILTIN_GETIFADDRS "Don't use the BSD getifaddrs implementation from libwebsockets if it is missing (this will result in a compilation error) ... The default is to assume that your libc provides it. On some systems such as uclibc it doesn't exist." OFF)
|
||||
option(LWS_WITHOUT_BUILTIN_SHA1 "Don't build the lws sha-1 (eg, because openssl will provide it" OFF)
|
||||
|
@ -184,7 +184,7 @@ if (LWS_WITH_ESP32)
|
|||
confirm_command(genromfs "install genromfs package")
|
||||
|
||||
set(LWS_WITH_SHARED OFF)
|
||||
set(LWS_USE_MBEDTLS ON)
|
||||
set(LWS_WITH_MBEDTLS ON)
|
||||
# set(LWS_WITHOUT_CLIENT ON)
|
||||
set(LWS_WITHOUT_TESTAPPS ON)
|
||||
set(LWS_WITHOUT_EXTENSIONS ON)
|
||||
|
@ -220,12 +220,12 @@ set(LWS_INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for hea
|
|||
set(LWS_INSTALL_EXAMPLES_DIR bin CACHE PATH "Installation directory for example files")
|
||||
|
||||
# Allow the user to use the old CyaSSL options/library in stead of wolfSSL
|
||||
if (LWS_USE_CYASSL AND LWS_USE_WOLFSSL)
|
||||
message(FATAL_ERROR "LWS_USE_CYASSL and LWS_USE_WOLFSSL are mutually exclusive!")
|
||||
if (LWS_WITH_CYASSL AND LWS_WITH_WOLFSSL)
|
||||
message(FATAL_ERROR "LWS_WITH_CYASSL and LWS_WITH_WOLFSSL are mutually exclusive!")
|
||||
endif()
|
||||
if (LWS_USE_CYASSL)
|
||||
if (LWS_WITH_CYASSL)
|
||||
# Copy CyaSSL options to the wolfSSL options
|
||||
set(LWS_USE_WOLFSSL ${LWS_USE_CYASSL} CACHE BOOL "Use wolfSSL/CyaSSL instead of OpenSSL" FORCE)
|
||||
set(LWS_WITH_WOLFSSL ${LWS_WITH_CYASSL} CACHE BOOL "Use wolfSSL/CyaSSL instead of OpenSSL" FORCE)
|
||||
set(LWS_WOLFSSL_LIBRARIES ${LWS_CYASSL_LIBRARIES} CACHE PATH "Path to wolfSSL/CyaSSL libraries" FORCE)
|
||||
set(LWS_WOLFSSL_INCLUDE_DIRS ${LWS_CYASSL_INCLUDE_DIRS} CACHE PATH "Path to wolfSSL/CyaSSL header files" FORCE)
|
||||
endif()
|
||||
|
@ -264,7 +264,7 @@ if (NOT LWS_WITH_SSL)
|
|||
set(LWS_WITHOUT_BUILTIN_SHA1 OFF)
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_SSL AND NOT LWS_USE_WOLFSSL AND NOT LWS_USE_MBEDTLS)
|
||||
if (LWS_WITH_SSL AND NOT LWS_WITH_WOLFSSL AND NOT LWS_WITH_MBEDTLS)
|
||||
if ("${LWS_OPENSSL_LIBRARIES}" STREQUAL "" OR "${LWS_OPENSSL_INCLUDE_DIRS}" STREQUAL "")
|
||||
else()
|
||||
if (NOT LWS_WITH_ESP32)
|
||||
|
@ -275,13 +275,13 @@ if (LWS_WITH_SSL AND NOT LWS_USE_WOLFSSL AND NOT LWS_USE_MBEDTLS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_SSL AND LWS_USE_WOLFSSL)
|
||||
if (LWS_WITH_SSL AND LWS_WITH_WOLFSSL)
|
||||
if ("${LWS_WOLFSSL_LIBRARIES}" STREQUAL "" OR "${LWS_WOLFSSL_INCLUDE_DIRS}" STREQUAL "")
|
||||
if (NOT WOLFSSL_FOUND)
|
||||
if (LWS_USE_CYASSL)
|
||||
message(FATAL_ERROR "You must set LWS_CYASSL_LIBRARIES and LWS_CYASSL_INCLUDE_DIRS when LWS_USE_CYASSL is turned on.")
|
||||
if (LWS_WITH_CYASSL)
|
||||
message(FATAL_ERROR "You must set LWS_CYASSL_LIBRARIES and LWS_CYASSL_INCLUDE_DIRS when LWS_WITH_CYASSL is turned on.")
|
||||
else()
|
||||
message(FATAL_ERROR "You must set LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS when LWS_USE_WOLFSSL is turned on.")
|
||||
message(FATAL_ERROR "You must set LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS when LWS_WITH_WOLFSSL is turned on.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
|
@ -290,12 +290,12 @@ if (LWS_WITH_SSL AND LWS_USE_WOLFSSL)
|
|||
set(WOLFSSL_FOUND 1)
|
||||
endif()
|
||||
set(USE_WOLFSSL 1)
|
||||
if (LWS_USE_CYASSL)
|
||||
if (LWS_WITH_CYASSL)
|
||||
set(USE_OLD_CYASSL 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_SSL AND LWS_USE_MBEDTLS)
|
||||
if (LWS_WITH_SSL AND LWS_WITH_MBEDTLS)
|
||||
if ("${LWS_MBEDTLS_LIBRARIES}" STREQUAL "" OR "${LWS_MBEDTLS_INCLUDE_DIRS}" STREQUAL "" AND NOT LWS_WITH_ESP32)
|
||||
|
||||
find_path(LWS_MBEDTLS_INCLUDE_DIRS mbedtls/ssl.h)
|
||||
|
@ -313,7 +313,7 @@ if (LWS_WITH_SSL AND LWS_USE_MBEDTLS)
|
|||
mark_as_advanced(LWS_MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
|
||||
|
||||
if ("${LWS_MBEDTLS_LIBRARIES}" STREQUAL "" OR "${LWS_MBEDTLS_INCLUDE_DIRS}" STREQUAL "")
|
||||
message(FATAL_ERROR "You must set LWS_MBEDTLS_LIBRARIES and LWS_MBEDTLS_INCLUDE_DIRS when LWS_USE_MBEDTLS is turned on.")
|
||||
message(FATAL_ERROR "You must set LWS_MBEDTLS_LIBRARIES and LWS_MBEDTLS_INCLUDE_DIRS when LWS_WITH_MBEDTLS is turned on.")
|
||||
endif()
|
||||
endif()
|
||||
set(MBEDTLS_LIBRARIES ${LWS_MBEDTLS_LIBRARIES})
|
||||
|
@ -322,7 +322,7 @@ if (LWS_WITH_SSL AND LWS_USE_MBEDTLS)
|
|||
set(USE_MBEDTLS 1)
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_ZLIB AND NOT LWS_USE_BUNDLED_ZLIB)
|
||||
if (LWS_WITH_ZLIB AND NOT LWS_WITH_BUNDLED_ZLIB)
|
||||
if ("${LWS_ZLIB_LIBRARIES}" STREQUAL "" OR "${LWS_ZLIB_INCLUDE_DIRS}" STREQUAL "")
|
||||
else()
|
||||
set(ZLIB_LIBRARIES ${LWS_ZLIB_LIBRARIES})
|
||||
|
@ -410,27 +410,27 @@ if (LWS_WITHOUT_CLIENT)
|
|||
endif()
|
||||
|
||||
if (LWS_WITH_LIBEV)
|
||||
set(LWS_USE_LIBEV 1)
|
||||
set(LWS_WITH_LIBEV 1)
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_LIBUV)
|
||||
set(LWS_USE_LIBUV 1)
|
||||
set(LWS_WITH_LIBUV 1)
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_LIBEVENT)
|
||||
set(LWS_USE_LIBEVENT 1)
|
||||
set(LWS_WITH_LIBEVENT 1)
|
||||
endif()
|
||||
|
||||
if (LWS_IPV6)
|
||||
set(LWS_USE_IPV6 1)
|
||||
set(LWS_WITH_IPV6 1)
|
||||
endif()
|
||||
|
||||
if (LWS_UNIX_SOCK)
|
||||
set(LWS_USE_UNIX_SOCK 1)
|
||||
set(LWS_WITH_UNIX_SOCK 1)
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_HTTP2)
|
||||
set(LWS_USE_HTTP2 1)
|
||||
set(LWS_WITH_HTTP2 1)
|
||||
endif()
|
||||
|
||||
if ("${LWS_MAX_SMP}" STREQUAL "")
|
||||
|
@ -553,7 +553,7 @@ CHECK_INCLUDE_FILE(uv-version.h LWS_HAVE_UV_VERSION_H)
|
|||
endif()
|
||||
|
||||
|
||||
if (LWS_WITH_ZLIB AND NOT LWS_USE_BUNDLED_ZLIB)
|
||||
if (LWS_WITH_ZLIB AND NOT LWS_WITH_BUNDLED_ZLIB)
|
||||
CHECK_INCLUDE_FILE(zlib.h LWS_HAVE_ZLIB_H)
|
||||
endif()
|
||||
|
||||
|
@ -628,7 +628,7 @@ if (NOT LWS_WITHOUT_CLIENT)
|
|||
lib/client-parser.c)
|
||||
endif()
|
||||
|
||||
if (LWS_USE_MBEDTLS AND NOT LWS_WITH_ESP32)
|
||||
if (LWS_WITH_MBEDTLS AND NOT LWS_WITH_ESP32)
|
||||
set(LWS_WITH_SSL ON)
|
||||
|
||||
list(APPEND HDR_PRIVATE
|
||||
|
@ -943,7 +943,7 @@ set(LIB_LIST)
|
|||
# ZLIB (Only needed for deflate extensions).
|
||||
#
|
||||
if (LWS_WITH_ZLIB)
|
||||
if (LWS_USE_BUNDLED_ZLIB)
|
||||
if (LWS_WITH_BUNDLED_ZLIB)
|
||||
if (WIN32)
|
||||
set(WIN32_ZLIB_PATH "win32port/zlib")
|
||||
set(ZLIB_SRCS
|
||||
|
@ -989,7 +989,7 @@ endif()
|
|||
if (LWS_WITH_SSL)
|
||||
message("Compiling with SSL support")
|
||||
set(chose_ssl 0)
|
||||
if (LWS_USE_WOLFSSL)
|
||||
if (LWS_WITH_WOLFSSL)
|
||||
# Use wolfSSL as OpenSSL replacement.
|
||||
# TODO: Add a find_package command for this also.
|
||||
message("wolfSSL include dir: ${WOLFSSL_INCLUDE_DIRS}")
|
||||
|
@ -999,7 +999,7 @@ if (LWS_WITH_SSL)
|
|||
# the wolfssl/ subdirectory which contains the OpenSSL
|
||||
# compatibility layer headers.
|
||||
|
||||
if (LWS_USE_CYASSL)
|
||||
if (LWS_WITH_CYASSL)
|
||||
foreach(inc ${WOLFSSL_INCLUDE_DIRS})
|
||||
include_directories("${inc}" "${inc}/cyassl")
|
||||
endforeach()
|
||||
|
@ -1013,7 +1013,7 @@ if (LWS_WITH_SSL)
|
|||
set(chose_ssl 1)
|
||||
endif()
|
||||
|
||||
if (LWS_USE_MBEDTLS)
|
||||
if (LWS_WITH_MBEDTLS)
|
||||
message("MBEDTLS include dir: ${MBEDTLS_INCLUDE_DIRS}")
|
||||
message("MBEDTLS libraries: ${MBEDTLS_LIBRARIES}")
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ if (LWS_WITH_SSL)
|
|||
endif()
|
||||
|
||||
if (NOT chose_ssl)
|
||||
if (NOT OPENSSL_FOUND AND NOT LWS_USE_BORINGSSL)
|
||||
if (NOT OPENSSL_FOUND AND NOT LWS_WITH_BORINGSSL)
|
||||
# TODO: Add support for STATIC also.
|
||||
if (NOT LWS_WITH_ESP32)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
@ -1044,7 +1044,7 @@ if (LWS_WITH_SSL)
|
|||
list(APPEND LIB_LIST ${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (NOT LWS_USE_MBEDTLS)
|
||||
if (NOT LWS_WITH_MBEDTLS)
|
||||
# older (0.98) Openssl lacks this
|
||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
||||
check_include_file(openssl/ecdh.h LWS_HAVE_OPENSSL_ECDH_H)
|
||||
|
@ -1054,7 +1054,7 @@ if (LWS_WITH_SSL)
|
|||
endif()
|
||||
else()
|
||||
unset(LWS_HAVE_OPENSSL_ECDH_H)
|
||||
endif(NOT LWS_USE_MBEDTLS)
|
||||
endif(NOT LWS_WITH_MBEDTLS)
|
||||
endif()
|
||||
|
||||
endif(LWS_WITH_SSL)
|
||||
|
@ -1157,7 +1157,7 @@ CHECK_FUNCTION_EXISTS(SSL_set_info_callback LWS_HAVE_SSL_SET_INFO_CALLBACK)
|
|||
CHECK_FUNCTION_EXISTS(X509_VERIFY_PARAM_set1_host LWS_HAVE_X509_VERIFY_PARAM_set1_host)
|
||||
CHECK_FUNCTION_EXISTS(RSA_set0_key LWS_HAVE_RSA_SET0_KEY)
|
||||
|
||||
if (LWS_USE_MBEDTLS)
|
||||
if (LWS_WITH_MBEDTLS)
|
||||
set(LWS_HAVE_TLS_CLIENT_METHOD 1)
|
||||
if (NOT LWS_WITH_ESP32)
|
||||
# not supported in esp-idf openssl wrapper yet, but is in our version
|
||||
|
@ -1180,7 +1180,7 @@ configure_file(
|
|||
|
||||
# Generate self-signed SSL certs for the test-server.
|
||||
|
||||
if (LWS_WITH_SSL AND NOT LWS_USE_WOLFSSL)
|
||||
if (LWS_WITH_SSL AND NOT LWS_WITH_WOLFSSL)
|
||||
message("Searching for OpenSSL executable and dlls")
|
||||
find_package(OpenSSLbins)
|
||||
message("OpenSSL executable: ${OPENSSL_EXECUTABLE}")
|
||||
|
@ -1636,7 +1636,7 @@ endif(LWS_WITH_GENERIC_SESSIONS)
|
|||
# Copy OpenSSL dlls to the output directory on Windows.
|
||||
# (Otherwise we'll get an error when trying to run)
|
||||
#
|
||||
if (WIN32 AND LWS_WITH_SSL AND NOT LWS_USE_WOLFSSL)
|
||||
if (WIN32 AND LWS_WITH_SSL AND NOT LWS_WITH_WOLFSSL)
|
||||
if(OPENSSL_BIN_FOUND)
|
||||
message("OpenSSL dlls found:")
|
||||
message(" Libeay: ${LIBEAY_BIN}")
|
||||
|
@ -1903,12 +1903,12 @@ message(" LWS_WITH_STATIC = ${LWS_WITH_STATIC}")
|
|||
message(" LWS_WITH_SHARED = ${LWS_WITH_SHARED}")
|
||||
message(" LWS_WITH_SSL = ${LWS_WITH_SSL} (SSL Support)")
|
||||
message(" LWS_SSL_CLIENT_USE_OS_CA_CERTS = ${LWS_SSL_CLIENT_USE_OS_CA_CERTS}")
|
||||
message(" LWS_USE_WOLFSSL = ${LWS_USE_WOLFSSL} (wolfSSL/CyaSSL replacement for OpenSSL)")
|
||||
if (LWS_USE_WOLFSSL)
|
||||
message(" LWS_WITH_WOLFSSL = ${LWS_WITH_WOLFSSL} (wolfSSL/CyaSSL replacement for OpenSSL)")
|
||||
if (LWS_WITH_WOLFSSL)
|
||||
message(" LWS_WOLFSSL_LIBRARIES = ${LWS_WOLFSSL_LIBRARIES}")
|
||||
message(" LWS_WOLFSSL_INCLUDE_DIRS = ${LWS_WOLFSSL_INCLUDE_DIRS}")
|
||||
endif()
|
||||
message(" LWS_USE_MBEDTLS = ${LWS_USE_MBEDTLS} (mbedTLS replacement for OpenSSL)")
|
||||
message(" LWS_WITH_MBEDTLS = ${LWS_WITH_MBEDTLS} (mbedTLS replacement for OpenSSL)")
|
||||
message(" LWS_WITHOUT_BUILTIN_SHA1 = ${LWS_WITHOUT_BUILTIN_SHA1}")
|
||||
message(" LWS_WITHOUT_BUILTIN_GETIFADDRS = ${LWS_WITHOUT_BUILTIN_GETIFADDRS}")
|
||||
message(" LWS_WITHOUT_CLIENT = ${LWS_WITHOUT_CLIENT}")
|
||||
|
@ -1924,9 +1924,9 @@ message(" LWS_WITHOUT_TEST_FRAGGLE = ${LWS_WITHOUT_TEST_FRAGGLE}")
|
|||
message(" LWS_WITHOUT_EXTENSIONS = ${LWS_WITHOUT_EXTENSIONS}")
|
||||
message(" LWS_WITH_LATENCY = ${LWS_WITH_LATENCY}")
|
||||
message(" LWS_WITHOUT_DAEMONIZE = ${LWS_WITHOUT_DAEMONIZE}")
|
||||
message(" LWS_USE_LIBEV = ${LWS_USE_LIBEV}")
|
||||
message(" LWS_USE_LIBUV = ${LWS_USE_LIBUV}")
|
||||
message(" LWS_USE_LIBEVENT = ${LWS_USE_LIBEVENT}")
|
||||
message(" LWS_WITH_LIBEV = ${LWS_WITH_LIBEV}")
|
||||
message(" LWS_WITH_LIBUV = ${LWS_WITH_LIBUV}")
|
||||
message(" LWS_WITH_LIBEVENT = ${LWS_WITH_LIBEVENT}")
|
||||
message(" LWS_IPV6 = ${LWS_IPV6}")
|
||||
message(" LWS_UNIX_SOCK = ${LWS_UNIX_SOCK}")
|
||||
message(" LWS_WITH_HTTP2 = ${LWS_WITH_HTTP2}")
|
||||
|
|
|
@ -306,7 +306,7 @@ this to work.
|
|||
@section wolf1 Compiling libwebsockets with wolfSSL
|
||||
|
||||
```
|
||||
cmake .. -DLWS_USE_WOLFSSL=1 \
|
||||
cmake .. -DLWS_WITH_WOLFSSL=1 \
|
||||
-DLWS_WOLFSSL_INCLUDE_DIRS=/path/to/wolfssl \
|
||||
-DLWS_WOLFSSL_LIBRARIES=/path/to/wolfssl/wolfssl.a ..
|
||||
```
|
||||
|
@ -316,7 +316,7 @@ this to work.
|
|||
@section cya Compiling libwebsockets with CyaSSL
|
||||
|
||||
```
|
||||
cmake .. -DLWS_USE_CYASSL=1 \
|
||||
cmake .. -DLWS_WITH_CYASSL=1 \
|
||||
-DLWS_CYASSL_INCLUDE_DIRS=/path/to/cyassl \
|
||||
-DLWS_CYASSL_LIBRARIES=/path/to/wolfssl/cyassl.a ..
|
||||
```
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
/* Also define to 1 (in addition to USE_WOLFSSL) when using the
|
||||
(older) CyaSSL library */
|
||||
#cmakedefine USE_OLD_CYASSL
|
||||
#cmakedefine LWS_USE_BORINGSSL
|
||||
#cmakedefine LWS_WITH_BORINGSSL
|
||||
|
||||
#cmakedefine LWS_USE_MBEDTLS
|
||||
#cmakedefine LWS_USE_POLARSSL
|
||||
#cmakedefine LWS_WITH_MBEDTLS
|
||||
#cmakedefine LWS_WITH_POLARSSL
|
||||
#cmakedefine LWS_WITH_ESP8266
|
||||
#cmakedefine LWS_WITH_ESP32
|
||||
|
||||
|
@ -50,22 +50,22 @@
|
|||
#cmakedefine LWS_NO_EXTENSIONS
|
||||
|
||||
/* Enable libev io loop */
|
||||
#cmakedefine LWS_USE_LIBEV
|
||||
#cmakedefine LWS_WITH_LIBEV
|
||||
|
||||
/* Enable libuv io loop */
|
||||
#cmakedefine LWS_USE_LIBUV
|
||||
#cmakedefine LWS_WITH_LIBUV
|
||||
|
||||
/* Enable libevent io loop */
|
||||
#cmakedefine LWS_USE_LIBEVENT
|
||||
#cmakedefine LWS_WITH_LIBEVENT
|
||||
|
||||
/* Build with support for ipv6 */
|
||||
#cmakedefine LWS_USE_IPV6
|
||||
#cmakedefine LWS_WITH_IPV6
|
||||
|
||||
/* Build with support for UNIX domain socket */
|
||||
#cmakedefine LWS_USE_UNIX_SOCK
|
||||
#cmakedefine LWS_WITH_UNIX_SOCK
|
||||
|
||||
/* Build with support for HTTP2 */
|
||||
#cmakedefine LWS_USE_HTTP2
|
||||
#cmakedefine LWS_WITH_HTTP2
|
||||
|
||||
/* Turn on latency measuring code */
|
||||
#cmakedefine LWS_LATENCY
|
||||
|
|
|
@ -6,7 +6,7 @@ COMPONENT_OWNBUILDTARGET:= 1
|
|||
CROSS_PATH1:=$(shell which xtensa-esp32-elf-gcc )
|
||||
CROSS_PATH:= $(shell dirname $(CROSS_PATH1) )/..
|
||||
|
||||
#-DLWS_USE_BORINGSSL=1 \
|
||||
#-DLWS_WITH_BORINGSSL=1 \
|
||||
# -DOPENSSL_ROOT_DIR="${PWD}/../../boringssl" \
|
||||
# -DOPENSSL_LIBRARIES="${PWD}/../../boringssl/build/ssl/libssl.a;${PWD}/../../boringssl/build/crypto/libcrypto.a" \
|
||||
# -DOPENSSL_INCLUDE_DIRS="${PWD}/../../boringssl/include" \
|
||||
|
|
|
@ -101,7 +101,7 @@ PATH=$TOOLCHAIN_PATH:$PATH cmake \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DLWS_OPENSSL_LIBRARIES="$TOOLCHAIN_PATH/../lib/libssl.a;$TOOLCHAIN_PATH/../lib/libcrypto.a" \
|
||||
|
|
|
@ -25,13 +25,13 @@ CMAKE_OPTIONS += -DLWS_WITHOUT_TESTAPPS=$(if $(CONFIG_PACKAGE_libwebsockets-exam
|
|||
|
||||
# for wolfssl, define these in addition to LWS_OPENSSL_SUPPORT and
|
||||
# edit package/libs/wolfssl/Makefile to include --enable-opensslextra
|
||||
# CMAKE_OPTIONS += -DLWS_USE_WOLFSSL=ON
|
||||
# CMAKE_OPTIONS += -DLWS_WITH_WOLFSSL=ON
|
||||
# CMAKE_OPTIONS += -DLWS_WOLFSSL_LIBRARIES=$(STAGING_DIR)/usr/lib/libwolfssl.so
|
||||
# CMAKE_OPTIONS += -DLWS_WOLFSSL_INCLUDE_DIRS=$(STAGING_DIR)/usr/include
|
||||
|
||||
# for cyassl, define these in addition to LWS_OPENSSL_SUPPORT and
|
||||
# edit package/libs/wolfssl/Makefile to include --enable-opensslextra
|
||||
# CMAKE_OPTIONS += -DLWS_USE_CYASSL=ON
|
||||
# CMAKE_OPTIONS += -DLWS_WITH_CYASSL=ON
|
||||
# CMAKE_OPTIONS += -DLWS_CYASSL_LIBRARIES=$(STAGING_DIR)/usr/lib/libcyassl.so
|
||||
# CMAKE_OPTIONS += -DLWS_CYASSL_INCLUDE_DIRS=$(STAGING_DIR)/usr/include
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ lws_getaddrinfo46(struct lws *wsi, const char *ads, struct addrinfo **result)
|
|||
memset(&hints, 0, sizeof(hints));
|
||||
*result = NULL;
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (wsi->ipv6) {
|
||||
|
||||
#if !defined(__ANDROID__)
|
||||
|
@ -38,7 +38,7 @@ lws_client_connect_2(struct lws *wsi)
|
|||
int n, port;
|
||||
ssize_t plen = 0;
|
||||
const char *ads;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
char ipv6only = lws_check_opt(wsi->vhost->options,
|
||||
LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY |
|
||||
LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE);
|
||||
|
@ -108,7 +108,7 @@ lws_client_connect_2(struct lws *wsi)
|
|||
|
||||
n = lws_getaddrinfo46(wsi, ads, &result);
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (wsi->ipv6) {
|
||||
|
||||
if (n) {
|
||||
|
@ -211,7 +211,7 @@ lws_client_connect_2(struct lws *wsi)
|
|||
|
||||
if (!lws_socket_is_valid(wsi->desc.sockfd)) {
|
||||
|
||||
#if defined(LWS_USE_LIBUV)
|
||||
#if defined(LWS_WITH_LIBUV)
|
||||
if (LWS_LIBUV_ENABLED(context))
|
||||
if (lws_libuv_check_watcher_active(wsi)) {
|
||||
lwsl_warn("Waiting for libuv watcher to close\n");
|
||||
|
@ -220,7 +220,7 @@ lws_client_connect_2(struct lws *wsi)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (wsi->ipv6)
|
||||
wsi->desc.sockfd = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
else
|
||||
|
@ -279,7 +279,7 @@ lws_client_connect_2(struct lws *wsi)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (wsi->ipv6) {
|
||||
sa46.sa6.sin6_port = htons(port);
|
||||
n = sizeof(struct sockaddr_in6);
|
||||
|
@ -486,7 +486,7 @@ lws_client_reset(struct lws **pwsi, int ssl, const char *address, int port,
|
|||
lws_ssl_close(wsi);
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
if (LWS_LIBUV_ENABLED(wsi->context)) {
|
||||
lwsl_debug("%s: lws_libuv_closehandle: wsi %p\n", __func__, wsi);
|
||||
/*
|
||||
|
|
|
@ -572,7 +572,7 @@ lws_create_vhost(struct lws_context *context,
|
|||
|
||||
vh->mount_list = info->mounts;
|
||||
|
||||
#ifdef LWS_USE_UNIX_SOCK
|
||||
#ifdef LWS_WITH_UNIX_SOCK
|
||||
if (LWS_UNIX_SOCK_ENABLED(context)) {
|
||||
lwsl_notice("Creating Vhost '%s' path \"%s\", %d protocols\n",
|
||||
vh->name, info->iface, vh->count_protocols);
|
||||
|
@ -768,7 +768,7 @@ lws_create_context(struct lws_context_creation_info *info)
|
|||
lwsl_info("Compiled with %s\n", GCC_VER);
|
||||
#endif
|
||||
#if LWS_POSIX
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DISABLE_IPV6))
|
||||
lwsl_info("IPV6 compiled in and enabled\n");
|
||||
else
|
||||
|
@ -914,7 +914,7 @@ lws_create_context(struct lws_context_creation_info *info)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
context->pt[n].context = context;
|
||||
#endif
|
||||
context->pt[n].tid = n;
|
||||
|
@ -949,7 +949,7 @@ lws_create_context(struct lws_context_creation_info *info)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef LWS_USE_LIBEV
|
||||
#ifdef LWS_WITH_LIBEV
|
||||
/* (Issue #264) In order to *avoid breaking backwards compatibility*, we
|
||||
* enable libev mediated SIGINT handling with a default handler of
|
||||
* lws_sigint_cb. The handler can be overridden or disabled
|
||||
|
@ -958,8 +958,8 @@ lws_create_context(struct lws_context_creation_info *info)
|
|||
*/
|
||||
context->use_ev_sigint = 1;
|
||||
context->lws_ev_sigint_cb = &lws_ev_sigint_cb;
|
||||
#endif /* LWS_USE_LIBEV */
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#endif /* LWS_WITH_LIBEV */
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
/* (Issue #264) In order to *avoid breaking backwards compatibility*, we
|
||||
* enable libev mediated SIGINT handling with a default handler of
|
||||
* lws_sigint_cb. The handler can be overridden or disabled
|
||||
|
@ -969,7 +969,7 @@ lws_create_context(struct lws_context_creation_info *info)
|
|||
context->use_ev_sigint = 1;
|
||||
context->lws_uv_sigint_cb = &lws_uv_sigint_cb;
|
||||
#endif
|
||||
#ifdef LWS_USE_LIBEVENT
|
||||
#ifdef LWS_WITH_LIBEVENT
|
||||
/* (Issue #264) In order to *avoid breaking backwards compatibility*, we
|
||||
* enable libev mediated SIGINT handling with a default handler of
|
||||
* lws_sigint_cb. The handler can be overridden or disabled
|
||||
|
@ -978,7 +978,7 @@ lws_create_context(struct lws_context_creation_info *info)
|
|||
*/
|
||||
context->use_ev_sigint = 1;
|
||||
context->lws_event_sigint_cb = &lws_event_sigint_cb;
|
||||
#endif /* LWS_USE_LIBEVENT */
|
||||
#endif /* LWS_WITH_LIBEVENT */
|
||||
|
||||
#if defined(LWS_WITH_PEER_LIMITS)
|
||||
/* scale the peer hash table according to the max fds for the process,
|
||||
|
|
|
@ -67,7 +67,7 @@ lws_read(struct lws *wsi, unsigned char *buf, lws_filepos_t len)
|
|||
size_t n;
|
||||
|
||||
switch (wsi->state) {
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
case LWSS_HTTP2_AWAIT_CLIENT_PREFACE:
|
||||
case LWSS_HTTP2_ESTABLISHED_PRE_SETTINGS:
|
||||
case LWSS_HTTP2_ESTABLISHED:
|
||||
|
|
10
lib/header.c
10
lib/header.c
|
@ -37,7 +37,7 @@ lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
|
|||
const unsigned char *value, int length,
|
||||
unsigned char **p, unsigned char *end)
|
||||
{
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
if (wsi->mode == LWSCM_HTTP2_SERVING)
|
||||
return lws_add_http2_header_by_name(wsi, name,
|
||||
value, length, p, end);
|
||||
|
@ -65,7 +65,7 @@ lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
|
|||
int lws_finalize_http_header(struct lws *wsi, unsigned char **p,
|
||||
unsigned char *end)
|
||||
{
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
if (wsi->mode == LWSCM_HTTP2_SERVING)
|
||||
return 0;
|
||||
#else
|
||||
|
@ -85,7 +85,7 @@ lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
|
|||
unsigned char **p, unsigned char *end)
|
||||
{
|
||||
const unsigned char *name;
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
if (wsi->mode == LWSCM_HTTP2_SERVING)
|
||||
return lws_add_http2_header_by_token(wsi, token, value,
|
||||
length, p, end);
|
||||
|
@ -160,7 +160,7 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
|
|||
wsi->access_log.response = code;
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
if (wsi->mode == LWSCM_HTTP2_SERVING)
|
||||
return lws_add_http2_header_status(wsi, code, p, end);
|
||||
#endif
|
||||
|
@ -250,7 +250,7 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
|
|||
if (lws_finalize_http_header(wsi, &p, end))
|
||||
return 1;
|
||||
|
||||
#if defined(LWS_USE_HTTP2)
|
||||
#if defined(LWS_WITH_HTTP2)
|
||||
{
|
||||
unsigned char *body = p + 512;
|
||||
|
||||
|
|
|
@ -754,7 +754,7 @@ lwsws_get_config(void *user, const char *f, const char * const *paths,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(LWS_USE_LIBUV) && UV_VERSION_MAJOR > 0
|
||||
#if defined(LWS_WITH_LIBUV) && UV_VERSION_MAJOR > 0
|
||||
|
||||
static int
|
||||
lwsws_get_config_d(void *user, const char *d, const char * const *paths,
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#include <Iphlpapi.h>
|
||||
#else
|
||||
|
@ -741,7 +741,7 @@ just_kill_connection:
|
|||
async_close:
|
||||
wsi->socket_is_permanently_unusable = 1;
|
||||
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
if (!wsi->parent_carries_io)
|
||||
if (LWS_LIBUV_ENABLED(context)) {
|
||||
if (wsi->listener) {
|
||||
|
@ -826,7 +826,7 @@ interface_to_sa(struct lws_vhost *vh, const char *ifname,
|
|||
struct sockaddr_in *addr, size_t addrlen)
|
||||
{
|
||||
int ipv6 = 0;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
ipv6 = LWS_IPV6_ENABLED(vh);
|
||||
#endif
|
||||
(void)vh;
|
||||
|
@ -849,7 +849,7 @@ lws_get_addresses(struct lws_vhost *vh, void *ads, char *name,
|
|||
name[0] = '\0';
|
||||
addr4.sin_family = AF_UNSPEC;
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (LWS_IPV6_ENABLED(vh)) {
|
||||
if (!lws_plat_inet_ntop(AF_INET6,
|
||||
&((struct sockaddr_in6 *)ads)->sin6_addr,
|
||||
|
@ -926,7 +926,7 @@ lws_get_peer_simple(struct lws *wsi, char *name, int namelen)
|
|||
{
|
||||
#if LWS_POSIX
|
||||
socklen_t len, olen;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
struct sockaddr_in6 sin6;
|
||||
#endif
|
||||
struct sockaddr_in sin4;
|
||||
|
@ -936,7 +936,7 @@ lws_get_peer_simple(struct lws *wsi, char *name, int namelen)
|
|||
if (wsi->parent_carries_io)
|
||||
wsi = wsi->parent;
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (LWS_IPV6_ENABLED(wsi->vhost)) {
|
||||
len = sizeof(sin6);
|
||||
p = &sin6;
|
||||
|
@ -974,7 +974,7 @@ lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
|
|||
#ifndef LWS_PLAT_OPTEE
|
||||
#if LWS_POSIX
|
||||
socklen_t len;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
struct sockaddr_in6 sin6;
|
||||
#endif
|
||||
struct sockaddr_in sin4;
|
||||
|
@ -987,7 +987,7 @@ lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
|
|||
|
||||
lws_latency_pre(context, wsi);
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (LWS_IPV6_ENABLED(wsi->vhost)) {
|
||||
len = sizeof(sin6);
|
||||
p = &sin6;
|
||||
|
@ -1699,7 +1699,7 @@ void lws_set_protocol_write_pending(struct lws *wsi,
|
|||
LWS_VISIBLE size_t
|
||||
lws_get_peer_write_allowance(struct lws *wsi)
|
||||
{
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
/* only if we are using HTTP2 on this connection */
|
||||
if (wsi->mode != LWSCM_HTTP2_SERVING)
|
||||
return -1;
|
||||
|
@ -2018,10 +2018,10 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
|
|||
const char *iface)
|
||||
{
|
||||
#if LWS_POSIX
|
||||
#ifdef LWS_USE_UNIX_SOCK
|
||||
#ifdef LWS_WITH_UNIX_SOCK
|
||||
struct sockaddr_un serv_unix;
|
||||
#endif
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
struct sockaddr_in6 serv_addr6;
|
||||
#endif
|
||||
struct sockaddr_in serv_addr4;
|
||||
|
@ -2032,7 +2032,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
|
|||
struct sockaddr_storage sin;
|
||||
struct sockaddr *v;
|
||||
|
||||
#ifdef LWS_USE_UNIX_SOCK
|
||||
#ifdef LWS_WITH_UNIX_SOCK
|
||||
if (LWS_UNIX_SOCK_ENABLED(vhost)) {
|
||||
v = (struct sockaddr *)&serv_unix;
|
||||
n = sizeof(struct sockaddr_un);
|
||||
|
@ -2049,7 +2049,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
|
|||
|
||||
} else
|
||||
#endif
|
||||
#if defined(LWS_USE_IPV6) && !defined(LWS_WITH_ESP32)
|
||||
#if defined(LWS_WITH_IPV6) && !defined(LWS_WITH_ESP32)
|
||||
if (LWS_IPV6_ENABLED(vhost)) {
|
||||
v = (struct sockaddr *)&serv_addr6;
|
||||
n = sizeof(struct sockaddr_in6);
|
||||
|
@ -2086,7 +2086,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
|
|||
} /* ipv4 */
|
||||
|
||||
n = bind(sockfd, v, n);
|
||||
#ifdef LWS_USE_UNIX_SOCK
|
||||
#ifdef LWS_WITH_UNIX_SOCK
|
||||
if (n < 0 && LWS_UNIX_SOCK_ENABLED(vhost)) {
|
||||
lwsl_err("ERROR on binding fd %d to \"%s\" (%d %d)\n",
|
||||
sockfd, iface, n, LWS_ERRNO);
|
||||
|
@ -2104,7 +2104,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
|
|||
lwsl_warn("getsockname: %s\n", strerror(LWS_ERRNO));
|
||||
else
|
||||
#endif
|
||||
#if defined(LWS_USE_IPV6)
|
||||
#if defined(LWS_WITH_IPV6)
|
||||
port = (sin.ss_family == AF_INET6) ?
|
||||
ntohs(((struct sockaddr_in6 *) &sin)->sin6_port) :
|
||||
ntohs(((struct sockaddr_in *) &sin)->sin_port);
|
||||
|
@ -2116,7 +2116,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
|
|||
return port;
|
||||
}
|
||||
|
||||
#if defined(LWS_USE_IPV6)
|
||||
#if defined(LWS_WITH_IPV6)
|
||||
LWS_EXTERN unsigned long
|
||||
lws_get_addr_scope(const char *ipaddr)
|
||||
{
|
||||
|
@ -3504,7 +3504,7 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len,
|
|||
struct lws_cgi * const *pcgi;
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
uv_uptime(&d);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -166,18 +166,18 @@ typedef unsigned long long lws_intptr_t;
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_LIBEV
|
||||
#ifdef LWS_WITH_LIBEV
|
||||
#include <ev.h>
|
||||
#endif /* LWS_USE_LIBEV */
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#endif /* LWS_WITH_LIBEV */
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
#include <uv.h>
|
||||
#ifdef LWS_HAVE_UV_VERSION_H
|
||||
#include <uv-version.h>
|
||||
#endif
|
||||
#endif /* LWS_USE_LIBUV */
|
||||
#ifdef LWS_USE_LIBEVENT
|
||||
#endif /* LWS_WITH_LIBUV */
|
||||
#ifdef LWS_WITH_LIBEVENT
|
||||
#include <event2/event.h>
|
||||
#endif /* LWS_USE_LIBEVENT */
|
||||
#endif /* LWS_WITH_LIBEVENT */
|
||||
|
||||
#ifndef LWS_EXTERN
|
||||
#define LWS_EXTERN extern
|
||||
|
@ -203,7 +203,7 @@ typedef unsigned long long lws_intptr_t;
|
|||
#include <wolfssl/error-ssl.h>
|
||||
#endif /* not USE_OLD_CYASSL */
|
||||
#else
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
#if defined(LWS_WITH_ESP32)
|
||||
/* this filepath is passed to us but without quotes or <> */
|
||||
#undef MBEDTLS_CONFIG_FILE
|
||||
|
@ -212,7 +212,7 @@ typedef unsigned long long lws_intptr_t;
|
|||
#include <mbedtls/ssl.h>
|
||||
#endif
|
||||
#include <openssl/ssl.h>
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
#endif /* not USE_WOLFSSL */
|
||||
|
@ -1439,7 +1439,7 @@ lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
|
||||
#ifdef LWS_OPENSSL_SUPPORT
|
||||
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
#include <mbedtls/sha1.h>
|
||||
#include <mbedtls/sha256.h>
|
||||
#include <mbedtls/sha512.h>
|
||||
|
@ -1451,7 +1451,7 @@ lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
|
||||
struct lws_genhash_ctx {
|
||||
uint8_t type;
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
union {
|
||||
mbedtls_sha1_context sha1;
|
||||
mbedtls_sha256_context sha256;
|
||||
|
@ -3811,7 +3811,7 @@ lws_json_purify(char *escaped, const char *string, int len);
|
|||
*/
|
||||
///@{
|
||||
|
||||
#ifdef LWS_USE_LIBEV
|
||||
#ifdef LWS_WITH_LIBEV
|
||||
typedef void (lws_ev_signal_cb_t)(EV_P_ struct ev_signal *w, int revents);
|
||||
|
||||
LWS_VISIBLE LWS_EXTERN int
|
||||
|
@ -3823,7 +3823,7 @@ lws_ev_initloop(struct lws_context *context, struct ev_loop *loop, int tsi);
|
|||
|
||||
LWS_VISIBLE LWS_EXTERN void
|
||||
lws_ev_sigint_cb(struct ev_loop *loop, struct ev_signal *watcher, int revents);
|
||||
#endif /* LWS_USE_LIBEV */
|
||||
#endif /* LWS_WITH_LIBEV */
|
||||
|
||||
///@}
|
||||
|
||||
|
@ -3834,7 +3834,7 @@ lws_ev_sigint_cb(struct ev_loop *loop, struct ev_signal *watcher, int revents);
|
|||
* APIs specific to libuv event loop itegration
|
||||
*/
|
||||
///@{
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
LWS_VISIBLE LWS_EXTERN int
|
||||
lws_uv_sigint_cfg(struct lws_context *context, int use_uv_sigint,
|
||||
uv_signal_cb cb);
|
||||
|
@ -3859,7 +3859,7 @@ lws_uv_sigint_cb(uv_signal_t *watcher, int signum);
|
|||
|
||||
LWS_VISIBLE LWS_EXTERN void
|
||||
lws_close_all_handles_in_loop(uv_loop_t *loop);
|
||||
#endif /* LWS_USE_LIBUV */
|
||||
#endif /* LWS_WITH_LIBUV */
|
||||
///@}
|
||||
|
||||
/*! \defgroup event libevent helpers
|
||||
|
@ -3870,7 +3870,7 @@ lws_close_all_handles_in_loop(uv_loop_t *loop);
|
|||
*/
|
||||
///@{
|
||||
|
||||
#ifdef LWS_USE_LIBEVENT
|
||||
#ifdef LWS_WITH_LIBEVENT
|
||||
typedef void (lws_event_signal_cb_t) (evutil_socket_t sock_fd, short revents,
|
||||
void *ctx);
|
||||
|
||||
|
@ -3885,7 +3885,7 @@ lws_event_initloop(struct lws_context *context, struct event_base *loop,
|
|||
LWS_VISIBLE LWS_EXTERN void
|
||||
lws_event_sigint_cb(evutil_socket_t sock_fd, short revents,
|
||||
void *ctx);
|
||||
#endif /* LWS_USE_LIBEVENT */
|
||||
#endif /* LWS_WITH_LIBEVENT */
|
||||
|
||||
///@}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ lws_genhash_init(struct lws_genhash_ctx *ctx, int type)
|
|||
{
|
||||
ctx->type = type;
|
||||
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
switch (ctx->type) {
|
||||
case LWS_GENHASH_TYPE_SHA1:
|
||||
mbedtls_sha1_init(&ctx->u.sha1);
|
||||
|
@ -92,7 +92,7 @@ lws_genhash_init(struct lws_genhash_ctx *ctx, int type)
|
|||
int
|
||||
lws_genhash_update(struct lws_genhash_ctx *ctx, const void *in, size_t len)
|
||||
{
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
switch (ctx->type) {
|
||||
case LWS_GENHASH_TYPE_SHA1:
|
||||
mbedtls_sha1_update(&ctx->u.sha1, in, len);
|
||||
|
@ -114,7 +114,7 @@ lws_genhash_update(struct lws_genhash_ctx *ctx, const void *in, size_t len)
|
|||
int
|
||||
lws_genhash_destroy(struct lws_genhash_ctx *ctx, void *result)
|
||||
{
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
switch (ctx->type) {
|
||||
case LWS_GENHASH_TYPE_SHA1:
|
||||
mbedtls_sha1_finish(&ctx->u.sha1, result);
|
||||
|
|
|
@ -346,7 +346,7 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
|
|||
|
||||
struct ifaddrs *ifr;
|
||||
struct ifaddrs *ifc;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
|
||||
#endif
|
||||
|
||||
|
@ -362,7 +362,7 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
|
|||
|
||||
switch (ifc->ifa_addr->sa_family) {
|
||||
case AF_INET:
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (ipv6) {
|
||||
/* map IPv4 to IPv6 */
|
||||
bzero((char *)&addr6->sin6_addr,
|
||||
|
@ -378,7 +378,7 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
|
|||
(struct sockaddr_in *)ifc->ifa_addr,
|
||||
sizeof(struct sockaddr_in));
|
||||
break;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
case AF_INET6:
|
||||
memcpy(&addr6->sin6_addr,
|
||||
&((struct sockaddr_in6 *)ifc->ifa_addr)->sin6_addr,
|
||||
|
@ -395,7 +395,7 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
|
|||
|
||||
if (rc == -1) {
|
||||
/* check if bind to IP address */
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1)
|
||||
rc = 0;
|
||||
else
|
||||
|
|
|
@ -369,7 +369,7 @@ lws_plat_drop_app_privileges(struct lws_context_creation_info *info)
|
|||
|
||||
#ifdef LWS_WITH_PLUGINS
|
||||
|
||||
#if defined(LWS_USE_LIBUV) && UV_VERSION_MAJOR > 0
|
||||
#if defined(LWS_WITH_LIBUV) && UV_VERSION_MAJOR > 0
|
||||
|
||||
/* libuv.c implements these in a cross-platform way */
|
||||
|
||||
|
@ -572,7 +572,7 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
|
|||
|
||||
struct ifaddrs *ifr;
|
||||
struct ifaddrs *ifc;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
|
||||
#endif
|
||||
|
||||
|
@ -588,7 +588,7 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
|
|||
|
||||
switch (ifc->ifa_addr->sa_family) {
|
||||
case AF_INET:
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (ipv6) {
|
||||
/* map IPv4 to IPv6 */
|
||||
bzero((char *)&addr6->sin6_addr,
|
||||
|
@ -604,7 +604,7 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
|
|||
(struct sockaddr_in *)ifc->ifa_addr,
|
||||
sizeof(struct sockaddr_in));
|
||||
break;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
case AF_INET6:
|
||||
memcpy(&addr6->sin6_addr,
|
||||
&((struct sockaddr_in6 *)ifc->ifa_addr)->sin6_addr,
|
||||
|
@ -621,7 +621,7 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
|
|||
|
||||
if (rc == -1) {
|
||||
/* check if bind to IP address */
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1)
|
||||
rc = 0;
|
||||
else
|
||||
|
|
|
@ -401,7 +401,7 @@ LWS_VISIBLE LWS_EXTERN int
|
|||
lws_interface_to_sa(int ipv6,
|
||||
const char *ifname, struct sockaddr_in *addr, size_t addrlen)
|
||||
{
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
|
||||
|
||||
if (ipv6) {
|
||||
|
@ -513,7 +513,7 @@ lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt)
|
|||
|
||||
if (!WSAAddressToStringW((struct sockaddr*)&srcaddr, sizeof(srcaddr), 0, buffer, &bufferlen))
|
||||
ok = TRUE;
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
} else if (af == AF_INET6) {
|
||||
struct sockaddr_in6 srcaddr;
|
||||
bzero(&srcaddr, sizeof(srcaddr));
|
||||
|
@ -567,7 +567,7 @@ lws_plat_inet_pton(int af, const char *src, void *dst)
|
|||
ok = TRUE;
|
||||
memcpy(dst, &dstaddr.sin_addr, sizeof(dstaddr.sin_addr));
|
||||
}
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
} else if (af == AF_INET6) {
|
||||
struct sockaddr_in6 dstaddr;
|
||||
int dstaddrlen = sizeof(dstaddr);
|
||||
|
|
|
@ -516,7 +516,7 @@ send_raw:
|
|||
case LWS_WRITE_HTTP_HEADERS:
|
||||
case LWS_WRITE_PONG:
|
||||
case LWS_WRITE_PING:
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
if (wsi->mode == LWSCM_HTTP2_SERVING) {
|
||||
unsigned char flags = 0;
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ LWS_VISIBLE int
|
|||
lws_callback_on_writable(struct lws *wsi)
|
||||
{
|
||||
struct lws_context_per_thread *pt;
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
struct lws *network_wsi, *wsi2;
|
||||
int already;
|
||||
#endif
|
||||
|
@ -379,7 +379,7 @@ lws_callback_on_writable(struct lws *wsi)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
lwsl_info("%s: %p\n", __func__, wsi);
|
||||
|
||||
if (wsi->mode != LWSCM_HTTP2_SERVING)
|
||||
|
|
|
@ -215,13 +215,13 @@ int kill(int pid, int sig);
|
|||
#include <arpa/inet.h>
|
||||
#include <poll.h>
|
||||
#endif
|
||||
#ifdef LWS_USE_LIBEV
|
||||
#ifdef LWS_WITH_LIBEV
|
||||
#include <ev.h>
|
||||
#endif
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
#include <uv.h>
|
||||
#endif
|
||||
#ifdef LWS_USE_LIBEVENT
|
||||
#ifdef LWS_WITH_LIBEVENT
|
||||
#include <event2/event.h>
|
||||
#endif
|
||||
|
||||
|
@ -280,7 +280,7 @@ lws_plat_get_peer_simple(struct lws *wsi, char *name, int namelen);
|
|||
#if defined(LWS_WITH_ESP32)
|
||||
#define OPENSSL_NO_TLSEXT
|
||||
#else
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
#include <mbedtls/ssl.h>
|
||||
#include <mbedtls/x509_crt.h>
|
||||
#else
|
||||
|
@ -686,16 +686,16 @@ struct lws_ring {
|
|||
struct lws_protocols;
|
||||
struct lws;
|
||||
|
||||
#if defined(LWS_USE_LIBEV) || defined(LWS_USE_LIBUV) || defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
|
||||
|
||||
struct lws_io_watcher {
|
||||
#ifdef LWS_USE_LIBEV
|
||||
#ifdef LWS_WITH_LIBEV
|
||||
ev_io ev_watcher;
|
||||
#endif
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
uv_poll_t uv_watcher;
|
||||
#endif
|
||||
#ifdef LWS_USE_LIBEVENT
|
||||
#ifdef LWS_WITH_LIBEVENT
|
||||
struct event *event_watcher;
|
||||
#endif
|
||||
struct lws_context *context;
|
||||
|
@ -704,13 +704,13 @@ struct lws_io_watcher {
|
|||
};
|
||||
|
||||
struct lws_signal_watcher {
|
||||
#ifdef LWS_USE_LIBEV
|
||||
#ifdef LWS_WITH_LIBEV
|
||||
ev_signal ev_watcher;
|
||||
#endif
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
uv_signal_t uv_watcher;
|
||||
#endif
|
||||
#ifdef LWS_USE_LIBEVENT
|
||||
#ifdef LWS_WITH_LIBEVENT
|
||||
struct event *event_watcher;
|
||||
#endif
|
||||
struct lws_context *context;
|
||||
|
@ -789,7 +789,7 @@ struct lws_context_per_thread {
|
|||
struct lws *rx_draining_ext_list;
|
||||
struct lws *tx_draining_ext_list;
|
||||
struct lws *timeout_list;
|
||||
#if defined(LWS_USE_LIBUV) || defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
|
||||
struct lws_context *context;
|
||||
#endif
|
||||
#ifdef LWS_WITH_CGI
|
||||
|
@ -802,22 +802,22 @@ struct lws_context_per_thread {
|
|||
#ifdef LWS_OPENSSL_SUPPORT
|
||||
struct lws *pending_read_list; /* linked list */
|
||||
#endif
|
||||
#if defined(LWS_USE_LIBEV)
|
||||
#if defined(LWS_WITH_LIBEV)
|
||||
struct ev_loop *io_loop_ev;
|
||||
#endif
|
||||
#if defined(LWS_USE_LIBUV)
|
||||
#if defined(LWS_WITH_LIBUV)
|
||||
uv_loop_t *io_loop_uv;
|
||||
uv_signal_t signals[8];
|
||||
uv_timer_t uv_timeout_watcher;
|
||||
uv_idle_t uv_idle;
|
||||
#endif
|
||||
#if defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBEVENT)
|
||||
struct event_base *io_loop_event_base;
|
||||
#endif
|
||||
#if defined(LWS_USE_LIBEV)
|
||||
#if defined(LWS_WITH_LIBEV)
|
||||
struct lws_io_watcher w_accept;
|
||||
#endif
|
||||
#if defined(LWS_USE_LIBEV) || defined(LWS_USE_LIBUV) || defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
|
||||
struct lws_signal_watcher w_sigint;
|
||||
unsigned char ev_loop_foreign:1;
|
||||
#endif
|
||||
|
@ -900,7 +900,7 @@ struct lws_vhost {
|
|||
SSL_CTX *ssl_ctx;
|
||||
SSL_CTX *ssl_client_ctx;
|
||||
#endif
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
X509 *x509_client_CA;
|
||||
#endif
|
||||
#ifndef LWS_NO_EXTENSIONS
|
||||
|
@ -946,7 +946,7 @@ struct lws_deferred_free
|
|||
};
|
||||
|
||||
typedef union {
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
struct sockaddr_in6 sa6;
|
||||
#endif
|
||||
struct sockaddr_in sa4;
|
||||
|
@ -1030,14 +1030,14 @@ struct lws_context {
|
|||
char count_caps;
|
||||
#endif
|
||||
|
||||
#if defined(LWS_USE_LIBEV)
|
||||
#if defined(LWS_WITH_LIBEV)
|
||||
lws_ev_signal_cb_t * lws_ev_sigint_cb;
|
||||
#endif
|
||||
#if defined(LWS_USE_LIBUV)
|
||||
#if defined(LWS_WITH_LIBUV)
|
||||
uv_signal_cb lws_uv_sigint_cb;
|
||||
uv_loop_t pu_loop;
|
||||
#endif
|
||||
#if defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBEVENT)
|
||||
lws_event_signal_cb_t * lws_event_sigint_cb;
|
||||
#endif
|
||||
char canonical_hostname[128];
|
||||
|
@ -1057,7 +1057,7 @@ struct lws_context {
|
|||
#endif
|
||||
|
||||
int max_fds;
|
||||
#if defined(LWS_USE_LIBEV) || defined(LWS_USE_LIBUV) || defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
|
||||
int use_ev_sigint;
|
||||
#endif
|
||||
int started_with_parent;
|
||||
|
@ -1153,7 +1153,7 @@ enum {
|
|||
LWS_EV_PREPARE_DELETION = (1 << 31),
|
||||
};
|
||||
|
||||
#if defined(LWS_USE_LIBEV)
|
||||
#if defined(LWS_WITH_LIBEV)
|
||||
LWS_EXTERN void
|
||||
lws_libev_accept(struct lws *new_wsi, lws_sock_file_fd_type desc);
|
||||
LWS_EXTERN void
|
||||
|
@ -1181,7 +1181,7 @@ LWS_EXTERN void lws_feature_status_libev(struct lws_context_creation_info *info)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LWS_USE_LIBUV)
|
||||
#if defined(LWS_WITH_LIBUV)
|
||||
LWS_EXTERN void
|
||||
lws_libuv_accept(struct lws *new_wsi, lws_sock_file_fd_type desc);
|
||||
LWS_EXTERN void
|
||||
|
@ -1211,7 +1211,7 @@ LWS_EXTERN void lws_feature_status_libuv(struct lws_context_creation_info *info)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBEVENT)
|
||||
LWS_EXTERN void
|
||||
lws_libevent_accept(struct lws *new_wsi, lws_sock_file_fd_type desc);
|
||||
LWS_EXTERN void
|
||||
|
@ -1240,7 +1240,7 @@ LWS_EXTERN void lws_feature_status_libevent(struct lws_context_creation_info *in
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
#define LWS_IPV6_ENABLED(vh) \
|
||||
(!lws_check_opt(vh->context->options, LWS_SERVER_OPTION_DISABLE_IPV6) && \
|
||||
!lws_check_opt(vh->options, LWS_SERVER_OPTION_DISABLE_IPV6))
|
||||
|
@ -1248,7 +1248,7 @@ LWS_EXTERN void lws_feature_status_libevent(struct lws_context_creation_info *in
|
|||
#define LWS_IPV6_ENABLED(context) (0)
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_UNIX_SOCK
|
||||
#ifdef LWS_WITH_UNIX_SOCK
|
||||
#define LWS_UNIX_SOCK_ENABLED(vhost) \
|
||||
(vhost->options & LWS_SERVER_OPTION_UNIX_SOCK)
|
||||
#else
|
||||
|
@ -1364,7 +1364,7 @@ struct _lws_http_mode_related {
|
|||
lws_filepos_t content_remain;
|
||||
};
|
||||
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
|
||||
enum lws_http2_settings {
|
||||
LWS_HTTP2_SETTINGS__HEADER_TABLE_SIZE = 1,
|
||||
|
@ -1626,7 +1626,7 @@ struct lws {
|
|||
|
||||
union u {
|
||||
struct _lws_http_mode_related http;
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
struct _lws_http2_related http2;
|
||||
#endif
|
||||
struct _lws_header_related hdr;
|
||||
|
@ -1635,10 +1635,10 @@ struct lws {
|
|||
|
||||
/* lifetime members */
|
||||
|
||||
#if defined(LWS_USE_LIBEV) || defined(LWS_USE_LIBUV) || defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
|
||||
struct lws_io_watcher w_read;
|
||||
#endif
|
||||
#if defined(LWS_USE_LIBEV) || defined(LWS_USE_LIBEVENT)
|
||||
#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBEVENT)
|
||||
struct lws_io_watcher w_write;
|
||||
#endif
|
||||
#ifdef LWS_WITH_ACCESS_LOG
|
||||
|
@ -1803,7 +1803,7 @@ LWS_EXTERN int
|
|||
lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
|
||||
const char *iface);
|
||||
|
||||
#if defined(LWS_USE_IPV6)
|
||||
#if defined(LWS_WITH_IPV6)
|
||||
LWS_EXTERN unsigned long
|
||||
lws_get_addr_scope(const char *ipaddr);
|
||||
#endif
|
||||
|
@ -1946,7 +1946,7 @@ LWS_EXTERN int LWS_WARN_UNUSED_RESULT
|
|||
user_callback_handle_rxflow(lws_callback_function, struct lws *wsi,
|
||||
enum lws_callback_reasons reason, void *user,
|
||||
void *in, size_t len);
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
LWS_EXTERN struct lws *lws_http2_get_network_wsi(struct lws *wsi);
|
||||
struct lws * lws_http2_get_nth_child(struct lws *wsi, int n);
|
||||
LWS_EXTERN int
|
||||
|
@ -2108,7 +2108,7 @@ LWS_EXTERN void
|
|||
lws_ssl_destroy(struct lws_vhost *vhost);
|
||||
/* HTTP2-related */
|
||||
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
LWS_EXTERN void
|
||||
lws_context_init_http2_ssl(struct lws_vhost *vhost);
|
||||
#else
|
||||
|
|
26
lib/server.c
26
lib/server.c
|
@ -25,7 +25,7 @@
|
|||
#if defined(_DEBUG) || defined(LWS_WITH_ACCESS_LOG)
|
||||
static const char * const method_names[] = {
|
||||
"GET", "POST", "OPTIONS", "PUT", "PATCH", "DELETE", "CONNECT",
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
":path",
|
||||
#endif
|
||||
};
|
||||
|
@ -80,12 +80,12 @@ lws_context_init_server(struct lws_context_creation_info *info,
|
|||
#endif
|
||||
|
||||
for (m = 0; m < limit; m++) {
|
||||
#ifdef LWS_USE_UNIX_SOCK
|
||||
#ifdef LWS_WITH_UNIX_SOCK
|
||||
if (LWS_UNIX_SOCK_ENABLED(vhost))
|
||||
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
else
|
||||
#endif
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (LWS_IPV6_ENABLED(vhost))
|
||||
sockfd = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
else
|
||||
|
@ -131,7 +131,7 @@ lws_context_init_server(struct lws_context_creation_info *info,
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if defined(LWS_USE_IPV6) && defined(IPV6_V6ONLY)
|
||||
#if defined(LWS_WITH_IPV6) && defined(IPV6_V6ONLY)
|
||||
if (LWS_IPV6_ENABLED(vhost)) {
|
||||
if (vhost->options & LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY) {
|
||||
int value = (vhost->options & LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE) ? 1 : 0;
|
||||
|
@ -183,7 +183,7 @@ lws_context_init_server(struct lws_context_creation_info *info,
|
|||
wsi->vhost = vhost;
|
||||
wsi->listener = 1;
|
||||
|
||||
#ifdef LWS_USE_LIBUV
|
||||
#ifdef LWS_WITH_LIBUV
|
||||
if (LWS_LIBUV_ENABLED(vhost->context))
|
||||
lws_uv_initvhost(vhost, wsi);
|
||||
#endif
|
||||
|
@ -210,7 +210,7 @@ lws_context_init_server(struct lws_context_creation_info *info,
|
|||
#endif
|
||||
#endif
|
||||
if (!lws_check_opt(info->options, LWS_SERVER_OPTION_EXPLICIT_VHOSTS)) {
|
||||
#ifdef LWS_USE_UNIX_SOCK
|
||||
#ifdef LWS_WITH_UNIX_SOCK
|
||||
if (LWS_UNIX_SOCK_ENABLED(vhost))
|
||||
lwsl_info(" Listening on \"%s\"\n", info->iface);
|
||||
else
|
||||
|
@ -738,7 +738,7 @@ lws_prepare_access_log_info(struct lws *wsi, char *uri_ptr, int meth)
|
|||
static const char * const hver[] = {
|
||||
"http/1.0", "http/1.1", "http/2"
|
||||
};
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
char ads[INET6_ADDRSTRLEN];
|
||||
#else
|
||||
char ads[INET_ADDRSTRLEN];
|
||||
|
@ -817,7 +817,7 @@ static const unsigned char methods[] = {
|
|||
WSI_TOKEN_PATCH_URI,
|
||||
WSI_TOKEN_DELETE_URI,
|
||||
WSI_TOKEN_CONNECT,
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
WSI_TOKEN_HTTP_COLON_PATH,
|
||||
#endif
|
||||
};
|
||||
|
@ -1530,7 +1530,7 @@ raw_transition:
|
|||
lwsl_info("Upgrade to ws\n");
|
||||
goto upgrade_ws;
|
||||
}
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
if (!strcasecmp(lws_hdr_simple_ptr(wsi, WSI_TOKEN_UPGRADE),
|
||||
"h2c")) {
|
||||
wsi->vhost->conn_stats.http2_upg++;
|
||||
|
@ -1561,7 +1561,7 @@ raw_transition:
|
|||
|
||||
return n;
|
||||
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
upgrade_h2c:
|
||||
if (!lws_hdr_total_length(wsi, WSI_TOKEN_HTTP2_SETTINGS)) {
|
||||
lwsl_info("missing http2_settings\n");
|
||||
|
@ -1829,7 +1829,7 @@ lws_get_or_create_peer(struct lws_vhost *vhost, lws_sockfd_type sockfd)
|
|||
int n, af = AF_INET;
|
||||
struct sockaddr_storage addr;
|
||||
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
if (LWS_IPV6_ENABLED(vhost)) {
|
||||
af = AF_INET6;
|
||||
}
|
||||
|
@ -1843,7 +1843,7 @@ lws_get_or_create_peer(struct lws_vhost *vhost, lws_sockfd_type sockfd)
|
|||
q = &s->sin_addr;
|
||||
rlen = sizeof(s->sin_addr);
|
||||
} else
|
||||
#ifdef LWS_USE_IPV6
|
||||
#ifdef LWS_WITH_IPV6
|
||||
{
|
||||
struct sockaddr_in6 *s = (struct sockaddr_in6 *)&addr;
|
||||
q = &s->sin6_addr;
|
||||
|
@ -2786,7 +2786,7 @@ try_pollout:
|
|||
|
||||
lws_plat_set_socket_options(wsi->vhost, accept_fd);
|
||||
|
||||
#if defined(LWS_USE_IPV6)
|
||||
#if defined(LWS_WITH_IPV6)
|
||||
lwsl_debug("accepted new conn port %u on fd=%d\n",
|
||||
((cli_addr.ss_family == AF_INET6) ?
|
||||
ntohs(((struct sockaddr_in6 *) &cli_addr)->sin6_port) :
|
||||
|
|
|
@ -72,7 +72,7 @@ lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
|
|||
{
|
||||
int write_type = LWS_WRITE_PONG;
|
||||
struct lws_tokens eff_buf;
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
struct lws *wsi2;
|
||||
#endif
|
||||
int ret, m, n;
|
||||
|
@ -111,7 +111,7 @@ lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
|
|||
if (wsi->mode == LWSCM_WSCL_ISSUE_HTTP_BODY)
|
||||
goto user_service;
|
||||
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
/*
|
||||
* Priority 2: protocol packets
|
||||
*/
|
||||
|
@ -366,7 +366,7 @@ user_service:
|
|||
user_service_go_again:
|
||||
#endif
|
||||
|
||||
#ifdef LWS_USE_HTTP2
|
||||
#ifdef LWS_WITH_HTTP2
|
||||
/*
|
||||
* we are the 'network wsi' for potentially many muxed child wsi with
|
||||
* no network connection of their own, who have to use us for all their
|
||||
|
|
|
@ -35,7 +35,7 @@ extern int lws_ssl_get_error(struct lws *wsi, int n);
|
|||
static int
|
||||
OpenSSL_client_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
|
||||
{
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
lwsl_notice("%s\n", __func__);
|
||||
|
||||
return 0;
|
||||
|
@ -150,14 +150,14 @@ lws_ssl_client_bio_create(struct lws *wsi)
|
|||
|
||||
#endif
|
||||
|
||||
#if !defined(USE_WOLFSSL) && !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(USE_WOLFSSL) && !defined(LWS_WITH_MBEDTLS)
|
||||
#ifndef USE_OLD_CYASSL
|
||||
/* OpenSSL_client_verify_callback will be called @ SSL_connect() */
|
||||
SSL_set_verify(wsi->ssl, SSL_VERIFY_PEER, OpenSSL_client_verify_callback);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(USE_WOLFSSL) && !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(USE_WOLFSSL) && !defined(LWS_WITH_MBEDTLS)
|
||||
SSL_set_mode(wsi->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
|
||||
#endif
|
||||
/*
|
||||
|
@ -175,7 +175,7 @@ lws_ssl_client_bio_create(struct lws *wsi)
|
|||
#endif
|
||||
#endif
|
||||
#else
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
if (wsi->vhost->x509_client_CA)
|
||||
SSL_set_verify(wsi->ssl, SSL_VERIFY_PEER, OpenSSL_client_verify_callback);
|
||||
else
|
||||
|
@ -205,7 +205,7 @@ lws_ssl_client_bio_create(struct lws *wsi)
|
|||
#endif
|
||||
#endif /* USE_WOLFSSL */
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
wsi->client_bio = BIO_new_socket(wsi->desc.sockfd, BIO_NOCLOSE);
|
||||
SSL_set_bio(wsi->ssl, wsi->client_bio, wsi->client_bio);
|
||||
#else
|
||||
|
@ -219,12 +219,12 @@ lws_ssl_client_bio_create(struct lws *wsi)
|
|||
wolfSSL_set_using_nonblock(wsi->ssl, 1);
|
||||
#endif
|
||||
#else
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
BIO_set_nbio(wsi->client_bio, 1); /* nonblocking */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
SSL_set_ex_data(wsi->ssl, openssl_websocket_private_data_index,
|
||||
wsi);
|
||||
#endif
|
||||
|
@ -232,7 +232,7 @@ lws_ssl_client_bio_create(struct lws *wsi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
int ERR_get_error(void)
|
||||
{
|
||||
return 0;
|
||||
|
@ -379,7 +379,7 @@ lws_ssl_client_connect2(struct lws *wsi)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
{
|
||||
X509 *peer = SSL_get_peer_certificate(wsi->ssl);
|
||||
|
||||
|
@ -437,7 +437,7 @@ int lws_context_init_client_ssl(struct lws_context_creation_info *info,
|
|||
struct lws wsi;
|
||||
unsigned long error;
|
||||
const char *ca_filepath = info->ssl_ca_filepath;
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
const char *cipher_list = info->ssl_cipher_list;
|
||||
const char *private_key_filepath = info->ssl_private_key_filepath;
|
||||
const char *cert_filepath = info->ssl_cert_filepath;
|
||||
|
@ -508,7 +508,7 @@ int lws_context_init_client_ssl(struct lws_context_creation_info *info,
|
|||
SSL_CTX_set_options(vhost->ssl_client_ctx, SSL_OP_NO_COMPRESSION);
|
||||
#endif
|
||||
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
if (ca_filepath) {
|
||||
lws_filepos_t len;
|
||||
uint8_t *buf;
|
||||
|
|
|
@ -27,7 +27,7 @@ extern int openssl_websocket_private_data_index,
|
|||
extern void
|
||||
lws_ssl_bind_passphrase(SSL_CTX *ssl_ctx, struct lws_context_creation_info *info);
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
static int
|
||||
OpenSSL_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ static int
|
|||
lws_context_ssl_init_ecdh_curve(struct lws_context_creation_info *info,
|
||||
struct lws_vhost *vhost)
|
||||
{
|
||||
#if defined(LWS_HAVE_OPENSSL_ECDH_H) && !defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_HAVE_OPENSSL_ECDH_H) && !defined(LWS_WITH_MBEDTLS)
|
||||
EC_KEY *ecdh;
|
||||
int ecdh_nid;
|
||||
const char *ecdh_curve = "prime256v1";
|
||||
|
@ -130,7 +130,7 @@ lws_context_ssl_init_ecdh_curve(struct lws_context_creation_info *info,
|
|||
|
||||
lwsl_notice(" SSL ECDH curve '%s'\n", ecdh_curve);
|
||||
#else
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
lwsl_notice(" OpenSSL doesn't support ECDH\n");
|
||||
#endif
|
||||
#endif
|
||||
|
@ -243,7 +243,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
* versions", compared to e.g. TLSv1_2_server_method() which only allows
|
||||
* tlsv1.2. Unwanted versions must be disabled using SSL_CTX_set_options()
|
||||
*/
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
{
|
||||
SSL_METHOD *method;
|
||||
|
||||
|
@ -276,7 +276,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
|
||||
}
|
||||
#endif
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
|
||||
/* associate the lws context with the SSL_CTX */
|
||||
|
||||
|
@ -305,7 +305,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
LWS_SERVER_OPTION_PEER_CERT_NOT_REQUIRED))
|
||||
verify_options |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
SSL_CTX_set_session_id_context(vhost->ssl_ctx,
|
||||
(unsigned char *)context, sizeof(void *));
|
||||
|
||||
|
@ -316,7 +316,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS) && !defined(OPENSSL_NO_TLSEXT)
|
||||
#if !defined(LWS_WITH_MBEDTLS) && !defined(OPENSSL_NO_TLSEXT)
|
||||
SSL_CTX_set_tlsext_servername_callback(vhost->ssl_ctx,
|
||||
lws_ssl_server_name_cb);
|
||||
#endif
|
||||
|
@ -325,7 +325,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
* give user code a chance to load certs into the server
|
||||
* allowing it to verify incoming client certs
|
||||
*/
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
if (info->ssl_ca_filepath &&
|
||||
!SSL_CTX_load_verify_locations(vhost->ssl_ctx,
|
||||
info->ssl_ca_filepath, NULL)) {
|
||||
|
@ -349,7 +349,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
SSL_CTX_set_options(vhost->ssl_ctx, info->ssl_options_set);
|
||||
|
||||
/* SSL_clear_options introduced in 0.9.8m */
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x009080df) && !defined(USE_WOLFSSL)
|
||||
if (info->ssl_options_clear)
|
||||
SSL_CTX_clear_options(vhost->ssl_ctx, info->ssl_options_clear);
|
||||
|
@ -369,7 +369,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
* happened just above and has the vhost SSL_CTX * in the user
|
||||
* parameter.
|
||||
*/
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
/* set the local certificate from CertFile */
|
||||
n = SSL_CTX_use_certificate_chain_file(vhost->ssl_ctx,
|
||||
info->ssl_cert_filepath);
|
||||
|
@ -425,7 +425,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
#endif
|
||||
#endif
|
||||
if (info->ssl_private_key_filepath != NULL) {
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
/* set the private key from KeyFile */
|
||||
if (SSL_CTX_use_PrivateKey_file(vhost->ssl_ctx,
|
||||
info->ssl_private_key_filepath,
|
||||
|
@ -446,7 +446,7 @@ lws_context_init_server_ssl(struct lws_context_creation_info *info,
|
|||
|
||||
return 1;
|
||||
}
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
/* verify private key */
|
||||
if (!SSL_CTX_check_private_key(vhost->ssl_ctx)) {
|
||||
lwsl_err("Private SSL key doesn't match cert\n");
|
||||
|
|
32
lib/ssl.c
32
lib/ssl.c
|
@ -54,7 +54,7 @@ bail:
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
#if defined(LWS_WITH_ESP32)
|
||||
int alloc_file(struct lws_context *context, const char *filename, uint8_t **buf,
|
||||
lws_filepos_t *amount)
|
||||
|
@ -250,7 +250,7 @@ char* lws_ssl_get_error_string(int status, int ret, char *buf, size_t len) {
|
|||
void
|
||||
lws_ssl_elaborate_error(void)
|
||||
{
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
#else
|
||||
char buf[256];
|
||||
u_long err;
|
||||
|
@ -262,7 +262,7 @@ lws_ssl_elaborate_error(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
|
||||
static int
|
||||
lws_context_init_ssl_pem_passwd_cb(char * buf, int size, int rwflag, void *userdata)
|
||||
|
@ -301,10 +301,10 @@ lws_context_init_ssl_library(struct lws_context_creation_info *info)
|
|||
lwsl_info(" Compiled with wolfSSL support\n");
|
||||
#endif
|
||||
#else
|
||||
#if defined(LWS_USE_BORINGSSL)
|
||||
#if defined(LWS_WITH_BORINGSSL)
|
||||
lwsl_info(" Compiled with BoringSSL support\n");
|
||||
#else
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
lwsl_info(" Compiled with MbedTLS support\n");
|
||||
#else
|
||||
lwsl_info(" Compiled with OpenSSL support\n");
|
||||
|
@ -320,7 +320,7 @@ lws_context_init_ssl_library(struct lws_context_creation_info *info)
|
|||
|
||||
lwsl_info("Doing SSL library init\n");
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
SSL_library_init();
|
||||
OpenSSL_add_all_algorithms();
|
||||
SSL_load_error_strings();
|
||||
|
@ -347,7 +347,7 @@ lws_ssl_destroy(struct lws_vhost *vhost)
|
|||
if (!vhost->user_supplied_ssl_ctx && vhost->ssl_client_ctx)
|
||||
SSL_CTX_free(vhost->ssl_client_ctx);
|
||||
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
if (vhost->x509_client_CA)
|
||||
X509_free(vhost->x509_client_CA);
|
||||
#else
|
||||
|
@ -410,7 +410,7 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
|
|||
struct lws_context *context = wsi->context;
|
||||
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
|
||||
int n = 0;
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
int ssl_read_errno = 0;
|
||||
#endif
|
||||
|
||||
|
@ -446,7 +446,7 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
|
|||
return LWS_SSL_CAPABLE_ERROR;
|
||||
|
||||
if (n == SSL_ERROR_SYSCALL) {
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
int err = ERR_get_error();
|
||||
if (err == 0 && (ssl_read_errno == EPIPE ||
|
||||
ssl_read_errno == ECONNABORTED ||
|
||||
|
@ -541,7 +541,7 @@ LWS_VISIBLE int
|
|||
lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len)
|
||||
{
|
||||
int n;
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
int ssl_read_errno = 0;
|
||||
#endif
|
||||
|
||||
|
@ -564,7 +564,7 @@ lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len)
|
|||
if (n == SSL_ERROR_ZERO_RETURN)
|
||||
return LWS_SSL_CAPABLE_ERROR;
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
if (n == SSL_ERROR_SYSCALL) {
|
||||
int err = ERR_get_error();
|
||||
|
||||
|
@ -676,7 +676,7 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
|
|||
struct lws_context *context = wsi->context;
|
||||
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
|
||||
int n, m;
|
||||
#if !defined(USE_WOLFSSL) && !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(USE_WOLFSSL) && !defined(LWS_WITH_MBEDTLS)
|
||||
BIO *bio;
|
||||
#endif
|
||||
char buf[256];
|
||||
|
@ -721,7 +721,7 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
|
|||
context->updated = 1;
|
||||
#endif
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
SSL_set_ex_data(wsi->ssl,
|
||||
openssl_websocket_private_data_index, wsi);
|
||||
#endif
|
||||
|
@ -734,7 +734,7 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
|
|||
wolfSSL_set_using_nonblock(wsi->ssl, 1);
|
||||
#endif
|
||||
#else
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
lws_plat_set_socket_options(wsi->vhost, accept_fd);
|
||||
#else
|
||||
SSL_set_mode(wsi->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
|
||||
|
@ -851,7 +851,7 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
|
|||
|
||||
m = lws_ssl_get_error(wsi, n);
|
||||
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
if (m == 5 && errno == 11)
|
||||
m = SSL_ERROR_WANT_READ;
|
||||
#endif
|
||||
|
@ -928,7 +928,7 @@ void
|
|||
lws_ssl_context_destroy(struct lws_context *context)
|
||||
{
|
||||
|
||||
#if !defined(LWS_USE_MBEDTLS)
|
||||
#if !defined(LWS_WITH_MBEDTLS)
|
||||
|
||||
// after 1.1.0 no need
|
||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000)
|
||||
|
|
|
@ -523,7 +523,7 @@ ssh_destroy_channel(struct per_session_data__sshd *pss,
|
|||
static int
|
||||
lws_ssh_parse_plaintext(struct per_session_data__sshd *pss, uint8_t *p, size_t len)
|
||||
{
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
mbedtls_rsa_context *ctx;
|
||||
#else
|
||||
BIGNUM *bn_e = NULL, *bn_n = NULL;
|
||||
|
@ -1222,7 +1222,7 @@ again:
|
|||
* Prepare the RSA decryption context: load in
|
||||
* the E and N factors
|
||||
*/
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
ctx = sshd_zalloc(sizeof(*ctx));
|
||||
if (!ctx)
|
||||
goto ua_fail;
|
||||
|
@ -1300,7 +1300,7 @@ again:
|
|||
m = lws_g32(&pp);
|
||||
pp += m;
|
||||
m = lws_g32(&pp);
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
ctx->len = m;
|
||||
#endif
|
||||
|
||||
|
@ -1313,7 +1313,7 @@ again:
|
|||
if (!otmp)
|
||||
/* ua_fail1 frees bn_e, bn_n and rsa */
|
||||
goto ua_fail1;
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
m = mbedtls_rsa_rsaes_pkcs1_v15_decrypt(ctx,
|
||||
NULL, NULL, MBEDTLS_RSA_PUBLIC,
|
||||
&olen, pp, otmp, m);
|
||||
|
@ -1350,7 +1350,7 @@ again:
|
|||
}
|
||||
} else
|
||||
lwsl_notice("decrypt failed\n");
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
mbedtls_rsa_free(ctx);
|
||||
free(ctx);
|
||||
#endif
|
||||
|
@ -1876,7 +1876,7 @@ ch_fail:
|
|||
break;
|
||||
|
||||
ua_fail1:
|
||||
#if defined(LWS_USE_MBEDTLS)
|
||||
#if defined(LWS_WITH_MBEDTLS)
|
||||
mbedtls_rsa_free(ctx);
|
||||
free(ctx);
|
||||
#else
|
||||
|
|
|
@ -193,7 +193,7 @@ TARGET_X86_LWS_OPTIONS = \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
@ -208,7 +208,7 @@ TARGET_X86_64_LWS_OPTIONS = \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
@ -223,7 +223,7 @@ TARGET_ARM_LWS_OPTIONS = \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
@ -238,7 +238,7 @@ TARGET_ARM_V7A_LWS_OPTIONS = \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
@ -253,7 +253,7 @@ TARGET_ARM_V7A_HARD_LWS_OPTIONS = \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
@ -268,7 +268,7 @@ TARGET_ARM64_V8A_LWS_OPTIONS = \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
@ -283,7 +283,7 @@ TARGET_MIPS_LWS_OPTIONS = \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
@ -298,7 +298,7 @@ TARGET_MIPS64_LWS_OPTIONS = \
|
|||
-DLWS_WITHOUT_DAEMONIZE=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_IPV6=OFF \
|
||||
-DLWS_USE_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_BUNDLED_ZLIB=OFF \
|
||||
-DLWS_WITH_SSL=ON \
|
||||
-DLWS_WITH_HTTP2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
|
Loading…
Add table
Reference in a new issue