* Inserts the specified trial into the dhttests.trials table
*
* @param trialuid return the trialuid of the newly inserted trial
+ * @param other_identifier identifier for the trial from another source
+ * (for joining later)
* @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
*
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
- int (*insert_trial) (unsigned long long *trialuid, unsigned int num_nodes, unsigned int topology,
+ int (*insert_trial) (unsigned long long *trialuid, unsigned int other_identifier, 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,
* Inserts the specified trial into the dhttests.trials table
*
* @param trialuid return the trialuid of the newly inserted trial
+ * @param other_identifier identifier for the trial from another source
+ * (for joining later)
* @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
*
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned int topology,
+int add_trial (unsigned long long *trialuid, unsigned int other_identifier, 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,
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
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_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;
#include <mysql/mysql.h>
-#define DEBUG_DHTLOG GNUNET_NO
+#define DEBUG_DHTLOG GNUNET_YES
/**
* Maximum number of supported parameters for a prepared
static struct StatementHandle *insert_node;
#define INSERT_TRIALS_STMT "INSERT INTO trials"\
- "(starttime, numnodes, topology,"\
+ "(starttime, other_trial_identifier, numnodes, topology,"\
"topology_percentage, topology_probability,"\
"blacklist_topology, connect_topology, connect_topology_option,"\
"connect_topology_option_modifier, puts, gets, "\
"malicious_putters, malicious_droppers, malicious_get_frequency,"\
"malicious_put_frequency, stop_closest, stop_found, strict_kademlia, "\
"gets_succeeded, message) "\
- "VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+ "VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
static struct StatementHandle *insert_trial;
return GNUNET_SYSERR;
if (MRUNS ("CREATE TABLE IF NOT EXISTS `trials` ("
- "`trialuid` int(10) unsigned NOT NULL auto_increment,"
- "`numnodes` int(10) unsigned NOT NULL,"
- "`topology` int(10) NOT NULL,"
- "`starttime` datetime NOT NULL,"
- "`endtime` datetime NOT NULL,"
- "`puts` int(10) unsigned NOT NULL,"
- "`gets` int(10) unsigned NOT NULL,"
- "`concurrent` int(10) unsigned NOT NULL,"
- "`settle_time` int(10) unsigned NOT NULL,"
- "`totalConnections` int(10) unsigned NOT NULL,"
- "`message` text NOT NULL,"
- "`num_rounds` int(10) unsigned NOT NULL,"
- "`malicious_getters` int(10) unsigned NOT NULL,"
- "`malicious_putters` int(10) unsigned NOT NULL,"
- "`malicious_droppers` int(10) unsigned NOT NULL,"
- "`totalMessagesDropped` int(10) unsigned NOT NULL,"
- "`totalBytesDropped` int(10) unsigned NOT NULL,"
- "`topology_modifier` double NOT NULL,"
- "`logNMultiplier` double NOT NULL,"
- "`maxnetbps` bigint(20) unsigned NOT NULL,"
- "`unknownPeers` int(10) unsigned NOT NULL,"
- "PRIMARY KEY (`trialuid`),"
- "UNIQUE KEY `trialuid` (`trialuid`)"
- ") ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"))
+ "`trialuid` int(10) unsigned NOT NULL auto_increment,"
+ "`other_trial_identifier` int(10) unsigned NOT NULL default '0',"
+ "`numnodes` int(10) unsigned NOT NULL,"
+ "`topology` int(10) NOT NULL,"
+ "`blacklist_topology` int(11) NOT NULL,"
+ "`connect_topology` int(11) NOT NULL,"
+ "`connect_topology_option` int(11) NOT NULL,"
+ "`topology_percentage` float NOT NULL,"
+ "`topology_probability` float NOT NULL,"
+ "`connect_topology_option_modifier` float NOT NULL,"
+ "`starttime` datetime NOT NULL,"
+ "`endtime` datetime NOT NULL,"
+ "`puts` int(10) unsigned NOT NULL,"
+ "`gets` int(10) unsigned NOT NULL,"
+ "`concurrent` int(10) unsigned NOT NULL,"
+ "`settle_time` int(10) unsigned NOT NULL,"
+ "`totalConnections` int(10) unsigned NOT NULL,"
+ "`message` text NOT NULL,"
+ "`num_rounds` int(10) unsigned NOT NULL,"
+ "`malicious_getters` int(10) unsigned NOT NULL,"
+ "`malicious_putters` int(10) unsigned NOT NULL,"
+ "`malicious_droppers` int(10) unsigned NOT NULL,"
+ "`topology_modifier` double NOT NULL,"
+ "`malicious_get_frequency` int(10) unsigned NOT NULL,"
+ "`malicious_put_frequency` int(10) unsigned NOT NULL,"
+ "`stop_closest` int(10) unsigned NOT NULL,"
+ "`stop_found` int(10) unsigned NOT NULL,"
+ "`strict_kademlia` int(10) unsigned NOT NULL,"
+ "`gets_succeeded` int(10) unsigned NOT NULL,"
+ "PRIMARY KEY (`trialuid`),"
+ "UNIQUE KEY `trialuid` (`trialuid`)"
+ ") ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"))
return GNUNET_SYSERR;
if (MRUNS ("CREATE TABLE IF NOT EXISTS `topology` ("
rbind[0].buffer = dhtkeyuid;
GNUNET_CRYPTO_hash_to_enc (key, &encKey);
k_len = strlen ((char *) &encKey);
-
+#if DEBUG_DHTLOG
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Searching for dhtkey `%s' in trial %llu\n", GNUNET_h2s(key), current_trial);
+#endif
if ((GNUNET_OK !=
prepared_statement_run_select (get_dhtkeyuid,
1,
* Inserts the specified trial into the dhttests.trials table
*
* @param trialuid return the trialuid of the newly inserted trial
+ * @param other_identifier identifier for the trial from another source
+ * (for joining later)
* @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
*
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned int topology,
+int add_trial (unsigned long long *trialuid, unsigned int other_identifier, 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,
stmt = mysql_stmt_init(conn);
if (GNUNET_OK !=
(ret = prepared_statement_run (insert_trial, trialuid,
+ MYSQL_TYPE_LONG, &other_identifier, GNUNET_YES,
MYSQL_TYPE_LONG, &num_nodes, GNUNET_YES,
MYSQL_TYPE_LONG, &topology, GNUNET_YES,
MYSQL_TYPE_FLOAT, &topology_percentage,
return GNUNET_OK;
}
else if (ret == GNUNET_SYSERR)
- return GNUNET_SYSERR;
+ {
+#if DEBUG_DHTLOG
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Failed to get dhtkeyuid!\n");
+#endif
+ }
if (GNUNET_OK !=
(ret = prepared_statement_run (insert_dhtkey,
#define SET_MALICIOUS_STMT "prepare set_malicious from 'update nodes set malicious_dropper = 1 where trialuid = @temp_trial and nodeid = @temp_node'"
#define INSERT_TRIALS_STMT "prepare insert_trial from 'INSERT INTO trials"\
- "(starttime, numnodes, topology,"\
+ "(starttime, other_trial_identifier, numnodes, topology,"\
"topology_percentage, topology_probability,"\
"blacklist_topology, connect_topology, connect_topology_option,"\
"connect_topology_option_modifier, puts, gets, "\
"malicious_putters, malicious_droppers, malicious_get_frequency,"\
"malicious_put_frequency, stop_closest, stop_found, strict_kademlia, "\
"gets_succeeded, message) "\
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'"
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'"
#define INSERT_GENERIC_STAT_STMT "prepare insert_generic_stat from 'INSERT INTO generic_stats" \
"(trialuid, nodeuid, section, name, value)"\
* Inserts the specified trial into the dhttests.trials table
*
* @param trialuid return the trialuid of the newly inserted trial
+ * @param other_identifier identifier for the trial from another source
+ * (for joining later)
* @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
*
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned int topology,
+int add_trial (unsigned long long *trialuid, unsigned int other_identifier, 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,
if (outfile == NULL)
return GNUNET_SYSERR;
- ret = fprintf(outfile, "set @date = \"%s\", @num = %u, @topology = %u, @bl = %u, "
+ ret = fprintf(outfile, "set @date = \"%s\", @oid = %u, @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,
+ get_sql_time(), other_identifier, num_nodes, topology,
blacklist_topology, connect_topology,
connect_topology_option, connect_topology_option_modifier,
topology_percentage, topology_probability,
if (ret < 0)
return GNUNET_SYSERR;
ret = fprintf(outfile, "execute insert_trial using "
- "@date, @num, @topology, @t_p, @t_pr,"
+ "@date, @oid, @num, @topology, @t_p, @t_pr,"
" @bl, @connect, @c_t_o,"
"@c_t_o_m, @puts, @gets,"
"@concurrent, @settle, @rounds,"
* Inserts the specified trial into the dhttests.trials table
*
* @param trialuid return the trialuid of the newly inserted trial
+ * @param other_identifier identifier for the trial from another source
+ * (for joining later)
* @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
*
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned int topology,
+int add_trial (unsigned long long *trialuid, unsigned int other_identifier, 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,
return GNUNET_SYSERR;
ret = fprintf(outfile, "INSERT INTO trials "
- "(starttime, numnodes, topology,"
+ "(starttime, other_trial_identifier, numnodes, topology,"
"blacklist_topology, connect_topology, connect_topology_option,"
"connect_topology_option_modifier, topology_percentage, topology_probability,"
"puts, gets, "
"malicious_putters, malicious_droppers, malicious_get_frequency,"
"malicious_put_frequency, stop_closest, stop_found, strict_kademlia, "
"gets_succeeded, message) "
- "VALUES (\"%s\", %u, %u, %u, %u, %u, %f, %f, %f, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, \"%s\");\n",
- get_sql_time(), num_nodes, topology,
+ "VALUES (\"%s\", %u, %u, %u, %u, %u, %u, %f, %f, %f, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, \"%s\");\n",
+ get_sql_time(), other_identifier, num_nodes, topology,
blacklist_topology, connect_topology,
connect_topology_option, connect_topology_option_modifier,
topology_percentage, topology_probability,