indentation
[oweals/gnunet.git] / src / dht / plugin_dhtlog_dummy.c
index 7be199a76be9aee1f31f590670b3bbd72a033074..2250c03306c71899bf86cbdc1543f59054f28c52 100644 (file)
 
 #define DEBUG_DHTLOG GNUNET_NO
 
-  /*
-   * Inserts the specified trial into the dhttests.trials table
-   *
-   * @param trialuid return the trialuid of the newly inserted trial
-   * @param num_nodes how many nodes are in the trial
-   * @param topology integer representing topology for this trial
-   * @param blacklist_topology integer representing blacklist topology for this trial
-   * @param connect_topology integer representing connect topology for this trial
-   * @param connect_topology_option integer representing connect topology option
-   * @param connect_topology_option_modifier float to modify connect option
-   * @param topology_percentage percentage modifier for certain topologies
-   * @param topology_probability probability modifier for certain topologies
-   * @param puts number of puts to perform
-   * @param gets number of gets to perform
-   * @param concurrent number of concurrent requests
-   * @param settle_time time to wait between creating topology and starting testing
-   * @param num_rounds number of times to repeat the trial
-   * @param malicious_getters number of malicious GET peers in the trial
-   * @param malicious_putters number of malicious PUT peers in the trial
-   * @param malicious_droppers number of malicious DROP peers in the trial
-   * @param malicious_get_frequency how often malicious gets are sent
-   * @param malicious_put_frequency how often malicious puts are sent
-   * @param stop_closest stop forwarding PUTs if closest node found
-   * @param stop_found stop forwarding GETs if data found
-   * @param strict_kademlia test used kademlia routing algorithm
-   * @param gets_succeeded how many gets did the test driver report success on
-   * @param message string to put into DB for this trial
-   *
-   * @return GNUNET_OK on success, GNUNET_SYSERR on failure
-   */
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned int topology,
-               unsigned int blacklist_topology, unsigned int connect_topology,
-               unsigned int connect_topology_option, float connect_topology_option_modifier,
-               float topology_percentage, float topology_probability,
-               unsigned int puts, unsigned int gets, unsigned int concurrent, unsigned int settle_time,
-               unsigned int num_rounds, unsigned int malicious_getters, unsigned int malicious_putters,
-               unsigned int malicious_droppers, unsigned int malicious_get_frequency,
-               unsigned int malicious_put_frequency, unsigned int stop_closest, unsigned int stop_found,
-               unsigned int strict_kademlia, unsigned int gets_succeeded,
-               char *message)
+/*
+ * Inserts the specified trial into the dhttests.trials table
+ *
+ * @param trial_info struct containing the data to insert about this trial
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int
+add_trial (struct GNUNET_DHTLOG_TrialInfo *trial_info)
+{
+  return GNUNET_OK;
+}
+
+/*
+ * Inserts the specified round into the dhttests.rounds table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int
+add_round (unsigned int round_type, unsigned int round_count)
+{
+  return GNUNET_OK;
+}
+
+/*
+ * Inserts the specified round results into the
+ * dhttests.processed_round_details table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ * @param num_messages the total number of messages initiated
+ * @param num_messages_succeeded the number of messages that succeeded
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int
+add_round_details (unsigned int round_type, unsigned int round_count,
+                   unsigned int num_messages,
+                   unsigned int num_messages_succeded)
 {
-  *trialuid = 42;
   return GNUNET_OK;
 }
 
@@ -103,7 +104,7 @@ add_dhtkey (unsigned long long *dhtkeyuid, const GNUNET_HashCode * dhtkey)
  * @return GNUNET_OK on success, GNUNET_SYSERR on failure
  */
 int
-add_node (unsigned long long *nodeuid, struct GNUNET_PeerIdentity * node)
+add_node (unsigned long long *nodeuid, struct GNUNET_PeerIdentity *node)
 {
   *nodeuid = 1337;
   return GNUNET_OK;
@@ -112,14 +113,12 @@ add_node (unsigned long long *nodeuid, struct GNUNET_PeerIdentity * node)
 /*
  * Update dhttests.trials table with current server time as end time
  *
- * @param trialuid trial to update
  * @param gets_succeeded how many gets did the testcase report as successful
  *
  * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
  */
 int
-update_trials (unsigned long long trialuid,
-               unsigned int gets_succeeded)
+update_trials (unsigned int gets_succeeded)
 {
   return GNUNET_OK;
 }
@@ -137,8 +136,7 @@ update_trials (unsigned long long trialuid,
  */
 int
 add_generic_stat (const struct GNUNET_PeerIdentity *peer,
-                  const char *name,
-                  const char *section, uint64_t value)
+                  const char *name, const char *section, uint64_t value)
 {
   return GNUNET_OK;
 }
@@ -146,13 +144,12 @@ add_generic_stat (const struct GNUNET_PeerIdentity *peer,
 /*
  * Update dhttests.trials table with total connections information
  *
- * @param trialuid the trialuid to update
  * @param totalConnections the number of connections
  *
  * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
  */
 int
-add_connections (unsigned long long trialuid, unsigned int totalConnections)
+add_connections (unsigned int totalConnections)
 {
   return GNUNET_OK;
 }
@@ -173,7 +170,7 @@ add_connections (unsigned long long trialuid, unsigned int totalConnections)
 int
 add_query (unsigned long long *sqlqueryuid, unsigned long long queryid,
            unsigned int type, unsigned int hops, int succeeded,
-           const struct GNUNET_PeerIdentity * node, const GNUNET_HashCode * key)
+           const struct GNUNET_PeerIdentity *node, const GNUNET_HashCode * key)
 {
   *sqlqueryuid = 17;
   return GNUNET_OK;
@@ -197,9 +194,10 @@ add_query (unsigned long long *sqlqueryuid, unsigned long long queryid,
 int
 add_route (unsigned long long *sqlqueryuid, unsigned long long queryid,
            unsigned int type, unsigned int hops,
-           int succeeded, const struct GNUNET_PeerIdentity * node,
-           const GNUNET_HashCode * key, const struct GNUNET_PeerIdentity * from_node,
-           const struct GNUNET_PeerIdentity * to_node)
+           int succeeded, const struct GNUNET_PeerIdentity *node,
+           const GNUNET_HashCode * key,
+           const struct GNUNET_PeerIdentity *from_node,
+           const struct GNUNET_PeerIdentity *to_node)
 {
   *sqlqueryuid = 18;
   return GNUNET_OK;
@@ -228,7 +226,8 @@ add_topology (int num_connections)
  * @return GNUNET_OK on success, GNUNET_SYSERR on failure
  */
 int
-add_extended_topology (const struct GNUNET_PeerIdentity *first, const struct GNUNET_PeerIdentity *second)
+add_extended_topology (const struct GNUNET_PeerIdentity *first,
+                       const struct GNUNET_PeerIdentity *second)
 {
   return GNUNET_OK;
 }
@@ -246,6 +245,56 @@ update_topology (unsigned int connections)
   return GNUNET_OK;
 }
 
+/*
+ * Update dhttests.nodes table setting the identified
+ * node as a malicious dropper.
+ *
+ * @param peer the peer that was set to be malicious
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
+ */
+int
+set_malicious (struct GNUNET_PeerIdentity *peer)
+{
+  return GNUNET_OK;
+}
+
+/*
+ * Inserts the specified stats into the dhttests.node_statistics table
+ *
+ * @param peer the peer inserting the statistic
+ * @param route_requests route requests seen
+ * @param route_forwards route requests forwarded
+ * @param result_requests route result requests seen
+ * @param client_requests client requests initiated
+ * @param result_forwards route results forwarded
+ * @param gets get requests handled
+ * @param puts put requests handle
+ * @param data_inserts data inserted at this node
+ * @param find_peer_requests find peer requests seen
+ * @param find_peers_started find peer requests initiated at this node
+ * @param gets_started get requests initiated at this node
+ * @param puts_started put requests initiated at this node
+ * @param find_peer_responses_received find peer responses received locally
+ * @param get_responses_received get responses received locally
+ * @param find_peer_responses_sent find peer responses sent from this node
+ * @param get_responses_sent get responses sent from this node
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int insert_stat
+    (const struct GNUNET_PeerIdentity *peer, unsigned int route_requests,
+     unsigned int route_forwards, unsigned int result_requests,
+     unsigned int client_requests, unsigned int result_forwards,
+     unsigned int gets, unsigned int puts,
+     unsigned int data_inserts, unsigned int find_peer_requests,
+     unsigned int find_peers_started, unsigned int gets_started,
+     unsigned int puts_started, unsigned int find_peer_responses_received,
+     unsigned int get_responses_received, unsigned int find_peer_responses_sent,
+     unsigned int get_responses_sent)
+{
+  return GNUNET_OK;
+}
 
 /*
  * Provides the dhtlog api
@@ -255,18 +304,23 @@ update_topology (unsigned int connections)
  * @return the handle to the server, or NULL on error
  */
 void *
-libgnunet_plugin_dhtlog_dummy_init (void * cls)
+libgnunet_plugin_dhtlog_dummy_init (void *cls)
 {
   struct GNUNET_DHTLOG_Plugin *plugin = cls;
+
 #if DEBUG_DHTLOG
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DUMMY DHT Logger: initializing.\n");
 #endif
-  GNUNET_assert(plugin->dhtlog_api == NULL);
-  plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle));
+  GNUNET_assert (plugin->dhtlog_api == NULL);
+  plugin->dhtlog_api = GNUNET_malloc (sizeof (struct GNUNET_DHTLOG_Handle));
   plugin->dhtlog_api->add_generic_stat = &add_generic_stat;
+  plugin->dhtlog_api->insert_round = &add_round;
+  plugin->dhtlog_api->insert_round_details = &add_round_details;
+  plugin->dhtlog_api->insert_stat = &insert_stat;
   plugin->dhtlog_api->insert_trial = &add_trial;
   plugin->dhtlog_api->insert_query = &add_query;
   plugin->dhtlog_api->update_trial = &update_trials;
+  plugin->dhtlog_api->set_malicious = &set_malicious;
   plugin->dhtlog_api->insert_route = &add_route;
   plugin->dhtlog_api->insert_node = &add_node;
   plugin->dhtlog_api->insert_dhtkey = &add_dhtkey;
@@ -274,18 +328,17 @@ libgnunet_plugin_dhtlog_dummy_init (void * cls)
   plugin->dhtlog_api->insert_topology = &add_topology;
   plugin->dhtlog_api->update_topology = &update_topology;
   plugin->dhtlog_api->insert_extended_topology = &add_extended_topology;
-  return NULL;
+  return plugin;
 }
 
 /**
  * Shutdown the plugin.
  */
 void *
-libgnunet_plugin_dhtlog_dummy_done (void * cls)
+libgnunet_plugin_dhtlog_dummy_done (void *cls)
 {
 #if DEBUG_DHTLOG
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "DUMMY DHT Logger: shutdown\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DUMMY DHT Logger: shutdown\n");
 #endif
   return NULL;
 }