# This file is part of GNUnet.
-# (C) 2001--2016 GNUnet e.V.
+# (C) 2001--2017 GNUnet e.V.
#
# GNUnet is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
src/set/set.conf
src/social/Makefile
src/social/social.conf
+src/sq/Makefile
src/statistics/Makefile
src/statistics/statistics.conf
src/template/Makefile
--- /dev/null
+# This Makefile.am is in the public domain
+AM_CPPFLAGS = -I$(top_srcdir)/src/include $(POSTGRESQL_CPPFLAGS)
+
+if MINGW
+ WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
+endif
+
+if USE_COVERAGE
+ AM_CFLAGS = --coverage
+endif
+
+if HAVE_POSTGRESQL
+lib_LTLIBRARIES = libgnunetsq.la
+endif
+
+libgnunetsq_la_SOURCES = \
+ sq.c \
+ sq_query_helper.c \
+ sq_result_helper.c
+libgnunetsq_la_LIBADD = -lsq \
+ $(top_builddir)/src/util/libgnunetutil.la
+libgnunetsq_la_LDFLAGS = \
+ $(POSTGRESQL_LDFLAGS) \
+ $(GN_LIB_LDFLAGS) \
+ -version-info 0:0:0
+
+if ENABLE_TEST_RUN
+TESTS = \
+ test_sq
+endif
+
+check_PROGRAMS= \
+ test_sq
+
+test_sq_SOURCES = \
+ test_sq.c
+test_sq_LDADD = \
+ libgnunetsq.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ -lsqlite3 $(XLIB)
--- /dev/null
+/*
+ This file is part of GNUnet
+ Copyright (C) 2017 GNUnet e.V.
+
+ GNUnet is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file sq/sq.c
+ * @brief helper functions for Sqlite3 DB interactions
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_sq_lib.h"
+
+
+/**
+ * Execute a prepared statement.
+ *
+ * @param db_conn database connection
+ * @param params parameters to the statement
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+int
+GNUNET_SQ_bind (sqlite3_stmt *stmt,
+ const struct GNUNET_SQ_QueryParam *params)
+{
+}
+
+
+/**
+ * Extract results from a query result according to the given specification.
+ *
+ * @param result result to process
+ * @param[in,out] rs result specification to extract for
+ * @param row row from the result to extract
+ * @return
+ * #GNUNET_YES if all results could be extracted
+ * #GNUNET_SYSERR if a result was invalid (non-existing field)
+ */
+int
+GNUNET_SQ_extract_result (sqlite3_stmt *result,
+ struct GNUNET_SQ_ResultSpec *rs,
+ int row)
+{
+}
+
+
+/**
+ * Free all memory that was allocated in @a rs during
+ * #GNUNET_SQ_extract_result().
+ *
+ * @param rs reult specification to clean up
+ */
+void
+GNUNET_SQ_cleanup_result (struct GNUNET_SQ_ResultSpec *rs)
+{
+}
+
+/* end of sq.c */
--- /dev/null
+/*
+ This file is part of GNUnet
+ Copyright (C) 2017 GNUnet e.V.
+
+ GNUnet is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file sq/sq_query_helper.c
+ * @brief helper functions for queries
+ * @author Christian Grothoff
+ */
+#include "gnunet_sq_lib.h"
+
+
+/**
+ * Generate query parameter for a buffer @a ptr of
+ * @a ptr_size bytes.
+ *
+ * @param ptr pointer to the query parameter to pass
+ * @oaran ptr_size number of bytes in @a ptr
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_fixed_size (const void *ptr,
+ size_t ptr_size)
+{
+}
+
+
+/**
+ * Generate query parameter for a string.
+ *
+ * @param ptr pointer to the string query parameter to pass
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_string (const char *ptr)
+{
+}
+
+
+/**
+ * Generate query parameter for an RSA public key. The
+ * database must contain a BLOB type in the respective position.
+ *
+ * @param x the query parameter to pass.
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *x)
+{
+}
+
+
+/**
+ * Generate query parameter for an RSA signature. The
+ * database must contain a BLOB type in the respective position.
+ *
+ * @param x the query parameter to pass
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *x)
+{
+}
+
+
+/**
+ * Generate query parameter for an absolute time value.
+ * The database must store a 64-bit integer.
+ *
+ * @param x pointer to the query parameter to pass
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_absolute_time (const struct GNUNET_TIME_Absolute *x)
+{
+}
+
+
+/**
+ * Generate query parameter for an absolute time value.
+ * The database must store a 64-bit integer.
+ *
+ * @param x pointer to the query parameter to pass
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_absolute_time_nbo (const struct GNUNET_TIME_AbsoluteNBO *x)
+{
+}
+
+
+/**
+ * Generate query parameter for an uint16_t in host byte order.
+ *
+ * @param x pointer to the query parameter to pass
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_uint16 (const uint16_t *x)
+{
+}
+
+
+/**
+ * Generate query parameter for an uint32_t in host byte order.
+ *
+ * @param x pointer to the query parameter to pass
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_uint32 (const uint32_t *x)
+{
+}
+
+
+/**
+ * Generate query parameter for an uint16_t in host byte order.
+ *
+ * @param x pointer to the query parameter to pass
+ */
+struct GNUNET_SQ_QueryParam
+GNUNET_SQ_query_param_uint64 (const uint64_t *x)
+{
+}
+
+/* end of sq_query_helper.c */
--- /dev/null
+
+/*
+ This file is part of GNUnet
+ Copyright (C) 2017 GNUnet e.V.
+
+ GNUnet is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file sq/sq_result_helper.c
+ * @brief helper functions for queries
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_sq_lib.h"
+
+
+/**
+ * Variable-size result expected.
+ *
+ * @param[out] dst where to store the result, allocated
+ * @param[out] sptr where to store the size of @a dst
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_variable_size (void **dst,
+ size_t *sptr)
+{
+}
+
+
+/**
+ * Fixed-size result expected.
+ *
+ * @param[out] dst where to store the result
+ * @param dst_size number of bytes in @a dst
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_fixed_size (void *dst,
+ size_t dst_size)
+{
+}
+
+
+/**
+ * Variable-size result expected.
+ *
+ * @param[out] dst where to store the result, allocated
+ * @param[out] sptr where to store the size of @a dst
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_variable_size (void **dst,
+ size_t *sptr)
+{
+}
+
+
+/**
+ * 0-terminated string expected.
+ *
+ * @param[out] dst where to store the result, allocated
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_string (char **dst)
+{
+}
+
+
+/**
+ * RSA public key expected.
+ *
+ * @param[out] rsa where to store the result
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa)
+{
+}
+
+
+/**
+ * RSA signature expected.
+ *
+ * @param[out] sig where to store the result;
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig)
+{
+}
+
+
+/**
+ * Absolute time expected.
+ *
+ * @param[out] at where to store the result
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at)
+{
+}
+
+
+/**
+ * Absolute time expected.
+ *
+ * @param[out] at where to store the result
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at)
+{
+}
+
+
+/**
+ * uint16_t expected.
+ *
+ * @param[out] u16 where to store the result
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_uint16 (uint16_t *u16)
+{
+}
+
+
+/**
+ * uint32_t expected.
+ *
+ * @param[out] u32 where to store the result
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_uint32 (uint32_t *u32)
+{
+}
+
+
+/**
+ * uint64_t expected.
+ *
+ * @param[out] u64 where to store the result
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_SQ_ResultSpec
+GNUNET_SQ_result_spec_uint64 (uint64_t *u64)
+{
+}
+
+
+/* end of sq_result_helper.c */