summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2024-01-18 11:25:43 +0200
committerGitHub <noreply@github.com>2024-01-18 11:25:43 +0200
commitdedc5be04014f80da63f4c3ca58307025ddffe8d (patch)
tree2a061a1b927e910aec2ef68ab1bc72ac9060c400
parent83d1250cfaca88d2210a173e7fc39073a4abdb6b (diff)
Move mqtt_websockets under aclk/ (#16804)
* Move mqtt_websockets under aclk/ * Use relative paths for includes from mqtt_websockets ...in order to reduce the number of header search paths that we use when building the agent. Ideally, we'd make each component a standalone library target from CMake's perspective but more work needs to be done before we are able to do this. * Remove unused files. * Make licensing information consistent across all files. * Flatten the hierarchy of source files.
-rw-r--r--CMakeLists.txt46
-rw-r--r--aclk/aclk.c2
-rw-r--r--aclk/aclk_otp.c2
-rw-r--r--aclk/aclk_query.h2
-rw-r--r--aclk/aclk_stats.h2
-rw-r--r--aclk/aclk_tx_msgs.h2
-rw-r--r--aclk/aclk_util.h2
-rw-r--r--aclk/https_client.h4
-rw-r--r--aclk/mqtt_websockets/.github/workflows/run-tests.yaml (renamed from mqtt_websockets/.github/workflows/run-tests.yaml)0
-rw-r--r--aclk/mqtt_websockets/.gitignore (renamed from mqtt_websockets/.gitignore)0
-rw-r--r--aclk/mqtt_websockets/README.md7
-rw-r--r--aclk/mqtt_websockets/c-rbuf/cringbuffer.c (renamed from mqtt_websockets/c-rbuf/src/ringbuffer.c)14
-rw-r--r--aclk/mqtt_websockets/c-rbuf/cringbuffer.h (renamed from mqtt_websockets/c-rbuf/include/ringbuffer.h)12
-rw-r--r--aclk/mqtt_websockets/c-rbuf/cringbuffer_internal.h (renamed from mqtt_websockets/c-rbuf/src/ringbuffer_internal.h)12
-rw-r--r--aclk/mqtt_websockets/c-rbuf/ringbuffer_test.c (renamed from mqtt_websockets/c-rbuf/tests/ringbuffer_test.c)8
-rw-r--r--aclk/mqtt_websockets/c_rhash/c_rhash.c (renamed from mqtt_websockets/c_rhash/src/c_rhash.c)4
-rw-r--r--aclk/mqtt_websockets/c_rhash/c_rhash.h (renamed from mqtt_websockets/c_rhash/include/c_rhash.h)2
-rw-r--r--aclk/mqtt_websockets/c_rhash/c_rhash_internal.h (renamed from mqtt_websockets/c_rhash/src/c_rhash_internal.h)2
-rw-r--r--aclk/mqtt_websockets/c_rhash/tests.c (renamed from mqtt_websockets/c_rhash/src/tests.c)2
-rw-r--r--aclk/mqtt_websockets/common_internal.h (renamed from mqtt_websockets/src/include/common_internal.h)10
-rw-r--r--aclk/mqtt_websockets/common_public.c (renamed from mqtt_websockets/src/common_public.c)2
-rw-r--r--aclk/mqtt_websockets/common_public.h (renamed from mqtt_websockets/src/include/common_public.h)0
-rw-r--r--aclk/mqtt_websockets/endian_compat.h (renamed from mqtt_websockets/src/include/endian_compat.h)10
-rw-r--r--aclk/mqtt_websockets/mqtt_constants.h (renamed from mqtt_websockets/src/include/mqtt_constants.h)2
-rw-r--r--aclk/mqtt_websockets/mqtt_ng.c (renamed from mqtt_websockets/src/mqtt_ng.c)4
-rw-r--r--aclk/mqtt_websockets/mqtt_ng.h (renamed from mqtt_websockets/src/include/mqtt_ng.h)4
-rw-r--r--aclk/mqtt_websockets/mqtt_wss_client.c (renamed from mqtt_websockets/src/mqtt_wss_client.c)13
-rw-r--r--aclk/mqtt_websockets/mqtt_wss_client.h (renamed from mqtt_websockets/src/include/mqtt_wss_client.h)12
-rw-r--r--aclk/mqtt_websockets/mqtt_wss_log.c (renamed from mqtt_websockets/src/mqtt_wss_log.c)5
-rw-r--r--aclk/mqtt_websockets/mqtt_wss_log.h (renamed from mqtt_websockets/src/include/mqtt_wss_log.h)2
-rw-r--r--aclk/mqtt_websockets/test.c (renamed from mqtt_websockets/src/test.c)12
-rw-r--r--aclk/mqtt_websockets/ws_client.c (renamed from mqtt_websockets/src/ws_client.c)0
-rw-r--r--aclk/mqtt_websockets/ws_client.h (renamed from mqtt_websockets/src/include/ws_client.h)14
-rw-r--r--mqtt_websockets/LICENSE674
-rw-r--r--mqtt_websockets/Makefile61
-rw-r--r--mqtt_websockets/README.md12
-rw-r--r--mqtt_websockets/build/.keep0
-rw-r--r--mqtt_websockets/c-rbuf/.github/workflows/codeql-analysis.yml67
-rw-r--r--mqtt_websockets/c-rbuf/.github/workflows/run-tests.yaml13
-rw-r--r--mqtt_websockets/c-rbuf/.gitignore8
-rw-r--r--mqtt_websockets/c-rbuf/LICENSE165
-rw-r--r--mqtt_websockets/c-rbuf/Makefile24
-rw-r--r--mqtt_websockets/c-rbuf/README.md20
-rw-r--r--mqtt_websockets/c-rbuf/build/.keep0
-rw-r--r--mqtt_websockets/c_rhash/.github/workflows/run-tests.yaml16
-rw-r--r--mqtt_websockets/c_rhash/.gitignore58
-rw-r--r--mqtt_websockets/c_rhash/AUTHORS0
-rw-r--r--mqtt_websockets/c_rhash/COPYING674
-rw-r--r--mqtt_websockets/c_rhash/ChangeLog0
-rw-r--r--mqtt_websockets/c_rhash/INSTALL368
-rw-r--r--mqtt_websockets/c_rhash/LICENSE674
-rw-r--r--mqtt_websockets/c_rhash/Makefile.am21
-rw-r--r--mqtt_websockets/c_rhash/NEWS0
-rw-r--r--mqtt_websockets/c_rhash/README.md0
-rw-r--r--mqtt_websockets/c_rhash/configure.ac8
-rw-r--r--web/server/h2o/streaming.h2
56 files changed, 80 insertions, 3000 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3bbdeeea0a..eaf1f5fc16 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1295,23 +1295,23 @@ elseif(FREEBSD)
endif()
set(MQTT_WEBSOCKETS_FILES
- mqtt_websockets/src/mqtt_wss_client.c
- mqtt_websockets/src/include/mqtt_wss_client.h
- mqtt_websockets/src/mqtt_wss_log.c
- mqtt_websockets/src/include/mqtt_wss_log.h
- mqtt_websockets/src/ws_client.c
- mqtt_websockets/src/include/ws_client.h
- mqtt_websockets/src/mqtt_ng.c
- mqtt_websockets/src/include/mqtt_ng.h
- mqtt_websockets/src/common_public.c
- mqtt_websockets/src/include/common_public.h
- mqtt_websockets/src/include/common_internal.h
- mqtt_websockets/c-rbuf/src/ringbuffer.c
- mqtt_websockets/c-rbuf/include/ringbuffer.h
- mqtt_websockets/c-rbuf/src/ringbuffer_internal.h
- mqtt_websockets/c_rhash/src/c_rhash.c
- mqtt_websockets/c_rhash/include/c_rhash.h
- mqtt_websockets/c_rhash/src/c_rhash_internal.h
+ aclk/mqtt_websockets/mqtt_wss_client.c
+ aclk/mqtt_websockets/mqtt_wss_client.h
+ aclk/mqtt_websockets/mqtt_wss_log.c
+ aclk/mqtt_websockets/mqtt_wss_log.h
+ aclk/mqtt_websockets/ws_client.c
+ aclk/mqtt_websockets/ws_client.h
+ aclk/mqtt_websockets/mqtt_ng.c
+ aclk/mqtt_websockets/mqtt_ng.h
+ aclk/mqtt_websockets/common_public.c
+ aclk/mqtt_websockets/common_public.h
+ aclk/mqtt_websockets/common_internal.h
+ aclk/mqtt_websockets/c-rbuf/cringbuffer.c
+ aclk/mqtt_websockets/c-rbuf/cringbuffer.h
+ aclk/mqtt_websockets/c-rbuf/cringbuffer_internal.h
+ aclk/mqtt_websockets/c_rhash/c_rhash.c
+ aclk/mqtt_websockets/c_rhash/c_rhash.h
+ aclk/mqtt_websockets/c_rhash/c_rhash_internal.h
)
set(ACLK_PROTO_DEFS
@@ -1637,11 +1637,11 @@ if (ENABLE_H2O OR ENABLE_ACLK)
endif()
if(ENABLE_MQTTWEBSOCKETS)
- include_directories(BEFORE
- ${CMAKE_SOURCE_DIR}/mqtt_websockets/src/include
- ${CMAKE_SOURCE_DIR}/mqtt_websockets/c-rbuf/include
- ${CMAKE_SOURCE_DIR}/mqtt_websockets/c_rhash/include
- )
+ # include_directories(BEFORE
+ # ${CMAKE_SOURCE_DIR}/aclk/mqtt_websockets/src/include
+ # ${CMAKE_SOURCE_DIR}/aclk/mqtt_websockets/c-rbuf/include
+ # ${CMAKE_SOURCE_DIR}/aclk/mqtt_websockets/c_rhash/include
+ # )
add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES})
@@ -1995,8 +1995,6 @@ target_compile_definitions(netdata PRIVATE
target_include_directories(netdata PRIVATE
"$<$<BOOL:${ENABLE_PROTOBUF}>:${PROTOBUF_INCLUDE_DIRS}>"
"$<$<BOOL:${ENABLE_ACLK}>:${CMAKE_SOURCE_DIR}/aclk/aclk-schemas>"
- "$<$<BOOL:${ENABLE_MQTTWEBSOCKETS}>:${CMAKE_SOURCE_DIR}/mqtt_websockets/src/include>"
- "$<$<BOOL:${ENABLE_MQTTWEBSOCKETS}>:${CMAKE_SOURCE_DIR}/mqtt_websockets/c-rbuf/include>"
"$<$<BOOL:${ENABLE_ML}>:${CMAKE_SOURCE_DIR}/ml/dlib>"
"$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_INCLUDE_DIRS}>"
"$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_INCLUDE_DIRS}>"
diff --git a/aclk/aclk.c b/aclk/aclk.c
index e95d7d6ab7..6d583a76a6 100644
--- a/aclk/aclk.c
+++ b/aclk/aclk.c
@@ -4,7 +4,7 @@
#ifdef ENABLE_ACLK
#include "aclk_stats.h"
-#include "mqtt_wss_client.h"
+#include "mqtt_websockets/mqtt_wss_client.h"
#include "aclk_otp.h"
#include "aclk_tx_msgs.h"
#include "aclk_query.h"
diff --git a/aclk/aclk_otp.c b/aclk/aclk_otp.c
index 207ca08cf0..e03f8b2121 100644
--- a/aclk/aclk_otp.c
+++ b/aclk/aclk_otp.c
@@ -7,7 +7,7 @@
#include "daemon/common.h"
-#include "mqtt_websockets/c-rbuf/include/ringbuffer.h"
+#include "mqtt_websockets/c-rbuf/cringbuffer.h"
static int aclk_https_request(https_req_t *request, https_req_response_t *response) {
int rc;
diff --git a/aclk/aclk_query.h b/aclk/aclk_query.h
index dbe6f9e5e6..371b8d0a24 100644
--- a/aclk/aclk_query.h
+++ b/aclk/aclk_query.h
@@ -5,7 +5,7 @@
#include "libnetdata/libnetdata.h"
-#include "mqtt_wss_client.h"
+#include "mqtt_websockets/mqtt_wss_client.h"
#include "aclk_query_queue.h"
diff --git a/aclk/aclk_stats.h b/aclk/aclk_stats.h
index 002ebcfa6b..758347ae26 100644
--- a/aclk/aclk_stats.h
+++ b/aclk/aclk_stats.h
@@ -6,7 +6,7 @@
#include "daemon/common.h"
#include "libnetdata/libnetdata.h"
#include "aclk_query_queue.h"
-#include "mqtt_wss_client.h"
+#include "mqtt_websockets/mqtt_wss_client.h"
extern netdata_mutex_t aclk_stats_mutex;
diff --git a/aclk/aclk_tx_msgs.h b/aclk/aclk_tx_msgs.h
index 9e7d890772..86ed20c381 100644
--- a/aclk/aclk_tx_msgs.h
+++ b/aclk/aclk_tx_msgs.h
@@ -5,7 +5,7 @@
#include <json-c/json.h>
#include "libnetdata/libnetdata.h"
#include "daemon/common.h"
-#include "mqtt_wss_client.h"
+#include "mqtt_websockets/mqtt_wss_client.h"
#include "schema-wrappers/schema_wrappers.h"
#include "aclk_util.h"
diff --git a/aclk/aclk_util.h b/aclk/aclk_util.h
index 38ef5b0bcb..6c0239cc31 100644
--- a/aclk/aclk_util.h
+++ b/aclk/aclk_util.h
@@ -5,7 +5,7 @@
#include "libnetdata/libnetdata.h"
#ifdef ENABLE_ACLK
-#include "mqtt_wss_client.h"
+#include "mqtt_websockets/mqtt_wss_client.h"
#define CLOUD_EC_MALFORMED_NODE_ID 1
#define CLOUD_EMSG_MALFORMED_NODE_ID "URL requests node_id but there is not enough chars following (for it to be valid uuid)."
diff --git a/aclk/https_client.h b/aclk/https_client.h
index c87b3b69fd..79d0a42b75 100644
--- a/aclk/https_client.h
+++ b/aclk/https_client.h
@@ -5,8 +5,8 @@
#include "libnetdata/libnetdata.h"
-#include "mqtt_websockets/c-rbuf/include/ringbuffer.h"
-#include "mqtt_websockets/c_rhash/include/c_rhash.h"
+#include "mqtt_websockets/c-rbuf/cringbuffer.h"
+#include "mqtt_websockets/c_rhash/c_rhash.h"
typedef enum http_req_type {
HTTP_REQ_GET = 0,
diff --git a/mqtt_websockets/.github/workflows/run-tests.yaml b/aclk/mqtt_websockets/.github/workflows/run-tests.yaml
index da5dde821b..da5dde821b 100644
--- a/mqtt_websockets/.github/workflows/run-tests.yaml
+++ b/aclk/mqtt_websockets/.github/workflows/run-tests.yaml
diff --git a/mqtt_websockets/.gitignore b/aclk/mqtt_websockets/.gitignore
index 9f1a0d89a3..9f1a0d89a3 100644
--- a/mqtt_websockets/.gitignore
+++ b/aclk/mqtt_websockets/.gitignore
diff --git a/aclk/mqtt_websockets/README.md b/aclk/mqtt_websockets/README.md
new file mode 100644
index 0000000000..b159686dfb
--- /dev/null
+++ b/aclk/mqtt_websockets/README.md
@@ -0,0 +1,7 @@
+# mqtt_websockets
+
+Library to connect MQTT client over Websockets Secure (WSS).
+
+## License
+
+The Project is released under GPL v3 license. See [License](LICENSE)
diff --git a/mqtt_websockets/c-rbuf/src/ringbuffer.c b/aclk/mqtt_websockets/c-rbuf/cringbuffer.c
index 0dec13654d..165980166e 100644
--- a/mqtt_websockets/c-rbuf/src/ringbuffer.c
+++ b/aclk/mqtt_websockets/c-rbuf/cringbuffer.c
@@ -1,13 +1,7 @@
-/*
- *
- * Copyright: SPDX-License-Identifier: LGPL-3.0-only
- *
- * Author: Timotej Šiškovič <timotejs@gmail.com>
- *
- */
-
-#include "ringbuffer.h"
-#include "ringbuffer_internal.h"
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
+
+#include "cringbuffer.h"
+#include "cringbuffer_internal.h"
#include <stdlib.h>
#include <assert.h>
diff --git a/mqtt_websockets/c-rbuf/include/ringbuffer.h b/aclk/mqtt_websockets/c-rbuf/cringbuffer.h
index cc8d334cb3..eb98035a96 100644
--- a/mqtt_websockets/c-rbuf/include/ringbuffer.h
+++ b/aclk/mqtt_websockets/c-rbuf/cringbuffer.h
@@ -1,13 +1,7 @@
-/*
- *
- * Copyright: SPDX-License-Identifier: LGPL-3.0-only
- *
- * Author: Timotej Šiškovič <timotejs@gmail.com>
- *
- */
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
-#ifndef RINGBUFFER_H
-#define RINGBUFFER_H
+#ifndef CRINGBUFFER_H
+#define CRINGBUFFER_H
#include <stddef.h>
diff --git a/mqtt_websockets/c-rbuf/src/ringbuffer_internal.h b/aclk/mqtt_websockets/c-rbuf/cringbuffer_internal.h
index f7bdf815cc..d32de187ce 100644
--- a/mqtt_websockets/c-rbuf/src/ringbuffer_internal.h
+++ b/aclk/mqtt_websockets/c-rbuf/cringbuffer_internal.h
@@ -1,13 +1,7 @@
-/*
- *
- * Copyright: SPDX-License-Identifier: LGPL-3.0-only
- *
- * Author: Timotej Šiškovič <timotejs@gmail.com>
- *
- */
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
-#ifndef RINGBUFFER_INTERNAL_H
-#define RINGBUFFER_INTERNAL_H
+#ifndef CRINGBUFFER_INTERNAL_H
+#define CRINGBUFFER_INTERNAL_H
struct rbuf_t {
char *data;
diff --git a/mqtt_websockets/c-rbuf/tests/ringbuffer_test.c b/aclk/mqtt_websockets/c-rbuf/ringbuffer_test.c
index d810ea5a14..6a17c99567 100644
--- a/mqtt_websockets/c-rbuf/tests/ringbuffer_test.c
+++ b/aclk/mqtt_websockets/c-rbuf/ringbuffer_test.c
@@ -1,10 +1,4 @@
-/*
- *
- * Copyright: SPDX-License-Identifier: LGPL-3.0-only
- *
- * Author: Timotej Šiškovič <timotejs@gmail.com>
- *
- */
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
#include "ringbuffer.h"
diff --git a/mqtt_websockets/c_rhash/src/c_rhash.c b/aclk/mqtt_websockets/c_rhash/c_rhash.c
index fd130a4428..a71b500e2c 100644
--- a/mqtt_websockets/c_rhash/src/c_rhash.c
+++ b/aclk/mqtt_websockets/c_rhash/c_rhash.c
@@ -1,3 +1,5 @@
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
+
#include "c_rhash_internal.h"
#include <stdlib.h>
@@ -259,4 +261,4 @@ void c_rhash_destroy(c_rhash hash) {
c_rhash_destroy_bin(hash->bins[i]);
}
c_rfree(hash);
-} \ No newline at end of file
+}
diff --git a/mqtt_websockets/c_rhash/include/c_rhash.h b/aclk/mqtt_websockets/c_rhash/c_rhash.h
index e14fea5ded..37addd1616 100644
--- a/mqtt_websockets/c_rhash/include/c_rhash.h
+++ b/aclk/mqtt_websockets/c_rhash/c_rhash.h
@@ -1,3 +1,5 @@
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
+
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
diff --git a/mqtt_websockets/c_rhash/src/c_rhash_internal.h b/aclk/mqtt_websockets/c_rhash/c_rhash_internal.h
index aefa9453c0..20f741076b 100644
--- a/mqtt_websockets/c_rhash/src/c_rhash_internal.h
+++ b/aclk/mqtt_websockets/c_rhash/c_rhash_internal.h
@@ -1,3 +1,5 @@
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
+
#include "c_rhash.h"
struct bin_item {
diff --git a/mqtt_websockets/c_rhash/src/tests.c b/aclk/mqtt_websockets/c_rhash/tests.c
index 652aad69be..909c5562db 100644
--- a/mqtt_websockets/c_rhash/src/tests.c
+++ b/aclk/mqtt_websockets/c_rhash/tests.c
@@ -1,3 +1,5 @@
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
+
#include <stdio.h>
#include <string.h>
diff --git a/mqtt_websockets/src/include/common_internal.h b/aclk/mqtt_websockets/common_internal.h
index 2e6563552b..356e7121fa 100644
--- a/mqtt_websockets/src/include/common_internal.h
+++ b/aclk/mqtt_websockets/common_internal.h
@@ -1,14 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
-//
-// 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, version 3.
-//
-// 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 <https://www.gnu.org/licenses/>.
#ifndef COMMON_INTERNAL_H
#define COMMON_INTERNAL_H
diff --git a/mqtt_websockets/src/common_public.c b/aclk/mqtt_websockets/common_public.c
index 7f74fa511c..7991b0c238 100644
--- a/mqtt_websockets/src/common_public.c
+++ b/aclk/mqtt_websockets/common_public.c
@@ -1,3 +1,5 @@
+// Copyright: SPDX-License-Identifier: GPL-3.0-only
+
#include "common_public.h"
// this dummy exists to have a special pointer with special meaning
diff --git a/mqtt_websockets/src/include/common_public.h b/aclk/mqtt_websockets/common_public.h
index a855737f9e..a855737f9e 100644
--- a/