diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e28b7ac0..2fbb18046 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ option(LWS_WITH_PLUGINS "Support plugins for protocols and extensions" OFF) option(LWS_WITH_ACCESS_LOG "Support generating Apache-compatible access logs" OFF) option(LWS_WITH_SERVER_STATUS "Support json + jscript server monitoring" OFF) option(LWS_WITH_LEJP "With the Lightweight JSON Parser" OFF) +option(LWS_WITH_LEJP_CONF "With LEJP configuration parser as used by lwsws" OFF) if (LWS_WITH_LWSWS) message(STATUS "LWS_WITH_LWSWS --> Enabling LWS_WITH_PLUGINS and LWS_WITH_LIBUV") @@ -106,6 +107,7 @@ if (LWS_WITH_LWSWS) set(LWS_WITH_ACCESS_LOG 1) set(LWS_WITH_SERVER_STATUS 1) set(LWS_WITH_LEJP 1) + set(LWS_WITH_LEJP_CONF 1) endif() if (LWS_WITH_PLUGINS AND NOT LWS_WITH_LIBUV) @@ -584,6 +586,11 @@ if (LWS_WITH_LEJP) list(APPEND HDR_PUBLIC lib/lejp.h) endif() +if (LWS_WITH_LEJP_CONF) + list(APPEND SOURCES + "lib/lejp-conf.c" + ) +endif() # Add helper files for Windows. if (WIN32) @@ -1264,7 +1271,6 @@ endif(NOT LWS_WITHOUT_TESTAPPS) if (LWS_WITH_LWSWS) list(APPEND LWSWS_SRCS "lwsws/main.c" - "lwsws/conf.c" ) if (WIN32) @@ -1292,8 +1298,6 @@ if (LWS_WITH_LWSWS) PROPERTY COMPILE_DEFINITIONS INSTALL_DATADIR="${CMAKE_INSTALL_PREFIX}/share" ) - - endif (LWS_WITH_LWSWS) if (UNIX) @@ -1509,7 +1513,7 @@ message(" PLUGINS = ${PLUGINS_LIST}") message(" LWS_WITH_ACCESS_LOG = ${LWS_WITH_ACCESS_LOG}") message(" LWS_WITH_SERVER_STATUS = ${LWS_WITH_SERVER_STATUS}") message(" LWS_WITH_LEJP = ${LWS_WITH_LEJP}") -message(" LWS_WITH_GENERIC_SESSIONS = ${LWS_WITH_GENERIC_SESSIONS}") +message(" LWS_WITH_LEJP_CONF = ${LWS_WITH_LEJP_CONF}") message("---------------------------------------------------------------------") # These will be available to parent projects including libwebsockets using add_subdirectory() diff --git a/lwsws/conf.c b/lib/lejp-conf.c similarity index 99% rename from lwsws/conf.c rename to lib/lejp-conf.c index 1d16b883d..96ded72c4 100644 --- a/lwsws/conf.c +++ b/lib/lejp-conf.c @@ -19,7 +19,13 @@ * MA 02110-1301 USA */ -#include "lwsws.h" +#include "private-libwebsockets.h" +#include "lejp.h" + +#ifndef _WIN32 +/* this is needed for Travis CI */ +#include +#endif static const char * const paths_global[] = { "global.uid", diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index f2f9fc902..f71ab79a7 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -2129,6 +2129,18 @@ lws_cgi_kill(struct lws *wsi); LWS_VISIBLE LWS_EXTERN int lws_http_client_read(struct lws *wsi, char **buf, int *len); +/* + * lejp conf parsers + */ +LWS_VISIBLE LWS_EXTERN int +lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d, + char **config_strings, int *len); + +LWS_VISIBLE LWS_EXTERN int +lwsws_get_config_vhosts(struct lws_context *context, + struct lws_context_creation_info *info, const char *d, + char **config_strings, int *len); + /* * Wsi-associated File Operations access helpers * diff --git a/lwsws/lwsws.h b/lwsws/lwsws.h deleted file mode 100644 index 12fc62dbc..000000000 --- a/lwsws/lwsws.h +++ /dev/null @@ -1,45 +0,0 @@ -#if defined(_WIN32) && defined(EXTERNAL_POLL) -#define WINVER 0x0600 -#define _WIN32_WINNT 0x0600 -#define poll(fdArray, fds, timeout) WSAPoll((LPWSAPOLLFD)(fdArray), (ULONG)(fds), (INT)(timeout)) -#endif - -#include "lws_config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef _WIN32 -#include -#endif - -#include "../lib/libwebsockets.h" -#include "lejp.h" - -#ifdef _WIN32 -#include -#include "gettimeofday.h" -#else -#include -#include -#include -#endif - - -#ifndef __func__ -#define __func__ __FUNCTION__ -#endif - -extern int -lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d, - char **config_strings, int *len); - -extern int -lwsws_get_config_vhosts(struct lws_context *context, - struct lws_context_creation_info *info, const char *d, - char **config_strings, int *len); diff --git a/lwsws/main.c b/lwsws/main.c index ae4009446..b428199d1 100644 --- a/lwsws/main.c +++ b/lwsws/main.c @@ -18,8 +18,27 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA */ +#include "lws_config.h" -#include "lwsws.h" +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef _WIN32 +#include +#include +#include +#include +#else +#include +#include "gettimeofday.h" +#endif + +#include "../lib/libwebsockets.h" static struct lws_context *context;