gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated (d7570f9f9 -> 78674f13e)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (d7570f9f9 -> 78674f13e)
Date: Wed, 11 Jan 2017 19:57:40 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository gnunet.

    from d7570f9f9 remove old nat_lib header to avoid problems
     new 6f79b4994 initial gnunet-auction commit
     new 78674f13e cmdline for auction-create

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                                       |   1 +
 po/POTFILES.in                                     |   2 +
 src/Makefile.am                                    |   1 +
 src/auction/.gitignore                             |   5 +
 src/auction/Makefile.am                            |  63 ++++++++++++
 src/auction/gnunet-auction-create.c                | 100 +++++++++++++++++++
 .../gnunet-auction-info.c}                         |  10 +-
 .../gnunet-auction-join.c}                         |  10 +-
 src/auction/gnunet-service-auction.c               | 106 +++++++++++++++++++++
 .../test_auction_api.c}                            |   6 +-
 10 files changed, 291 insertions(+), 13 deletions(-)
 create mode 100644 src/auction/.gitignore
 create mode 100644 src/auction/Makefile.am
 create mode 100644 src/auction/gnunet-auction-create.c
 copy src/{template/gnunet-template.c => auction/gnunet-auction-info.c} (92%)
 copy src/{template/gnunet-template.c => auction/gnunet-auction-join.c} (92%)
 create mode 100644 src/auction/gnunet-service-auction.c
 copy src/{template/test_template_api.c => auction/test_auction_api.c} (90%)

diff --git a/configure.ac b/configure.ac
index dade7d211..8521e060a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e1c3ec697..5ddb71d0f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -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
diff --git a/src/Makefile.am b/src/Makefile.am
index c1f9b33f9..c6f320ae4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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
index 000000000..5c3ec20cb
--- /dev/null
+++ b/src/auction/.gitignore
@@ -0,0 +1,5 @@
+gnunet-auction-create
+gnunet-auction-info
+gnunet-auction-join
+gnunet-service-auction
+test_auction_api
diff --git a/src/auction/Makefile.am b/src/auction/Makefile.am
new file mode 100644
index 000000000..18a3e5604
--- /dev/null
+++ b/src/auction/Makefile.am
@@ -0,0 +1,63 @@
+# 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
+
+# use bin_PROGRAMS for gnunet-auction wrapper script
+
+libexec_PROGRAMS = \
+ gnunet-auction-create \
+ gnunet-auction-info \
+ gnunet-auction-join \
+ gnunet-service-auction
+
+gnunet_auction_create_SOURCES = \
+ gnunet-auction-create.c
+gnunet_auction_create_LDADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+gnunet_auction_info_SOURCES = \
+ gnunet-auction-info.c
+gnunet_auction_info_LDADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
+gnunet_auction_join_SOURCES = \
+ gnunet-auction-join.c
+gnunet_auction_join_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:address@hidden@};export 
PATH=$${GNUNET_PREFIX:address@hidden@}/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-create.c 
b/src/auction/gnunet-auction-create.c
new file mode 100644
index 000000000..fd3fcdabe
--- /dev/null
+++ b/src/auction/gnunet-auction-create.c
@@ -0,0 +1,100 @@
+/*
+   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-create.c
+ * @brief tool to create a new auction
+ * @author Markus Teich
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+/* #include "gnunet_auction_service.h" */
+
+static int ret; /** Final status code. */
+static char *fndesc; /** filename of the item description */
+static char *fnprices; /** filename of the price map */
+static struct GNUNET_TIME_Relative dround; /** max round duration */
+static struct GNUNET_TIME_Relative dstart; /** time until auction starts */
+static unsigned int m = 0; /** auction parameter m */
+static int public = 0; /** public outcome */
+
+
+/**
+ * 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[] = {
+               {'d', "description", "FILE",
+                       gettext_noop ("description of the item to be sold"),
+                       1, &GNUNET_GETOPT_set_filename, &fndesc},
+               {'c', "costmap", "FILE",
+                       gettext_noop ("mapping of possible prices"),
+                       1, &GNUNET_GETOPT_set_filename, &fnprices},
+               {'r', "roundtime", "DURATION",
+                       gettext_noop ("max duration per round"),
+                       1, &GNUNET_GETOPT_set_relative_time, &dround},
+               {'s', "starttime", "DURATION",
+                       gettext_noop ("duration until auction starts"),
+                       1, &GNUNET_GETOPT_set_relative_time, &dstart},
+               {'m', "m", "NUMBER",
+                       gettext_noop ("number of items to sell, 0 for first 
price auction"),
+                       0, &GNUNET_GETOPT_set_uint, &m},
+               {'p', "public", NULL,
+                       gettext_noop ("public auction outcome"),
+                       0, &GNUNET_GETOPT_set_one, &public},
+               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-create",
+                                                          gettext_noop ("help 
text"),
+                                                          options,
+                                                          &run,
+                                                          NULL)) ? ret : 1;
+       GNUNET_free ((void*) argv);
+       return ret;
+}
diff --git a/src/template/gnunet-template.c b/src/auction/gnunet-auction-info.c
similarity index 92%
copy from src/template/gnunet-template.c
copy to src/auction/gnunet-auction-info.c
index 22b78d632..a4af1152a 100644
--- a/src/template/gnunet-template.c
+++ b/src/auction/gnunet-auction-info.c
@@ -19,13 +19,13 @@
 */
 
 /**
- * @file template/gnunet-template.c
- * @brief template for writing a tool
+ * @file auction/gnunet-auction.c
+ * @brief auction for writing a tool
  * @author Christian Grothoff
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-/* #include "gnunet_template_service.h" */
+/* #include "gnunet_auction_service.h" */
 
 /**
  * Final status code.
@@ -72,7 +72,7 @@ main (int argc, char *const *argv)
 
   ret = (GNUNET_OK ==
         GNUNET_PROGRAM_run (argc, argv,
-                            "gnunet-template",
+                            "gnunet-auction",
                             gettext_noop ("help text"),
                             options,
                             &run,
@@ -81,4 +81,4 @@ main (int argc, char *const *argv)
   return ret;
 }
 
-/* end of gnunet-template.c */
+/* end of gnunet-auction.c */
diff --git a/src/template/gnunet-template.c b/src/auction/gnunet-auction-join.c
similarity index 92%
copy from src/template/gnunet-template.c
copy to src/auction/gnunet-auction-join.c
index 22b78d632..a4af1152a 100644
--- a/src/template/gnunet-template.c
+++ b/src/auction/gnunet-auction-join.c
@@ -19,13 +19,13 @@
 */
 
 /**
- * @file template/gnunet-template.c
- * @brief template for writing a tool
+ * @file auction/gnunet-auction.c
+ * @brief auction for writing a tool
  * @author Christian Grothoff
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-/* #include "gnunet_template_service.h" */
+/* #include "gnunet_auction_service.h" */
 
 /**
  * Final status code.
@@ -72,7 +72,7 @@ main (int argc, char *const *argv)
 
   ret = (GNUNET_OK ==
         GNUNET_PROGRAM_run (argc, argv,
-                            "gnunet-template",
+                            "gnunet-auction",
                             gettext_noop ("help text"),
                             options,
                             &run,
@@ -81,4 +81,4 @@ main (int argc, char *const *argv)
   return ret;
 }
 
-/* end of gnunet-template.c */
+/* 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
index 000000000..b2587bfd7
--- /dev/null
+++ b/src/auction/gnunet-service-auction.c
@@ -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/template/test_template_api.c b/src/auction/test_auction_api.c
similarity index 90%
copy from src/template/test_template_api.c
copy to src/auction/test_auction_api.c
index 326361291..38e93c6fc 100644
--- a/src/template/test_template_api.c
+++ b/src/auction/test_auction_api.c
@@ -18,8 +18,8 @@
      Boston, MA 02110-1301, USA.
 */
 /**
- * @file template/test_template_api.c
- * @brief testcase for template.c
+ * @file auction/test_auction_api.c
+ * @brief testcase for auction.c
  */
 #include "platform.h"
 
@@ -39,4 +39,4 @@ main (int argc, char *argv[])
   return ret;
 }
 
-/* end of test_template_api.c */
+/* end of test_auction_api.c */

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]