index 042091a997044a712c4de1d4c45fe734b1406348..acdc699c107f11294905fc58fc8ed655551ba49e 100644 (file)
#include "frontend/connection.h"
#include "core/object.h"
#include "frontend/connection.h"
#include "core/object.h"
-#include "core/store.h"
#include "core/timeseries.h"
#include "core/timeseries.h"
+#include "utils/ssl.h"
#include "utils/strbuf.h"
#include <inttypes.h>
#include "utils/strbuf.h"
#include <inttypes.h>
struct sockaddr_storage client_addr;
socklen_t client_addr_len;
struct sockaddr_storage client_addr;
socklen_t client_addr_len;
+ /* connection handling */
+ ssize_t (*read)(sdb_conn_t *, size_t);
+ ssize_t (*write)(sdb_conn_t *, const void *, size_t);
+ int (*finish)(sdb_conn_t *);
+ sdb_ssl_session_t *ssl_session;
+
/* read buffer */
sdb_strbuf_t *buf;
/* read buffer */
sdb_strbuf_t *buf;
/* user information */
char *username; /* NULL if the user has not been authenticated */
/* user information */
char *username; /* NULL if the user has not been authenticated */
- _Bool ready; /* indicates that startup finished successfully */
+ bool ready; /* indicates that startup finished successfully */
};
#define CONN(obj) ((sdb_conn_t *)(obj))
};
#define CONN(obj) ((sdb_conn_t *)(obj))
} conn_lookup_t;
#define CONN_LOOKUP(obj) ((conn_lookup_t *)(obj))
} conn_lookup_t;
#define CONN_LOOKUP(obj) ((conn_lookup_t *)(obj))
+typedef struct {
+ sdb_conn_node_t super;
+ char *name;
+ sdb_time_t last_update;
+} conn_store_host_t;
+#define CONN_STORE_HOST(obj) ((conn_store_host_t *)(obj))
+
+typedef struct {
+ sdb_conn_node_t super;
+ char *hostname;
+ char *name;
+ sdb_time_t last_update;
+} conn_store_svc_t;
+#define CONN_STORE_SVC(obj) ((conn_store_svc_t *)(obj))
+
+typedef struct {
+ sdb_conn_node_t super;
+ char *hostname;
+ char *name;
+ char *store_type; /* optional */
+ char *store_id; /* optional */
+ sdb_time_t last_update;
+} conn_store_metric_t;
+#define CONN_STORE_METRIC(obj) ((conn_store_metric_t *)(obj))
+
+typedef struct {
+ sdb_conn_node_t super;
+ int parent_type;
+ char *hostname; /* optional */
+ char *parent;
+ char *key;
+ sdb_data_t value;
+ sdb_time_t last_update;
+} conn_store_attr_t;
+#define CONN_STORE_ATTR(obj) ((conn_store_attr_t *)(obj))
+
typedef struct {
sdb_conn_node_t super;
char *hostname;
typedef struct {
sdb_conn_node_t super;
char *hostname;
sdb_object_deref(SDB_OBJ(CONN_LOOKUP(obj)->filter));
} /* conn_lookup_destroy */
sdb_object_deref(SDB_OBJ(CONN_LOOKUP(obj)->filter));
} /* conn_lookup_destroy */
+static void __attribute__((unused))
+conn_store_host_destroy(sdb_object_t *obj)
+{
+ conn_store_host_t *host = CONN_STORE_HOST(obj);
+ if (host->name)
+ free((void *)host->name);
+ host->name = NULL;
+} /* conn_store_host_destroy */
+
+static void __attribute__((unused))
+conn_store_svc_destroy(sdb_object_t *obj)
+{
+ conn_store_svc_t *svc = CONN_STORE_SVC(obj);
+ if (svc->hostname)
+ free((void *)svc->hostname);
+ svc->hostname = NULL;
+ if (svc->name)
+ free((void *)svc->name);
+ svc->name = NULL;
+} /* conn_store_svc_destroy */
+
+static void __attribute__((unused))
+conn_store_metric_destroy(sdb_object_t *obj)
+{
+ conn_store_metric_t *metric = CONN_STORE_METRIC(obj);
+ if (metric->hostname)
+ free((void *)metric->hostname);
+ metric->hostname = NULL;
+ if (metric->name)
+ free((void *)metric->name);
+ metric->name = NULL;
+ if (metric->store_type)
+ free((void *)metric->store_type);
+ metric->store_type = NULL;
+ if (metric->store_id)
+ free((void *)metric->store_id);
+ metric->store_id = NULL;
+} /* conn_store_metric_destroy */
+
+static void __attribute__((unused))
+conn_store_attr_destroy(sdb_object_t *obj)
+{
+ conn_store_attr_t *attr = CONN_STORE_ATTR(obj);
+ if (attr->hostname)
+ free((void *)attr->hostname);
+ attr->hostname = NULL;
+ if (attr->parent)
+ free((void *)attr->parent);
+ attr->parent = NULL;
+ if (attr->key)
+ free((void *)attr->key);
+ attr->key = NULL;
+ sdb_data_free_datum(&attr->value);
+} /* conn_store_attr_destroy */
+
static void __attribute__((unused))
conn_ts_destroy(sdb_object_t *obj)
{
static void __attribute__((unused))
conn_ts_destroy(sdb_object_t *obj)
{