aboutsummaryrefslogtreecommitdiff
path: root/src/auction
diff options
context:
space:
mode:
authorMarkus Teich <teichm@fs.tum.de>2017-01-11 14:50:29 +0100
committerMarkus Teich <teichm@fs.tum.de>2017-01-11 14:50:29 +0100
commit78674f13e2ba87b026d9c242f91f602aee42774d (patch)
treee202020a20213850a6dbd7f9806bd625ce47ae91 /src/auction
parent6f79b499450512c4b92d0f9dbe12932a8e8d83b6 (diff)
downloadgnunet-78674f13e2ba87b026d9c242f91f602aee42774d.tar.gz
gnunet-78674f13e2ba87b026d9c242f91f602aee42774d.zip
cmdline for auction-create
Diffstat (limited to 'src/auction')
-rw-r--r--src/auction/.gitignore4
-rw-r--r--src/auction/Makefile.am27
-rw-r--r--src/auction/gnunet-auction-create.c100
-rw-r--r--src/auction/gnunet-auction-info.c (renamed from src/auction/gnunet-auction.c)0
-rw-r--r--src/auction/gnunet-auction-join.c84
5 files changed, 206 insertions, 9 deletions
diff --git a/src/auction/.gitignore b/src/auction/.gitignore
index 768cce85b..5c3ec20cb 100644
--- a/src/auction/.gitignore
+++ b/src/auction/.gitignore
@@ -1,3 +1,5 @@
1gnunet-auction 1gnunet-auction-create
2gnunet-auction-info
3gnunet-auction-join
2gnunet-service-auction 4gnunet-service-auction
3test_auction_api 5test_auction_api
diff --git a/src/auction/Makefile.am b/src/auction/Makefile.am
index 0ced1ad22..18a3e5604 100644
--- a/src/auction/Makefile.am
+++ b/src/auction/Makefile.am
@@ -16,18 +16,29 @@ if USE_COVERAGE
16 AM_CFLAGS = -fprofile-arcs -ftest-coverage 16 AM_CFLAGS = -fprofile-arcs -ftest-coverage
17endif 17endif
18 18
19# Note: In a real installation, 19# use bin_PROGRAMS for gnunet-auction wrapper script
20# bin_PROGRAMS should be used for gnunet-auction
21# libexec_PROGRAMS should be used for gnunet-service-auction
22 20
23noinst_PROGRAMS = \ 21libexec_PROGRAMS = \
24 gnunet-auction \ 22 gnunet-auction-create \
23 gnunet-auction-info \
24 gnunet-auction-join \
25 gnunet-service-auction 25 gnunet-service-auction
26 26
27gnunet_auction_create_SOURCES = \
28 gnunet-auction-create.c
29gnunet_auction_create_LDADD = \
30 $(top_builddir)/src/util/libgnunetutil.la \
31 $(GN_LIBINTL)
32
33gnunet_auction_info_SOURCES = \
34 gnunet-auction-info.c
35gnunet_auction_info_LDADD = \
36 $(top_builddir)/src/util/libgnunetutil.la \
37 $(GN_LIBINTL)
27 38
28gnunet_auction_SOURCES = \ 39gnunet_auction_join_SOURCES = \
29 gnunet-auction.c 40 gnunet-auction-join.c
30gnunet_auction_LDADD = \ 41gnunet_auction_join_LDADD = \
31 $(top_builddir)/src/util/libgnunetutil.la \ 42 $(top_builddir)/src/util/libgnunetutil.la \
32 $(GN_LIBINTL) 43 $(GN_LIBINTL)
33 44
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 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 */
20
21/**
22 * @file auction/gnunet-auction-create.c
23 * @brief tool to create a new auction
24 * @author Markus Teich
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28/* #include "gnunet_auction_service.h" */
29
30static int ret; /** Final status code. */
31static char *fndesc; /** filename of the item description */
32static char *fnprices; /** filename of the price map */
33static struct GNUNET_TIME_Relative dround; /** max round duration */
34static struct GNUNET_TIME_Relative dstart; /** time until auction starts */
35static unsigned int m = 0; /** auction parameter m */
36static int public = 0; /** public outcome */
37
38
39/**
40 * Main function that will be run by the scheduler.
41 *
42 * @param cls closure
43 * @param args remaining command-line arguments
44 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
45 * @param cfg configuration
46 */
47static void
48run (void *cls,
49 char *const *args,
50 const char *cfgfile,
51 const struct GNUNET_CONFIGURATION_Handle *cfg)
52{
53 /* main code here */
54}
55
56
57/**
58 * The main function.
59 *
60 * @param argc number of arguments from the command line
61 * @param argv command line arguments
62 * @return 0 ok, 1 on error
63 */
64int
65main (int argc, char *const *argv)
66{
67 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
68 {'d', "description", "FILE",
69 gettext_noop ("description of the item to be sold"),
70 1, &GNUNET_GETOPT_set_filename, &fndesc},
71 {'c', "costmap", "FILE",
72 gettext_noop ("mapping of possible prices"),
73 1, &GNUNET_GETOPT_set_filename, &fnprices},
74 {'r', "roundtime", "DURATION",
75 gettext_noop ("max duration per round"),
76 1, &GNUNET_GETOPT_set_relative_time, &dround},
77 {'s', "starttime", "DURATION",
78 gettext_noop ("duration until auction starts"),
79 1, &GNUNET_GETOPT_set_relative_time, &dstart},
80 {'m', "m", "NUMBER",
81 gettext_noop ("number of items to sell, 0 for first price auction"),
82 0, &GNUNET_GETOPT_set_uint, &m},
83 {'p', "public", NULL,
84 gettext_noop ("public auction outcome"),
85 0, &GNUNET_GETOPT_set_one, &public},
86 GNUNET_GETOPT_OPTION_END
87 };
88 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
89 return 2;
90
91 ret = (GNUNET_OK ==
92 GNUNET_PROGRAM_run (argc, argv,
93 "gnunet-auction-create",
94 gettext_noop ("help text"),
95 options,
96 &run,
97 NULL)) ? ret : 1;
98 GNUNET_free ((void*) argv);
99 return ret;
100}
diff --git a/src/auction/gnunet-auction.c b/src/auction/gnunet-auction-info.c
index a4af1152a..a4af1152a 100644
--- a/src/auction/gnunet-auction.c
+++ b/src/auction/gnunet-auction-info.c
diff --git a/src/auction/gnunet-auction-join.c b/src/auction/gnunet-auction-join.c
new file mode 100644
index 000000000..a4af1152a
--- /dev/null
+++ b/src/auction/gnunet-auction-join.c
@@ -0,0 +1,84 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21/**
22 * @file auction/gnunet-auction.c
23 * @brief auction for writing a tool
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28/* #include "gnunet_auction_service.h" */
29
30/**
31 * Final status code.
32 */
33static int ret;
34
35
36/**
37 * Main function that will be run by the scheduler.
38 *
39 * @param cls closure
40 * @param args remaining command-line arguments
41 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
42 * @param cfg configuration
43 */
44static void
45run (void *cls,
46 char *const *args,
47 const char *cfgfile,
48 const struct GNUNET_CONFIGURATION_Handle *cfg)
49{
50 /* main code here */
51}
52
53
54/**
55 * The main function.
56 *
57 * @param argc number of arguments from the command line
58 * @param argv command line arguments
59 * @return 0 ok, 1 on error
60 */
61int
62main (int argc, char *const *argv)
63{
64 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
65 /* FIMXE: add options here */
66 GNUNET_GETOPT_OPTION_END
67 };
68 if (GNUNET_OK !=
69 GNUNET_STRINGS_get_utf8_args (argc, argv,
70 &argc, &argv))
71 return 2;
72
73 ret = (GNUNET_OK ==
74 GNUNET_PROGRAM_run (argc, argv,
75 "gnunet-auction",
76 gettext_noop ("help text"),
77 options,
78 &run,
79 NULL)) ? ret : 1;
80 GNUNET_free ((void*) argv);
81 return ret;
82}
83
84/* end of gnunet-auction.c */