X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Ffrontend%2Fconnection-private.h;h=ae9cbbc91ba0cfa2dd532cb55795de95164a96fe;hb=a253fa4a57c8ac8abd2e0801d55f8556b87ef836;hp=6cf7395b7c122b0c5c329c622be47745f71f5bb3;hpb=724fcc3faf3362d4cedf8f3f07b5342287d6070e;p=sysdb.git diff --git a/src/frontend/connection-private.h b/src/frontend/connection-private.h index 6cf7395..ae9cbbc 100644 --- a/src/frontend/connection-private.h +++ b/src/frontend/connection-private.h @@ -1,5 +1,5 @@ /* - * SysDB - src/include/frontend/connection-private.h + * SysDB - src/frontend/connection-private.h * Copyright (C) 2013 Sebastian 'tokkee' Harl * All rights reserved. * @@ -32,13 +32,17 @@ #ifndef SDB_FRONTEND_CONNECTION_PRIVATE_H #define SDB_FRONTEND_CONNECTION_PRIVATE_H 1 +#include "frontend/connection.h" + #include "core/object.h" +#include "core/store.h" #include "utils/strbuf.h" -#include "frontend/connection.h" #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -60,6 +64,10 @@ 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 */ @@ -67,6 +75,52 @@ struct sdb_conn { }; #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_matcher_destroy(sdb_object_t *obj) +{ + if (CONN_MATCHER(obj)->matcher) + sdb_object_deref(SDB_OBJ(CONN_MATCHER(obj)->matcher)); +} /* conn_matcher_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_lookup_destroy */ + #ifdef __cplusplus } /* extern "C" */ #endif