diff options
Diffstat (limited to 'src/consensus/gnunet-consensus.c')
-rw-r--r-- | src/consensus/gnunet-consensus.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/consensus/gnunet-consensus.c b/src/consensus/gnunet-consensus.c index b2b635059..ef067ea34 100644 --- a/src/consensus/gnunet-consensus.c +++ b/src/consensus/gnunet-consensus.c | |||
@@ -23,13 +23,58 @@ | |||
23 | * @brief | 23 | * @brief |
24 | * @author Florian Dold | 24 | * @author Florian Dold |
25 | */ | 25 | */ |
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_consensus_service.h" | ||
26 | 29 | ||
27 | 30 | ||
28 | #include "gnunet_consensus_service.h" | 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 | } | ||
29 | 68 | ||
30 | 69 | ||
31 | int | 70 | int |
32 | main () | 71 | main (int argc, char **argv) |
33 | { | 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); | ||
34 | return 0; | 79 | return 0; |
35 | } | 80 | } |