diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-11-29 14:24:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-11-29 14:24:13 +0000 |
commit | 01a6f7fa2652d6b5b23e10238e740b0aa39f7845 (patch) | |
tree | 271d1a5b8969579977502e334615d93bde4ae7c2 /src/consensus | |
parent | 853136628dc02b5037dbeb88bdca67d7ebc11139 (diff) | |
download | gnunet-01a6f7fa2652d6b5b23e10238e740b0aa39f7845.tar.gz gnunet-01a6f7fa2652d6b5b23e10238e740b0aa39f7845.zip |
-you are welcome
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/Makefile.am | 1 | ||||
-rw-r--r-- | src/consensus/consensus.h | 4 | ||||
-rw-r--r-- | src/consensus/gnunet-consensus.c | 49 |
3 files changed, 50 insertions, 4 deletions
diff --git a/src/consensus/Makefile.am b/src/consensus/Makefile.am index 8d6a9aaff..10b22cc87 100644 --- a/src/consensus/Makefile.am +++ b/src/consensus/Makefile.am | |||
@@ -28,6 +28,7 @@ gnunet_consensus_SOURCES = \ | |||
28 | gnunet-consensus.c | 28 | gnunet-consensus.c |
29 | gnunet_consensus_LDADD = \ | 29 | gnunet_consensus_LDADD = \ |
30 | $(top_builddir)/src/util/libgnunetutil.la \ | 30 | $(top_builddir)/src/util/libgnunetutil.la \ |
31 | $(top_builddir)/src/consensus/libgnunetconsensus.la \ | ||
31 | $(GN_LIBINTL) | 32 | $(GN_LIBINTL) |
32 | 33 | ||
33 | gnunet_service_consensus_SOURCES = \ | 34 | gnunet_service_consensus_SOURCES = \ |
diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h index 3f1efe340..2762e8ff4 100644 --- a/src/consensus/consensus.h +++ b/src/consensus/consensus.h | |||
@@ -23,8 +23,8 @@ | |||
23 | * @file consensus/consensus.h | 23 | * @file consensus/consensus.h |
24 | * @brief | 24 | * @brief |
25 | */ | 25 | */ |
26 | #ifndef NSE_H | 26 | #ifndef CONSENSUS_H |
27 | #define NSE_H | 27 | #define CONSENSUS_H |
28 | 28 | ||
29 | #include "gnunet_common.h" | 29 | #include "gnunet_common.h" |
30 | 30 | ||
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 | } |