[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29771 - gnunet/src/experimentation
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29771 - gnunet/src/experimentation |
Date: |
Tue, 1 Oct 2013 20:21:54 +0200 |
Author: grothoff
Date: 2013-10-01 20:21:54 +0200 (Tue, 01 Oct 2013)
New Revision: 29771
Modified:
gnunet/src/experimentation/gnunet-daemon-experimentation.h
gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
gnunet/src/experimentation/gnunet-daemon-experimentation_storage.c
Log:
-fix experimentation ftbfs
Modified: gnunet/src/experimentation/gnunet-daemon-experimentation.h
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation.h 2013-10-01
17:49:00 UTC (rev 29770)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation.h 2013-10-01
18:21:54 UTC (rev 29771)
@@ -174,6 +174,14 @@
struct NodeComCtx *e_req_head;
struct NodeComCtx *e_req_tail;
+
+ /**
+ * Array of issuers accepted by this neighbor.
+ */
+ struct GNUNET_CRYPTO_EccPublicSignKey *issuer_id;
+
+ unsigned int issuer_count;
+
};
Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
2013-10-01 17:49:00 UTC (rev 29770)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
2013-10-01 18:21:54 UTC (rev 29771)
@@ -105,11 +105,11 @@
* @return #GNUNET_YES or #GNUNET_NO
*/
int
-GED_experiments_issuer_accepted (struct GNUNET_PeerIdentity *issuer_id)
+GED_experiments_issuer_accepted (const struct GNUNET_CRYPTO_EccPublicSignKey
*issuer_id)
{
struct GNUNET_HashCode hash;
- GNUNET_CRYPTO_hash (issuer_id, sizeof (struct GNUNET_PeerIdentity), &hash);
+ GNUNET_CRYPTO_hash (issuer_id, sizeof (struct
GNUNET_CRYPTO_EccPublicSignKey), &hash);
if (GNUNET_CONTAINER_multihashmap_contains (valid_issuers, &hash))
return GNUNET_YES;
return GNUNET_NO;
@@ -121,14 +121,14 @@
* experiment map.
*/
static void
-get_experment_key (const struct GNUNET_PeerIdentity *issuer,
- const char *name,
- const struct GNUNET_TIME_Absolute version,
- struct GNUNET_HashCode *key)
+get_experiment_key (const struct GNUNET_CRYPTO_EccPublicSignKey *issuer,
+ const char *name,
+ const struct GNUNET_TIME_Absolute version,
+ struct GNUNET_HashCode *key)
{
GNUNET_assert (GNUNET_YES ==
GNUNET_CRYPTO_kdf (key, sizeof (struct GNUNET_HashCode),
- issuer, sizeof (struct GNUNET_PeerIdentity),
+ issuer, sizeof (struct
GNUNET_CRYPTO_EccPublicSignKey),
name, strlen (name),
&version, sizeof (version),
NULL, 0));
@@ -144,11 +144,11 @@
* @return the experiment or NULL if not found
*/
struct Experiment *
-GED_experiments_find (const struct GNUNET_PeerIdentity *issuer,
+GED_experiments_find (const struct GNUNET_CRYPTO_EccPublicSignKey *issuer,
const char *name,
const struct GNUNET_TIME_Absolute version)
{
- struct GNUENT_HashCode hc;
+ struct GNUNET_HashCode hc;
get_experiment_key (issuer,
name,
@@ -177,10 +177,10 @@
struct GetCtx *get_ctx = cls;
struct Experiment *e = value;
- if (0 == memcmp (e->issuer,
+ if (0 == memcmp (&e->issuer,
get_ctx->issuer,
- sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))
- get_ctx->get_cb (get_ctx->n, e);
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)))
+ get_ctx->get_cb (get_ctx->n, e);
return GNUNET_OK;
}
@@ -210,7 +210,7 @@
int
GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i,
const char *name,
- const struct GNUNET_CRYPTO_EccPublicKey
*issuer_id,
+ const struct
GNUNET_CRYPTO_EccPublicSignKey *issuer_id,
struct GNUNET_TIME_Absolute version,
char *description,
uint32_t required_capabilities,
@@ -220,10 +220,11 @@
struct GNUNET_TIME_Absolute stop)
{
struct Experiment *e;
+ struct GNUNET_HashCode hc;
e = GNUNET_new (struct Experiment);
e->name = GNUNET_strdup (name);
- e->issuer = issuer_id;
+ e->issuer = *issuer_id;
e->version = version;
if (NULL != description)
e->description = GNUNET_strdup (description);
@@ -252,8 +253,12 @@
GNUNET_STRINGS_absolute_time_to_string (stop),
(long long unsigned int) frequency.rel_value_us / 1000000LL,
(long long unsigned int) duration.rel_value_us / 1000000LL);
+ get_experiment_key (&e->issuer,
+ name,
+ version,
+ &hc);
GNUNET_CONTAINER_multihashmap_put (experiments,
- &e->issuer.hashPubKey,
+ &hc,
e,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
GNUNET_STATISTICS_set (GED_stats,
@@ -279,7 +284,7 @@
char *val;
unsigned long long number;
/* Experiment values */
- struct GNUNET_PeerIdentity issuer;
+ struct GNUNET_CRYPTO_EccPublicSignKey issuer;
struct GNUNET_TIME_Absolute version;
char *description;
uint32_t required_capabilities;
@@ -287,6 +292,7 @@
struct GNUNET_TIME_Absolute stop;
struct GNUNET_TIME_Relative frequency;
struct GNUNET_TIME_Relative duration;
+ struct GNUNET_HashCode phash;
/* Mandatory fields */
@@ -297,14 +303,18 @@
_("Experiment `%s': Issuer missing\n"), name);
return;
}
- if (GNUNET_SYSERR == GNUNET_CRYPTO_hash_from_string (val,
&issuer.hashPubKey))
+ if (GNUNET_SYSERR ==
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (val,
+ strlen (val),
+ &issuer))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Experiment `%s': Issuer invalid\n"), name);
GNUNET_free (val);
return;
}
- if (NULL == (i = GNUNET_CONTAINER_multihashmap_get (valid_issuers,
&issuer.hashPubKey)))
+ GNUNET_CRYPTO_hash (&issuer, sizeof (issuer), &phash);
+ if (NULL == (i = GNUNET_CONTAINER_multihashmap_get (valid_issuers, &phash)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Experiment `%s': Issuer not accepted!\n"), name);
@@ -353,7 +363,7 @@
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name,
"STOP", (long long unsigned int *)&stop.abs_value_us))
stop = GNUNET_TIME_UNIT_FOREVER_ABS;
- GNUNET_EXPERIMENTATION_experiments_add (i, name, issuer, version,
+ GNUNET_EXPERIMENTATION_experiments_add (i, name, &issuer, version,
description, required_capabilities,
start, frequency, duration, stop);
GNUNET_free_non_null (description);
@@ -395,10 +405,8 @@
struct Issuer *i;
char *issuers;
char *file;
- char *pubkey;
char *pos;
- struct GNUNET_PeerIdentity issuer_ID;
- struct GNUNET_CRYPTO_EccPublicSignKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey issuer_ID;
struct GNUNET_HashCode hash;
/* Load valid issuer */
@@ -417,13 +425,13 @@
valid_issuers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
for (pos = strtok (issuers, " "); pos != NULL; pos = strtok (NULL, " "))
{
- if (GNUNET_SYSERR == GNUNET_CRYPTO_ecc_public_sign_key_from_string (pos,
+ if (GNUNET_SYSERR == GNUNET_CRYPTO_ecc_public_sign_key_from_string (pos,
strlen
(pos),
&issuer_ID))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"EXPERIMENTATION",
- "ISSUERS"
+ "ISSUERS",
_("Invalid value for public key\n"));
GED_experiments_stop ();
return GNUNET_SYSERR;
Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
2013-10-01 17:49:00 UTC (rev 29770)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
2013-10-01 18:21:54 UTC (rev 29771)
@@ -471,7 +471,8 @@
struct Node *n;
struct NodeComCtx *e_ctx;
const struct Experimentation_Request *rm = (const struct
Experimentation_Request *) message;
- const struct Experimentation_Issuer *rmi = (const struct
Experimentation_Issuer *) &rm[1];
+ const struct GNUNET_CRYPTO_EccPublicSignKey *rmi = (const struct
GNUNET_CRYPTO_EccPublicSignKey *) &rm[1];
+ unsigned int my_issuer_count = GNUNET_CONTAINER_multihashmap_size
(valid_issuers);
int c1;
int c2;
uint32_t ic;
@@ -484,7 +485,8 @@
return;
}
ic = ntohl (rm->issuer_count);
- if (ntohs (message->size) != sizeof (struct Experimentation_Request) + ic *
sizeof (struct Experimentation_Issuer))
+ if (ntohs (message->size) !=
+ sizeof (struct Experimentation_Request) + ic * sizeof (struct
GNUNET_CRYPTO_EccPublicSignKey))
{
GNUNET_break (0);
return;
@@ -528,20 +530,20 @@
ic_accepted = 0;
for (c1 = 0; c1 < ic; c1++)
{
- if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1].issuer_id))
+ if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1]))
ic_accepted ++;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Request from peer `%s' with %u issuers, we accepted %u issuer
\n",
GNUNET_i2s (peer), ic, ic_accepted);
GNUNET_free_non_null (n->issuer_id);
- n->issuer_id = GNUNET_malloc (ic_accepted * sizeof (struct
GNUNET_PeerIdentity));
+ n->issuer_id = GNUNET_malloc (ic_accepted * sizeof (struct
GNUNET_CRYPTO_EccPublicSignKey));
c2 = 0;
for (c1 = 0; c1 < ic; c1++)
{
- if (GNUNET_YES == GED_experiments_issuer_accepted (&rmi[c1].issuer_id))
+ if (GNUNET_YES == GED_experiments_issuer_accepted (&rmi[c1]))
{
- n->issuer_id[c2] = rmi[c1].issuer_id;
+ n->issuer_id[c2] = rmi[c1];
c2 ++;
}
}
@@ -554,7 +556,8 @@
e_ctx = GNUNET_new (struct NodeComCtx);
e_ctx->n = n;
e_ctx->e = NULL;
- e_ctx->size = sizeof (struct Experimentation_Response) + GSE_my_issuer_count
* sizeof (struct Experimentation_Issuer);
+ e_ctx->size = sizeof (struct Experimentation_Response) +
+ my_issuer_count * sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
e_ctx->notify = &send_response_cb;
e_ctx->notify_cls = n;
@@ -574,7 +577,7 @@
{
struct Node *n;
const struct Experimentation_Response *rm = (const struct
Experimentation_Response *) message;
- const struct Experimentation_Issuer *rmi = (const struct
Experimentation_Issuer *) &rm[1];
+ const struct GNUNET_CRYPTO_EccPublicSignKey *rmi = (const struct
GNUNET_CRYPTO_EccPublicSignKey *) &rm[1];
uint32_t ic;
uint32_t ic_accepted;
int make_active;
@@ -587,7 +590,7 @@
return;
}
ic = ntohl (rm->issuer_count);
- if (ntohs (message->size) != sizeof (struct Experimentation_Response) + ic *
sizeof (struct Experimentation_Issuer))
+ if (ntohs (message->size) != sizeof (struct Experimentation_Response) + ic *
sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))
{
GNUNET_break (0);
return;
@@ -636,7 +639,7 @@
ic_accepted = 0;
for (c1 = 0; c1 < ic; c1++)
{
- if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1].issuer_id))
+ if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1]))
ic_accepted ++;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -647,9 +650,9 @@
c2 = 0;
for (c1 = 0; c1 < ic; c1++)
{
- if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1].issuer_id))
+ if (GNUNET_YES == GED_experiments_issuer_accepted(&rmi[c1]))
{
- n->issuer_id[c2] = rmi[c1].issuer_id;
+ n->issuer_id[c2] = rmi[c1];
c2 ++;
}
}
Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_storage.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_storage.c
2013-10-01 17:49:00 UTC (rev 29770)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_storage.c
2013-10-01 18:21:54 UTC (rev 29771)
@@ -25,7 +25,6 @@
* @author Matthias Wachs
*/
#include "platform.h"
-#include "gnunet_getopt_lib.h"
#include "gnunet_util_lib.h"
#include "gnunet_core_service.h"
#include "gnunet_statistics_service.h"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29771 - gnunet/src/experimentation,
gnunet <=