initial gnunet-auction commit
authorMarkus Teich <teichm@fs.tum.de>
Tue, 3 Jan 2017 06:52:18 +0000 (07:52 +0100)
committerMarkus Teich <teichm@fs.tum.de>
Wed, 11 Jan 2017 13:04:29 +0000 (14:04 +0100)
configure.ac
po/POTFILES.in
src/Makefile.am
src/auction/.gitignore [new file with mode: 0644]
src/auction/Makefile.am [new file with mode: 0644]
src/auction/gnunet-auction.c [new file with mode: 0644]
src/auction/gnunet-service-auction.c [new file with mode: 0644]
src/auction/test_auction_api.c [new file with mode: 0644]

index dade7d2111f6c7ea202a55c688b1c3b5b3361379..8521e060a4470f672cb76c6efd24dec850425cca 100644 (file)
@@ -1551,6 +1551,7 @@ src/ats/Makefile
 src/ats/ats.conf
 src/ats-tool/Makefile
 src/ats-tests/Makefile
+src/auction/Makefile
 src/block/Makefile
 src/cadet/Makefile
 src/cadet/cadet.conf
index e1c3ec697d48e983b597595582b95edafa33bcaf..5ddb71d0f48a66eeec54a290426208e7ea30c04d 100644 (file)
@@ -28,6 +28,8 @@ src/ats-tests/ats-testing-traffic.c
 src/ats-tests/gnunet-ats-sim.c
 src/ats-tests/gnunet-solver-eval.c
 src/ats-tool/gnunet-ats.c
+src/auction/gnunet-auction.c
+src/auction/gnunet-service-auction.c
 src/block/block.c
 src/block/plugin_block_template.c
 src/block/plugin_block_test.c
index c1f9b33f9bc44c1509ca0826b982db99547dea40..c6f320ae4542d2581848000a32f5dbbc05bc4cca 100644 (file)
@@ -122,6 +122,7 @@ SUBDIRS = \
   psycstore \
   psyc \
   social \
+  auction \
   $(EXP_DIR) \
   $(PROVIDER_DIR)
 
diff --git a/src/auction/.gitignore b/src/auction/.gitignore
new file mode 100644 (file)
index 0000000..768cce8
--- /dev/null
@@ -0,0 +1,3 @@
+gnunet-auction
+gnunet-service-auction
+test_auction_api
diff --git a/src/auction/Makefile.am b/src/auction/Makefile.am
new file mode 100644 (file)
index 0000000..0ced1ad
--- /dev/null
@@ -0,0 +1,52 @@
+# This Makefile.am is in the public domain
+AM_CPPFLAGS = -I$(top_srcdir)/src/include
+
+pkgcfgdir= $(pkgdatadir)/config.d/
+
+libexecdir= $(pkglibdir)/libexec/
+
+dist_pkgcfg_DATA = \
+  auction.conf
+
+if MINGW
+ WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
+endif
+
+if USE_COVERAGE
+  AM_CFLAGS = -fprofile-arcs -ftest-coverage
+endif
+
+# Note: In a real installation,
+# bin_PROGRAMS should be used for gnunet-auction
+# libexec_PROGRAMS should be used for gnunet-service-auction
+
+noinst_PROGRAMS = \
+ gnunet-auction \
+ gnunet-service-auction
+
+
+gnunet_auction_SOURCES = \
+ gnunet-auction.c
+gnunet_auction_LDADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+gnunet_service_auction_SOURCES = \
+ gnunet-service-auction.c
+gnunet_service_auction_LDADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+
+check_PROGRAMS = \
+ test_auction_api
+
+if ENABLE_TEST_RUN
+AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;
+TESTS = $(check_PROGRAMS)
+endif
+
+test_auction_api_SOURCES = \
+ test_auction_api.c
+test_auction_api_LDADD = \
+  $(top_builddir)/src/util/libgnunetutil.la
diff --git a/src/auction/gnunet-auction.c b/src/auction/gnunet-auction.c
new file mode 100644 (file)
index 0000000..a4af115
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 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, write to the
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
+*/
+
+/**
+ * @file auction/gnunet-auction.c
+ * @brief auction for writing a tool
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+/* #include "gnunet_auction_service.h" */
+
+/**
+ * Final status code.
+ */
+static int ret;
+
+
+/**
+ * Main function that will be run by the scheduler.
+ *
+ * @param cls closure
+ * @param args remaining command-line arguments
+ * @param cfgfile name of the configuration file used (for saving, can be NULL!)
+ * @param cfg configuration
+ */
+static void
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  /* main code here */
+}
+
+
+/**
+ * The main function.
+ *
+ * @param argc number of arguments from the command line
+ * @param argv command line arguments
+ * @return 0 ok, 1 on error
+ */
+int
+main (int argc, char *const *argv)
+{
+  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
+    /* FIMXE: add options here */
+    GNUNET_GETOPT_OPTION_END
+  };
+  if (GNUNET_OK !=
+      GNUNET_STRINGS_get_utf8_args (argc, argv,
+                                   &argc, &argv))
+    return 2;
+
+  ret = (GNUNET_OK ==
+        GNUNET_PROGRAM_run (argc, argv,
+                            "gnunet-auction",
+                            gettext_noop ("help text"),
+                            options,
+                            &run,
+                            NULL)) ? ret : 1;
+  GNUNET_free ((void*) argv);
+  return ret;
+}
+
+/* end of gnunet-auction.c */
diff --git a/src/auction/gnunet-service-auction.c b/src/auction/gnunet-service-auction.c
new file mode 100644 (file)
index 0000000..b2587bf
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+   This file is part of GNUnet.
+   Copyright (C) 2009 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, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+   */
+
+/**
+ * @file auction/gnunet-service-auction.c
+ * @brief program that does auction
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+
+
+/**
+ * Task run during shutdown.
+ *
+ * @param cls unused
+ */
+static void
+cleanup_task (void *cls)
+{
+       /* FIXME: do clean up here */
+}
+
+
+/**
+ * Callback called when a client connects to the service.
+ *
+ * @param cls closure for the service
+ * @param c the new client that connected to the service
+ * @param mq the message queue used to send messages to the client
+ * @return @a c
+ */
+static void *
+client_connect_cb (void *cls,
+                                  struct GNUNET_SERVICE_Client *c,
+                                  struct GNUNET_MQ_Handle *mq)
+{
+       return c;
+}
+
+
+/**
+ * Callback called when a client disconnected from the service
+ *
+ * @param cls closure for the service
+ * @param c the client that disconnected
+ * @param internal_cls should be equal to @a c
+ */
+static void
+client_disconnect_cb (void *cls,
+                                         struct GNUNET_SERVICE_Client *c,
+                                         void *internal_cls)
+{
+       GNUNET_assert (c == internal_cls);
+}
+
+
+/**
+ * Process auction requests.
+ *
+ * @param cls closure
+ * @param cfg configuration to use
+ * @param service the initialized service
+ */
+static void
+run (void *cls,
+        const struct GNUNET_CONFIGURATION_Handle *cfg,
+        struct GNUNET_SERVICE_Handle *service)
+{
+       /* FIXME: do setup here */
+       GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
+                                                                  NULL);
+}
+
+
+/**
+ * Define "main" method using service macro.
+ */
+GNUNET_SERVICE_MAIN
+("auction",
+ GNUNET_SERVICE_OPTION_NONE,
+ &run,
+ &client_connect_cb,
+ &client_disconnect_cb,
+ NULL,
+ GNUNET_MQ_handler_end ())
+
+
+/* end of gnunet-service-auction.c */
diff --git a/src/auction/test_auction_api.c b/src/auction/test_auction_api.c
new file mode 100644 (file)
index 0000000..38e93c6
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2009 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, write to the
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
+*/
+/**
+ * @file auction/test_auction_api.c
+ * @brief testcase for auction.c
+ */
+#include "platform.h"
+
+static int
+check ()
+{
+  return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+  int ret;
+
+  ret = check ();
+
+  return ret;
+}
+
+/* end of test_auction_api.c */