aboutsummaryrefslogtreecommitdiff
path: root/src/exit
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-12 19:07:40 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-12 19:07:40 +0000
commit6c471eeb15e27f8226492b4860a3c2acb94c5f25 (patch)
treea3a9dcba12ee5356c03056c10b7aba5367b2ef34 /src/exit
parent16bcbbea7133fd2265d46bd2ae1dc70e8c9ba96f (diff)
downloadgnunet-6c471eeb15e27f8226492b4860a3c2acb94c5f25.tar.gz
gnunet-6c471eeb15e27f8226492b4860a3c2acb94c5f25.zip
-consistently use struct GNUNET_HashCode
Diffstat (limited to 'src/exit')
-rw-r--r--src/exit/exit.h6
-rw-r--r--src/exit/gnunet-daemon-exit.c34
2 files changed, 20 insertions, 20 deletions
diff --git a/src/exit/exit.h b/src/exit/exit.h
index 90df26d7d..ff5e3f54c 100644
--- a/src/exit/exit.h
+++ b/src/exit/exit.h
@@ -49,7 +49,7 @@ struct GNUNET_EXIT_TcpServiceStartMessage
49 /** 49 /**
50 * Identification for the desired service. 50 * Identification for the desired service.
51 */ 51 */
52 GNUNET_HashCode service_descriptor; 52 struct GNUNET_HashCode service_descriptor;
53 53
54 /** 54 /**
55 * Skeleton of the TCP header to send. Port numbers are to 55 * Skeleton of the TCP header to send. Port numbers are to
@@ -142,7 +142,7 @@ struct GNUNET_EXIT_UdpServiceMessage
142 /** 142 /**
143 * Identification for the desired service. 143 * Identification for the desired service.
144 */ 144 */
145 GNUNET_HashCode service_descriptor; 145 struct GNUNET_HashCode service_descriptor;
146 146
147 /* followed by UDP payload */ 147 /* followed by UDP payload */
148}; 148};
@@ -230,7 +230,7 @@ struct GNUNET_EXIT_IcmpServiceMessage
230 /** 230 /**
231 * Identification for the desired service. 231 * Identification for the desired service.
232 */ 232 */
233 GNUNET_HashCode service_descriptor; 233 struct GNUNET_HashCode service_descriptor;
234 234
235 /** 235 /**
236 * ICMP header to use. 236 * ICMP header to use.
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 216625567..f23838776 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -189,7 +189,7 @@ struct TunnelState
189 /** 189 /**
190 * Key this state has in the connections_map. 190 * Key this state has in the connections_map.
191 */ 191 */
192 GNUNET_HashCode state_key; 192 struct GNUNET_HashCode state_key;
193 193
194 /** 194 /**
195 * Associated service record, or NULL for no service. 195 * Associated service record, or NULL for no service.
@@ -325,12 +325,12 @@ static int ipv6_enabled;
325 * @param ri information about the connection 325 * @param ri information about the connection
326 */ 326 */
327static void 327static void
328hash_redirect_info (GNUNET_HashCode *hash, 328hash_redirect_info (struct GNUNET_HashCode *hash,
329 const struct RedirectInformation *ri) 329 const struct RedirectInformation *ri)
330{ 330{
331 char *off; 331 char *off;
332 332
333 memset (hash, 0, sizeof (GNUNET_HashCode)); 333 memset (hash, 0, sizeof (struct GNUNET_HashCode));
334 /* the GNUnet hashmap only uses the first sizeof(unsigned int) of the hash, 334 /* the GNUnet hashmap only uses the first sizeof(unsigned int) of the hash,
335 so we put the IP address in there (and hope for few collisions) */ 335 so we put the IP address in there (and hope for few collisions) */
336 off = (char*) hash; 336 off = (char*) hash;
@@ -389,10 +389,10 @@ get_redirect_state (int af,
389 uint16_t destination_port, 389 uint16_t destination_port,
390 const void *local_ip, 390 const void *local_ip,
391 uint16_t local_port, 391 uint16_t local_port,
392 GNUNET_HashCode *state_key) 392 struct GNUNET_HashCode *state_key)
393{ 393{
394 struct RedirectInformation ri; 394 struct RedirectInformation ri;
395 GNUNET_HashCode key; 395 struct GNUNET_HashCode key;
396 struct TunnelState *state; 396 struct TunnelState *state;
397 397
398 if ( ( (af == AF_INET) && (protocol == IPPROTO_ICMP) ) || 398 if ( ( (af == AF_INET) && (protocol == IPPROTO_ICMP) ) ||
@@ -442,15 +442,15 @@ get_redirect_state (int af,
442 */ 442 */
443static struct LocalService * 443static struct LocalService *
444find_service (struct GNUNET_CONTAINER_MultiHashMap *service_map, 444find_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
445 const GNUNET_HashCode *desc, 445 const struct GNUNET_HashCode *desc,
446 uint16_t destination_port) 446 uint16_t destination_port)
447{ 447{
448 char key[sizeof (GNUNET_HashCode) + sizeof (uint16_t)]; 448 char key[sizeof (struct GNUNET_HashCode) + sizeof (uint16_t)];
449 449
450 memcpy (&key[0], &destination_port, sizeof (uint16_t)); 450 memcpy (&key[0], &destination_port, sizeof (uint16_t));
451 memcpy (&key[sizeof(uint16_t)], desc, sizeof (GNUNET_HashCode)); 451 memcpy (&key[sizeof(uint16_t)], desc, sizeof (struct GNUNET_HashCode));
452 return GNUNET_CONTAINER_multihashmap_get (service_map, 452 return GNUNET_CONTAINER_multihashmap_get (service_map,
453 (GNUNET_HashCode *) key); 453 (struct GNUNET_HashCode *) key);
454} 454}
455 455
456 456
@@ -464,7 +464,7 @@ find_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
464 */ 464 */
465static int 465static int
466free_service_record (void *cls, 466free_service_record (void *cls,
467 const GNUNET_HashCode *key, 467 const struct GNUNET_HashCode *key,
468 void *value) 468 void *value)
469{ 469{
470 struct LocalService *service = value; 470 struct LocalService *service = value;
@@ -490,20 +490,20 @@ store_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
490 uint16_t destination_port, 490 uint16_t destination_port,
491 struct LocalService *service) 491 struct LocalService *service)
492{ 492{
493 char key[sizeof (GNUNET_HashCode) + sizeof (uint16_t)]; 493 char key[sizeof (struct GNUNET_HashCode) + sizeof (uint16_t)];
494 GNUNET_HashCode desc; 494 struct GNUNET_HashCode desc;
495 495
496 GNUNET_CRYPTO_hash (name, strlen (name) + 1, &desc); 496 GNUNET_CRYPTO_hash (name, strlen (name) + 1, &desc);
497 service->name = GNUNET_strdup (name); 497 service->name = GNUNET_strdup (name);
498 memcpy (&key[0], &destination_port, sizeof (uint16_t)); 498 memcpy (&key[0], &destination_port, sizeof (uint16_t));
499 memcpy (&key[sizeof(uint16_t)], &desc, sizeof (GNUNET_HashCode)); 499 memcpy (&key[sizeof(uint16_t)], &desc, sizeof (struct GNUNET_HashCode));
500 if (GNUNET_OK != 500 if (GNUNET_OK !=
501 GNUNET_CONTAINER_multihashmap_put (service_map, 501 GNUNET_CONTAINER_multihashmap_put (service_map,
502 (GNUNET_HashCode *) key, 502 (struct GNUNET_HashCode *) key,
503 service, 503 service,
504 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) 504 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
505 { 505 {
506 free_service_record (NULL, (GNUNET_HashCode *) key, service); 506 free_service_record (NULL, (struct GNUNET_HashCode *) key, service);
507 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 507 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
508 _("Got duplicate service records for `%s:%u'\n"), 508 _("Got duplicate service records for `%s:%u'\n"),
509 name, 509 name,
@@ -1218,7 +1218,7 @@ setup_fresh_address (int af,
1218static void 1218static void
1219setup_state_record (struct TunnelState *state) 1219setup_state_record (struct TunnelState *state)
1220{ 1220{
1221 GNUNET_HashCode key; 1221 struct GNUNET_HashCode key;
1222 struct TunnelState *s; 1222 struct TunnelState *s;
1223 1223
1224 /* generate fresh, unique address */ 1224 /* generate fresh, unique address */
@@ -2733,7 +2733,7 @@ clean_tunnel (void *cls GNUNET_UNUSED, const struct GNUNET_MESH_Tunnel *tunnel,
2733 */ 2733 */
2734static int 2734static int
2735free_iterate (void *cls GNUNET_UNUSED, 2735free_iterate (void *cls GNUNET_UNUSED,
2736 const GNUNET_HashCode * hash GNUNET_UNUSED, void *value) 2736 const struct GNUNET_HashCode * hash GNUNET_UNUSED, void *value)
2737{ 2737{
2738 GNUNET_free (value); 2738 GNUNET_free (value);
2739 return GNUNET_YES; 2739 return GNUNET_YES;