aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex_internal_dht.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-27 11:31:48 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-27 11:31:48 +0000
commitd1b1c834fbb65d70fca837e1ab742e71e16adf50 (patch)
treeff3c5f148bee8c53a8a36447a8bd5535ed5573c2 /src/regex/regex_internal_dht.c
parent1350dd76782b3cea091cd3c41dc53a6fc244414b (diff)
downloadgnunet-d1b1c834fbb65d70fca837e1ab742e71e16adf50.tar.gz
gnunet-d1b1c834fbb65d70fca837e1ab742e71e16adf50.zip
-move struct RegexBlock into regex_block_lib
Diffstat (limited to 'src/regex/regex_internal_dht.c')
-rw-r--r--src/regex/regex_internal_dht.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index 3d6cf7360..15f53e953 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -107,36 +107,36 @@ regex_iterator (void *cls,
107 num_edges); 107 num_edges);
108 if (GNUNET_YES == accepting) 108 if (GNUNET_YES == accepting)
109 { 109 {
110 struct RegexAcceptBlock block; 110 struct RegexAcceptBlock ab;
111 111
112 LOG (GNUNET_ERROR_TYPE_DEBUG, 112 LOG (GNUNET_ERROR_TYPE_DEBUG,
113 "State %s is accepting, putting own id\n", 113 "State %s is accepting, putting own id\n",
114 GNUNET_h2s(key)); 114 GNUNET_h2s(key));
115 size = sizeof (block); 115 size = sizeof (struct RegexAcceptBlock);
116 block.purpose.size = sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 116 ab.purpose.size = sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
117 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 117 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
118 sizeof (struct GNUNET_HashCode); 118 sizeof (struct GNUNET_HashCode);
119 block.purpose.purpose = ntohl (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT); 119 ab.purpose.purpose = ntohl (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT);
120 block.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_DHT_MAX_EXPIRATION)); 120 ab.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_DHT_MAX_EXPIRATION));
121 block.key = *key; 121 ab.key = *key;
122 GNUNET_CRYPTO_ecc_key_get_public (h->priv, 122 GNUNET_CRYPTO_ecc_key_get_public (h->priv,
123 &block.public_key); 123 &ab.public_key);
124 GNUNET_assert (GNUNET_OK == 124 GNUNET_assert (GNUNET_OK ==
125 GNUNET_CRYPTO_ecc_sign (h->priv, 125 GNUNET_CRYPTO_ecc_sign (h->priv,
126 &block.purpose, 126 &ab.purpose,
127 &block.signature)); 127 &ab.signature));
128 128
129 GNUNET_STATISTICS_update (h->stats, "# regex accepting blocks stored", 129 GNUNET_STATISTICS_update (h->stats, "# regex accepting blocks stored",
130 1, GNUNET_NO); 130 1, GNUNET_NO);
131 GNUNET_STATISTICS_update (h->stats, "# regex accepting block bytes stored", 131 GNUNET_STATISTICS_update (h->stats, "# regex accepting block bytes stored",
132 sizeof (block), GNUNET_NO); 132 sizeof (struct RegexAcceptBlock), GNUNET_NO);
133 (void) 133 (void)
134 GNUNET_DHT_put (h->dht, key, 134 GNUNET_DHT_put (h->dht, key,
135 DHT_REPLICATION, 135 DHT_REPLICATION,
136 DHT_OPT | GNUNET_DHT_RO_RECORD_ROUTE, 136 DHT_OPT | GNUNET_DHT_RO_RECORD_ROUTE,
137 GNUNET_BLOCK_TYPE_REGEX_ACCEPT, 137 GNUNET_BLOCK_TYPE_REGEX_ACCEPT,
138 size, 138 size,
139 &block, 139 &ab,
140 GNUNET_TIME_relative_to_absolute (DHT_TTL), 140 GNUNET_TIME_relative_to_absolute (DHT_TTL),
141 DHT_TTL, 141 DHT_TTL,
142 NULL, NULL); 142 NULL, NULL);
@@ -463,7 +463,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp,
463 GNUNET_free (datastore); 463 GNUNET_free (datastore);
464 464
465 copy = GNUNET_malloc (size); 465 copy = GNUNET_malloc (size);
466 memcpy (copy, data, size); 466 memcpy (copy, block, size);
467 GNUNET_break ( 467 GNUNET_break (
468 GNUNET_OK == 468 GNUNET_OK ==
469 GNUNET_CONTAINER_multihashmap_put (info->dht_get_results, 469 GNUNET_CONTAINER_multihashmap_put (info->dht_get_results,
@@ -473,7 +473,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp,
473 len = strlen (info->description); 473 len = strlen (info->description);
474 if (len == ctx->position) // String processed 474 if (len == ctx->position) // String processed
475 { 475 {
476 if (GNUNET_YES == ntohs (block->is_accepting)) 476 if (GNUNET_YES == GNUNET_BLOCK_is_accepting (block))
477 { 477 {
478 regex_find_path (key, ctx); 478 regex_find_path (key, ctx);
479 } 479 }
@@ -504,8 +504,9 @@ regex_result_iterator (void *cls,
504 struct RegexBlock *block = value; 504 struct RegexBlock *block = value;
505 struct RegexSearchContext *ctx = cls; 505 struct RegexSearchContext *ctx = cls;
506 506
507 if (GNUNET_YES == ntohs (block->is_accepting) && 507 if ( (GNUNET_YES ==
508 ctx->position == strlen (ctx->info->description)) 508 GNUNET_BLOCK_is_accepting (block)) &&
509 (ctx->position == strlen (ctx->info->description)) )
509 { 510 {
510 LOG (GNUNET_ERROR_TYPE_INFO, " * Found accepting known block\n"); 511 LOG (GNUNET_ERROR_TYPE_INFO, " * Found accepting known block\n");
511 regex_find_path (key, ctx); 512 regex_find_path (key, ctx);
@@ -513,7 +514,7 @@ regex_result_iterator (void *cls,
513 } 514 }
514 LOG (GNUNET_ERROR_TYPE_DEBUG, "* %u, %u, [%u]\n", 515 LOG (GNUNET_ERROR_TYPE_DEBUG, "* %u, %u, [%u]\n",
515 ctx->position, strlen(ctx->info->description), 516 ctx->position, strlen(ctx->info->description),
516 ntohs (block->is_accepting)); 517 GNUNET_BLOCK_is_accepting (block));
517 518
518 regex_next_edge (block, SIZE_MAX, ctx); 519 regex_next_edge (block, SIZE_MAX, ctx);
519 520