Code

connection: Drop old and unused conn_node* types.
[sysdb.git] / src / frontend / connection-private.h
index f2d85f2ccdfd177e461032421a90eb181f870fdc..03e58e5e51e25fa4bf9ea747d2f2607f259c9b86 100644 (file)
@@ -35,7 +35,8 @@
 #include "frontend/connection.h"
 
 #include "core/object.h"
-#include "core/store.h"
+#include "core/timeseries.h"
+#include "utils/ssl.h"
 #include "utils/strbuf.h"
 
 #include <inttypes.h>
@@ -57,6 +58,12 @@ struct sdb_conn {
        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;
 
@@ -64,52 +71,18 @@ struct sdb_conn {
        uint32_t cmd;
        uint32_t cmd_len;
 
+       /* amount of data to skip, e.g., after receiving invalid commands; if this
+        * is non-zero, the 'skip_len' first bytes of 'buf' are invalid */
+       size_t skip_len;
+
        sdb_strbuf_t *errbuf;
 
        /* user information */
        char *username; /* NULL if the user has not been authenticated */
+       bool  ready; /* indicates that startup finished successfully */
 };
 #define CONN(obj) ((sdb_conn_t *)(obj))
 
-/*
- * node types
- */
-
-typedef struct {
-       sdb_conn_node_t super;
-       char *name;
-} conn_fetch_t;
-#define CONN_FETCH(obj) ((conn_fetch_t *)(obj))
-
-typedef struct {
-       sdb_conn_node_t super;
-       sdb_store_matcher_t *matcher;
-} conn_node_matcher_t;
-#define CONN_MATCHER(obj) ((conn_node_matcher_t *)(obj))
-
-typedef struct {
-       sdb_conn_node_t super;
-       conn_node_matcher_t *matcher;
-} conn_lookup_t;
-#define CONN_LOOKUP(obj) ((conn_lookup_t *)(obj))
-
-/*
- * type helper functions
- */
-static void __attribute__((unused))
-conn_fetch_destroy(sdb_object_t *obj)
-{
-       if (CONN_FETCH(obj)->name)
-               free(CONN_FETCH(obj)->name);
-} /* conn_fetch_destroy */
-
-static void __attribute__((unused))
-conn_lookup_destroy(sdb_object_t *obj)
-{
-       if (CONN_LOOKUP(obj)->matcher)
-               sdb_object_deref(SDB_OBJ(CONN_LOOKUP(obj)->matcher));
-} /* conn_fetch_destroy */
-
 #ifdef __cplusplus
 } /* extern "C" */
 #endif