lwsws conf.c migrate to lib
authorAndy Green <andy@warmcat.com>
Thu, 26 May 2016 13:12:11 +0000 (21:12 +0800)
committerAndy Green <andy@warmcat.com>
Thu, 26 May 2016 13:12:11 +0000 (21:12 +0800)
Signed-off-by: Andy Green <andy@warmcat.com>
CMakeLists.txt
lib/lejp-conf.c [moved from lwsws/conf.c with 99% similarity]
lib/libwebsockets.h
lwsws/lwsws.h [deleted file]
lwsws/main.c

index 7e28b7a..2fbb180 100644 (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()
similarity index 99%
rename from lwsws/conf.c
rename to lib/lejp-conf.c
index 1d16b88..96ded72 100644 (file)
  * 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",
index f2f9fc9..f71ab79 100644 (file)
@@ -2130,6 +2130,18 @@ 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
  *
  * Use these helper functions if you want to access a file from the perspective
diff --git a/lwsws/lwsws.h b/lwsws/lwsws.h
deleted file mode 100644 (file)
index 12fc62d..0000000
+++ /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 <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);
index ae40094..b428199 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301  USA
  */
+#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>
+#include <syslog.h>
+#include <sys/time.h>
+#include <unistd.h>
+#else
+#include <io.h>
+#include "gettimeofday.h"
+#endif
 
-#include "lwsws.h"
+#include "../lib/libwebsockets.h"
 
 static struct lws_context *context;