summaryrefslogtreecommitdiffstats
path: root/aclk
diff options
context:
space:
mode:
authorTimotej S <6674623+underhood@users.noreply.github.com>2021-01-11 09:01:32 +0100
committerGitHub <noreply@github.com>2021-01-11 09:01:32 +0100
commit6e33f048734e2b279f43926515aa343025a8b807 (patch)
tree846c40a1cff5da2ff8c8a534db9e5e3dd96ae942 /aclk
parent7481a123dde93cb07e88d768f75d62369a6ca3b9 (diff)
ACLK fix error for older compilers (#10470)
* organizes code better and fixes error with older C compilers
Diffstat (limited to 'aclk')
-rw-r--r--aclk/aclk_common.h41
-rw-r--r--aclk/aclk_rrdhost_state.h42
2 files changed, 44 insertions, 39 deletions
diff --git a/aclk/aclk_common.h b/aclk/aclk_common.h
index f03ec3b5ed..cc556afa34 100644
--- a/aclk/aclk_common.h
+++ b/aclk/aclk_common.h
@@ -1,7 +1,8 @@
#ifndef ACLK_COMMON_H
#define ACLK_COMMON_H
-#include "libnetdata/libnetdata.h"
+#include "aclk_rrdhost_state.h"
+#include "../daemon/common.h"
extern netdata_mutex_t aclk_shared_state_mutex;
#define ACLK_SHARED_STATE_LOCK netdata_mutex_lock(&aclk_shared_state_mutex)
@@ -29,47 +30,9 @@ extern netdata_mutex_t aclk_shared_state_mutex;
#define ACLK_V_COMPRESSION 2
#define ACLK_V_CHILDRENSTATE 3
-typedef enum aclk_cmd {
- ACLK_CMD_CLOUD,
- ACLK_CMD_ONCONNECT,
- ACLK_CMD_INFO,
- ACLK_CMD_CHART,
- ACLK_CMD_CHARTDEL,
- ACLK_CMD_ALARM,
- ACLK_CMD_CLOUD_QUERY_2,
- ACLK_CMD_CHILD_CONNECT,
- ACLK_CMD_CHILD_DISCONNECT
-} ACLK_CMD;
-
-typedef enum aclk_metadata_state {
- ACLK_METADATA_REQUIRED,
- ACLK_METADATA_CMD_QUEUED,
- ACLK_METADATA_SENT
-} ACLK_METADATA_STATE;
-
-typedef enum aclk_agent_state {
- ACLK_HOST_INITIALIZING,
- ACLK_HOST_STABLE
-} ACLK_POPCORNING_STATE;
-
-typedef struct aclk_rrdhost_state {
- char *claimed_id; // Claimed ID if host has one otherwise NULL
-
-#ifdef ENABLE_ACLK
- // per child popcorning
- ACLK_POPCORNING_STATE state;
- ACLK_METADATA_STATE metadata;
-
- time_t timestamp_created;
- time_t t_last_popcorn_update;
-#endif
-} aclk_rrdhost_state;
-
#define ACLK_IS_HOST_INITIALIZING(host) (host->aclk_state.state == ACLK_HOST_INITIALIZING)
#define ACLK_IS_HOST_POPCORNING(host) (ACLK_IS_HOST_INITIALIZING(host) && host->aclk_state.t_last_popcorn_update)
-typedef struct rrdhost RRDHOST;
-
extern struct aclk_shared_state {
// optimization to avoid looping trough hosts
// every time Query Thread wakes up
diff --git a/aclk/aclk_rrdhost_state.h b/aclk/aclk_rrdhost_state.h
new file mode 100644
index 0000000000..5ef0cc2184
--- /dev/null
+++ b/aclk/aclk_rrdhost_state.h
@@ -0,0 +1,42 @@
+#ifndef ACLK_RRDHOST_STATE_H
+#define ACLK_RRDHOST_STATE_H
+
+#include "../libnetdata/libnetdata.h"
+
+typedef enum aclk_cmd {
+ ACLK_CMD_CLOUD,
+ ACLK_CMD_ONCONNECT,
+ ACLK_CMD_INFO,
+ ACLK_CMD_CHART,
+ ACLK_CMD_CHARTDEL,
+ ACLK_CMD_ALARM,
+ ACLK_CMD_CLOUD_QUERY_2,
+ ACLK_CMD_CHILD_CONNECT,
+ ACLK_CMD_CHILD_DISCONNECT
+} ACLK_CMD;
+
+typedef enum aclk_metadata_state {
+ ACLK_METADATA_REQUIRED,
+ ACLK_METADATA_CMD_QUEUED,
+ ACLK_METADATA_SENT
+} ACLK_METADATA_STATE;
+
+typedef enum aclk_agent_state {
+ ACLK_HOST_INITIALIZING,
+ ACLK_HOST_STABLE
+} ACLK_POPCORNING_STATE;
+
+typedef struct aclk_rrdhost_state {
+ char *claimed_id; // Claimed ID if host has one otherwise NULL
+
+#ifdef ENABLE_ACLK
+ // per child popcorning
+ ACLK_POPCORNING_STATE state;
+ ACLK_METADATA_STATE metadata;
+
+ time_t timestamp_created;
+ time_t t_last_popcorn_update;
+#endif /* ENABLE_ACLK */
+} aclk_rrdhost_state;
+
+#endif /* ACLK_RRDHOST_STATE_H */