diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d8d145b2..7bf0bb0c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,7 @@ find_program(PROTOBUF_COMPILER NAMES protoc) set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/share/pkgconfig:/usr/lib64/pkgconfig") -pkg_check_modules(JANSSON IMPORTED_TARGET REQUIRED jansson>=2.7) +pkg_check_modules(JANSSON IMPORTED_TARGET REQUIRED jansson>=2.10) pkg_check_modules(LIBWEBSOCKETS IMPORTED_TARGET REQUIRED libwebsockets>=2.3.0) pkg_check_modules(PROTOBUF IMPORTED_TARGET protobuf>=2.6.0) pkg_check_modules(PROTOBUFC IMPORTED_TARGET libprotobuf-c>=1.1.0) diff --git a/include/villas/super_node.h b/include/villas/super_node.h index 81ad888dc..7e4729ae3 100644 --- a/include/villas/super_node.h +++ b/include/villas/super_node.h @@ -42,4 +42,6 @@ struct lws_vhost * web_get_vhost(struct web *w); enum state web_get_state(struct web *w); +#ifdef WITH_WEB int web_callback_on_writable(struct web *w, struct lws *wsi); +#endif diff --git a/lib/formats/csv.c b/lib/formats/csv.c index 9de170515..910c96510 100644 --- a/lib/formats/csv.c +++ b/lib/formats/csv.c @@ -121,7 +121,7 @@ static size_t csv_sscan_single(struct io *io, const char *buf, size_t len, struc if (sig->type == SIGNAL_TYPE_AUTO) { /* Find end of the current column */ - next = strpbrk(ptr, (char[]) { io->separator, io->delimiter, 0 }); + next = strpbrk(ptr, ((char[]) { io->separator, io->delimiter, 0 })); if (next == NULL) goto out; diff --git a/lib/formats/villas_human.c b/lib/formats/villas_human.c index b969d1527..ef7f5aa90 100644 --- a/lib/formats/villas_human.c +++ b/lib/formats/villas_human.c @@ -146,7 +146,7 @@ static size_t villas_human_sscan_single(struct io *io, const char *buf, size_t l if (sig->type == SIGNAL_TYPE_AUTO) { /* Find end of the current column */ - next = strpbrk(ptr, (char[]) { io->separator, io->delimiter, 0 }); + next = strpbrk(ptr, ((char[]) { io->separator, io->delimiter, 0 })); if (next == NULL) goto out; diff --git a/lib/super_node.cpp b/lib/super_node.cpp index 366e6bb10..011ce1f2c 100644 --- a/lib/super_node.cpp +++ b/lib/super_node.cpp @@ -53,8 +53,12 @@ SuperNode::SuperNode() : affinity(0), hugepages(DEFAULT_NR_HUGEPAGES), stats(0), +#ifdef WITH_API api(this), +#ifdef WITH_WEB web(&api), +#endif +#endif json(nullptr) { nodes.state = STATE_DESTROYED; @@ -467,9 +471,9 @@ void SuperNode::stopInterfaces() void SuperNode::stop() { - int ret; #ifdef WITH_HOOKS + int ret; if (stats > 0) { ret = task_destroy(&task); if (ret) @@ -583,7 +587,7 @@ extern "C" { return ssn->getInterfaces(); } - +#ifdef WITH_WEB struct web * super_node_get_web(struct super_node *sn) { SuperNode *ssn = reinterpret_cast(sn); @@ -591,7 +595,7 @@ extern "C" { return reinterpret_cast(w); } - +#endif struct lws_context * web_get_context(struct web *w) { Web *ws = reinterpret_cast(w); @@ -613,8 +617,10 @@ extern "C" { return ws->getState(); } +#ifdef WITH_WEB int web_callback_on_writable(struct web *w, struct lws *wsi) { return lws_callback_on_writable(wsi); } +#endif } diff --git a/tests/integration/pipe-loopback-rtp-dual.sh b/tests/integration/pipe-loopback-rtp-dual.sh new file mode 100755 index 000000000..cda8dca58 --- /dev/null +++ b/tests/integration/pipe-loopback-rtp-dual.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# Integration loopback test for villas-pipe. +# +# @author Steffen Vogel +# @author Marvin Klimke +# @copyright 2014-2019, Institute for Automation of Complex Power Systems, EONERC +# @license GNU General Public License (version 3) +# +# VILLASnode +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################## + +SCRIPT=$(realpath $0) +SCRIPTPATH=$(dirname ${SCRIPT}) +source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh + +CONFIG_FILE_SRC=$(mktemp) +CONFIG_FILE_DEST=$(mktemp) +INPUT_FILE=$(mktemp) +OUTPUT_FILE=$(mktemp) + +FORMAT="villas.binary" +VECTORIZE="1" + +RATE=10000 +NUM_SAMPLES=100 + +cat > ${CONFIG_FILE_SRC} << EOF +{ + "nodes" : { + "rtp_node" : { + "type" : "rtp", + "format" : "${FORMAT}", + "vectorize" : ${VECTORIZE}, + "rate" : ${RATE}, + "rtcp" : { + "enabled" : false, + "mode" : "aimd", + "throttle_mode" : "decimate" + }, + "aimd" : { + "a" : 10, + "b" : 0.5 + }, + "in" : { + "address" : "0.0.0.0:12002", + "signals" : { + "count" : 5, + "type" : "float" + } + }, + "out" : { + "address" : "127.0.0.1:12000" + } + } + } +} +EOF + +cat > ${CONFIG_FILE_DEST} << EOF +{ + "nodes" : { + "rtp_node" : { + "type" : "rtp", + "format" : "${FORMAT}", + "vectorize" : ${VECTORIZE}, + "rate" : ${RATE}, + "rtcp": { + "enabled" : false, + "mode" : "aimd", + "throttle_mode" : "decimate" + }, + "aimd" : { + "a" : 10, + "b" : 0.5 + }, + "in" : { + "address" : "0.0.0.0:12000", + "signals" : { + "count" : 5, + "type" : "float" + } + }, + "out" : { + "address" : "127.0.0.1:12002" + } + } + } +} +EOF + +villas-signal mixed -v 5 -l ${NUM_SAMPLES} > ${INPUT_FILE} + +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE_DEST} rtp_node > ${OUTPUT_FILE} & + +villas-pipe ${CONFIG_FILE_SRC} rtp_node < ${INPUT_FILE} + +# Compare data +villas-test-cmp ${CMPFLAGS} ${INPUT_FILE} ${OUTPUT_FILE} +RC=$? + +rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} + +exit $RC