client_manager: add API for async operations
[oweals/gnunet.git] / src / include / gnunet_dht_service.h
index 3e59f2b6de1a327078a48547935ed36d3bd34e84..aa2b19e83700aea8b4eebba3e67f43c256697c2e 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      (C) 2004-2013 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2004-2013 Christian Grothoff (and other contributing authors)
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -95,7 +95,12 @@ enum GNUNET_DHT_RouteOption
   /**
    * Possible message option for query key randomization.
    */
-  GNUNET_DHT_RO_BART = 8
+  GNUNET_DHT_RO_BART = 8,
+
+  /**
+   * Flag given to monitors if this was the last hop for a GET/PUT.
+   */
+  GNUNET_DHT_RO_LAST_HOP = 16
 };
 
 
@@ -386,6 +391,36 @@ void
 GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle);
 
 
+#if ENABLE_MALICIOUS
+/**
+ * Type of a Malicious continuation.  You must not call
+ * #GNUNET_DHT_disconnect in this continuation.
+ *
+ * @param cls closure
+ * @param success #GNUNET_OK if the set malicious request was transmitted,
+ *                #GNUNET_NO on timeout,
+ *                #GNUNET_SYSERR on disconnect from service
+ *                after the PUT message was transmitted
+ *                (so we don't know if it was received or not)
+ */
+typedef void (*GNUNET_DHT_ActMaliciousContinuation)(void *cls,
+                                                int success);
+
+/**
+ * Turn the DHT service to act malicious
+ *
+ * @param handle the DHT handle
+ * @param action 1 to make the service malicious; 0 to make it benign
+          FIXME: perhaps make this an enum of known malicious behaviors?
+ */
+struct GNUNET_DHT_ActMaliciousHandle *
+GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle, 
+                      unsigned int action, 
+                      GNUNET_DHT_PutContinuation cont,
+                      void *cont_cls);
+#endif
+
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif