1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

lwsws conf.c migrate to lib

Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
Andy Green 2016-05-26 21:12:11 +08:00
parent 488e05a6b4
commit 3358c53445
5 changed files with 47 additions and 51 deletions

View file

@ -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()

View file

@ -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 <dirent.h>
#endif
static const char * const paths_global[] = {
"global.uid",

View file

@ -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
*

View file

@ -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 <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <signal.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#ifndef _WIN32
#include <dirent.h>
#endif
#include "../lib/libwebsockets.h"
#include "lejp.h"
#ifdef _WIN32
#include <io.h>
#include "gettimeofday.h"
#else
#include <syslog.h>
#include <sys/time.h>
#include <unistd.h>
#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);

View file

@ -18,8 +18,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#include "lws_config.h"
#include "lwsws.h"
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <signal.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#ifndef _WIN32
#include <dirent.h>
#include <syslog.h>
#include <sys/time.h>
#include <unistd.h>
#else
#include <io.h>
#include "gettimeofday.h"
#endif
#include "../lib/libwebsockets.h"
static struct lws_context *context;