[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12518 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12518 - gnunet/src/dht |
Date: |
Thu, 12 Aug 2010 18:21:04 +0200 |
Author: nevans
Date: 2010-08-12 18:21:04 +0200 (Thu, 12 Aug 2010)
New Revision: 12518
Modified:
gnunet/src/dht/dhtlog.h
gnunet/src/dht/gnunet-dht-driver.c
gnunet/src/dht/gnunet-service-dht.c
gnunet/src/dht/plugin_dhtlog_dummy.c
gnunet/src/dht/plugin_dhtlog_mysql.c
gnunet/src/dht/plugin_dhtlog_mysql_dump.c
gnunet/src/dht/test_dhtlog.c
Log:
myriad changes
Modified: gnunet/src/dht/dhtlog.h
===================================================================
--- gnunet/src/dht/dhtlog.h 2010-08-11 17:25:53 UTC (rev 12517)
+++ gnunet/src/dht/dhtlog.h 2010-08-12 16:21:04 UTC (rev 12518)
@@ -111,17 +111,25 @@
* @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 (*insert_trial) (unsigned long long *trialuid, int num_nodes, int
topology,
- int blacklist_topology, int connect_topology,
- int connect_topology_option, float
connect_topology_option_modifier,
+ int (*insert_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,
- int puts, int gets, int concurrent, int settle_time,
- int num_rounds, int malicious_getters, int
malicious_putters,
- int malicious_droppers,
+ 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);
/*
@@ -162,16 +170,12 @@
* Update dhttests.trials table with current server time as end time
*
* @param trialuid trial to update
- * @param totalMessagesDropped stats value for messages dropped
- * @param totalBytesDropped stats value for total bytes dropped
- * @param unknownPeers stats value for unknown peers
+ * @param gets_succeeded how many gets did the trial report successful
*
* @return GNUNET_OK on success, GNUNET_SYSERR on failure.
*/
int (*update_trial) (unsigned long long trialuid,
- unsigned long long totalMessagesDropped,
- unsigned long long totalBytesDropped,
- unsigned long long unknownPeers);
+ unsigned int gets_succeeded);
/*
* Records the current topology (number of connections, time, trial)
Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c 2010-08-11 17:25:53 UTC (rev 12517)
+++ gnunet/src/dht/gnunet-dht-driver.c 2010-08-12 16:21:04 UTC (rev 12518)
@@ -23,6 +23,8 @@
* then issuing GETS and PUTS on the DHT. Coarse results
* are reported, fine grained results (if requested) are
* logged to a (mysql) database, or to file.
+ *
+ * FIXME: Do churn, enable malicious peers!
*/
#include "platform.h"
#include "gnunet_testing_lib.h"
@@ -60,8 +62,41 @@
#define DEFAULT_TOPOLOGY_TIMEOUT
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 8)
+/*
+ * Default frequency for sending malicious get messages
+ */
+#define DEFAULT_MALICIOUS_GET_FREQUENCY 1000 /* Number of milliseconds */
+
+/*
+ * Default frequency for sending malicious put messages
+ */
+#define DEFAULT_MALICIOUS_PUT_FREQUENCY 1000 /* Default is in milliseconds */
+
/* Structs */
+struct MaliciousContext
+{
+ /**
+ * Handle to DHT service (via the API)
+ */
+ struct GNUNET_DHT_Handle *dht_handle;
+
+ /**
+ * Handle to the peer daemon
+ */
+ struct GNUNET_TESTING_Daemon *daemon;
+
+ /**
+ * Task for disconnecting DHT handles
+ */
+ GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
+
+ /**
+ * What type of malicious to set this peer to.
+ */
+ int malicious_type;
+};
+
struct TestPutContext
{
/* This is a linked list */
@@ -211,6 +246,10 @@
static unsigned long long malicious_droppers;
+static unsigned long long malicious_get_frequency;
+
+static unsigned long long malicious_put_frequency;
+
static unsigned long long settle_time;
static struct GNUNET_DHTLOG_Handle *dhtlog_handle;
@@ -223,6 +262,11 @@
struct GNUNET_CONTAINER_MultiHashMap *stats_map;
/**
+ * LL of malicious settings.
+ */
+struct MaliciousContext *all_malicious;
+
+/**
* List of GETS to perform
*/
struct TestGetContext *all_gets;
@@ -273,11 +317,6 @@
static unsigned long long num_puts;
/**
- * Total number of items to attempt to get.
- */
-static unsigned long long num_gets;
-
-/**
* How many puts do we currently have in flight?
*/
static unsigned long long outstanding_puts;
@@ -288,6 +327,11 @@
static unsigned long long puts_completed;
/**
+ * Total number of items to attempt to get.
+ */
+static unsigned long long num_gets;
+
+/**
* How many puts do we currently have in flight?
*/
static unsigned long long outstanding_gets;
@@ -303,6 +347,17 @@
static unsigned long long gets_failed;
/**
+ * How many malicious control messages do
+ * we currently have in flight?
+ */
+static unsigned long long outstanding_malicious;
+
+/**
+ * How many set malicious peers are done?
+ */
+static unsigned long long malicious_completed;
+
+/**
* Global used to count how many connections we have currently
* been notified about (how many times has topology_callback been called
* with success?)
@@ -481,7 +536,7 @@
if (dhtlog_handle != NULL)
{
fprintf(stderr, "Update trial endtime\n");
- dhtlog_handle->update_trial (trialuid, 0, 0, 0);
+ dhtlog_handle->update_trial (trialuid, gets_completed);
GNUNET_DHTLOG_disconnect(dhtlog_handle);
dhtlog_handle = NULL;
}
@@ -694,7 +749,7 @@
if (dhtlog_handle != NULL)
{
fprintf(stderr, "Update trial endtime\n");
- dhtlog_handle->update_trial (trialuid, 0, 0, 0);
+ dhtlog_handle->update_trial (trialuid, gets_completed);
GNUNET_DHTLOG_disconnect(dhtlog_handle);
dhtlog_handle = NULL;
}
@@ -1025,6 +1080,156 @@
}
/**
+ * Task to release DHT handles
+ */
+static void
+malicious_disconnect_task (void *cls, const struct
GNUNET_SCHEDULER_TaskContext * tc)
+{
+ struct MaliciousContext *ctx = cls;
+ outstanding_malicious--;
+ malicious_completed++;
+ ctx->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
+ GNUNET_DHT_disconnect(ctx->dht_handle);
+ ctx->dht_handle = NULL;
+ GNUNET_free(ctx);
+
+ if (malicious_completed == malicious_getters + malicious_putters +
malicious_droppers)
+ {
+ GNUNET_SCHEDULER_cancel(sched, die_task);
+ fprintf(stderr, "Finished setting all malicious peers up, calling
continuation!\n");
+ if (dhtlog_handle != NULL)
+ GNUNET_SCHEDULER_add_now (sched,
+ &continue_puts_and_gets, NULL);
+ else
+ GNUNET_SCHEDULER_add_delayed (sched,
+
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time),
+ &continue_puts_and_gets, NULL);
+ }
+
+}
+
+/**
+ * Task to release DHT handles
+ */
+static void
+malicious_done_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
+{
+ struct MaliciousContext *ctx = cls;
+ GNUNET_SCHEDULER_cancel(sched, ctx->disconnect_task);
+ GNUNET_SCHEDULER_add_now(sched, &malicious_disconnect_task, ctx);
+}
+
+/**
+ * Set up some data, and call API PUT function
+ */
+static void
+set_malicious (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
+{
+ struct MaliciousContext *ctx = cls;
+ int ret;
+
+ if (outstanding_malicious > DEFAULT_MAX_OUTSTANDING_GETS)
+ {
+ GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100),
&set_malicious, ctx);
+ return;
+ }
+
+ if (ctx->dht_handle == NULL)
+ {
+ ctx->dht_handle = GNUNET_DHT_connect(sched, ctx->daemon->cfg, 1);
+ outstanding_malicious++;
+ }
+
+ GNUNET_assert(ctx->dht_handle != NULL);
+
+
+#if VERBOSE > 1
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting peer %s malicious type %d\n",
+ ctx->daemon->shortname, ctx->malicious_type);
+#endif
+
+ ret = GNUNET_YES;
+ switch (ctx->malicious_type)
+ {
+ case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_GET:
+ ret = GNUNET_DHT_set_malicious_getter(ctx->dht_handle,
malicious_get_frequency, &malicious_done_task, ctx);
+ break;
+ case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT:
+ ret = GNUNET_DHT_set_malicious_putter(ctx->dht_handle,
malicious_put_frequency, &malicious_done_task, ctx);
+ break;
+ case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP:
+ ret = GNUNET_DHT_set_malicious_dropper(ctx->dht_handle,
&malicious_done_task, ctx);
+ break;
+ default:
+ break;
+ }
+
+ if (ret == GNUNET_NO)
+ {
+ GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100),
&set_malicious, ctx);
+ }
+ else
+ ctx->disconnect_task = GNUNET_SCHEDULER_add_delayed(sched,
GNUNET_TIME_relative_get_forever(), &malicious_disconnect_task, ctx);
+}
+
+/**
+ * Select randomly from set of known peers,
+ * set the desired number of peers to the
+ * proper malicious types.
+ */
+static void
+setup_malicious_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *
tc)
+{
+ struct MaliciousContext *ctx;
+ int i;
+ uint32_t temp_daemon;
+
+ for (i = 0; i < malicious_getters; i++)
+ {
+ ctx = GNUNET_malloc(sizeof(struct MaliciousContext));
+ temp_daemon = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK,
num_peers);
+ ctx->daemon = GNUNET_TESTING_daemon_get(pg, temp_daemon);
+ ctx->malicious_type = GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_GET;
+ GNUNET_SCHEDULER_add_now (sched, &set_malicious, ctx);
+
+ }
+
+ for (i = 0; i < malicious_putters; i++)
+ {
+ ctx = GNUNET_malloc(sizeof(struct MaliciousContext));
+ temp_daemon = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK,
num_peers);
+ ctx->daemon = GNUNET_TESTING_daemon_get(pg, temp_daemon);
+ ctx->malicious_type = GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT;
+ GNUNET_SCHEDULER_add_now (sched, &set_malicious, ctx);
+
+ }
+
+ for (i = 0; i < malicious_droppers; i++)
+ {
+ ctx = GNUNET_malloc(sizeof(struct MaliciousContext));
+ temp_daemon = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK,
num_peers);
+ ctx->daemon = GNUNET_TESTING_daemon_get(pg, temp_daemon);
+ ctx->malicious_type = GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP;
+ GNUNET_SCHEDULER_add_now (sched, &set_malicious, ctx);
+ }
+
+ if (malicious_getters + malicious_putters + malicious_droppers > 0)
+ die_task = GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, (malicious_getters +
malicious_putters + malicious_droppers) * 2),
+ &end_badly, "from set malicious");
+ else
+ {
+ if (dhtlog_handle != NULL)
+ GNUNET_SCHEDULER_add_now (sched,
+ &continue_puts_and_gets, NULL);
+ else
+ GNUNET_SCHEDULER_add_delayed (sched,
+
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time),
+ &continue_puts_and_gets, NULL);
+ }
+
+}
+
+/**
* This function is called whenever a connection attempt is finished between
two of
* the started peers (started with GNUNET_TESTING_daemons_start). The total
* number of times this function is called should equal the number returned
@@ -1084,11 +1289,17 @@
if ((dhtlog_handle != NULL) && (settle_time > 0))
{
topo_ctx = GNUNET_malloc(sizeof(struct TopologyIteratorContext));
- topo_ctx->cont = &continue_puts_and_gets;
+ topo_ctx->cont = &setup_malicious_peers;
+ //topo_ctx->cont = &continue_puts_and_gets;
GNUNET_SCHEDULER_add_now(sched, &capture_current_topology, topo_ctx);
}
else
- GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time),
&continue_puts_and_gets, NULL);
+ {
+ GNUNET_SCHEDULER_add_now(sched, &setup_malicious_peers, NULL);
+ /*GNUNET_SCHEDULER_add_delayed (sched,
+
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time),
+ &continue_puts_and_gets, NULL);*/
+ }
}
else if (total_connections + failed_connections == expected_connections)
{
@@ -1244,6 +1455,9 @@
char *hostfile;
float topology_probability;
unsigned long long temp_config_number;
+ int stop_closest;
+ int stop_found;
+ int strict_kademlia;
char *buf;
char *data;
int count;
@@ -1273,6 +1487,18 @@
}
}
+ stop_closest = GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht",
"stop_on_closest");
+ if (stop_closest == GNUNET_SYSERR)
+ stop_closest = GNUNET_NO;
+
+ stop_found = GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht", "stop_found");
+ if (stop_found == GNUNET_SYSERR)
+ stop_found = GNUNET_NO;
+
+ strict_kademlia = GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht",
"strict_kademlia");
+ if (strict_kademlia == GNUNET_SYSERR)
+ strict_kademlia = GNUNET_NO;
+
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, "dht_testing", "comment",
&trialmessage))
@@ -1421,6 +1647,18 @@
/**
* Get testing related options.
*/
+
+ if (GNUNET_NO == GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING",
+
"MALICIOUS_GET_FREQUENCY",
+
&malicious_get_frequency))
+ malicious_get_frequency = DEFAULT_MALICIOUS_GET_FREQUENCY;
+
+
+ if (GNUNET_NO == GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING",
+
"MALICIOUS_PUT_FREQUENCY",
+
&malicious_put_frequency))
+ malicious_put_frequency = DEFAULT_MALICIOUS_PUT_FREQUENCY;
+
topology_str = NULL;
if ((GNUNET_YES ==
GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "topology",
@@ -1530,7 +1768,9 @@
topology_probability, num_puts, num_gets,
max_outstanding_gets, settle_time, 1,
malicious_getters, malicious_putters,
- malicious_droppers, trialmessage);
+ malicious_droppers,
malicious_get_frequency,
+ malicious_put_frequency, stop_closest,
stop_found,
+ strict_kademlia, 0, trialmessage);
}
else if (dhtlog_handle != NULL)
{
@@ -1541,7 +1781,9 @@
topology_probability, num_puts, num_gets,
max_outstanding_gets, settle_time, 1,
malicious_getters, malicious_putters,
- malicious_droppers, "");
+ malicious_droppers,
malicious_get_frequency,
+ malicious_put_frequency, stop_closest,
stop_found,
+ strict_kademlia, 0, "");
}
GNUNET_free_non_null(trialmessage);
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-08-11 17:25:53 UTC (rev 12517)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-08-12 16:21:04 UTC (rev 12518)
@@ -87,15 +87,16 @@
*/
#define DEFAULT_MALICIOUS_GET_FREQUENCY 1000 /* Number of milliseconds */
-/**
- * Type for a malicious request, so we can ignore it during testing
- */
-#define DHT_MALICIOUS_MESSAGE_TYPE 42
/*
* Default frequency for sending malicious put messages
*/
#define DEFAULT_MALICIOUS_PUT_FREQUENCY 1000 /* Default is in milliseconds */
+/**
+ * Type for a malicious request, so we can ignore it during testing
+ */
+#define DHT_MALICIOUS_MESSAGE_TYPE 42
+
#define DHT_DEFAULT_PING_DELAY
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 1)
/**
@@ -2537,6 +2538,10 @@
static GNUNET_HashCode key;
unsigned int mcsize;
uint32_t random_key;
+
+ if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
+ return;
+
put_message.header.size = htons(sizeof(struct GNUNET_DHT_GetMessage));
put_message.header.type = htons(GNUNET_MESSAGE_TYPE_DHT_PUT);
put_message.type = htons(DHT_MALICIOUS_MESSAGE_TYPE);
@@ -2552,6 +2557,9 @@
message_context.msg_options = ntohl (0);
message_context.network_size = estimate_diameter();
message_context.peer = &my_identity;
+
+ if (dhtlog_handle != NULL)
+ dhtlog_handle->insert_dhtkey(NULL, &key);
increment_stats(STAT_PUT_START);
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious PUT message
with hash %s", my_short_id, "DHT", GNUNET_h2s(&key));
route_message(NULL, &put_message.header, &message_context);
@@ -2573,6 +2581,10 @@
static GNUNET_HashCode key;
unsigned int mcsize;
uint32_t random_key;
+
+ if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
+ return;
+
get_message.header.size = htons(sizeof(struct GNUNET_DHT_GetMessage));
get_message.header.type = htons(GNUNET_MESSAGE_TYPE_DHT_GET);
get_message.type = htons(DHT_MALICIOUS_MESSAGE_TYPE);
@@ -2587,6 +2599,9 @@
message_context.msg_options = ntohl (0);
message_context.network_size = estimate_diameter();
message_context.peer = &my_identity;
+
+ if (dhtlog_handle != NULL)
+ dhtlog_handle->insert_dhtkey(NULL, &key);
increment_stats(STAT_GET_START);
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious GET message
with hash %s", my_short_id, "DHT", GNUNET_h2s(&key));
route_message(NULL, &get_message.header, &message_context);
@@ -2717,6 +2732,8 @@
case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_GET:
if (ntohs(dht_control_msg->variable) > 0)
malicious_get_frequency = ntohs(dht_control_msg->variable);
+ if (malicious_get_frequency == 0)
+ malicious_get_frequency = DEFAULT_MALICIOUS_GET_FREQUENCY;
if (malicious_getter != GNUNET_YES)
GNUNET_SCHEDULER_add_now(sched, &malicious_get_task, NULL);
malicious_getter = GNUNET_YES;
@@ -2725,6 +2742,8 @@
case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT:
if (ntohs(dht_control_msg->variable) > 0)
malicious_put_frequency = ntohs(dht_control_msg->variable);
+ if (malicious_put_frequency == 0)
+ malicious_put_frequency = DEFAULT_MALICIOUS_PUT_FREQUENCY;
if (malicious_putter != GNUNET_YES)
GNUNET_SCHEDULER_add_now(sched, &malicious_put_task, NULL);
malicious_putter = GNUNET_YES;
Modified: gnunet/src/dht/plugin_dhtlog_dummy.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_dummy.c 2010-08-11 17:25:53 UTC (rev
12517)
+++ gnunet/src/dht/plugin_dhtlog_dummy.c 2010-08-12 16:21:04 UTC (rev
12518)
@@ -32,38 +32,46 @@
#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 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, int num_nodes, int topology,
- int blacklist_topology, int connect_topology,
- int connect_topology_option, float connect_topology_option_modifier,
- float topology_percentage, float topology_probability,
- int puts, int gets, int concurrent, int settle_time,
- int num_rounds, int malicious_getters, int malicious_putters,
- int malicious_droppers, char *message)
+ /*
+ * 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)
{
*trialuid = 42;
return GNUNET_OK;
@@ -105,17 +113,13 @@
* Update dhttests.trials table with current server time as end time
*
* @param trialuid trial to update
- * @param totalMessagesDropped stats value for messages dropped
- * @param totalBytesDropped stats value for total bytes dropped
- * @param unknownPeers stats value for unknown peers
+ * @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 long long totalMessagesDropped,
- unsigned long long totalBytesDropped,
- unsigned long long unknownPeers)
+ unsigned int gets_succeeded)
{
return GNUNET_OK;
}
Modified: gnunet/src/dht/plugin_dhtlog_mysql.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql.c 2010-08-11 17:25:53 UTC (rev
12517)
+++ gnunet/src/dht/plugin_dhtlog_mysql.c 2010-08-12 16:21:04 UTC (rev
12518)
@@ -109,8 +109,10 @@
"blacklist_topology, connect_topology,
connect_topology_option,"\
"connect_topology_option_modifier, puts, gets, "\
"concurrent, settle_time, num_rounds,
malicious_getters,"\
- "malicious_putters, malicious_droppers, message) "\
- "VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?)"
+ "malicious_putters, malicious_droppers,
malicious_get_frequency,"\
+ "malicious_put_frequency, stop_closest,
stop_found, strict_kademlia, "\
+ "gets_succeeded, message) "\
+ "VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
static struct StatementHandle *insert_trial;
@@ -129,7 +131,7 @@
"VALUES (?, ?, ?)"
static struct StatementHandle *insert_dhtkey;
-#define UPDATE_TRIALS_STMT "UPDATE trials set endtime=NOW(),
total_messages_dropped = ?, total_bytes_dropped = ?, unknownPeers = ? where
trialuid = ?"
+#define UPDATE_TRIALS_STMT "UPDATE trials set endtime=NOW(), gets_succeeded =
? where trialuid = ?"
static struct StatementHandle *update_trial;
#define UPDATE_CONNECTIONS_STMT "UPDATE trials set totalConnections = ? where
trialuid = ?"
@@ -822,18 +824,26 @@
* @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, int num_nodes, int topology,
- int blacklist_topology, int connect_topology,
- int connect_topology_option, float connect_topology_option_modifier,
- float topology_percentage, float topology_probability,
- int puts, int gets, int concurrent, int settle_time,
- int num_rounds, int malicious_getters, int malicious_putters,
- int malicious_droppers, char *message)
+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)
{
MYSQL_STMT *stmt;
int ret;
@@ -842,57 +852,31 @@
stmt = mysql_stmt_init(conn);
if (GNUNET_OK !=
- (ret = prepared_statement_run (insert_trial,
- trialuid,
- MYSQL_TYPE_LONG,
- &num_nodes,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &topology,
- GNUNET_YES,
- MYSQL_TYPE_FLOAT,
- &topology_percentage,
- MYSQL_TYPE_FLOAT,
- &topology_probability,
- MYSQL_TYPE_LONG,
- &blacklist_topology,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &connect_topology,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &connect_topology_option,
- GNUNET_YES,
- MYSQL_TYPE_FLOAT,
- &connect_topology_option_modifier,
- MYSQL_TYPE_LONG,
- &puts,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &gets,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &concurrent,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &settle_time,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &num_rounds,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &malicious_getters,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &malicious_putters,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &malicious_droppers,
- GNUNET_YES,
- MYSQL_TYPE_BLOB,
- message,
- max_varchar_len +
- max_varchar_len, &m_len,
+ (ret = prepared_statement_run (insert_trial, trialuid,
+ MYSQL_TYPE_LONG, &num_nodes, GNUNET_YES,
+ MYSQL_TYPE_LONG, &topology, GNUNET_YES,
+ MYSQL_TYPE_FLOAT, &topology_percentage,
+ MYSQL_TYPE_FLOAT, &topology_probability,
+ MYSQL_TYPE_LONG, &blacklist_topology,
GNUNET_YES,
+ MYSQL_TYPE_LONG, &connect_topology,
GNUNET_YES,
+ MYSQL_TYPE_LONG,
&connect_topology_option, GNUNET_YES,
+ MYSQL_TYPE_FLOAT,
&connect_topology_option_modifier,
+ MYSQL_TYPE_LONG, &puts, GNUNET_YES,
+ MYSQL_TYPE_LONG, &gets, GNUNET_YES,
+ MYSQL_TYPE_LONG, &concurrent, GNUNET_YES,
+ MYSQL_TYPE_LONG, &settle_time, GNUNET_YES,
+ MYSQL_TYPE_LONG, &num_rounds, GNUNET_YES,
+ MYSQL_TYPE_LONG, &malicious_getters,
GNUNET_YES,
+ MYSQL_TYPE_LONG, &malicious_putters,
GNUNET_YES,
+ MYSQL_TYPE_LONG, &malicious_droppers,
GNUNET_YES,
+ MYSQL_TYPE_LONG,
&malicious_get_frequency, GNUNET_YES,
+ MYSQL_TYPE_LONG,
&malicious_put_frequency, GNUNET_YES,
+ MYSQL_TYPE_LONG, &stop_closest,
GNUNET_YES,
+ MYSQL_TYPE_LONG, &stop_found, GNUNET_YES,
+ MYSQL_TYPE_LONG, &strict_kademlia,
GNUNET_YES,
+ MYSQL_TYPE_LONG, &gets_succeeded,
GNUNET_YES,
+ MYSQL_TYPE_BLOB, message, max_varchar_len
+
+ max_varchar_len, &m_len,
-1)))
{
if (ret == GNUNET_SYSERR)
@@ -1095,34 +1079,22 @@
* Update dhttests.trials table with current server time as end time
*
* @param trialuid trial to update
- * @param totalMessagesDropped stats value for messages dropped
- * @param totalBytesDropped stats value for total bytes dropped
- * @param unknownPeers stats value for unknown peers
+ * @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 long long totalMessagesDropped,
- unsigned long long totalBytesDropped,
- unsigned long long unknownPeers)
+ unsigned int gets_succeeded)
{
int ret;
if (GNUNET_OK !=
(ret = prepared_statement_run (update_trial,
NULL,
- MYSQL_TYPE_LONGLONG,
- &totalMessagesDropped,
- GNUNET_YES,
- MYSQL_TYPE_LONGLONG,
- &totalBytesDropped,
- GNUNET_YES,
- MYSQL_TYPE_LONGLONG,
- &unknownPeers,
- GNUNET_YES,
- MYSQL_TYPE_LONGLONG,
- &trialuid, GNUNET_YES, -1)))
+ MYSQL_TYPE_LONG, &gets_succeeded,
GNUNET_YES,
+ MYSQL_TYPE_LONGLONG, &trialuid, GNUNET_YES,
+ -1)))
{
if (ret == GNUNET_SYSERR)
{
Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump.c 2010-08-11 17:25:53 UTC (rev
12517)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump.c 2010-08-12 16:21:04 UTC (rev
12518)
@@ -74,8 +74,10 @@
"blacklist_topology, connect_topology,
connect_topology_option,"\
"connect_topology_option_modifier, puts, gets, "\
"concurrent, settle_time, num_rounds,
malicious_getters,"\
- "malicious_putters, malicious_droppers, message) "\
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?)'"
+ "malicious_putters, malicious_droppers,
malicious_get_frequency,"\
+ "malicious_put_frequency, stop_closest, stop_found,
strict_kademlia, "\
+ "gets_succeeded, message) "\
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'"
#define INSERT_STAT_STMT "prepare insert_stat from 'INSERT INTO
node_statistics"\
"(trialuid, nodeuid, route_requests,"\
@@ -89,7 +91,7 @@
#define INSERT_DHTKEY_STMT "prepare insert_dhtkey from 'INSERT ignore INTO
dhtkeys (dhtkey, trialuid) "\
"VALUES (?, @temp_trial)'"
-#define UPDATE_TRIALS_STMT "prepare update_trial from 'UPDATE trials set
endtime= ?, total_messages_dropped = ?, total_bytes_dropped = ?, unknownPeers =
? where trialuid = @temp_trial'"
+#define UPDATE_TRIALS_STMT "prepare update_trial from 'UPDATE trials set
endtime= ?, gets_succeeded = ? where trialuid = @temp_trial'"
#define UPDATE_CONNECTIONS_STMT "prepare update_conn from 'UPDATE trials set
totalConnections = ? where trialuid = @temp_trial'"
@@ -261,18 +263,26 @@
* @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, int num_nodes, int topology,
- int blacklist_topology, int connect_topology,
- int connect_topology_option, float connect_topology_option_modifier,
- float topology_percentage, float topology_probability,
- int puts, int gets, int concurrent, int settle_time,
- int num_rounds, int malicious_getters, int malicious_putters,
- int malicious_droppers, char *message)
+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)
{
int ret;
if (trialuid != NULL)
@@ -280,18 +290,21 @@
if (outfile == NULL)
return GNUNET_SYSERR;
- ret = fprintf(outfile, "set @date = \"%s\", @num = %d, @topology = %d, @bl =
%d, "
- "@connect = %d, @c_t_o = %d, @c_t_o_m = %f, @t_p = %f, "
- "@t_pr = %f, @puts = %d, @gets = %d, "
- "@concurrent = %d, @settle = %d, @rounds = %d, "
- "@m_gets = %d, @m_puts = %d, @m_drops = %d, "
- "@message = \"%s\";\n", get_sql_time(), num_nodes, topology,
+ ret = fprintf(outfile, "set @date = \"%s\", @num = %u, @topology = %u, @bl =
%u, "
+ "@connect = %u, @c_t_o = %u, @c_t_o_m = %f, @t_p = %f, "
+ "@t_pr = %f, @puts = %u, @gets = %u, "
+ "@concurrent = %u, @settle = %u, @rounds = %u, "
+ "@m_gets = %u, @m_puts = %u, @m_drops = %u, "
+ "@m_g_f = %u, @m_p_f = %u, @s_c = %u, @s_f = %u,"
+ "@s_k = %u, @g_s = %u, @message = \"%s\";\n",
+ get_sql_time(), num_nodes, topology,
blacklist_topology, connect_topology,
connect_topology_option, connect_topology_option_modifier,
topology_percentage, topology_probability,
puts, gets, concurrent, settle_time,
num_rounds, malicious_getters, malicious_putters,
- malicious_droppers, message);
+ malicious_droppers, malicious_get_frequency,
malicious_put_frequency,
+ stop_closest, stop_found, strict_kademlia, gets_succeeded,
message);
if (ret < 0)
return GNUNET_SYSERR;
@@ -301,7 +314,8 @@
"@c_t_o_m, @puts, @gets,"
"@concurrent, @settle, @rounds,"
"@m_gets, @m_puts, @m_drops,"
- "@message;\n");
+ "@m_g_f, @m_p_f, @s_c, @s_f,"
+ "@s_k, @g_s, @message;\n");
ret = fprintf(outfile, "execute select_trial;\n");
@@ -446,17 +460,13 @@
* Update dhttests.trials table with current server time as end time
*
* @param trialuid trial to update
- * @param totalMessagesDropped stats value for messages dropped
- * @param totalBytesDropped stats value for total bytes dropped
- * @param unknownPeers stats value for unknown peers
+ * @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 long long totalMessagesDropped,
- unsigned long long totalBytesDropped,
- unsigned long long unknownPeers)
+ unsigned int gets_succeeded)
{
int ret;
#if DEBUG_DHTLOG
@@ -470,12 +480,12 @@
if (outfile == NULL)
return GNUNET_SYSERR;
- ret = fprintf(outfile, "set @date = \"%s\", @m_dropped = %llu, @b_dropped =
%llu, @unknown = %llu;\n", get_sql_time(), totalMessagesDropped,
totalBytesDropped, unknownPeers);
+ ret = fprintf(outfile, "set @date = \"%s\", @g_s = %u;\n", get_sql_time(),
gets_succeeded);
if (ret < 0)
return GNUNET_SYSERR;
- ret = fprintf(outfile, "execute update_trial using @date, @m_dropped,
@b_dropped, @unknown;\n");
+ ret = fprintf(outfile, "execute update_trial using @date, @g_s;\n");
if (ret >= 0)
return GNUNET_OK;
Modified: gnunet/src/dht/test_dhtlog.c
===================================================================
--- gnunet/src/dht/test_dhtlog.c 2010-08-11 17:25:53 UTC (rev 12517)
+++ gnunet/src/dht/test_dhtlog.c 2010-08-12 16:21:04 UTC (rev 12518)
@@ -66,8 +66,8 @@
ret =
api->insert_trial (&trialuid, i, 5, 4, 3, 2,
.75, .25, .5, 42, 14,
- 5, 1, 12, 0, 0, 0,
- "TEST INSERT TRIAL");
+ 5, 1, 12, 0, 0, 0, 1, 0, 1,
+ 0, 1, 0, "TEST INSERT TRIAL");
CHECK(ret);
ret = api->insert_topology(500);
CHECK(ret);
@@ -101,7 +101,7 @@
ret = api->insert_stat(&p1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17);
ret = api->insert_stat(&p2, 12, 23, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27);
CHECK(ret);
- ret = api->update_trial (trialuid, 0, 0, 0);
+ ret = api->update_trial (trialuid, 787);
CHECK(ret);
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12518 - gnunet/src/dht,
gnunet <=