diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-20 09:02:43 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-20 09:02:43 +0000 |
commit | 566b7539fcaf9c455da665cb641016d2cfbb1b47 (patch) | |
tree | eb12baa08d99313d6da7eb8c1be17c5e447f1586 /src/regex/regex_internal_dht.c | |
parent | de9409f80dbfc5cc61a28316b271600e9da95cdc (diff) | |
download | gnunet-566b7539fcaf9c455da665cb641016d2cfbb1b47.tar.gz gnunet-566b7539fcaf9c455da665cb641016d2cfbb1b47.zip |
renaming symbols from libgnunetregextest to have the prefix REGEX_TEST
Diffstat (limited to 'src/regex/regex_internal_dht.c')
-rw-r--r-- | src/regex/regex_internal_dht.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c index 0b5d99928..a11d59752 100644 --- a/src/regex/regex_internal_dht.c +++ b/src/regex/regex_internal_dht.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #define DHT_OPT GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE | 42 | #define DHT_OPT GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | struct REGEX_ITERNAL_Announcement | 45 | struct REGEX_INTERNAL_Announcement |
46 | { | 46 | { |
47 | /** | 47 | /** |
48 | * DHT handle to use, must be initialized externally. | 48 | * DHT handle to use, must be initialized externally. |
@@ -57,7 +57,7 @@ struct REGEX_ITERNAL_Announcement | |||
57 | /** | 57 | /** |
58 | * Automaton representation of the regex (expensive to build). | 58 | * Automaton representation of the regex (expensive to build). |
59 | */ | 59 | */ |
60 | struct REGEX_ITERNAL_Automaton* dfa; | 60 | struct REGEX_INTERNAL_Automaton* dfa; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Identity under which to announce the regex. | 63 | * Identity under which to announce the regex. |
@@ -87,9 +87,9 @@ regex_iterator (void *cls, | |||
87 | const char *proof, | 87 | const char *proof, |
88 | int accepting, | 88 | int accepting, |
89 | unsigned int num_edges, | 89 | unsigned int num_edges, |
90 | const struct REGEX_ITERNAL_Edge *edges) | 90 | const struct REGEX_INTERNAL_Edge *edges) |
91 | { | 91 | { |
92 | struct REGEX_ITERNAL_Announcement *h = cls; | 92 | struct REGEX_INTERNAL_Announcement *h = cls; |
93 | struct RegexBlock *block; | 93 | struct RegexBlock *block; |
94 | struct RegexEdge *block_edge; | 94 | struct RegexEdge *block_edge; |
95 | size_t size; | 95 | size_t size; |
@@ -182,43 +182,43 @@ regex_iterator (void *cls, | |||
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | struct REGEX_ITERNAL_Announcement * | 185 | struct REGEX_INTERNAL_Announcement * |
186 | REGEX_ITERNAL_announce (struct GNUNET_DHT_Handle *dht, | 186 | REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht, |
187 | const struct GNUNET_PeerIdentity *id, | 187 | const struct GNUNET_PeerIdentity *id, |
188 | const char *regex, | 188 | const char *regex, |
189 | uint16_t compression, | 189 | uint16_t compression, |
190 | struct GNUNET_STATISTICS_Handle *stats) | 190 | struct GNUNET_STATISTICS_Handle *stats) |
191 | { | 191 | { |
192 | struct REGEX_ITERNAL_Announcement *h; | 192 | struct REGEX_INTERNAL_Announcement *h; |
193 | 193 | ||
194 | GNUNET_assert (NULL != dht); | 194 | GNUNET_assert (NULL != dht); |
195 | h = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Announcement)); | 195 | h = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Announcement)); |
196 | h->regex = regex; | 196 | h->regex = regex; |
197 | h->dht = dht; | 197 | h->dht = dht; |
198 | h->stats = stats; | 198 | h->stats = stats; |
199 | h->id = *id; | 199 | h->id = *id; |
200 | h->dfa = REGEX_ITERNAL_construct_dfa (regex, | 200 | h->dfa = REGEX_INTERNAL_construct_dfa (regex, |
201 | strlen (regex), | 201 | strlen (regex), |
202 | compression); | 202 | compression); |
203 | REGEX_ITERNAL_reannounce (h); | 203 | REGEX_INTERNAL_reannounce (h); |
204 | return h; | 204 | return h; |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | void | 208 | void |
209 | REGEX_ITERNAL_reannounce (struct REGEX_ITERNAL_Announcement *h) | 209 | REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h) |
210 | { | 210 | { |
211 | GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */ | 211 | GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */ |
212 | LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_ITERNAL_reannounce: %.60s\n", h->regex); | 212 | LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_INTERNAL_reannounce: %.60s\n", h->regex); |
213 | LOG (GNUNET_ERROR_TYPE_DEBUG, " full: %s\n", h->regex); | 213 | LOG (GNUNET_ERROR_TYPE_DEBUG, " full: %s\n", h->regex); |
214 | REGEX_ITERNAL_iterate_all_edges (h->dfa, ®ex_iterator, h); | 214 | REGEX_INTERNAL_iterate_all_edges (h->dfa, ®ex_iterator, h); |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | void | 218 | void |
219 | REGEX_ITERNAL_announce_cancel (struct REGEX_ITERNAL_Announcement *h) | 219 | REGEX_INTERNAL_announce_cancel (struct REGEX_INTERNAL_Announcement *h) |
220 | { | 220 | { |
221 | REGEX_ITERNAL_automaton_destroy (h->dfa); | 221 | REGEX_INTERNAL_automaton_destroy (h->dfa); |
222 | GNUNET_free (h); | 222 | GNUNET_free (h); |
223 | } | 223 | } |
224 | 224 | ||
@@ -241,7 +241,7 @@ struct RegexSearchContext | |||
241 | /** | 241 | /** |
242 | * Information about the search. | 242 | * Information about the search. |
243 | */ | 243 | */ |
244 | struct REGEX_ITERNAL_Search *info; | 244 | struct REGEX_INTERNAL_Search *info; |
245 | 245 | ||
246 | /** | 246 | /** |
247 | * We just want to look for one edge, the longer the better. | 247 | * We just want to look for one edge, the longer the better. |
@@ -260,7 +260,7 @@ struct RegexSearchContext | |||
260 | * Struct to keep information of searches of services described by a regex | 260 | * Struct to keep information of searches of services described by a regex |
261 | * using a user-provided string service description. | 261 | * using a user-provided string service description. |
262 | */ | 262 | */ |
263 | struct REGEX_ITERNAL_Search | 263 | struct REGEX_INTERNAL_Search |
264 | { | 264 | { |
265 | /** | 265 | /** |
266 | * DHT handle to use, must be initialized externally. | 266 | * DHT handle to use, must be initialized externally. |
@@ -300,7 +300,7 @@ struct REGEX_ITERNAL_Search | |||
300 | /** | 300 | /** |
301 | * @param callback Callback for found peers. | 301 | * @param callback Callback for found peers. |
302 | */ | 302 | */ |
303 | REGEX_ITERNAL_Found callback; | 303 | REGEX_INTERNAL_Found callback; |
304 | 304 | ||
305 | /** | 305 | /** |
306 | * @param callback_cls Closure for @c callback. | 306 | * @param callback_cls Closure for @c callback. |
@@ -352,7 +352,7 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
352 | { | 352 | { |
353 | const struct RegexAccept *block = data; | 353 | const struct RegexAccept *block = data; |
354 | struct RegexSearchContext *ctx = cls; | 354 | struct RegexSearchContext *ctx = cls; |
355 | struct REGEX_ITERNAL_Search *info = ctx->info; | 355 | struct REGEX_INTERNAL_Search *info = ctx->info; |
356 | 356 | ||
357 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got regex results from DHT!\n"); | 357 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got regex results from DHT!\n"); |
358 | LOG (GNUNET_ERROR_TYPE_INFO, " accept for %s (key %s)\n", | 358 | LOG (GNUNET_ERROR_TYPE_INFO, " accept for %s (key %s)\n", |
@@ -430,7 +430,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
430 | { | 430 | { |
431 | const struct RegexBlock *block = data; | 431 | const struct RegexBlock *block = data; |
432 | struct RegexSearchContext *ctx = cls; | 432 | struct RegexSearchContext *ctx = cls; |
433 | struct REGEX_ITERNAL_Search *info = ctx->info; | 433 | struct REGEX_INTERNAL_Search *info = ctx->info; |
434 | void *copy; | 434 | void *copy; |
435 | size_t len; | 435 | size_t len; |
436 | char *datastore; | 436 | char *datastore; |
@@ -466,7 +466,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
466 | 466 | ||
467 | memcpy (proof, &block[1], len); | 467 | memcpy (proof, &block[1], len); |
468 | proof[len] = '\0'; | 468 | proof[len] = '\0'; |
469 | if (GNUNET_OK != REGEX_ITERNAL_check_proof (proof, key)) | 469 | if (GNUNET_OK != REGEX_INTERNAL_check_proof (proof, key)) |
470 | { | 470 | { |
471 | GNUNET_break_op (0); | 471 | GNUNET_break_op (0); |
472 | return; | 472 | return; |
@@ -543,7 +543,7 @@ regex_edge_iterator (void *cls, | |||
543 | const struct GNUNET_HashCode *key) | 543 | const struct GNUNET_HashCode *key) |
544 | { | 544 | { |
545 | struct RegexSearchContext *ctx = cls; | 545 | struct RegexSearchContext *ctx = cls; |
546 | struct REGEX_ITERNAL_Search *info = ctx->info; | 546 | struct REGEX_INTERNAL_Search *info = ctx->info; |
547 | const char *current; | 547 | const char *current; |
548 | size_t current_len; | 548 | size_t current_len; |
549 | 549 | ||
@@ -602,7 +602,7 @@ regex_next_edge (const struct RegexBlock *block, | |||
602 | struct RegexSearchContext *ctx) | 602 | struct RegexSearchContext *ctx) |
603 | { | 603 | { |
604 | struct RegexSearchContext *new_ctx; | 604 | struct RegexSearchContext *new_ctx; |
605 | struct REGEX_ITERNAL_Search *info = ctx->info; | 605 | struct REGEX_INTERNAL_Search *info = ctx->info; |
606 | struct GNUNET_DHT_GetHandle *get_h; | 606 | struct GNUNET_DHT_GetHandle *get_h; |
607 | struct GNUNET_HashCode *hash; | 607 | struct GNUNET_HashCode *hash; |
608 | const char *rest; | 608 | const char *rest; |
@@ -611,7 +611,7 @@ regex_next_edge (const struct RegexBlock *block, | |||
611 | /* Find the longest match for the current string position, | 611 | /* Find the longest match for the current string position, |
612 | * among tokens in the given block */ | 612 | * among tokens in the given block */ |
613 | ctx->longest_match = 0; | 613 | ctx->longest_match = 0; |
614 | result = REGEX_ITERNAL_block_iterate (block, size, | 614 | result = REGEX_INTERNAL_block_iterate (block, size, |
615 | ®ex_edge_iterator, ctx); | 615 | ®ex_edge_iterator, ctx); |
616 | GNUNET_break (GNUNET_OK == result); | 616 | GNUNET_break (GNUNET_OK == result); |
617 | 617 | ||
@@ -670,14 +670,14 @@ regex_next_edge (const struct RegexBlock *block, | |||
670 | } | 670 | } |
671 | 671 | ||
672 | 672 | ||
673 | struct REGEX_ITERNAL_Search * | 673 | struct REGEX_INTERNAL_Search * |
674 | REGEX_ITERNAL_search (struct GNUNET_DHT_Handle *dht, | 674 | REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht, |
675 | const char *string, | 675 | const char *string, |
676 | REGEX_ITERNAL_Found callback, | 676 | REGEX_INTERNAL_Found callback, |
677 | void *callback_cls, | 677 | void *callback_cls, |
678 | struct GNUNET_STATISTICS_Handle *stats) | 678 | struct GNUNET_STATISTICS_Handle *stats) |
679 | { | 679 | { |
680 | struct REGEX_ITERNAL_Search *h; | 680 | struct REGEX_INTERNAL_Search *h; |
681 | struct GNUNET_DHT_GetHandle *get_h; | 681 | struct GNUNET_DHT_GetHandle *get_h; |
682 | struct RegexSearchContext *ctx; | 682 | struct RegexSearchContext *ctx; |
683 | struct GNUNET_HashCode key; | 683 | struct GNUNET_HashCode key; |
@@ -685,10 +685,10 @@ REGEX_ITERNAL_search (struct GNUNET_DHT_Handle *dht, | |||
685 | size_t len; | 685 | size_t len; |
686 | 686 | ||
687 | /* Initialize handle */ | 687 | /* Initialize handle */ |
688 | LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_ITERNAL_search: %s\n", string); | 688 | LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_INTERNAL_search: %s\n", string); |
689 | GNUNET_assert (NULL != dht); | 689 | GNUNET_assert (NULL != dht); |
690 | GNUNET_assert (NULL != callback); | 690 | GNUNET_assert (NULL != callback); |
691 | h = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Search)); | 691 | h = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Search)); |
692 | h->dht = dht; | 692 | h->dht = dht; |
693 | h->description = GNUNET_strdup (string); | 693 | h->description = GNUNET_strdup (string); |
694 | h->callback = callback; | 694 | h->callback = callback; |
@@ -699,7 +699,7 @@ REGEX_ITERNAL_search (struct GNUNET_DHT_Handle *dht, | |||
699 | 699 | ||
700 | /* Initialize context */ | 700 | /* Initialize context */ |
701 | len = strlen (string); | 701 | len = strlen (string); |
702 | size = REGEX_ITERNAL_get_first_key (string, len, &key); | 702 | size = REGEX_INTERNAL_get_first_key (string, len, &key); |
703 | ctx = GNUNET_malloc (sizeof (struct RegexSearchContext)); | 703 | ctx = GNUNET_malloc (sizeof (struct RegexSearchContext)); |
704 | ctx->position = size; | 704 | ctx->position = size; |
705 | ctx->info = h; | 705 | ctx->info = h; |
@@ -779,7 +779,7 @@ regex_free_result (void *cls, | |||
779 | * @param ctx The search context. | 779 | * @param ctx The search context. |
780 | */ | 780 | */ |
781 | static void | 781 | static void |
782 | regex_cancel_search (struct REGEX_ITERNAL_Search *ctx) | 782 | regex_cancel_search (struct REGEX_INTERNAL_Search *ctx) |
783 | { | 783 | { |
784 | GNUNET_free (ctx->description); | 784 | GNUNET_free (ctx->description); |
785 | GNUNET_CONTAINER_multihashmap_iterate (ctx->dht_get_handles, | 785 | GNUNET_CONTAINER_multihashmap_iterate (ctx->dht_get_handles, |
@@ -801,7 +801,7 @@ regex_cancel_search (struct REGEX_ITERNAL_Search *ctx) | |||
801 | } | 801 | } |
802 | 802 | ||
803 | void | 803 | void |
804 | REGEX_ITERNAL_search_cancel (struct REGEX_ITERNAL_Search *h) | 804 | REGEX_INTERNAL_search_cancel (struct REGEX_INTERNAL_Search *h) |
805 | { | 805 | { |
806 | regex_cancel_search (h); | 806 | regex_cancel_search (h); |
807 | GNUNET_free (h); | 807 | GNUNET_free (h); |