aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-05-03 11:55:52 +0000
committerBart Polot <bart@net.in.tum.de>2013-05-03 11:55:52 +0000
commitdd9093f1dd38e7e140ad8f7f85af60c139f32834 (patch)
treefa64f0a1e33323815341fe9f72479574e7f7260b /src
parent9f344d13ecaade85c52c9ba79dbbe7cc11bb7d17 (diff)
downloadgnunet-dd9093f1dd38e7e140ad8f7f85af60c139f32834.tar.gz
gnunet-dd9093f1dd38e7e140ad8f7f85af60c139f32834.zip
- update service new to ecc
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh-new.c153
1 files changed, 70 insertions, 83 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c
index 5dc9ff2fd..5b7e9991f 100644
--- a/src/mesh/gnunet-service-mesh-new.c
+++ b/src/mesh/gnunet-service-mesh-new.c
@@ -56,6 +56,7 @@
56 56
57#define MESH_BLOOM_SIZE 128 57#define MESH_BLOOM_SIZE 128
58 58
59#define MESH_DEBUG_REGEX GNUNET_YES
59#define MESH_DEBUG_DHT GNUNET_NO 60#define MESH_DEBUG_DHT GNUNET_NO
60#define MESH_DEBUG_CONNECTION GNUNET_NO 61#define MESH_DEBUG_CONNECTION GNUNET_NO
61#define MESH_DEBUG_TIMING __LINUX__ && GNUNET_NO 62#define MESH_DEBUG_TIMING __LINUX__ && GNUNET_NO
@@ -76,6 +77,12 @@
76#define DEBUG_DHT(...) 77#define DEBUG_DHT(...)
77#endif 78#endif
78 79
80#if MESH_DEBUG_REGEX
81#define DEBUG_REGEX(...) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
82#else
83#define DEBUG_REGEX(...)
84#endif
85
79#if MESH_DEBUG_TIMING 86#if MESH_DEBUG_TIMING
80#include <time.h> 87#include <time.h>
81double __sum; 88double __sum;
@@ -433,10 +440,10 @@ struct MeshTunnel
433 */ 440 */
434 uint32_t last_fwd_ack; 441 uint32_t last_fwd_ack;
435 442
436 /** 443 /**
437 * BCK ACK value received from the hop towards the owner of the tunnel, 444 * BCK ACK value received from the hop towards the owner of the tunnel,
438 * (previous node / owner): up to what message PID can we sent back to him. 445 * (previous node / owner): up to what message PID can we sent back to him.
439 */ 446 */
440 uint32_t bck_ack; 447 uint32_t bck_ack;
441 448
442 /** 449 /**
@@ -481,11 +488,6 @@ struct MeshTunnel
481 unsigned int peers_ready; 488 unsigned int peers_ready;
482 489
483 /** 490 /**
484 * Number of peers that have been added to the tunnel
485 */
486 unsigned int peers_total;
487
488 /**
489 * Client owner of the tunnel, if any 491 * Client owner of the tunnel, if any
490 */ 492 */
491 struct MeshClient *owner; 493 struct MeshClient *owner;
@@ -764,7 +766,7 @@ struct MeshClient
764 struct GNUNET_SERVER_Client *handle; 766 struct GNUNET_SERVER_Client *handle;
765 767
766 /** 768 /**
767 * Applications that this client has claimed to provide 769 * Applications that this client has claimed to provide: H(app) = app.
768 */ 770 */
769 struct GNUNET_CONTAINER_MultiHashMap *apps; 771 struct GNUNET_CONTAINER_MultiHashMap *apps;
770 772
@@ -896,7 +898,7 @@ static unsigned long long max_peers;
896/** 898/**
897 * Hostkey generation context 899 * Hostkey generation context
898 */ 900 */
899static struct GNUNET_CRYPTO_RsaKeyGenerationContext *keygen; 901static struct GNUNET_CRYPTO_EccKeyGenerationContext *keygen;
900 902
901/** 903/**
902 * DLL with all the clients, head. 904 * DLL with all the clients, head.
@@ -972,12 +974,12 @@ static struct GNUNET_PeerIdentity my_full_id;
972/** 974/**
973 * Own private key. 975 * Own private key.
974 */ 976 */
975static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key; 977static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
976 978
977/** 979/**
978 * Own public key. 980 * Own public key.
979 */ 981 */
980static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded my_public_key; 982static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded my_public_key;
981 983
982/** 984/**
983 * Tunnel ID for the next created tunnel (global tunnel number). 985 * Tunnel ID for the next created tunnel (global tunnel number).
@@ -990,7 +992,7 @@ static MESH_TunnelNumber next_tid;
990static MESH_TunnelNumber next_local_tid; 992static MESH_TunnelNumber next_local_tid;
991 993
992/** 994/**
993 * All application types provided by this peer. 995 * All application types provided by this peer: H(app) = *Client.
994 */ 996 */
995static struct GNUNET_CONTAINER_MultiHashMap *applications; 997static struct GNUNET_CONTAINER_MultiHashMap *applications;
996 998
@@ -1255,6 +1257,7 @@ queue_send (void *cls, size_t size, void *buf);
1255static void 1257static void
1256regex_cancel_search (struct MeshRegexSearchInfo *regex_search) 1258regex_cancel_search (struct MeshRegexSearchInfo *regex_search)
1257{ 1259{
1260 DEBUG_REGEX ("Search for %s canelled.\n", regex_search->description);
1258 GNUNET_REGEX_search_cancel (regex_search->search_handle); 1261 GNUNET_REGEX_search_cancel (regex_search->search_handle);
1259 if (0 < regex_search->n_peers) 1262 if (0 < regex_search->n_peers)
1260 GNUNET_free (regex_search->peers); 1263 GNUNET_free (regex_search->peers);
@@ -1282,16 +1285,16 @@ regex_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1282 GNUNET_PEER_Id id; 1285 GNUNET_PEER_Id id;
1283 GNUNET_PEER_Id old; 1286 GNUNET_PEER_Id old;
1284 1287
1285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Regex connect timeout\n"); 1288 DEBUG_REGEX ("Regex connect timeout\n");
1286 info->timeout = GNUNET_SCHEDULER_NO_TASK; 1289 info->timeout = GNUNET_SCHEDULER_NO_TASK;
1287 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1290 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1288 { 1291 {
1289 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " due to shutdown\n"); 1292 DEBUG_REGEX (" due to shutdown\n");
1290 return; 1293 return;
1291 } 1294 }
1292 1295
1293 old = info->peer; 1296 old = info->peer;
1294 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " timed out: %u\n", old); 1297 DEBUG_REGEX (" timed out: %u\n", old);
1295 1298
1296 if (0 < info->n_peers) 1299 if (0 < info->n_peers)
1297 { 1300 {
@@ -1305,7 +1308,7 @@ regex_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1305 // Try to connect to same peer again. 1308 // Try to connect to same peer again.
1306 id = info->peer; 1309 id = info->peer;
1307 } 1310 }
1308 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " trying: %u\n", id); 1311 DEBUG_REGEX (" trying: %u\n", id);
1309 1312
1310 peer_info = peer_info_get_short(id); 1313 peer_info = peer_info_get_short(id);
1311 tunnel_add_peer (info->t, peer_info); 1314 tunnel_add_peer (info->t, peer_info);
@@ -1315,7 +1318,7 @@ regex_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1315 info->timeout = GNUNET_SCHEDULER_add_delayed (connect_timeout, 1318 info->timeout = GNUNET_SCHEDULER_add_delayed (connect_timeout,
1316 &regex_connect_timeout, 1319 &regex_connect_timeout,
1317 info); 1320 info);
1318 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Regex connect timeout END\n"); 1321 DEBUG_REGEX ("Regex connect timeout END\n");
1319} 1322}
1320 1323
1321 1324
@@ -1342,8 +1345,8 @@ regex_found_handler (void *cls,
1342 struct MeshPeerPath *p; 1345 struct MeshPeerPath *p;
1343 struct MeshPeerInfo *peer_info; 1346 struct MeshPeerInfo *peer_info;
1344 1347
1345 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got regex results from DHT!\n"); 1348 DEBUG_REGEX ("Got regex results from DHT!\n");
1346 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " for %s\n", info->description); 1349 DEBUG_REGEX (" for %s\n", info->description);
1347 1350
1348 peer_info = peer_info_get (id); 1351 peer_info = peer_info_get (id);
1349 p = path_build_from_dht (get_path, get_path_length, 1352 p = path_build_from_dht (get_path, get_path_length,
@@ -1381,10 +1384,10 @@ regex_found_handler (void *cls,
1381static void 1384static void
1382regex_put (struct MeshRegexDescriptor *regex) 1385regex_put (struct MeshRegexDescriptor *regex)
1383{ 1386{
1384 DEBUG_DHT (" regex_put (%s) start\n", regex->regex); 1387 DEBUG_REGEX (" regex_put (%s) start\n", regex->regex);
1385 if (NULL == regex->h) 1388 if (NULL == regex->h)
1386 { 1389 {
1387 DEBUG_DHT (" first put, creating DFA\n"); 1390 DEBUG_REGEX (" first put, creating DFA\n");
1388 regex->h = GNUNET_REGEX_announce (dht_handle, 1391 regex->h = GNUNET_REGEX_announce (dht_handle,
1389 &my_full_id, 1392 &my_full_id,
1390 regex->regex, 1393 regex->regex,
@@ -1393,10 +1396,10 @@ regex_put (struct MeshRegexDescriptor *regex)
1393 } 1396 }
1394 else 1397 else
1395 { 1398 {
1396 DEBUG_DHT (" not first put, using cached data\n"); 1399 DEBUG_REGEX (" not first put, using cached data\n");
1397 GNUNET_REGEX_reannounce (regex->h); 1400 GNUNET_REGEX_reannounce (regex->h);
1398 } 1401 }
1399 DEBUG_DHT (" regex_put (%s) end\n", regex->regex); 1402 DEBUG_REGEX (" regex_put (%s) end\n", regex->regex);
1400} 1403}
1401 1404
1402 1405
@@ -1416,13 +1419,13 @@ regex_announce (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1416 c->regex_announce_task = GNUNET_SCHEDULER_NO_TASK; 1419 c->regex_announce_task = GNUNET_SCHEDULER_NO_TASK;
1417 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1420 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1418 return; 1421 return;
1419 DEBUG_DHT ("Starting PUT for regex\n"); 1422 DEBUG_REGEX ("Starting announce for regex\n");
1420 for (i = 0; i < c->n_regex; i++) 1423 for (i = 0; i < c->n_regex; i++)
1421 regex_put (&c->regexes[i]); 1424 regex_put (&c->regexes[i]);
1422 c->regex_announce_task = GNUNET_SCHEDULER_add_delayed (app_announce_time, 1425 c->regex_announce_task = GNUNET_SCHEDULER_add_delayed (app_announce_time,
1423 &regex_announce, 1426 &regex_announce,
1424 cls); 1427 cls);
1425 DEBUG_DHT ("Finished PUT for regex\n"); 1428 DEBUG_REGEX ("Finished announce for regex\n");
1426} 1429}
1427 1430
1428 1431
@@ -1456,17 +1459,17 @@ announce_application (void *cls, const struct GNUNET_HashCode * key, void *value
1456 return GNUNET_YES; 1459 return GNUNET_YES;
1457 } 1460 }
1458 block.type = htonl (block.type); 1461 block.type = htonl (block.type);
1459 1462 DEBUG_DHT ("Putting APP key: %s\n", GNUNET_h2s (key));
1460 GNUNET_break (NULL != 1463 GNUNET_break (NULL !=
1461 GNUNET_DHT_put (dht_handle, key, 1464 GNUNET_DHT_put (dht_handle, key,
1462 dht_replication_level, 1465 dht_replication_level,
1463 GNUNET_DHT_RO_RECORD_ROUTE | 1466 GNUNET_DHT_RO_RECORD_ROUTE |
1464 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, 1467 GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
1465 GNUNET_BLOCK_TYPE_MESH_PEER_BY_TYPE, 1468 GNUNET_BLOCK_TYPE_MESH_PEER_BY_TYPE,
1466 sizeof (block), 1469 sizeof (block),
1467 (const char *) &block, 1470 (const char *) &block,
1468 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS), /* FIXME: this should be an option */ 1471 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS), /* FIXME: this should be an option */
1469 app_announce_time, NULL, NULL)); 1472 app_announce_time, NULL, NULL));
1470 return GNUNET_OK; 1473 return GNUNET_OK;
1471} 1474}
1472 1475
@@ -2023,7 +2026,9 @@ peer_info_delete_tunnel (void *cls, const struct GNUNET_HashCode * key, void *va
2023 { 2026 {
2024 peer->ntunnels--; 2027 peer->ntunnels--;
2025 peer->tunnels[i] = peer->tunnels[peer->ntunnels]; 2028 peer->tunnels[i] = peer->tunnels[peer->ntunnels];
2026 peer->tunnels = GNUNET_realloc (peer->tunnels, peer->ntunnels); 2029 peer->tunnels =
2030 GNUNET_realloc (peer->tunnels,
2031 peer->ntunnels * sizeof(struct MeshTunnel *));
2027 return GNUNET_YES; 2032 return GNUNET_YES;
2028 } 2033 }
2029 } 2034 }
@@ -3027,7 +3032,6 @@ tunnel_add_peer (struct MeshTunnel *t, struct MeshPeerInfo *peer)
3027 if (GNUNET_NO == 3032 if (GNUNET_NO ==
3028 GNUNET_CONTAINER_multihashmap_contains (t->peers, &id.hashPubKey)) 3033 GNUNET_CONTAINER_multihashmap_contains (t->peers, &id.hashPubKey))
3029 { 3034 {
3030 t->peers_total++;
3031 GNUNET_array_append (peer->tunnels, peer->ntunnels, t); 3035 GNUNET_array_append (peer->tunnels, peer->ntunnels, t);
3032 GNUNET_assert (GNUNET_OK == 3036 GNUNET_assert (GNUNET_OK ==
3033 GNUNET_CONTAINER_multihashmap_put (t->peers, &id.hashPubKey, 3037 GNUNET_CONTAINER_multihashmap_put (t->peers, &id.hashPubKey,
@@ -5941,6 +5945,11 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
5941 tree_set_status (t->tree, peer_info->id, MESH_PEER_READY); 5945 tree_set_status (t->tree, peer_info->id, MESH_PEER_READY);
5942 send_client_peer_connected (t, peer_info->id); 5946 send_client_peer_connected (t, peer_info->id);
5943 } 5947 }
5948 if (NULL != peer_info->dhtget)
5949 {
5950 GNUNET_DHT_get_stop (peer_info->dhtget);
5951 peer_info->dhtget = NULL;
5952 }
5944 return GNUNET_OK; 5953 return GNUNET_OK;
5945 } 5954 }
5946 5955
@@ -5948,12 +5957,6 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
5948 " not for us, retransmitting...\n"); 5957 " not for us, retransmitting...\n");
5949 GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &id); 5958 GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &id);
5950 peer_info = peer_info_get (&msg->oid); 5959 peer_info = peer_info_get (&msg->oid);
5951 if (NULL == peer_info)
5952 {
5953 /* If we know the tunnel, we should DEFINITELY know the peer */
5954 GNUNET_break (0);
5955 return GNUNET_OK;
5956 }
5957 send_prebuilt_message (message, &id, t); 5960 send_prebuilt_message (message, &id, t);
5958 return GNUNET_OK; 5961 return GNUNET_OK;
5959} 5962}
@@ -6042,9 +6045,10 @@ static struct GNUNET_CORE_MessageHandler core_handlers[] = {
6042static int 6045static int
6043deregister_app (void *cls, const struct GNUNET_HashCode * key, void *value) 6046deregister_app (void *cls, const struct GNUNET_HashCode * key, void *value)
6044{ 6047{
6045 struct GNUNET_CONTAINER_MultiHashMap *h = cls; 6048 struct MeshClient *c = cls;
6049
6046 GNUNET_break (GNUNET_YES == 6050 GNUNET_break (GNUNET_YES ==
6047 GNUNET_CONTAINER_multihashmap_remove (h, key, value)); 6051 GNUNET_CONTAINER_multihashmap_remove (applications, key, c));
6048 return GNUNET_OK; 6052 return GNUNET_OK;
6049} 6053}
6050 6054
@@ -6160,10 +6164,10 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
6160 GNUNET_PEER_resolve (path_info->peer->id, &pi); 6164 GNUNET_PEER_resolve (path_info->peer->id, &pi);
6161 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " for %s\n", GNUNET_i2s (&pi)); 6165 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " for %s\n", GNUNET_i2s (&pi));
6162 6166
6163 p = path_build_from_dht (get_path, get_path_length, put_path, 6167 p = path_build_from_dht (get_path, get_path_length,
6164 put_path_length); 6168 put_path, put_path_length);
6165 path_add_to_peers (p, GNUNET_NO); 6169 path_add_to_peers (p, GNUNET_NO);
6166 path_destroy(p); 6170 path_destroy (p);
6167 for (i = 0; i < path_info->peer->ntunnels; i++) 6171 for (i = 0; i < path_info->peer->ntunnels; i++)
6168 { 6172 {
6169 tunnel_add_peer (path_info->peer->tunnels[i], path_info->peer); 6173 tunnel_add_peer (path_info->peer->tunnels[i], path_info->peer);
@@ -6285,7 +6289,7 @@ handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
6285 /* deregister clients applications */ 6289 /* deregister clients applications */
6286 if (NULL != c->apps) 6290 if (NULL != c->apps)
6287 { 6291 {
6288 GNUNET_CONTAINER_multihashmap_iterate (c->apps, &deregister_app, c->apps); 6292 GNUNET_CONTAINER_multihashmap_iterate (c->apps, &deregister_app, c);
6289 GNUNET_CONTAINER_multihashmap_destroy (c->apps); 6293 GNUNET_CONTAINER_multihashmap_destroy (c->apps);
6290 } 6294 }
6291 if (0 == GNUNET_CONTAINER_multihashmap_size (applications) && 6295 if (0 == GNUNET_CONTAINER_multihashmap_size (applications) &&
@@ -6300,7 +6304,7 @@ handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
6300 { 6304 {
6301 GNUNET_free (c->regexes[i].regex); 6305 GNUNET_free (c->regexes[i].regex);
6302 if (NULL != c->regexes[i].h) 6306 if (NULL != c->regexes[i].h)
6303 GNUNET_REGEX_announce_cancel (c->regexes[i].h); 6307 GNUNET_REGEX_announce_cancel (c->regexes[i].h);
6304 } 6308 }
6305 GNUNET_free_non_null (c->regexes); 6309 GNUNET_free_non_null (c->regexes);
6306 if (GNUNET_SCHEDULER_NO_TASK != c->regex_announce_task) 6310 if (GNUNET_SCHEDULER_NO_TASK != c->regex_announce_task)
@@ -6480,16 +6484,16 @@ handle_local_announce_regex (void *cls, struct GNUNET_SERVER_Client *client,
6480 rd.h = NULL; 6484 rd.h = NULL;
6481 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " length %u\n", len); 6485 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " length %u\n", len);
6482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " regex %s\n", regex); 6486 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " regex %s\n", regex);
6483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " cm %u\n", ntohs(rd.compression)); 6487 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " compr %u\n", ntohs (rd.compression));
6484 GNUNET_array_append (c->regexes, c->n_regex, rd); 6488 GNUNET_array_append (c->regexes, c->n_regex, rd);
6485 c->partial_regex = NULL; 6489 c->partial_regex = NULL;
6486 if (GNUNET_SCHEDULER_NO_TASK == c->regex_announce_task) 6490 if (GNUNET_SCHEDULER_NO_TASK == c->regex_announce_task)
6487 { 6491 {
6488 c->regex_announce_task = GNUNET_SCHEDULER_add_now(&regex_announce, c); 6492 c->regex_announce_task = GNUNET_SCHEDULER_add_now (&regex_announce, c);
6489 } 6493 }
6490 else 6494 else
6491 { 6495 {
6492 regex_put(&rd); 6496 regex_put (&rd);
6493 } 6497 }
6494 GNUNET_SERVER_receive_done (client, GNUNET_OK); 6498 GNUNET_SERVER_receive_done (client, GNUNET_OK);
6495 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "announce regex processed\n"); 6499 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "announce regex processed\n");
@@ -7143,7 +7147,6 @@ handle_local_connect_by_string (void *cls, struct GNUNET_SERVER_Client *client,
7143{ 7147{
7144 struct GNUNET_MESH_ConnectPeerByString *msg; 7148 struct GNUNET_MESH_ConnectPeerByString *msg;
7145 struct MeshRegexSearchInfo *info; 7149 struct MeshRegexSearchInfo *info;
7146 struct GNUNET_HashCode key;
7147 struct MeshTunnel *t; 7150 struct MeshTunnel *t;
7148 struct MeshClient *c; 7151 struct MeshClient *c;
7149 MESH_TunnelNumber tid; 7152 MESH_TunnelNumber tid;
@@ -7209,13 +7212,6 @@ handle_local_connect_by_string (void *cls, struct GNUNET_SERVER_Client *client,
7209 len = size - sizeof(struct GNUNET_MESH_ConnectPeerByString); 7212 len = size - sizeof(struct GNUNET_MESH_ConnectPeerByString);
7210 string = (const char *) &msg[1]; 7213 string = (const char *) &msg[1];
7211 7214
7212 /* Initialize context */
7213 size = GNUNET_REGEX_get_first_key (string, len, &key);
7214 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7215 " consumed %u bits out of %u\n", size, len);
7216 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7217 " looking for %s\n", GNUNET_h2s (&key));
7218
7219 info = GNUNET_malloc (sizeof (struct MeshRegexSearchInfo)); 7215 info = GNUNET_malloc (sizeof (struct MeshRegexSearchInfo));
7220 info->t = t; 7216 info->t = t;
7221 info->description = GNUNET_strndup (string, len); 7217 info->description = GNUNET_strndup (string, len);
@@ -7439,7 +7435,6 @@ handle_local_to_origin (void *cls, struct GNUNET_SERVER_Client *client,
7439 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 7435 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7440 " calling generic handler...\n"); 7436 " calling generic handler...\n");
7441 handle_mesh_data_to_orig (NULL, &my_full_id, &copy->header); 7437 handle_mesh_data_to_orig (NULL, &my_full_id, &copy->header);
7442
7443 } 7438 }
7444 GNUNET_SERVER_receive_done (client, GNUNET_OK); 7439 GNUNET_SERVER_receive_done (client, GNUNET_OK);
7445 7440
@@ -7871,8 +7866,7 @@ handle_local_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
7871 *resp = *msg; 7866 *resp = *msg;
7872 resp->npeers = 0; 7867 resp->npeers = 0;
7873 ctx.msg = resp; 7868 ctx.msg = resp;
7874 ctx.lookup = GNUNET_CONTAINER_multihashmap_create (4 * t->peers_total, 7869 ctx.lookup = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES);
7875 GNUNET_YES);
7876 ctx.c = c; 7870 ctx.c = c;
7877 7871
7878 /* Collect and send information */ 7872 /* Collect and send information */
@@ -8133,7 +8127,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
8133 } 8127 }
8134 if (NULL != keygen) 8128 if (NULL != keygen)
8135 { 8129 {
8136 GNUNET_CRYPTO_rsa_key_create_stop (keygen); 8130 GNUNET_CRYPTO_ecc_key_create_stop (keygen);
8137 keygen = NULL; 8131 keygen = NULL;
8138 } 8132 }
8139 GNUNET_CONTAINER_multihashmap_iterate (tunnels, &shutdown_tunnel, NULL); 8133 GNUNET_CONTAINER_multihashmap_iterate (tunnels, &shutdown_tunnel, NULL);
@@ -8163,15 +8157,15 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
8163 8157
8164 8158
8165/** 8159/**
8166 * Callback for hostkey read/generation 8160 * Callback for hostkey read/generation.
8167 * 8161 *
8168 * @param cls Closure (Configuration handle). 8162 * @param cls Closure (Configuration handle).
8169 * @param pk the private key 8163 * @param pk The ECC private key.
8170 * @param emsg error message 8164 * @param emsg Error message, if any.
8171 */ 8165 */
8172static void 8166static void
8173key_generation_cb (void *cls, 8167key_generation_cb (void *cls,
8174 struct GNUNET_CRYPTO_RsaPrivateKey *pk, 8168 struct GNUNET_CRYPTO_EccPrivateKey *pk,
8175 const char *emsg) 8169 const char *emsg)
8176{ 8170{
8177 const struct GNUNET_CONFIGURATION_Handle *c = cls; 8171 const struct GNUNET_CONFIGURATION_Handle *c = cls;
@@ -8188,7 +8182,7 @@ key_generation_cb (void *cls,
8188 return; 8182 return;
8189 } 8183 }
8190 my_private_key = pk; 8184 my_private_key = pk;
8191 GNUNET_CRYPTO_rsa_key_get_public (my_private_key, &my_public_key); 8185 GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key);
8192 GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), 8186 GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
8193 &my_full_id.hashPubKey); 8187 &my_full_id.hashPubKey);
8194 myid = GNUNET_PEER_intern (&my_full_id); 8188 myid = GNUNET_PEER_intern (&my_full_id);
@@ -8196,13 +8190,6 @@ key_generation_cb (void *cls,
8196 "Mesh for peer [%s] starting\n", 8190 "Mesh for peer [%s] starting\n",
8197 GNUNET_i2s(&my_full_id)); 8191 GNUNET_i2s(&my_full_id));
8198 8192
8199// transport_handle = GNUNET_TRANSPORT_connect(c,
8200// &my_full_id,
8201// NULL,
8202// NULL,
8203// NULL,
8204// NULL);
8205
8206 core_handle = GNUNET_CORE_connect (c, /* Main configuration */ 8193 core_handle = GNUNET_CORE_connect (c, /* Main configuration */
8207 NULL, /* Closure passed to MESH functions */ 8194 NULL, /* Closure passed to MESH functions */
8208 &core_init, /* Call core_init once connected */ 8195 &core_init, /* Call core_init once connected */
@@ -8266,13 +8253,13 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
8266 server_handle = server; 8253 server_handle = server;
8267 8254
8268 if (GNUNET_OK != 8255 if (GNUNET_OK !=
8269 GNUNET_CONFIGURATION_get_value_filename (c, "GNUNETD", "HOSTKEY", 8256 GNUNET_CONFIGURATION_get_value_filename (c, "PEER", "PRIVATE_KEY",
8270 &keyfile)) 8257 &keyfile))
8271 { 8258 {
8272 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 8259 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
8273 _ 8260 _
8274 ("%s service is lacking key configuration settings (%s). Exiting.\n"), 8261 ("%s service is lacking key configuration settings (%s). Exiting.\n"),
8275 "mesh", "hostkey"); 8262 "mesh", "peer/privatekey");
8276 GNUNET_SCHEDULER_shutdown (); 8263 GNUNET_SCHEDULER_shutdown ();
8277 return; 8264 return;
8278 } 8265 }
@@ -8301,8 +8288,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
8301 return; 8288 return;
8302 } 8289 }
8303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 8290 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8304 "APP_ANNOUNCE_TIME %llu ms\n", 8291 "APP_ANNOUNCE_TIME %llu ms\n",
8305 app_announce_time.rel_value); 8292 app_announce_time.rel_value);
8306 if (GNUNET_OK != 8293 if (GNUNET_OK !=
8307 GNUNET_CONFIGURATION_get_value_time (c, "MESH", "ID_ANNOUNCE_TIME", 8294 GNUNET_CONFIGURATION_get_value_time (c, "MESH", "ID_ANNOUNCE_TIME",
8308 &id_announce_time)) 8295 &id_announce_time))
@@ -8400,7 +8387,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
8400 /* Scheduled the task to clean up when shutdown is called */ 8387 /* Scheduled the task to clean up when shutdown is called */
8401 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 8388 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
8402 NULL); 8389 NULL);
8403 keygen = GNUNET_CRYPTO_rsa_key_create_start (keyfile, 8390 keygen = GNUNET_CRYPTO_ecc_key_create_start (keyfile,
8404 &key_generation_cb, 8391 &key_generation_cb,
8405 (void *) c); 8392 (void *) c);
8406 GNUNET_free (keyfile); 8393 GNUNET_free (keyfile);