-you are welcome
[oweals/gnunet.git] / src / consensus / gnunet-consensus.c
1 /*
2       This file is part of GNUnet
3       (C) 2012 Christian Grothoff (and other contributing authors)
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 2, 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., 59 Temple Place - Suite 330,
18       Boston, MA 02111-1307, USA.
19  */
20
21 /**
22  * @file consensus/gnunet-consensus.c
23  * @brief 
24  * @author Florian Dold
25  */
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 #include "gnunet_consensus_service.h"
29
30
31
32
33 /**
34  * Called when a new element was received from another peer, or an error occured.
35  *
36  * May deliver duplicate values.
37  *
38  * Elements given to a consensus operation by the local peer are NOT given
39  * to this callback.
40  *
41  * @param cls closure
42  * @param element new element, NULL on error
43  * @return GNUNET_OK if the valid is well-formed and should be added to the consensus,
44  *         GNUNET_SYSERR if the element should be ignored and not be propagated
45  */
46 static int
47 cb (void *cls,
48     struct GNUNET_CONSENSUS_Element *element)
49 {
50   return 0;
51 }
52
53
54
55 static void
56 run (void *cls, char *const *args, const char *cfgfile,
57      const struct GNUNET_CONFIGURATION_Handle *cfg)
58 {
59   static struct GNUNET_PeerIdentity pid;
60   static struct GNUNET_HashCode sid;
61   
62   GNUNET_CONSENSUS_create (cfg,
63                            1, &pid,
64                            &sid,
65                            &cb, NULL);
66   
67 }
68
69
70 int
71 main (int argc, char **argv)
72 {
73    static const struct GNUNET_GETOPT_CommandLineOption options[] = {
74         GNUNET_GETOPT_OPTION_END
75    };
76   GNUNET_PROGRAM_run (argc, argv, "gnunet-consensus",
77                       "help",
78                       options, &run, NULL);
79   return 0;
80 }