-you are welcome
authorChristian Grothoff <christian@grothoff.org>
Thu, 29 Nov 2012 14:24:13 +0000 (14:24 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 29 Nov 2012 14:24:13 +0000 (14:24 +0000)
src/consensus/Makefile.am
src/consensus/consensus.h
src/consensus/gnunet-consensus.c

index 8d6a9aaff2321667e09cc9b7da80f52b7ad56cad..10b22cc87798392ce9139345dee82a44fff96f1e 100644 (file)
@@ -28,6 +28,7 @@ gnunet_consensus_SOURCES = \
  gnunet-consensus.c         
 gnunet_consensus_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/consensus/libgnunetconsensus.la \
   $(GN_LIBINTL)
 
 gnunet_service_consensus_SOURCES = \
index 3f1efe3401b8f5871aad3e1049828caf828c6241..2762e8ff44b7b5eb3989b1df2b9429ebd3e840a3 100644 (file)
@@ -23,8 +23,8 @@
  * @file consensus/consensus.h
  * @brief
  */
-#ifndef NSE_H
-#define NSE_H
+#ifndef CONSENSUS_H
+#define CONSENSUS_H
 
 #include "gnunet_common.h"
 
index b2b6350590ff8da6c88d423c6ea3ab49f64d86d3..ef067ea34c0c028252517471c98b9ab50199c4c5 100644 (file)
  * @brief 
  * @author Florian Dold
  */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_consensus_service.h"
 
 
-#include "gnunet_consensus_service.h"
+
+
+/**
+ * Called when a new element was received from another peer, or an error occured.
+ *
+ * May deliver duplicate values.
+ *
+ * Elements given to a consensus operation by the local peer are NOT given
+ * to this callback.
+ *
+ * @param cls closure
+ * @param element new element, NULL on error
+ * @return GNUNET_OK if the valid is well-formed and should be added to the consensus,
+ *         GNUNET_SYSERR if the element should be ignored and not be propagated
+ */
+static int
+cb (void *cls,
+    struct GNUNET_CONSENSUS_Element *element)
+{
+  return 0;
+}
+
+
+
+static void
+run (void *cls, char *const *args, const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  static struct GNUNET_PeerIdentity pid;
+  static struct GNUNET_HashCode sid;
+  
+  GNUNET_CONSENSUS_create (cfg,
+                          1, &pid,
+                          &sid,
+                          &cb, NULL);
+  
+}
 
 
 int
-main ()
+main (int argc, char **argv)
 {
+   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
+        GNUNET_GETOPT_OPTION_END
+   };
+  GNUNET_PROGRAM_run (argc, argv, "gnunet-consensus",
+                     "help",
+                     options, &run, NULL);
   return 0;
 }