summaryrefslogtreecommitdiffstats
path: root/aclk/schema-wrappers/agent_cmds.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:04 +0000
commita836a244a3d2bdd4da1ee2641e3e957850668cea (patch)
treecb87c75b3677fab7144f868435243f864048a1e6 /aclk/schema-wrappers/agent_cmds.cc
parentAdding upstream version 1.38.1. (diff)
downloadnetdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.tar.xz
netdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.zip
Adding upstream version 1.39.0.upstream/1.39.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'aclk/schema-wrappers/agent_cmds.cc')
-rw-r--r--aclk/schema-wrappers/agent_cmds.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/aclk/schema-wrappers/agent_cmds.cc b/aclk/schema-wrappers/agent_cmds.cc
new file mode 100644
index 000000000..6950f4025
--- /dev/null
+++ b/aclk/schema-wrappers/agent_cmds.cc
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "proto/agent/v1/cmds.pb.h"
+
+#include "agent_cmds.h"
+
+#include "schema_wrapper_utils.h"
+
+using namespace agent::v1;
+
+int parse_cancel_pending_req(const char *msg, size_t msg_len, struct aclk_cancel_pending_req *req)
+{
+ CancelPendingRequest msg_parsed;
+
+ if (!msg_parsed.ParseFromArray(msg, msg_len)) {
+ error_report("Failed to parse CancelPendingRequest message");
+ return 1;
+ }
+
+ if (msg_parsed.request_id().c_str() == NULL) {
+ error_report("CancelPendingRequest message missing request_id");
+ return 1;
+ }
+ req->request_id = strdupz(msg_parsed.request_id().c_str());
+
+ if (msg_parsed.trace_id().c_str())
+ req->trace_id = strdupz(msg_parsed.trace_id().c_str());
+
+ set_timeval_from_google_timestamp(msg_parsed.timestamp(), &req->timestamp);
+
+ return 0;
+}
+
+void free_cancel_pending_req(struct aclk_cancel_pending_req *req)
+{
+ freez(req->request_id);
+ freez(req->trace_id);
+}