SUBDIRS = . test switchblade
AUTOMAKE_OPTIONS = subdir-objects
-AM_CFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/src/include
+AM_CFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/src/include -I$(top_srcdir)/../civetweb-1.9.1/include
+AM_LDFLAGS += -L$(top_srcdir)/../civetweb-1.9.1
noinst_LTLIBRARIES = libunqlite.la
libunqlite_la_SOURCES = src/unqlite.c
lib_LTLIBRARIES = libblade.la
libblade_la_SOURCES = src/blade.c src/blade_stack.c
libblade_la_SOURCES += src/blade_transportmgr.c src/blade_rpcmgr.c src/blade_routemgr.c src/blade_subscriptionmgr.c
-libblade_la_SOURCES += src/blade_mastermgr.c src/blade_connectionmgr.c src/blade_sessionmgr.c
+libblade_la_SOURCES += src/blade_mastermgr.c src/blade_connectionmgr.c src/blade_sessionmgr.c src/blade_restmgr.c
libblade_la_SOURCES += src/blade_identity.c src/blade_rpc.c src/blade_connection.c src/blade_session.c
libblade_la_SOURCES += src/blade_protocol.c src/blade_subscription.c src/blade_channel.c
libblade_la_SOURCES += src/blade_transport.c src/blade_transport_wss.c
libblade_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
-libblade_la_LDFLAGS = -version-info 0:1:0 -lncurses -lpthread -lm -lconfig $(AM_LDFLAGS)
+libblade_la_LDFLAGS = -version-info 0:1:0 -lncurses -lpthread -lm -lconfig -lcivetweb $(AM_LDFLAGS)
libblade_la_LIBADD = libunqlite.la
library_includedir = $(prefix)/include
library_include_HEADERS = src/include/blade.h src/include/blade_types.h src/include/blade_stack.h
library_include_HEADERS += src/include/blade_transportmgr.h src/include/blade_rpcmgr.h src/include/blade_routemgr.h src/include/blade_subscriptionmgr.h
-library_include_HEADERS += src/include/blade_mastermgr.h src/include/blade_connectionmgr.h src/include/blade_sessionmgr.h
+library_include_HEADERS += src/include/blade_mastermgr.h src/include/blade_connectionmgr.h src/include/blade_sessionmgr.h src/include/blade_restmgr.h
library_include_HEADERS += src/include/blade_identity.h src/include/blade_rpc.h src/include/blade_connection.h src/include/blade_session.h
library_include_HEADERS += src/include/blade_protocol.h src/include/blade_subscription.h src/include/blade_channel.h
library_include_HEADERS += src/include/blade_transport.h src/include/blade_transport_wss.h
/*
* Copyright (c) 2017, Shane Bryldt
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
- *
+ *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
blade_restmgr_t *brestmgr = NULL;
ks_assert(brestmgrP);
-
+
ks_pool_open(&pool);
ks_assert(pool);
#define CONFIG_LOADSTR(k) \
tmp = config_lookup_from(rest, k); \
if (tmp && config_setting_type(tmp) != CONFIG_TYPE_STRING) return KS_STATUS_FAIL; \
-if (tmp) ks_hash_insert(brestmgr->config.options, (const void *)k, (void *)ks_pstrdup(pool, config_setting_get_string(tmp)));
+if (tmp) ks_hash_insert(brestmgr->config.options, (void *)k, (void *)ks_pstrdup(pool, config_setting_get_string(tmp)));
ks_status_t blade_restmgr_config(blade_restmgr_t *brestmgr, config_setting_t *config)
{
void blade_restmgr_handle_end_request(const struct mg_connection *conn, int reply_status_code)
{
-
+
}
int blade_restmgr_handle_log_message(const struct mg_connection *conn, const char *message)
#ifndef _BLADE_H_
#define _BLADE_H_
+
+#define USE_STACK_SIZE 102400
+#define MAX_REQUEST_SIZE 16384
+#define USE_DUKTAPE 1
+#define USE_IPV6 1
+#define LUA_COMPAT_ALL 1
+#define USE_LUA 1
+#define USE_LUA_SQLITE3 1
+#define USE_LUA_FILE_SYSTEM 1
+#define USE_WEBSOCKET 1
+
#include <ks.h>
#include <sodium.h>
#include <libconfig.h>
-AM_CFLAGS += -I$(abs_top_srcdir)/src/include -g -ggdb -O0
-TEST_LDADD = $(abs_top_builddir)/libblade.la -lconfig -lm -lpthread
+AM_CFLAGS += -I$(abs_top_srcdir)/src/include -g -ggdb -O0 -I$(top_srcdir)/../civetweb-1.9.1/include
+TEST_LDADD = $(abs_top_builddir)/libblade.la -L$(top_srcdir)/../civetweb-1.9.1 -lconfig -lm -lpthread -lcivetweb
check_PROGRAMS =
--- /dev/null
+HTTP/1.0 200 OK
+Content-Type: text/html
+
+<html><body>
+
+<p>
+<span>Today is:</span>
+<? mg.write(os.date("%A")) ?>
+</p>
+<p>
+URI is <?=mg.request_info.uri?>
+</p>
+
+</body></html>
-AM_CFLAGS += -I$(abs_top_srcdir)/src/include -g -ggdb -O0
-TEST_LDADD = $(abs_top_builddir)/libblade.la -lconfig -lm -lpthread
+AM_CFLAGS += -I$(abs_top_srcdir)/src/include -g -ggdb -O0 -I$(top_srcdir)/../civetweb-1.9.1/include
+TEST_LDADD = $(abs_top_builddir)/libblade.la -L$(top_srcdir)/../civetweb-1.9.1 -lconfig -lm -lpthread -lcivetweb
check_PROGRAMS =