*/
struct GNUNET_STATISTICS_Handle *stats;
-/*************************** Static global variables **************************/
-
/**
* Local peer own ID (memory efficient handle).
*/
-static GNUNET_PEER_Id myid;
+GNUNET_PEER_Id myid;
/**
* Local peer own ID (full value).
*/
-static struct GNUNET_PeerIdentity my_full_id;
+struct GNUNET_PeerIdentity my_full_id;
+
+/*************************** Static global variables **************************/
/**
* Own private key.
*/
extern struct GNUNET_STATISTICS_Handle *stats;
+/**
+ * Local peer own ID (memory efficient handle).
+ */
+extern GNUNET_PEER_Id myid;
+
/**
* Connections known, indexed by cid (MeshConnection).
*/
if (path->peers[i] == my_short_id)
own_pos = i;
}
- if (own_pos == 0 && path->peers[own_pos] != myid)
+ if (own_pos == 0 && path->peers[own_pos] != my_short_id)
{
/* create path: self not found in path through self */
GNUNET_break_op (0);
return GNUNET_OK;
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
- path_add_to_peers (path, GNUNET_NO);
+ GMP_add_path_to_all (path, GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n");
c = GMC_new (cid, NULL, path_duplicate (path), own_pos);
if (NULL == c)
*/
extern struct GNUNET_STATISTICS_Handle *stats;
+/**
+ * Own ID (short value).
+ */
+extern GNUNET_PEER_Id myid;
+
+/**
+ * Own ID (full value).
+ */
+extern struct GNUNET_PeerIdentity my_full_id;
+
/**
* Handle to use DHT.
*/
*/
static GNUNET_SCHEDULER_TaskIdentifier announce_id_task;
-/**
- * Own ID (short value).
- */
-static GNUNET_PEER_Id short_id;
-
-/**
- * Own ID (full value).
- */
-static struct GNUNET_PeerIdentity *full_id;
-
/**
* Own private key.
*/
* - Set data expiration in function of X
* - Adapt X to churn
*/
- block.id = *full_id;
- GNUNET_CRYPTO_hash (full_id, sizeof (struct GNUNET_PeerIdentity), &phash);
+ block.id = my_full_id;
+ GNUNET_CRYPTO_hash (&my_full_id, sizeof (struct GNUNET_PeerIdentity), &phash);
GNUNET_DHT_put (dht_handle, /* DHT handle */
&phash, /* Key to use */
dht_replication_level, /* Replication level */
* @param peer_id Local peer ID (must remain valid during all execution time).
*/
void
-GMD_init (const struct GNUNET_CONFIGURATION_Handle *c,
- struct GNUNET_PeerIdentity *peer_id)
+GMD_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
- full_id = peer_id;
+
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DHT_REPLICATION_LEVEL",
&dht_replication_level))
{
- LOG_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
"MESH", "DHT_REPLICATION_LEVEL", "USING DEFAULT");
dht_replication_level = 3;
}
GNUNET_CONFIGURATION_get_value_time (c, "MESH", "ID_ANNOUNCE_TIME",
&id_announce_time))
{
- LOG_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"MESH", "ID_ANNOUNCE_TIME", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
*/
extern struct GNUNET_STATISTICS_Handle *stats;
+/**
+ * Local peer own ID (full value).
+ */
+extern struct GNUNET_PeerIdentity my_full_id;
+
+/**
+ * Local peer own ID (short)
+ */
+extern GNUNET_PEER_Id myid;
+
/**
* Peers known, indexed by PeerIdentity (MeshPeer).
*/
*/
static struct GNUNET_CORE_Handle *core_handle;
-/**
- * Local peer own ID (full value).
- */
-const static struct GNUNET_PeerIdentity *my_full_id;
-
-/**
- * Local peer own ID (short)
- */
-static GNUNET_PEER_Id my_short_id;
/******************************************************************************/
/***************************** CORE CALLBACKS *********************************/
struct MeshPeer *peer = cls;
struct MeshConnection *c = value;
- GMC_notify_broken (c, peer, my_full_id);
+ GMC_notify_broken (c, peer, &my_full_id);
return GNUNET_YES;
}
* @param id Peer identity
*/
void
-GMP_init (const struct GNUNET_CONFIGURATION_Handle *c,
- const struct GNUNET_PeerIdentity *id)
+GMP_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
- my_full_id = id;
- my_short_id = GNUNET_PEER_intern (id);
-
peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_PEERS",
&max_peers))
{
- LOG_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
"MESH", "MAX_PEERS", "USING DEFAULT");
max_peers = 1000;
}
GNUNET_CORE_disconnect (core_handle);
core_handle = NULL;
}
- GNUNET_PEER_change_rc (my_short_id, -1);
+ GNUNET_PEER_change_rc (myid, -1);
}
unsigned int i;
/* TODO: invert and add */
- for (i = 0; i < p->length && p->peers[i] != my_short_id; i++) /* skip'em */ ;
+ for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ;
for (i++; i < p->length; i++)
{
struct MeshPeer *aux;