aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/Makefile.am1
-rw-r--r--src/auction/.gitignore3
-rw-r--r--src/auction/Makefile.am52
-rw-r--r--src/auction/gnunet-auction.c84
-rw-r--r--src/auction/gnunet-service-auction.c106
-rw-r--r--src/auction/test_auction_api.c42
8 files changed, 291 insertions, 0 deletions
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
1551src/ats/ats.conf 1551src/ats/ats.conf
1552src/ats-tool/Makefile 1552src/ats-tool/Makefile
1553src/ats-tests/Makefile 1553src/ats-tests/Makefile
1554src/auction/Makefile
1554src/block/Makefile 1555src/block/Makefile
1555src/cadet/Makefile 1556src/cadet/Makefile
1556src/cadet/cadet.conf 1557src/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
28src/ats-tests/gnunet-ats-sim.c 28src/ats-tests/gnunet-ats-sim.c
29src/ats-tests/gnunet-solver-eval.c 29src/ats-tests/gnunet-solver-eval.c
30src/ats-tool/gnunet-ats.c 30src/ats-tool/gnunet-ats.c
31src/auction/gnunet-auction.c
32src/auction/gnunet-service-auction.c
31src/block/block.c 33src/block/block.c
32src/block/plugin_block_template.c 34src/block/plugin_block_template.c
33src/block/plugin_block_test.c 35src/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 = \
122 psycstore \ 122 psycstore \
123 psyc \ 123 psyc \
124 social \ 124 social \
125 auction \
125 $(EXP_DIR) \ 126 $(EXP_DIR) \
126 $(PROVIDER_DIR) 127 $(PROVIDER_DIR)
127 128
diff --git a/src/auction/.gitignore b/src/auction/.gitignore
new file mode 100644
index 000000000..768cce85b
--- /dev/null
+++ b/src/auction/.gitignore
@@ -0,0 +1,3 @@
1gnunet-auction
2gnunet-service-auction
3test_auction_api
diff --git a/src/auction/Makefile.am b/src/auction/Makefile.am
new file mode 100644
index 000000000..0ced1ad22
--- /dev/null
+++ b/src/auction/Makefile.am
@@ -0,0 +1,52 @@
1# This Makefile.am is in the public domain
2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4pkgcfgdir= $(pkgdatadir)/config.d/
5
6libexecdir= $(pkglibdir)/libexec/
7
8dist_pkgcfg_DATA = \
9 auction.conf
10
11if MINGW
12 WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
13endif
14
15if USE_COVERAGE
16 AM_CFLAGS = -fprofile-arcs -ftest-coverage
17endif
18
19# Note: In a real installation,
20# bin_PROGRAMS should be used for gnunet-auction
21# libexec_PROGRAMS should be used for gnunet-service-auction
22
23noinst_PROGRAMS = \
24 gnunet-auction \
25 gnunet-service-auction
26
27
28gnunet_auction_SOURCES = \
29 gnunet-auction.c
30gnunet_auction_LDADD = \
31 $(top_builddir)/src/util/libgnunetutil.la \
32 $(GN_LIBINTL)
33
34gnunet_service_auction_SOURCES = \
35 gnunet-service-auction.c
36gnunet_service_auction_LDADD = \
37 $(top_builddir)/src/util/libgnunetutil.la \
38 $(GN_LIBINTL)
39
40
41check_PROGRAMS = \
42 test_auction_api
43
44if ENABLE_TEST_RUN
45AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;
46TESTS = $(check_PROGRAMS)
47endif
48
49test_auction_api_SOURCES = \
50 test_auction_api.c
51test_auction_api_LDADD = \
52 $(top_builddir)/src/util/libgnunetutil.la
diff --git a/src/auction/gnunet-auction.c b/src/auction/gnunet-auction.c
new file mode 100644
index 000000000..a4af1152a
--- /dev/null
+++ b/src/auction/gnunet-auction.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 */
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 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 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-service-auction.c
23 * @brief program that does auction
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28
29
30/**
31 * Task run during shutdown.
32 *
33 * @param cls unused
34 */
35static void
36cleanup_task (void *cls)
37{
38 /* FIXME: do clean up here */
39}
40
41
42/**
43 * Callback called when a client connects to the service.
44 *
45 * @param cls closure for the service
46 * @param c the new client that connected to the service
47 * @param mq the message queue used to send messages to the client
48 * @return @a c
49 */
50static void *
51client_connect_cb (void *cls,
52 struct GNUNET_SERVICE_Client *c,
53 struct GNUNET_MQ_Handle *mq)
54{
55 return c;
56}
57
58
59/**
60 * Callback called when a client disconnected from the service
61 *
62 * @param cls closure for the service
63 * @param c the client that disconnected
64 * @param internal_cls should be equal to @a c
65 */
66static void
67client_disconnect_cb (void *cls,
68 struct GNUNET_SERVICE_Client *c,
69 void *internal_cls)
70{
71 GNUNET_assert (c == internal_cls);
72}
73
74
75/**
76 * Process auction requests.
77 *
78 * @param cls closure
79 * @param cfg configuration to use
80 * @param service the initialized service
81 */
82static void
83run (void *cls,
84 const struct GNUNET_CONFIGURATION_Handle *cfg,
85 struct GNUNET_SERVICE_Handle *service)
86{
87 /* FIXME: do setup here */
88 GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
89 NULL);
90}
91
92
93/**
94 * Define "main" method using service macro.
95 */
96GNUNET_SERVICE_MAIN
97("auction",
98 GNUNET_SERVICE_OPTION_NONE,
99 &run,
100 &client_connect_cb,
101 &client_disconnect_cb,
102 NULL,
103 GNUNET_MQ_handler_end ())
104
105
106/* 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
index 000000000..38e93c6fc
--- /dev/null
+++ b/src/auction/test_auction_api.c
@@ -0,0 +1,42 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 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 * @file auction/test_auction_api.c
22 * @brief testcase for auction.c
23 */
24#include "platform.h"
25
26static int
27check ()
28{
29 return 0;
30}
31
32int
33main (int argc, char *argv[])
34{
35 int ret;
36
37 ret = check ();
38
39 return ret;
40}
41
42/* end of test_auction_api.c */