FS-10690: [libblade] fixed some linux build issues that were missed recently for stringbuilder addition
This commit is contained in:
parent
71286aa436
commit
e28abe2929
|
@ -8,16 +8,6 @@ testbuild_SOURCES = testbuild.c tap.c
|
|||
testbuild_CFLAGS = $(AM_CFLAGS)
|
||||
testbuild_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += bladec
|
||||
bladec_SOURCES = bladec.c tap.c
|
||||
bladec_CFLAGS = $(AM_CFLAGS)
|
||||
bladec_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += blades
|
||||
blades_SOURCES = blades.c tap.c
|
||||
blades_CFLAGS = $(AM_CFLAGS)
|
||||
blades_LDADD = $(TEST_LDADD)
|
||||
|
||||
check_PROGRAMS += testcli
|
||||
testcli_SOURCES = testcli.c tap.c
|
||||
testcli_CFLAGS = $(AM_CFLAGS)
|
||||
|
|
|
@ -1,309 +0,0 @@
|
|||
#include "blade.h"
|
||||
#include "tap.h"
|
||||
|
||||
#define CONSOLE_INPUT_MAX 512
|
||||
|
||||
ks_bool_t g_shutdown = KS_FALSE;
|
||||
|
||||
void loop(blade_handle_t *bh);
|
||||
void process_console_input(blade_handle_t *bh, char *line);
|
||||
|
||||
typedef void (*command_callback)(blade_handle_t *bh, char *args);
|
||||
|
||||
struct command_def_s {
|
||||
const char *cmd;
|
||||
command_callback callback;
|
||||
};
|
||||
|
||||
void command_quit(blade_handle_t *bh, char *args);
|
||||
void command_execute(blade_handle_t *bh, char *args);
|
||||
void command_subscribe(blade_handle_t *bh, char *args);
|
||||
|
||||
static const struct command_def_s command_defs[] = {
|
||||
{ "quit", command_quit },
|
||||
{ "execute", command_execute },
|
||||
{ "subscribe", command_subscribe },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ks_bool_t test_echo_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
blade_session_t *bs = NULL;
|
||||
cJSON *result = NULL;
|
||||
const char *text = NULL;
|
||||
|
||||
ks_assert(brpcres);
|
||||
|
||||
bh = blade_rpc_response_handle_get(brpcres);
|
||||
ks_assert(bh);
|
||||
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
result = blade_rpcexecute_response_result_get(brpcres);
|
||||
ks_assert(result);
|
||||
|
||||
text = cJSON_GetObjectCstr(result, "text");
|
||||
ks_assert(text);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.echo response processing\n", blade_session_id_get(bs));
|
||||
|
||||
blade_session_read_unlock(bs);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.echo: %s\n", blade_session_id_get(bs), text);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
|
||||
ks_bool_t blade_locate_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
blade_session_t *bs = NULL;
|
||||
const char *nodeid = NULL;
|
||||
cJSON *res = NULL;
|
||||
cJSON *res_result = NULL;
|
||||
cJSON *res_result_controllers = NULL;
|
||||
const char *res_result_protocol = NULL;
|
||||
cJSON *params = NULL;
|
||||
|
||||
ks_assert(brpcres);
|
||||
|
||||
bh = blade_rpc_response_handle_get(brpcres);
|
||||
ks_assert(bh);
|
||||
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
res = blade_rpc_response_message_get(brpcres);
|
||||
ks_assert(res);
|
||||
|
||||
res_result = cJSON_GetObjectItem(res, "result");
|
||||
ks_assert(res_result);
|
||||
|
||||
res_result_protocol = cJSON_GetObjectCstr(res_result, "protocol");
|
||||
ks_assert(res_result_protocol);
|
||||
|
||||
res_result_controllers = cJSON_GetObjectItem(res_result, "controllers");
|
||||
ks_assert(res_result_controllers);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) blade.locate response processing\n", blade_session_id_get(bs));
|
||||
|
||||
for (int index = 0; index < cJSON_GetArraySize(res_result_controllers); ++index) {
|
||||
cJSON *elem = cJSON_GetArrayItem(res_result_controllers, index);
|
||||
if (elem->type == cJSON_String) {
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) blade.locate (%s) provider (%s)\n", blade_session_id_get(bs), res_result_protocol, elem->valuestring);
|
||||
nodeid = elem->valuestring;
|
||||
}
|
||||
}
|
||||
|
||||
blade_session_read_unlock(bs);
|
||||
|
||||
params = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(params, "text", "hello world!");
|
||||
blade_handle_rpcexecute(bh, nodeid, "test.echo", res_result_protocol, params, test_echo_response_handler, NULL);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
|
||||
ks_bool_t blade_subscribe_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
blade_session_t *bs = NULL;
|
||||
|
||||
ks_assert(brpcres);
|
||||
|
||||
bh = blade_rpc_response_handle_get(brpcres);
|
||||
ks_assert(bh);
|
||||
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) blade.subscribe response processing\n", blade_session_id_get(bs));
|
||||
|
||||
blade_session_read_unlock(bs);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
|
||||
ks_bool_t test_event_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
blade_session_t *bs = NULL;
|
||||
|
||||
ks_assert(brpcreq);
|
||||
|
||||
bh = blade_rpc_request_handle_get(brpcreq);
|
||||
ks_assert(bh);
|
||||
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_request_sessionid_get(brpcreq));
|
||||
ks_assert(bs);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.event request processing\n", blade_session_id_get(bs));
|
||||
|
||||
blade_session_read_unlock(bs);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
config_t config;
|
||||
config_setting_t *config_blade = NULL;
|
||||
const char *cfgpath = "bladec.cfg";
|
||||
//const char *session_state_callback_id = NULL;
|
||||
const char *autoconnect = NULL;
|
||||
|
||||
ks_global_set_default_logger(KS_LOG_LEVEL_DEBUG);
|
||||
|
||||
blade_init();
|
||||
|
||||
blade_handle_create(&bh);
|
||||
|
||||
//if (argc > 1) cfgpath = argv[1];
|
||||
if (argc > 1) autoconnect = argv[1];
|
||||
|
||||
config_init(&config);
|
||||
if (!config_read_file(&config, cfgpath)) {
|
||||
ks_log(KS_LOG_ERROR, "%s:%d - %s\n", config_error_file(&config), config_error_line(&config), config_error_text(&config));
|
||||
config_destroy(&config);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
config_blade = config_lookup(&config, "blade");
|
||||
if (!config_blade) {
|
||||
ks_log(KS_LOG_ERROR, "Missing 'blade' config group\n");
|
||||
config_destroy(&config);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (config_setting_type(config_blade) != CONFIG_TYPE_GROUP) {
|
||||
ks_log(KS_LOG_ERROR, "The 'blade' config setting is not a group\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (blade_handle_startup(bh, config_blade) != KS_STATUS_SUCCESS) {
|
||||
ks_log(KS_LOG_ERROR, "Blade startup failed\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (autoconnect) {
|
||||
blade_connection_t *bc = NULL;
|
||||
blade_identity_t *target = NULL;
|
||||
|
||||
blade_identity_create(&target, ks_pool_get(bh));
|
||||
|
||||
if (blade_identity_parse(target, autoconnect) == KS_STATUS_SUCCESS) blade_handle_connect(bh, &bc, target, NULL);
|
||||
|
||||
blade_identity_destroy(&target);
|
||||
|
||||
ks_sleep_ms(3000);
|
||||
}
|
||||
|
||||
loop(bh);
|
||||
|
||||
blade_handle_destroy(&bh);
|
||||
|
||||
config_destroy(&config);
|
||||
|
||||
blade_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void loop(blade_handle_t *bh)
|
||||
{
|
||||
char buf[CONSOLE_INPUT_MAX];
|
||||
while (!g_shutdown) {
|
||||
if (!fgets(buf, CONSOLE_INPUT_MAX, stdin)) break;
|
||||
|
||||
for (int index = 0; buf[index]; ++index) {
|
||||
if (buf[index] == '\r' || buf[index] == '\n') {
|
||||
buf[index] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
process_console_input(bh, buf);
|
||||
}
|
||||
}
|
||||
|
||||
void parse_argument(char **input, char **arg, char terminator)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
ks_assert(input);
|
||||
ks_assert(*input);
|
||||
ks_assert(arg);
|
||||
|
||||
tmp = *input;
|
||||
*arg = tmp;
|
||||
|
||||
while (*tmp && *tmp != terminator) ++tmp;
|
||||
if (*tmp == terminator) {
|
||||
*tmp = '\0';
|
||||
++tmp;
|
||||
}
|
||||
*input = tmp;
|
||||
}
|
||||
|
||||
void process_console_input(blade_handle_t *bh, char *line)
|
||||
{
|
||||
char *args = line;
|
||||
char *cmd = NULL;
|
||||
ks_bool_t found = KS_FALSE;
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Output: %s\n", line);
|
||||
|
||||
parse_argument(&args, &cmd, ' ');
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Command: %s, Args: %s\n", cmd, args);
|
||||
|
||||
for (int32_t index = 0; command_defs[index].cmd; ++index) {
|
||||
if (!strcmp(command_defs[index].cmd, cmd)) {
|
||||
found = KS_TRUE;
|
||||
command_defs[index].callback(bh, args);
|
||||
}
|
||||
}
|
||||
if (!found) ks_log(KS_LOG_INFO, "Command '%s' unknown.\n", cmd);
|
||||
}
|
||||
|
||||
void command_quit(blade_handle_t *bh, char *args)
|
||||
{
|
||||
//ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Shutting down\n");
|
||||
g_shutdown = KS_TRUE;
|
||||
}
|
||||
|
||||
void command_execute(blade_handle_t *bh, char *args)
|
||||
{
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
blade_handle_rpclocate(bh, "test", blade_locate_response_handler, NULL);
|
||||
}
|
||||
|
||||
void command_subscribe(blade_handle_t *bh, char *args)
|
||||
{
|
||||
cJSON *channels = NULL;
|
||||
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
channels = cJSON_CreateArray();
|
||||
cJSON_AddItemToArray(channels, cJSON_CreateString("test"));
|
||||
blade_handle_rpcsubscribe(bh, BLADE_RPCSUBSCRIBE_COMMAND_SUBSCRIBER_ADD, "test", channels, blade_subscribe_response_handler, NULL, test_event_request_handler, NULL);
|
||||
cJSON_Delete(channels);
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
|
||||
*/
|
|
@ -1,3 +0,0 @@
|
|||
blade:
|
||||
{
|
||||
};
|
|
@ -1,216 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4A70CDA9-AC5B-4818-BCF2-B0DD1B8F5F5F}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>bladec</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\..\w32\openssl.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\w32\sodium.props" />
|
||||
<Import Project="..\..\..\w32\config.props" />
|
||||
<Import Project="..\..\..\w32\civetweb.props" />
|
||||
<Import Project="..\..\..\w32\pcre.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\w32\sodium.props" />
|
||||
<Import Project="..\..\..\w32\config.props" />
|
||||
<Import Project="..\..\..\w32\civetweb.props" />
|
||||
<Import Project="..\..\..\w32\pcre.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\w32\sodium.props" />
|
||||
<Import Project="..\..\..\w32\config.props" />
|
||||
<Import Project="..\..\..\w32\civetweb.props" />
|
||||
<Import Project="..\..\..\w32\pcre.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\w32\sodium.props" />
|
||||
<Import Project="..\..\..\w32\config.props" />
|
||||
<Import Project="..\..\..\w32\civetweb.props" />
|
||||
<Import Project="..\..\..\w32\pcre.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IncludePath>$(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>$(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IncludePath>$(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>$(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../src/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4090</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;KS_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../src/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4090</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../src/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4090</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../src/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4090</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="tap.c" />
|
||||
<ClCompile Include="bladec.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\libks\libks.vcxproj">
|
||||
<Project>{70d178d8-1100-4152-86c0-809a91cff832}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\win32\libconfig\libconfig.2015.vcxproj">
|
||||
<Project>{1a234565-926d-49b2-83e4-d56e0c38c9f2}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\win32\libsodium\libsodium.2015.vcxproj">
|
||||
<Project>{a185b162-6cb6-4502-b03f-b56f7699a8d9}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\libblade.vcxproj">
|
||||
<Project>{a89d6d18-6203-4149-9051-f8e798e7a3e7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,268 +0,0 @@
|
|||
#include "blade.h"
|
||||
#include "tap.h"
|
||||
|
||||
#define CONSOLE_INPUT_MAX 512
|
||||
|
||||
ks_bool_t g_shutdown = KS_FALSE;
|
||||
|
||||
void loop(blade_handle_t *bh);
|
||||
void process_console_input(blade_handle_t *bh, char *line);
|
||||
|
||||
typedef void (*command_callback)(blade_handle_t *bh, char *args);
|
||||
|
||||
struct command_def_s {
|
||||
const char *cmd;
|
||||
command_callback callback;
|
||||
};
|
||||
|
||||
void command_quit(blade_handle_t *bh, char *args);
|
||||
void command_publish(blade_handle_t *bh, char *args);
|
||||
void command_broadcast(blade_handle_t *bh, char *args);
|
||||
|
||||
static const struct command_def_s command_defs[] = {
|
||||
{ "quit", command_quit },
|
||||
{ "publish", command_publish },
|
||||
{ "broadcast", command_broadcast },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
|
||||
ks_bool_t blade_publish_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
blade_session_t *bs = NULL;
|
||||
|
||||
ks_assert(brpcres);
|
||||
|
||||
bh = blade_rpc_response_handle_get(brpcres);
|
||||
ks_assert(bh);
|
||||
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) blade.publish response processing\n", blade_session_id_get(bs));
|
||||
|
||||
blade_session_read_unlock(bs);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
|
||||
ks_bool_t test_echo_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
blade_session_t *bs = NULL;
|
||||
cJSON *params = NULL;
|
||||
cJSON *result = NULL;
|
||||
const char *text = NULL;
|
||||
|
||||
ks_assert(brpcreq);
|
||||
|
||||
bh = blade_rpc_request_handle_get(brpcreq);
|
||||
ks_assert(bh);
|
||||
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_request_sessionid_get(brpcreq));
|
||||
ks_assert(bs);
|
||||
|
||||
// @todo get the inner parameters of a blade.execute request for protocolrpcs
|
||||
params = blade_rpcexecute_request_params_get(brpcreq);
|
||||
ks_assert(params);
|
||||
|
||||
text = cJSON_GetObjectCstr(params, "text");
|
||||
ks_assert(text);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.echo request processing\n", blade_session_id_get(bs));
|
||||
|
||||
blade_session_read_unlock(bs);
|
||||
|
||||
// @todo build and send response
|
||||
result = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(result, "text", text);
|
||||
|
||||
blade_rpcexecute_response_send(brpcreq, result);
|
||||
cJSON_Delete(result);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
|
||||
ks_bool_t test_broadcast_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
blade_session_t *bs = NULL;
|
||||
|
||||
ks_assert(brpcres);
|
||||
|
||||
bh = blade_rpc_response_handle_get(brpcres);
|
||||
ks_assert(bh);
|
||||
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test broadcast response processing\n", blade_session_id_get(bs));
|
||||
|
||||
blade_session_read_unlock(bs);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
blade_handle_t *bh = NULL;
|
||||
config_t config;
|
||||
config_setting_t *config_blade = NULL;
|
||||
const char *cfgpath = "blades.cfg";
|
||||
const char *autoconnect = NULL;
|
||||
|
||||
ks_global_set_default_logger(KS_LOG_LEVEL_DEBUG);
|
||||
|
||||
blade_init();
|
||||
|
||||
blade_handle_create(&bh);
|
||||
|
||||
if (argc > 1) autoconnect = argv[1];
|
||||
|
||||
config_init(&config);
|
||||
if (!config_read_file(&config, cfgpath)) {
|
||||
ks_log(KS_LOG_ERROR, "%s:%d - %s\n", config_error_file(&config), config_error_line(&config), config_error_text(&config));
|
||||
config_destroy(&config);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
config_blade = config_lookup(&config, "blade");
|
||||
if (!config_blade) {
|
||||
ks_log(KS_LOG_ERROR, "Missing 'blade' config group\n");
|
||||
config_destroy(&config);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (config_setting_type(config_blade) != CONFIG_TYPE_GROUP) {
|
||||
ks_log(KS_LOG_ERROR, "The 'blade' config setting is not a group\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (blade_handle_startup(bh, config_blade) != KS_STATUS_SUCCESS) {
|
||||
ks_log(KS_LOG_ERROR, "Blade startup failed\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (autoconnect) {
|
||||
blade_connection_t *bc = NULL;
|
||||
blade_identity_t *target = NULL;
|
||||
|
||||
blade_identity_create(&target, ks_pool_get(bh));
|
||||
|
||||
if (blade_identity_parse(target, autoconnect) == KS_STATUS_SUCCESS) blade_handle_connect(bh, &bc, target, NULL);
|
||||
|
||||
blade_identity_destroy(&target);
|
||||
|
||||
ks_sleep_ms(3000); // @todo use session state change callback to know when the session is ready, this hack temporarily ensures it's ready before trying to publish upstream
|
||||
}
|
||||
|
||||
loop(bh);
|
||||
|
||||
blade_handle_destroy(&bh);
|
||||
|
||||
config_destroy(&config);
|
||||
|
||||
blade_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void loop(blade_handle_t *bh)
|
||||
{
|
||||
char buf[CONSOLE_INPUT_MAX];
|
||||
while (!g_shutdown) {
|
||||
if (!fgets(buf, CONSOLE_INPUT_MAX, stdin)) break;
|
||||
|
||||
for (int index = 0; buf[index]; ++index) {
|
||||
if (buf[index] == '\r' || buf[index] == '\n') {
|
||||
buf[index] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
process_console_input(bh, buf);
|
||||
}
|
||||
}
|
||||
|
||||
void parse_argument(char **input, char **arg, char terminator)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
ks_assert(input);
|
||||
ks_assert(*input);
|
||||
ks_assert(arg);
|
||||
|
||||
tmp = *input;
|
||||
*arg = tmp;
|
||||
|
||||
while (*tmp && *tmp != terminator) ++tmp;
|
||||
if (*tmp == terminator) {
|
||||
*tmp = '\0';
|
||||
++tmp;
|
||||
}
|
||||
*input = tmp;
|
||||
}
|
||||
|
||||
void process_console_input(blade_handle_t *bh, char *line)
|
||||
{
|
||||
char *args = line;
|
||||
char *cmd = NULL;
|
||||
ks_bool_t found = KS_FALSE;
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Output: %s\n", line);
|
||||
|
||||
parse_argument(&args, &cmd, ' ');
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Command: %s, Args: %s\n", cmd, args);
|
||||
|
||||
for (int32_t index = 0; command_defs[index].cmd; ++index) {
|
||||
if (!strcmp(command_defs[index].cmd, cmd)) {
|
||||
found = KS_TRUE;
|
||||
command_defs[index].callback(bh, args);
|
||||
}
|
||||
}
|
||||
if (!found) ks_log(KS_LOG_INFO, "Command '%s' unknown.\n", cmd);
|
||||
}
|
||||
|
||||
void command_quit(blade_handle_t *bh, char *args)
|
||||
{
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Shutting down\n");
|
||||
g_shutdown = KS_TRUE;
|
||||
}
|
||||
|
||||
void command_publish(blade_handle_t *bh, char *args)
|
||||
{
|
||||
blade_rpc_t *brpc = NULL;
|
||||
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
blade_rpc_create(&brpc, bh, "test.echo", "test", test_echo_request_handler, NULL);
|
||||
blade_rpcmgr_protocolrpc_add(blade_handle_rpcmgr_get(bh), brpc);
|
||||
|
||||
// @todo build up json-based method schema for each protocolrpc registered above, and pass into blade_handle_rpcpublish() to attach to the request, to be stored in the blade_protocol_t tracked by the master node
|
||||
blade_handle_rpcpublish(bh, BLADE_RPCPUBLISH_COMMAND_CONTROLLER_ADD, "test", NULL, blade_publish_response_handler, NULL);
|
||||
}
|
||||
|
||||
void command_broadcast(blade_handle_t *bh, char *args)
|
||||
{
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
blade_handle_rpcbroadcast(bh, "test", "channel", "event", NULL, test_broadcast_response_handler, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
|
||||
*/
|
|
@ -1,20 +0,0 @@
|
|||
blade:
|
||||
{
|
||||
transport:
|
||||
{
|
||||
wss:
|
||||
{
|
||||
endpoints:
|
||||
{
|
||||
ipv4 = ( { address = "0.0.0.0", port = 2101 } );
|
||||
ipv6 = ( { address = "::", port = 2101 } );
|
||||
backlog = 128;
|
||||
};
|
||||
# SSL group is optional, disabled when absent
|
||||
ssl:
|
||||
{
|
||||
# todo: server SSL stuffs here
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,216 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{636D5B57-FC64-4A18-8D42-54209F8886BD}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>blades</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="..\..\..\w32\openssl.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\w32\sodium.props" />
|
||||
<Import Project="..\..\..\w32\config.props" />
|
||||
<Import Project="..\..\..\w32\civetweb.props" />
|
||||
<Import Project="..\..\..\w32\pcre.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\w32\sodium.props" />
|
||||
<Import Project="..\..\..\w32\config.props" />
|
||||
<Import Project="..\..\..\w32\civetweb.props" />
|
||||
<Import Project="..\..\..\w32\pcre.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\w32\sodium.props" />
|
||||
<Import Project="..\..\..\w32\config.props" />
|
||||
<Import Project="..\..\..\w32\civetweb.props" />
|
||||
<Import Project="..\..\..\w32\pcre.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\w32\sodium.props" />
|
||||
<Import Project="..\..\..\w32\config.props" />
|
||||
<Import Project="..\..\..\w32\civetweb.props" />
|
||||
<Import Project="..\..\..\w32\pcre.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IncludePath>$(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>$(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IncludePath>$(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>$(SolutionDir);$(SolutionDir)..\libks\src\include;$(SolutionDir)..\libsodium-$(SodiumVersion)\src\libsodium\include;$(SolutionDir)..\libconfig-$(ConfigVersion)\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../src/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4090</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;KS_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../src/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4090</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;rpcrt4.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../src/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4090</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../src/include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4090</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="tap.c" />
|
||||
<ClCompile Include="blades.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\libks\libks.vcxproj">
|
||||
<Project>{70d178d8-1100-4152-86c0-809a91cff832}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\win32\libconfig\libconfig.2015.vcxproj">
|
||||
<Project>{1a234565-926d-49b2-83e4-d56e0c38c9f2}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\win32\libsodium\libsodium.2015.vcxproj">
|
||||
<Project>{a185b162-6cb6-4502-b03f-b56f7699a8d9}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\libblade.vcxproj">
|
||||
<Project>{a89d6d18-6203-4149-9051-f8e798e7a3e7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -12,7 +12,7 @@ libks_la_SOURCES += src/ks_log.c src/ks_socket.c src/ks_buffer.c src/ks_pool.c s
|
|||
libks_la_SOURCES += src/ks_time.c src/ks_printf.c src/ks_hash.c src/ks_q.c src/ks_dso.c
|
||||
libks_la_SOURCES += src/ks_ssl.c src/kws.c src/ks_rng.c src/ks_base64.c
|
||||
libks_la_SOURCES += crypt/aeskey.c crypt/aestab.c crypt/sha2.c crypt/aes_modes.c crypt/aescrypt.c
|
||||
libks_la_SOURCES += src/ks_acl.c
|
||||
libks_la_SOURCES += src/ks_acl.c src/ks_sb.c
|
||||
|
||||
libks_la_CFLAGS = $(AM_CFLAGS)
|
||||
libks_la_CPPFLAGS = -DPOSIX
|
||||
|
@ -25,7 +25,7 @@ library_include_HEADERS += src/include/ks_pool.h src/include/simclist.h src/incl
|
|||
library_include_HEADERS += src/include/ks_dso.h src/include/ks_platform.h src/include/ks_types.h src/include/ks_rng.h
|
||||
library_include_HEADERS += src/include/ks_printf.h src/include/ks_hash.h src/include/ks_ssl.h src/include/kws.h
|
||||
library_include_HEADERS += src/include/ks_base64.h
|
||||
library_include_HEADERS += src/include/ks_acl.h
|
||||
library_include_HEADERS += src/include/ks_acl.h src/include/ks_sb.h
|
||||
|
||||
tests: libks.la
|
||||
$(MAKE) -C test tests
|
||||
|
|
|
@ -129,7 +129,7 @@ KS_DECLARE(ks_status_t) ks_sb_accommodate(ks_sb_t *sb, ks_size_t len)
|
|||
}
|
||||
|
||||
done:
|
||||
return KS_STATUS_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
KS_DECLARE(ks_status_t) ks_sb_append(ks_sb_t *sb, const char *str)
|
||||
|
@ -224,4 +224,3 @@ done:
|
|||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue