aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/gnunet-daemon-regexprofiler.c4
-rw-r--r--src/regex/gnunet-regex-profiler.c16
-rw-r--r--src/regex/gnunet-service-regex.c18
-rw-r--r--src/regex/perf-regex.c12
-rw-r--r--src/regex/plugin_block_regex.c4
-rw-r--r--src/regex/regex_api.c32
-rw-r--r--src/regex/regex_block_lib.c32
-rw-r--r--src/regex/regex_block_lib.h4
-rw-r--r--src/regex/regex_internal.c112
-rw-r--r--src/regex/regex_internal_dht.c58
-rw-r--r--src/regex/regex_internal_lib.h12
-rw-r--r--src/regex/regex_ipc.h4
-rw-r--r--src/regex/regex_test_lib.c14
-rw-r--r--src/regex/regex_test_lib.h6
-rw-r--r--src/regex/test_regex_api.c4
-rw-r--r--src/regex/test_regex_iterate_api.c2
16 files changed, 167 insertions, 167 deletions
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c
index 0fb47d23a..bcb99aaf5 100644
--- a/src/regex/gnunet-daemon-regexprofiler.c
+++ b/src/regex/gnunet-daemon-regexprofiler.c
@@ -135,7 +135,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
135 135
136/** 136/**
137 * Announce a previously announced regex re-using cached data. 137 * Announce a previously announced regex re-using cached data.
138 * 138 *
139 * @param cls Closure (regex to announce if needed). 139 * @param cls Closure (regex to announce if needed).
140 * @param tc TaskContext. 140 * @param tc TaskContext.
141 */ 141 */
@@ -309,7 +309,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
309 "REANNOUNCE_PERIOD_MAX", 309 "REANNOUNCE_PERIOD_MAX",
310 &reannounce_period_max)) 310 &reannounce_period_max))
311 { 311 {
312 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 312 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
313 "reannounce_period_max not given. Using 10 minutes.\n"); 313 "reannounce_period_max not given. Using 10 minutes.\n");
314 reannounce_period_max = 314 reannounce_period_max =
315 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10); 315 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10);
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c
index 4e55bd1c6..5a7cb9acd 100644
--- a/src/regex/gnunet-regex-profiler.c
+++ b/src/regex/gnunet-regex-profiler.c
@@ -725,7 +725,7 @@ regex_found_handler (void *cls,
725 725
726 if (GNUNET_YES == peer->search_str_matched) 726 if (GNUNET_YES == peer->search_str_matched)
727 { 727 {
728 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 728 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
729 "String %s on peer %u already matched!\n", 729 "String %s on peer %u already matched!\n",
730 peer->search_str, peer->id); 730 peer->search_str, peer->id);
731 return; 731 return;
@@ -824,7 +824,7 @@ search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
824 824
825 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 825 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
826 "Search timed out after %s." 826 "Search timed out after %s."
827 "Collecting stats and shutting down.\n", 827 "Collecting stats and shutting down.\n",
828 GNUNET_STRINGS_relative_time_to_string (search_timeout_time, 828 GNUNET_STRINGS_relative_time_to_string (search_timeout_time,
829 GNUNET_NO)); 829 GNUNET_NO));
830 830
@@ -1008,7 +1008,7 @@ announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1008 1008
1009 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting daemon %u\n", next_search); 1009 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting daemon %u\n", next_search);
1010 peer = &peers[next_search]; 1010 peer = &peers[next_search];
1011 peer->daemon_op = 1011 peer->daemon_op =
1012 GNUNET_TESTBED_peer_manage_service (NULL, 1012 GNUNET_TESTBED_peer_manage_service (NULL,
1013 peer->peer_handle, 1013 peer->peer_handle,
1014 "regexprofiler", 1014 "regexprofiler",
@@ -1113,7 +1113,7 @@ dht_da (void *cls, void *op_result)
1113 * @param links_failed the number of overlay link connection attempts that 1113 * @param links_failed the number of overlay link connection attempts that
1114 * failed 1114 * failed
1115 */ 1115 */
1116static void 1116static void
1117test_master (void *cls, 1117test_master (void *cls,
1118 struct GNUNET_TESTBED_RunHandle *h, 1118 struct GNUNET_TESTBED_RunHandle *h,
1119 unsigned int num_peers_, 1119 unsigned int num_peers_,
@@ -1148,7 +1148,7 @@ test_master (void *cls,
1148 settle_time = 1148 settle_time =
1149 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 1149 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
1150 10 * num_peers); 1150 10 * num_peers);
1151 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1151 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1152 "Waiting for DHT for %s to settle new connections.\n\n", 1152 "Waiting for DHT for %s to settle new connections.\n\n",
1153 GNUNET_STRINGS_relative_time_to_string(settle_time, GNUNET_NO)); 1153 GNUNET_STRINGS_relative_time_to_string(settle_time, GNUNET_NO));
1154 GNUNET_SCHEDULER_add_delayed (settle_time, &do_announce, NULL); 1154 GNUNET_SCHEDULER_add_delayed (settle_time, &do_announce, NULL);
@@ -1168,7 +1168,7 @@ test_master (void *cls,
1168 * @param event information on what is happening 1168 * @param event information on what is happening
1169 */ 1169 */
1170static void 1170static void
1171master_controller_cb (void *cls, 1171master_controller_cb (void *cls,
1172 const struct GNUNET_TESTBED_EventInformation *event) 1172 const struct GNUNET_TESTBED_EventInformation *event)
1173{ 1173{
1174 switch (event->type) 1174 switch (event->type)
@@ -1315,7 +1315,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1315 "REANNOUNCE_PERIOD_MAX", 1315 "REANNOUNCE_PERIOD_MAX",
1316 &reannounce_period_max)) 1316 &reannounce_period_max))
1317 { 1317 {
1318 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1318 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1319 "reannounce_period_max not given. Using 10 minutes.\n"); 1319 "reannounce_period_max not given. Using 10 minutes.\n");
1320 reannounce_period_max = 1320 reannounce_period_max =
1321 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10); 1321 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10);
@@ -1424,7 +1424,7 @@ run (void *cls, char *const *args, const char *cfgfile,
1424 "SETUP_TIMEOUT", 1424 "SETUP_TIMEOUT",
1425 &abort_time)) 1425 &abort_time))
1426 { 1426 {
1427 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1427 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1428 "SETUP_TIMEOUT not given. Using 15 minutes.\n"); 1428 "SETUP_TIMEOUT not given. Using 15 minutes.\n");
1429 abort_time = 1429 abort_time =
1430 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15); 1430 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15);
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c
index 22175331c..620086b15 100644
--- a/src/regex/gnunet-service-regex.c
+++ b/src/regex/gnunet-service-regex.c
@@ -193,7 +193,7 @@ reannounce (void *cls,
193 * @param message the actual message 193 * @param message the actual message
194 */ 194 */
195static void 195static void
196handle_announce (void *cls, 196handle_announce (void *cls,
197 struct GNUNET_SERVER_Client *client, 197 struct GNUNET_SERVER_Client *client,
198 const struct GNUNET_MessageHeader *message) 198 const struct GNUNET_MessageHeader *message)
199{ 199{
@@ -238,7 +238,7 @@ handle_announce (void *cls,
238 return; 238 return;
239 } 239 }
240 GNUNET_CONTAINER_DLL_insert (client_head, 240 GNUNET_CONTAINER_DLL_insert (client_head,
241 client_tail, 241 client_tail,
242 ce); 242 ce);
243 GNUNET_SERVER_receive_done (client, GNUNET_OK); 243 GNUNET_SERVER_receive_done (client, GNUNET_OK);
244} 244}
@@ -254,7 +254,7 @@ handle_announce (void *cls,
254 * @param put_path Path of the put request. 254 * @param put_path Path of the put request.
255 * @param put_path_length Length of the put_path. 255 * @param put_path_length Length of the put_path.
256 */ 256 */
257static void 257static void
258handle_search_result (void *cls, 258handle_search_result (void *cls,
259 const struct GNUNET_PeerIdentity *id, 259 const struct GNUNET_PeerIdentity *id,
260 const struct GNUNET_PeerIdentity *get_path, 260 const struct GNUNET_PeerIdentity *get_path,
@@ -283,11 +283,11 @@ handle_search_result (void *cls,
283 result->put_path_length = htons ((uint16_t) put_path_length); 283 result->put_path_length = htons ((uint16_t) put_path_length);
284 result->id = *id; 284 result->id = *id;
285 gp = &result->id; 285 gp = &result->id;
286 memcpy (&gp[1], 286 memcpy (&gp[1],
287 get_path, 287 get_path,
288 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 288 get_path_length * sizeof (struct GNUNET_PeerIdentity));
289 memcpy (&gp[1 + get_path_length], 289 memcpy (&gp[1 + get_path_length],
290 put_path, 290 put_path,
291 put_path_length * sizeof (struct GNUNET_PeerIdentity)); 291 put_path_length * sizeof (struct GNUNET_PeerIdentity));
292 GNUNET_SERVER_notification_context_unicast (nc, 292 GNUNET_SERVER_notification_context_unicast (nc,
293 ce->client, 293 ce->client,
@@ -304,7 +304,7 @@ handle_search_result (void *cls,
304 * @param message the actual message 304 * @param message the actual message
305 */ 305 */
306static void 306static void
307handle_search (void *cls, 307handle_search (void *cls,
308 struct GNUNET_SERVER_Client *client, 308 struct GNUNET_SERVER_Client *client,
309 const struct GNUNET_MessageHeader *message) 309 const struct GNUNET_MessageHeader *message)
310{ 310{
@@ -338,7 +338,7 @@ handle_search (void *cls,
338 return; 338 return;
339 } 339 }
340 GNUNET_CONTAINER_DLL_insert (client_head, 340 GNUNET_CONTAINER_DLL_insert (client_head,
341 client_tail, 341 client_tail,
342 ce); 342 ce);
343 GNUNET_SERVER_notification_context_add (nc, client); 343 GNUNET_SERVER_notification_context_add (nc, client);
344 GNUNET_SERVER_receive_done (client, GNUNET_OK); 344 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -364,7 +364,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
364 364
365 my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); 365 my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg);
366 if (NULL == my_private_key) 366 if (NULL == my_private_key)
367 { 367 {
368 GNUNET_SCHEDULER_shutdown (); 368 GNUNET_SCHEDULER_shutdown ();
369 return; 369 return;
370 } 370 }
diff --git a/src/regex/perf-regex.c b/src/regex/perf-regex.c
index 823601c84..3f1e77115 100644
--- a/src/regex/perf-regex.c
+++ b/src/regex/perf-regex.c
@@ -41,7 +41,7 @@
41 * @param num_edges number of edges leaving current state. 41 * @param num_edges number of edges leaving current state.
42 * @param edges edges leaving current state. 42 * @param edges edges leaving current state.
43 */ 43 */
44static void 44static void
45print_edge (void *cls, 45print_edge (void *cls,
46 const struct GNUNET_HashCode *key, 46 const struct GNUNET_HashCode *key,
47 const char *proof, 47 const char *proof,
@@ -64,7 +64,7 @@ print_edge (void *cls,
64 64
65/** 65/**
66 * The main function of the regex performace test. 66 * The main function of the regex performace test.
67 * 67 *
68 * Read a set of regex from a file, combine them and create a DFA from the 68 * Read a set of regex from a file, combine them and create a DFA from the
69 * resulting combined regex. 69 * resulting combined regex.
70 * 70 *
@@ -86,7 +86,7 @@ main (int argc, char *const *argv)
86 if (3 != argc) 86 if (3 != argc)
87 { 87 {
88 fprintf (stderr, 88 fprintf (stderr,
89 "Usage: %s REGEX_FILE COMPRESSION\n", 89 "Usage: %s REGEX_FILE COMPRESSION\n",
90 argv[0]); 90 argv[0]);
91 return 1; 91 return 1;
92 } 92 }
@@ -104,9 +104,9 @@ main (int argc, char *const *argv)
104 GNUNET_asprintf (&regex, "GNUNET_REGEX_PROFILER_(%s)(0|1)*", buffer); 104 GNUNET_asprintf (&regex, "GNUNET_REGEX_PROFILER_(%s)(0|1)*", buffer);
105 size = strlen (regex); 105 size = strlen (regex);
106 106
107 fprintf (stderr, 107 fprintf (stderr,
108 "Combined regex (%ld bytes):\n%s\n", 108 "Combined regex (%ld bytes):\n%s\n",
109 size, 109 size,
110 regex); 110 regex);
111 dfa = REGEX_INTERNAL_construct_dfa (regex, size, compression); 111 dfa = REGEX_INTERNAL_construct_dfa (regex, size, compression);
112 printf ("********* ALL EDGES *********'\n"); 112 printf ("********* ALL EDGES *********'\n");
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 0897641d5..3d7b97725 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -174,7 +174,7 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type,
174 if (ntohl (rba->purpose.size) != 174 if (ntohl (rba->purpose.size) !=
175 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 175 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
176 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 176 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
177 sizeof (struct GNUNET_HashCode)) 177 sizeof (struct GNUNET_HashCode))
178 { 178 {
179 GNUNET_break_op(0); 179 GNUNET_break_op(0);
180 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 180 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
@@ -184,7 +184,7 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type,
184 /* technically invalid, but can happen without an error, so 184 /* technically invalid, but can happen without an error, so
185 we're nice by reporting it as a 'duplicate' */ 185 we're nice by reporting it as a 'duplicate' */
186 return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; 186 return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE;
187 } 187 }
188 if (GNUNET_OK != 188 if (GNUNET_OK !=
189 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT, 189 GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT,
190 &rba->purpose, 190 &rba->purpose,
diff --git a/src/regex/regex_api.c b/src/regex/regex_api.c
index afc028cdb..e18674d65 100644
--- a/src/regex/regex_api.c
+++ b/src/regex/regex_api.c
@@ -40,11 +40,11 @@ struct GNUNET_REGEX_Announcement
40 */ 40 */
41 struct GNUNET_CLIENT_Connection *client; 41 struct GNUNET_CLIENT_Connection *client;
42 42
43 /** 43 /**
44 * Our configuration. 44 * Our configuration.
45 */ 45 */
46 const struct GNUNET_CONFIGURATION_Handle *cfg; 46 const struct GNUNET_CONFIGURATION_Handle *cfg;
47 47
48 /** 48 /**
49 * Message we're sending to the service. 49 * Message we're sending to the service.
50 */ 50 */
@@ -55,7 +55,7 @@ struct GNUNET_REGEX_Announcement
55/** 55/**
56 * We got a response (!?) or disconnect after asking regex 56 * We got a response (!?) or disconnect after asking regex
57 * to do the announcement. Retry. 57 * to do the announcement. Retry.
58 * 58 *
59 * @param cls the 'struct GNUNET_REGEX_Announcement' to retry 59 * @param cls the 'struct GNUNET_REGEX_Announcement' to retry
60 * @param msg NULL on disconnect 60 * @param msg NULL on disconnect
61 */ 61 */
@@ -65,7 +65,7 @@ handle_a_reconnect (void *cls,
65 65
66 66
67/** 67/**
68 * Try sending the announcement request to regex. On 68 * Try sending the announcement request to regex. On
69 * errors (i.e. regex died), try again. 69 * errors (i.e. regex died), try again.
70 * 70 *
71 * @param a the announcement to retry 71 * @param a the announcement to retry
@@ -87,7 +87,7 @@ retry_announcement (struct GNUNET_REGEX_Announcement *a)
87/** 87/**
88 * We got a response (!?) or disconnect after asking regex 88 * We got a response (!?) or disconnect after asking regex
89 * to do the announcement. Retry. 89 * to do the announcement. Retry.
90 * 90 *
91 * @param cls the 'struct GNUNET_REGEX_Announcement' to retry 91 * @param cls the 'struct GNUNET_REGEX_Announcement' to retry
92 * @param msg NULL on disconnect 92 * @param msg NULL on disconnect
93 */ 93 */
@@ -107,7 +107,7 @@ handle_a_reconnect (void *cls,
107 * Announce the given peer under the given regular expression. Does 107 * Announce the given peer under the given regular expression. Does
108 * not free resources, must call GNUNET_REGEX_announce_cancel for 108 * not free resources, must call GNUNET_REGEX_announce_cancel for
109 * that. 109 * that.
110 * 110 *
111 * @param cfg configuration to use 111 * @param cfg configuration to use
112 * @param regex Regular expression to announce. 112 * @param regex Regular expression to announce.
113 * @param refresh_delay after what delay should the announcement be repeated? 113 * @param refresh_delay after what delay should the announcement be repeated?
@@ -151,7 +151,7 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg,
151 151
152/** 152/**
153 * Stop announcing the regex specified by the given handle. 153 * Stop announcing the regex specified by the given handle.
154 * 154 *
155 * @param a handle returned by a previous GNUNET_REGEX_announce call. 155 * @param a handle returned by a previous GNUNET_REGEX_announce call.
156 */ 156 */
157void 157void
@@ -172,11 +172,11 @@ struct GNUNET_REGEX_Search
172 */ 172 */
173 struct GNUNET_CLIENT_Connection *client; 173 struct GNUNET_CLIENT_Connection *client;
174 174
175 /** 175 /**
176 * Our configuration. 176 * Our configuration.
177 */ 177 */
178 const struct GNUNET_CONFIGURATION_Handle *cfg; 178 const struct GNUNET_CONFIGURATION_Handle *cfg;
179 179
180 /** 180 /**
181 * Function to call with results. 181 * Function to call with results.
182 */ 182 */
@@ -186,7 +186,7 @@ struct GNUNET_REGEX_Search
186 * Closure for 'callback'. 186 * Closure for 'callback'.
187 */ 187 */
188 void *callback_cls; 188 void *callback_cls;
189 189
190 /** 190 /**
191 * Search message to transmit to the service. 191 * Search message to transmit to the service.
192 */ 192 */
@@ -197,7 +197,7 @@ struct GNUNET_REGEX_Search
197/** 197/**
198 * We got a response or disconnect after asking regex 198 * We got a response or disconnect after asking regex
199 * to do the search. Handle it. 199 * to do the search. Handle it.
200 * 200 *
201 * @param cls the 'struct GNUNET_REGEX_Search' to retry 201 * @param cls the 'struct GNUNET_REGEX_Search' to retry
202 * @param msg NULL on disconnect 202 * @param msg NULL on disconnect
203 */ 203 */
@@ -207,7 +207,7 @@ handle_search_response (void *cls,
207 207
208 208
209/** 209/**
210 * Try sending the search request to regex. On 210 * Try sending the search request to regex. On
211 * errors (i.e. regex died), try again. 211 * errors (i.e. regex died), try again.
212 * 212 *
213 * @param s the search to retry 213 * @param s the search to retry
@@ -229,7 +229,7 @@ retry_search (struct GNUNET_REGEX_Search *s)
229/** 229/**
230 * We got a response or disconnect after asking regex 230 * We got a response or disconnect after asking regex
231 * to do the search. Handle it. 231 * to do the search. Handle it.
232 * 232 *
233 * @param cls the 'struct GNUNET_REGEX_Search' to retry 233 * @param cls the 'struct GNUNET_REGEX_Search' to retry
234 * @param msg NULL on disconnect, otherwise presumably a response 234 * @param msg NULL on disconnect, otherwise presumably a response
235 */ 235 */
@@ -257,7 +257,7 @@ handle_search_response (void *cls,
257 result = (const struct ResultMessage *) msg; 257 result = (const struct ResultMessage *) msg;
258 gpl = ntohs (result->get_path_length); 258 gpl = ntohs (result->get_path_length);
259 ppl = ntohs (result->put_path_length); 259 ppl = ntohs (result->put_path_length);
260 if (size == (sizeof (struct ResultMessage) + 260 if (size == (sizeof (struct ResultMessage) +
261 (gpl + ppl) * sizeof (struct GNUNET_PeerIdentity))) 261 (gpl + ppl) * sizeof (struct GNUNET_PeerIdentity)))
262 { 262 {
263 const struct GNUNET_PeerIdentity *pid; 263 const struct GNUNET_PeerIdentity *pid;
@@ -269,7 +269,7 @@ handle_search_response (void *cls,
269 s->callback (s->callback_cls, 269 s->callback (s->callback_cls,
270 pid, 270 pid,
271 &pid[1], gpl, 271 &pid[1], gpl,
272 &pid[1 + gpl], ppl); 272 &pid[1 + gpl], ppl);
273 return; 273 return;
274 } 274 }
275 } 275 }
@@ -323,7 +323,7 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg,
323 323
324/** 324/**
325 * Stop search and free all data used by a GNUNET_REGEX_search call. 325 * Stop search and free all data used by a GNUNET_REGEX_search call.
326 * 326 *
327 * @param s Handle returned by a previous GNUNET_REGEX_search call. 327 * @param s Handle returned by a previous GNUNET_REGEX_search call.
328 */ 328 */
329void 329void
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c
index af74e89e6..8a1f08290 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -98,7 +98,7 @@ GNUNET_NETWORK_STRUCT_END
98 * @param block block to test 98 * @param block block to test
99 * @param size number of bytes in block 99 * @param size number of bytes in block
100 * @return GNUNET_YES if the block is accepting, GNUNET_NO if not 100 * @return GNUNET_YES if the block is accepting, GNUNET_NO if not
101 */ 101 */
102int 102int
103GNUNET_BLOCK_is_accepting (const struct RegexBlock *block, 103GNUNET_BLOCK_is_accepting (const struct RegexBlock *block,
104 size_t size) 104 size_t size)
@@ -164,7 +164,7 @@ struct CheckEdgeContext
164 * @param token Token that follows to next state. 164 * @param token Token that follows to next state.
165 * @param len Lenght of token. 165 * @param len Lenght of token.
166 * @param key Hash of next state. 166 * @param key Hash of next state.
167 * 167 *
168 * @return GNUNET_YES, to keep iterating 168 * @return GNUNET_YES, to keep iterating
169 */ 169 */
170static int 170static int
@@ -175,7 +175,7 @@ check_edge (void *cls,
175{ 175{
176 struct CheckEdgeContext *ctx = cls; 176 struct CheckEdgeContext *ctx = cls;
177 177
178 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 178 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
179 "edge %.*s [%u]: %s->%s\n", 179 "edge %.*s [%u]: %s->%s\n",
180 (int) len, token, len, GNUNET_h2s(key)); 180 (int) len, token, len, GNUNET_h2s(key));
181 if (NULL == ctx->xquery) 181 if (NULL == ctx->xquery)
@@ -212,7 +212,7 @@ REGEX_BLOCK_check (const struct RegexBlock *block,
212 int res; 212 int res;
213 213
214 LOG (GNUNET_ERROR_TYPE_DEBUG, "Block check\n"); 214 LOG (GNUNET_ERROR_TYPE_DEBUG, "Block check\n");
215 if (GNUNET_OK != 215 if (GNUNET_OK !=
216 REGEX_BLOCK_get_key (block, size, 216 REGEX_BLOCK_get_key (block, size,
217 &key)) 217 &key))
218 { 218 {
@@ -267,17 +267,17 @@ REGEX_BLOCK_get_key (const struct RegexBlock *block,
267 uint16_t num_edges; 267 uint16_t num_edges;
268 size_t total; 268 size_t total;
269 269
270 if (block_len < sizeof (struct RegexBlock)) 270 if (block_len < sizeof (struct RegexBlock))
271 { 271 {
272 GNUNET_break_op (0); 272 GNUNET_break_op (0);
273 return GNUNET_SYSERR; 273 return GNUNET_SYSERR;
274 } 274 }
275 num_destinations = ntohs (block->num_destinations); 275 num_destinations = ntohs (block->num_destinations);
276 num_edges = ntohs (block->num_edges); 276 num_edges = ntohs (block->num_edges);
277 len = ntohs (block->proof_len); 277 len = ntohs (block->proof_len);
278 destinations = (const struct GNUNET_HashCode *) &block[1]; 278 destinations = (const struct GNUNET_HashCode *) &block[1];
279 edges = (const struct EdgeInfo *) &destinations[num_destinations]; 279 edges = (const struct EdgeInfo *) &destinations[num_destinations];
280 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges + sizeof (struct EdgeInfo) + len; 280 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges + sizeof (struct EdgeInfo) + len;
281 if (block_len < total) 281 if (block_len < total)
282 { 282 {
283 GNUNET_break_op (0); 283 GNUNET_break_op (0);
@@ -321,7 +321,7 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block,
321 size_t off; 321 size_t off;
322 322
323 LOG (GNUNET_ERROR_TYPE_DEBUG, "Block iterate\n"); 323 LOG (GNUNET_ERROR_TYPE_DEBUG, "Block iterate\n");
324 if (size < sizeof (struct RegexBlock)) 324 if (size < sizeof (struct RegexBlock))
325 { 325 {
326 GNUNET_break_op (0); 326 GNUNET_break_op (0);
327 return GNUNET_SYSERR; 327 return GNUNET_SYSERR;
@@ -333,14 +333,14 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block,
333 edges = (const struct EdgeInfo *) &destinations[num_destinations]; 333 edges = (const struct EdgeInfo *) &destinations[num_destinations];
334 aux = (const char *) &edges[num_edges]; 334 aux = (const char *) &edges[num_edges];
335 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges * sizeof (struct EdgeInfo) + len; 335 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges * sizeof (struct EdgeInfo) + len;
336 if (size < total) 336 if (size < total)
337 { 337 {
338 GNUNET_break_op (0); 338 GNUNET_break_op (0);
339 return GNUNET_SYSERR; 339 return GNUNET_SYSERR;
340 } 340 }
341 for (n=0;n<num_edges;n++) 341 for (n=0;n<num_edges;n++)
342 total += ntohs (edges[n].token_length); 342 total += ntohs (edges[n].token_length);
343 if (size != total) 343 if (size != total)
344 { 344 {
345 fprintf (stderr, "Expected %u, got %u\n", 345 fprintf (stderr, "Expected %u, got %u\n",
346 (unsigned int) size, 346 (unsigned int) size,
@@ -360,8 +360,8 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block,
360 ntohs (edges[n].token_length), ntohs (edges[n].token_length), 360 ntohs (edges[n].token_length), ntohs (edges[n].token_length),
361 &aux[off]); 361 &aux[off]);
362 if (NULL != iterator) 362 if (NULL != iterator)
363 if (GNUNET_NO == iterator (iter_cls, 363 if (GNUNET_NO == iterator (iter_cls,
364 &aux[off], 364 &aux[off],
365 ntohs (edges[n].token_length), 365 ntohs (edges[n].token_length),
366 &destinations[ntohs (edges[n].destination_index)])) 366 &destinations[ntohs (edges[n].destination_index)]))
367 return GNUNET_OK; 367 return GNUNET_OK;
@@ -403,7 +403,7 @@ REGEX_BLOCK_create (const char *proof,
403 char *aux; 403 char *aux;
404 404
405 len = strlen (proof); 405 len = strlen (proof);
406 if (len > UINT16_MAX) 406 if (len > UINT16_MAX)
407 { 407 {
408 GNUNET_break (0); 408 GNUNET_break (0);
409 return NULL; 409 return NULL;
@@ -413,7 +413,7 @@ REGEX_BLOCK_create (const char *proof,
413 for (i=0;i<num_edges;i++) 413 for (i=0;i<num_edges;i++)
414 { 414 {
415 slen = strlen (edges[i].label); 415 slen = strlen (edges[i].label);
416 if (slen > UINT16_MAX) 416 if (slen > UINT16_MAX)
417 { 417 {
418 GNUNET_break (0); 418 GNUNET_break (0);
419 return NULL; 419 return NULL;
@@ -449,7 +449,7 @@ REGEX_BLOCK_create (const char *proof,
449 edgeinfos = (struct EdgeInfo *) &dests[unique_destinations]; 449 edgeinfos = (struct EdgeInfo *) &dests[unique_destinations];
450 aux = (char *) &edgeinfos[num_edges]; 450 aux = (char *) &edgeinfos[num_edges];
451 off = len; 451 off = len;
452 memcpy (aux, proof, len); 452 memcpy (aux, proof, len);
453 for (i=0;i<num_edges;i++) 453 for (i=0;i<num_edges;i++)
454 { 454 {
455 slen = strlen (edges[i].label); 455 slen = strlen (edges[i].label);
diff --git a/src/regex/regex_block_lib.h b/src/regex/regex_block_lib.h
index 28da934e3..4ea4c0765 100644
--- a/src/regex/regex_block_lib.h
+++ b/src/regex/regex_block_lib.h
@@ -106,7 +106,7 @@ REGEX_BLOCK_check (const struct RegexBlock *block,
106 * @param cls Closure. 106 * @param cls Closure.
107 * @param token Token that follows to next state. 107 * @param token Token that follows to next state.
108 * @param len Length of token. 108 * @param len Length of token.
109 * @param key Hash of next state. 109 * @param key Hash of next state.
110 * 110 *
111 * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise. 111 * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise.
112 */ 112 */
@@ -158,7 +158,7 @@ REGEX_BLOCK_get_key (const struct RegexBlock *block,
158 * @param block block to test 158 * @param block block to test
159 * @param size number of bytes in block 159 * @param size number of bytes in block
160 * @return GNUNET_YES if the block is accepting, GNUNET_NO if not 160 * @return GNUNET_YES if the block is accepting, GNUNET_NO if not
161 */ 161 */
162int 162int
163GNUNET_BLOCK_is_accepting (const struct RegexBlock *block, 163GNUNET_BLOCK_is_accepting (const struct RegexBlock *block,
164 size_t block_len); 164 size_t block_len);
diff --git a/src/regex/regex_internal.c b/src/regex/regex_internal.c
index 6789b2f72..4e0d5acc5 100644
--- a/src/regex/regex_internal.c
+++ b/src/regex/regex_internal.c
@@ -552,7 +552,7 @@ struct StringBuffer
552 * Allocated buffer. 552 * Allocated buffer.
553 */ 553 */
554 char *abuf; 554 char *abuf;
555 555
556 /** 556 /**
557 * Length of the string in the buffer. 557 * Length of the string in the buffer.
558 */ 558 */
@@ -575,10 +575,10 @@ struct StringBuffer
575 * change). This is used in an optimization that improves 575 * change). This is used in an optimization that improves
576 * performance by about 1% --- if we use int16_t here. With just 576 * performance by about 1% --- if we use int16_t here. With just
577 * "int" for both flags, performance drops (on my system) significantly, 577 * "int" for both flags, performance drops (on my system) significantly,
578 * most likely due to increased cache misses. 578 * most likely due to increased cache misses.
579 */ 579 */
580 int16_t synced; 580 int16_t synced;
581 581
582}; 582};
583 583
584 584
@@ -604,10 +604,10 @@ sb_nullstrcmp (const struct StringBuffer *s1,
604 return -1; 604 return -1;
605 return memcmp (s1->sbuf, s2->sbuf, s1->slen); 605 return memcmp (s1->sbuf, s2->sbuf, s1->slen);
606} 606}
607 607
608 608
609/** 609/**
610 * Compare two strings for equality. 610 * Compare two strings for equality.
611 * 611 *
612 * @param s1 first string for comparison. 612 * @param s1 first string for comparison.
613 * @param s2 second string for comparison. 613 * @param s2 second string for comparison.
@@ -622,7 +622,7 @@ sb_strcmp (const struct StringBuffer *s1,
622 return -1; 622 return -1;
623 return memcmp (s1->sbuf, s2->sbuf, s1->slen); 623 return memcmp (s1->sbuf, s2->sbuf, s1->slen);
624} 624}
625 625
626 626
627/** 627/**
628 * Reallocate the buffer of 'ret' to fit 'nlen' characters; 628 * Reallocate the buffer of 'ret' to fit 'nlen' characters;
@@ -647,7 +647,7 @@ sb_realloc (struct StringBuffer *ret,
647 ret->sbuf = ret->abuf; 647 ret->sbuf = ret->abuf;
648 GNUNET_free_non_null (old); 648 GNUNET_free_non_null (old);
649} 649}
650 650
651 651
652/** 652/**
653 * Append a string. 653 * Append a string.
@@ -669,7 +669,7 @@ sb_append (struct StringBuffer *ret,
669 sarg->slen); 669 sarg->slen);
670 ret->slen += sarg->slen; 670 ret->slen += sarg->slen;
671} 671}
672 672
673 673
674/** 674/**
675 * Append a C string. 675 * Append a C string.
@@ -693,7 +693,7 @@ sb_append_cstr (struct StringBuffer *ret,
693 cstr_len); 693 cstr_len);
694 ret->slen += cstr_len; 694 ret->slen += cstr_len;
695} 695}
696 696
697 697
698/** 698/**
699 * Wrap a string buffer, that is, set ret to the format string 699 * Wrap a string buffer, that is, set ret to the format string
@@ -854,7 +854,7 @@ sb_free (struct StringBuffer *sb)
854static void 854static void
855sb_strdup (struct StringBuffer *out, 855sb_strdup (struct StringBuffer *out,
856 const struct StringBuffer *in) 856 const struct StringBuffer *in)
857 857
858{ 858{
859 out->null_flag = in->null_flag; 859 out->null_flag = in->null_flag;
860 if (GNUNET_YES == out->null_flag) 860 if (GNUNET_YES == out->null_flag)
@@ -935,7 +935,7 @@ needs_parentheses (const struct StringBuffer *str)
935 } 935 }
936 /* while '(' before ')', count opening parens */ 936 /* while '(' before ')', count opening parens */
937 while ( (NULL != (op = memchr (pos, '(', end - pos))) && 937 while ( (NULL != (op = memchr (pos, '(', end - pos))) &&
938 (op < cl) ) 938 (op < cl) )
939 { 939 {
940 cnt++; 940 cnt++;
941 pos = op + 1; 941 pos = op + 1;
@@ -971,7 +971,7 @@ remove_parentheses (struct StringBuffer *str)
971 if (0) 971 if (0)
972 return; 972 return;
973 sbuf = str->sbuf; 973 sbuf = str->sbuf;
974 if ( (GNUNET_YES == str->null_flag) || 974 if ( (GNUNET_YES == str->null_flag) ||
975 (1 >= (slen = str->slen)) || 975 (1 >= (slen = str->slen)) ||
976 ('(' != str->sbuf[0]) || 976 ('(' != str->sbuf[0]) ||
977 (')' != str->sbuf[slen - 1]) ) 977 (')' != str->sbuf[slen - 1]) )
@@ -981,7 +981,7 @@ remove_parentheses (struct StringBuffer *str)
981 end = &sbuf[slen - 1]; 981 end = &sbuf[slen - 1];
982 op = memchr (pos, '(', end - pos); 982 op = memchr (pos, '(', end - pos);
983 cp = memchr (pos, ')', end - pos); 983 cp = memchr (pos, ')', end - pos);
984 while (NULL != cp) 984 while (NULL != cp)
985 { 985 {
986 while ( (NULL != op) && 986 while ( (NULL != op) &&
987 (op < cp) ) 987 (op < cp) )
@@ -1007,7 +1007,7 @@ remove_parentheses (struct StringBuffer *str)
1007 return; 1007 return;
1008 } 1008 }
1009 str->sbuf++; 1009 str->sbuf++;
1010 str->slen -= 2; 1010 str->slen -= 2;
1011} 1011}
1012 1012
1013 1013
@@ -1022,10 +1022,10 @@ remove_parentheses (struct StringBuffer *str)
1022static int 1022static int
1023has_epsilon (const struct StringBuffer *str) 1023has_epsilon (const struct StringBuffer *str)
1024{ 1024{
1025 return 1025 return
1026 (GNUNET_YES != str->null_flag) && 1026 (GNUNET_YES != str->null_flag) &&
1027 (0 < str->slen) && 1027 (0 < str->slen) &&
1028 ('(' == str->sbuf[0]) && 1028 ('(' == str->sbuf[0]) &&
1029 ('|' == str->sbuf[1]) && 1029 ('|' == str->sbuf[1]) &&
1030 (')' == str->sbuf[str->slen - 1]); 1030 (')' == str->sbuf[str->slen - 1]);
1031} 1031}
@@ -1048,8 +1048,8 @@ remove_epsilon (const struct StringBuffer *str,
1048 { 1048 {
1049 ret->null_flag = GNUNET_YES; 1049 ret->null_flag = GNUNET_YES;
1050 return; 1050 return;
1051 } 1051 }
1052 if ( (str->slen > 1) && 1052 if ( (str->slen > 1) &&
1053 ('(' == str->sbuf[0]) && 1053 ('(' == str->sbuf[0]) &&
1054 ('|' == str->sbuf[1]) && 1054 ('|' == str->sbuf[1]) &&
1055 (')' == str->sbuf[str->slen - 1]) ) 1055 (')' == str->sbuf[str->slen - 1]) )
@@ -1080,11 +1080,11 @@ remove_epsilon (const struct StringBuffer *str,
1080 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise 1080 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise
1081 */ 1081 */
1082static int 1082static int
1083sb_strncmp (const struct StringBuffer *str1, 1083sb_strncmp (const struct StringBuffer *str1,
1084 const struct StringBuffer *str2, size_t n) 1084 const struct StringBuffer *str2, size_t n)
1085{ 1085{
1086 size_t max; 1086 size_t max;
1087 1087
1088 if ( (str1->slen != str2->slen) && 1088 if ( (str1->slen != str2->slen) &&
1089 ( (str1->slen < n) || 1089 ( (str1->slen < n) ||
1090 (str2->slen < n) ) ) 1090 (str2->slen < n) ) )
@@ -1106,17 +1106,17 @@ sb_strncmp (const struct StringBuffer *str1,
1106 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise 1106 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise
1107 */ 1107 */
1108static int 1108static int
1109sb_strncmp_cstr (const struct StringBuffer *str1, 1109sb_strncmp_cstr (const struct StringBuffer *str1,
1110 const char *str2, size_t n) 1110 const char *str2, size_t n)
1111{ 1111{
1112 if (str1->slen < n) 1112 if (str1->slen < n)
1113 return -1; 1113 return -1;
1114 return memcmp (str1->sbuf, str2, n); 1114 return memcmp (str1->sbuf, str2, n);
1115} 1115}
1116 1116
1117 1117
1118/** 1118/**
1119 * Initialize string buffer for storing strings of up to n 1119 * Initialize string buffer for storing strings of up to n
1120 * characters. 1120 * characters.
1121 * 1121 *
1122 * @param sb buffer to initialize 1122 * @param sb buffer to initialize
@@ -1143,7 +1143,7 @@ sb_init (struct StringBuffer *sb,
1143 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise 1143 * @return -1 if any of the strings is NULL, 0 if equal, non 0 otherwise
1144 */ 1144 */
1145static int 1145static int
1146sb_strkcmp (const struct StringBuffer *str1, 1146sb_strkcmp (const struct StringBuffer *str1,
1147 const struct StringBuffer *str2, size_t k) 1147 const struct StringBuffer *str2, size_t k)
1148{ 1148{
1149 if ( (GNUNET_YES == str1->null_flag) || 1149 if ( (GNUNET_YES == str1->null_flag) ||
@@ -1196,7 +1196,7 @@ number_states (void *cls, const unsigned int count,
1196 * @param R_cur_r optimization -- kept between iterations to avoid realloc 1196 * @param R_cur_r optimization -- kept between iterations to avoid realloc
1197 */ 1197 */
1198static void 1198static void
1199automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, 1199automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1200 const struct StringBuffer *R_last_ik, 1200 const struct StringBuffer *R_last_ik,
1201 const struct StringBuffer *R_last_kk, 1201 const struct StringBuffer *R_last_kk,
1202 const struct StringBuffer *R_last_kj, 1202 const struct StringBuffer *R_last_kj,
@@ -1227,8 +1227,8 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1227 * R_cur_r == R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} 1227 * R_cur_r == R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj}
1228 */ 1228 */
1229 1229
1230 if ( (GNUNET_YES == R_last_ij->null_flag) && 1230 if ( (GNUNET_YES == R_last_ij->null_flag) &&
1231 ( (GNUNET_YES == R_last_ik->null_flag) || 1231 ( (GNUNET_YES == R_last_ik->null_flag) ||
1232 (GNUNET_YES == R_last_kj->null_flag))) 1232 (GNUNET_YES == R_last_kj->null_flag)))
1233 { 1233 {
1234 /* R^{(k)}_{ij} = N | N */ 1234 /* R^{(k)}_{ij} = N | N */
@@ -1237,13 +1237,13 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1237 return; 1237 return;
1238 } 1238 }
1239 1239
1240 if ( (GNUNET_YES == R_last_ik->null_flag) || 1240 if ( (GNUNET_YES == R_last_ik->null_flag) ||
1241 (GNUNET_YES == R_last_kj->null_flag) ) 1241 (GNUNET_YES == R_last_kj->null_flag) )
1242 { 1242 {
1243 /* R^{(k)}_{ij} = R^{(k-1)}_{ij} | N */ 1243 /* R^{(k)}_{ij} = R^{(k-1)}_{ij} | N */
1244 if (GNUNET_YES == R_last_ij->synced) 1244 if (GNUNET_YES == R_last_ij->synced)
1245 { 1245 {
1246 R_cur_ij->synced = GNUNET_YES; 1246 R_cur_ij->synced = GNUNET_YES;
1247 R_cur_ij->null_flag = GNUNET_NO; 1247 R_cur_ij->null_flag = GNUNET_NO;
1248 return; 1248 return;
1249 } 1249 }
@@ -1256,10 +1256,10 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1256 /* $R^{(k)}_{ij} = N | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} OR 1256 /* $R^{(k)}_{ij} = N | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} OR
1257 * $R^{(k)}_{ij} = R^{(k-1)}_{ij} | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} */ 1257 * $R^{(k)}_{ij} = R^{(k-1)}_{ij} | R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} */
1258 1258
1259 R_cur_r->null_flag = GNUNET_YES; 1259 R_cur_r->null_flag = GNUNET_YES;
1260 R_cur_r->slen = 0; 1260 R_cur_r->slen = 0;
1261 R_cur_l->null_flag = GNUNET_YES; 1261 R_cur_l->null_flag = GNUNET_YES;
1262 R_cur_l->slen = 0; 1262 R_cur_l->slen = 0;
1263 1263
1264 /* cache results from strcmp, we might need these many times */ 1264 /* cache results from strcmp, we might need these many times */
1265 ij_kj_cmp = sb_nullstrcmp (R_last_ij, R_last_kj); 1265 ij_kj_cmp = sb_nullstrcmp (R_last_ij, R_last_kj);
@@ -1291,8 +1291,8 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1291 remove_epsilon (R_last_ij, &R_temp_ij); 1291 remove_epsilon (R_last_ij, &R_temp_ij);
1292 remove_parentheses (&R_temp_ij); 1292 remove_parentheses (&R_temp_ij);
1293 1293
1294 if ( (0 == sb_strcmp (&R_temp_ij, &R_temp_ik)) && 1294 if ( (0 == sb_strcmp (&R_temp_ij, &R_temp_ik)) &&
1295 (0 == sb_strcmp (&R_temp_ik, &R_temp_kk)) && 1295 (0 == sb_strcmp (&R_temp_ik, &R_temp_kk)) &&
1296 (0 == sb_strcmp (&R_temp_kk, &R_temp_kj)) ) 1296 (0 == sb_strcmp (&R_temp_kk, &R_temp_kj)) )
1297 { 1297 {
1298 if (0 == R_temp_ij.slen) 1298 if (0 == R_temp_ij.slen)
@@ -1395,16 +1395,16 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1395 length = R_temp_kk.slen - R_last_ik->slen; 1395 length = R_temp_kk.slen - R_last_ik->slen;
1396 1396
1397 /* a(ba)*bx = (ab)+x */ 1397 /* a(ba)*bx = (ab)+x */
1398 if ( (length > 0) && 1398 if ( (length > 0) &&
1399 (GNUNET_YES != R_last_kk->null_flag) && 1399 (GNUNET_YES != R_last_kk->null_flag) &&
1400 (0 < R_last_kk->slen) && 1400 (0 < R_last_kk->slen) &&
1401 (GNUNET_YES != R_last_kj->null_flag) && 1401 (GNUNET_YES != R_last_kj->null_flag) &&
1402 (0 < R_last_kj->slen) && 1402 (0 < R_last_kj->slen) &&
1403 (GNUNET_YES != R_last_ik->null_flag) && 1403 (GNUNET_YES != R_last_ik->null_flag) &&
1404 (0 < R_last_ik->slen) && 1404 (0 < R_last_ik->slen) &&
1405 (0 == sb_strkcmp (&R_temp_kk, R_last_ik, length)) && 1405 (0 == sb_strkcmp (&R_temp_kk, R_last_ik, length)) &&
1406 (0 == sb_strncmp (&R_temp_kk, R_last_kj, length)) ) 1406 (0 == sb_strncmp (&R_temp_kk, R_last_kj, length)) )
1407 { 1407 {
1408 struct StringBuffer temp_a; 1408 struct StringBuffer temp_a;
1409 struct StringBuffer temp_b; 1409 struct StringBuffer temp_b;
1410 1410
@@ -1452,7 +1452,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1452 sb_printf1 (R_cur_r, "%.*s*", 1, &R_temp_kk); 1452 sb_printf1 (R_cur_r, "%.*s*", 1, &R_temp_kk);
1453 } 1453 }
1454 /* aa*a = a+a */ 1454 /* aa*a = a+a */
1455 else if ( (0 == clean_ik_kk_cmp) && 1455 else if ( (0 == clean_ik_kk_cmp) &&
1456 (0 == clean_kk_kj_cmp) && 1456 (0 == clean_kk_kj_cmp) &&
1457 (! has_epsilon (R_last_ik)) ) 1457 (! has_epsilon (R_last_ik)) )
1458 { 1458 {
@@ -1550,7 +1550,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1550 sb_free (&R_temp_kk); 1550 sb_free (&R_temp_kk);
1551 sb_free (&R_temp_kj); 1551 sb_free (&R_temp_kj);
1552 1552
1553 if ( (GNUNET_YES == R_cur_l->null_flag) && 1553 if ( (GNUNET_YES == R_cur_l->null_flag) &&
1554 (GNUNET_YES == R_cur_r->null_flag) ) 1554 (GNUNET_YES == R_cur_r->null_flag) )
1555 { 1555 {
1556 R_cur_ij->null_flag = GNUNET_YES; 1556 R_cur_ij->null_flag = GNUNET_YES;
@@ -1670,7 +1670,7 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a)
1670 for (i = 0; i < n; i++) 1670 for (i = 0; i < n; i++)
1671 for (j = 0; j < n; j++) 1671 for (j = 0; j < n; j++)
1672 if (needs_parentheses (&R_last[i * n + j])) 1672 if (needs_parentheses (&R_last[i * n + j]))
1673 sb_wrap (&R_last[i * n + j], "(%.*s)", 2); 1673 sb_wrap (&R_last[i * n + j], "(%.*s)", 2);
1674 /* Compute regular expressions of length "k" between each pair of states per 1674 /* Compute regular expressions of length "k" between each pair of states per
1675 * induction */ 1675 * induction */
1676 memset (&R_cur_l, 0, sizeof (struct StringBuffer)); 1676 memset (&R_cur_l, 0, sizeof (struct StringBuffer));
@@ -1726,14 +1726,14 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a)
1726 if ( (0 == complete_regex.slen) && 1726 if ( (0 == complete_regex.slen) &&
1727 (0 < R_last[a->start->dfs_id * n + i].slen) ) 1727 (0 < R_last[a->start->dfs_id * n + i].slen) )
1728 { 1728 {
1729 sb_append (&complete_regex, 1729 sb_append (&complete_regex,
1730 &R_last[a->start->dfs_id * n + i]); 1730 &R_last[a->start->dfs_id * n + i]);
1731 } 1731 }
1732 else if ( (GNUNET_YES != R_last[a->start->dfs_id * n + i].null_flag) && 1732 else if ( (GNUNET_YES != R_last[a->start->dfs_id * n + i].null_flag) &&
1733 (0 < R_last[a->start->dfs_id * n + i].slen) ) 1733 (0 < R_last[a->start->dfs_id * n + i].slen) )
1734 { 1734 {
1735 sb_append_cstr (&complete_regex, "|"); 1735 sb_append_cstr (&complete_regex, "|");
1736 sb_append (&complete_regex, 1736 sb_append (&complete_regex,
1737 &R_last[a->start->dfs_id * n + i]); 1737 &R_last[a->start->dfs_id * n + i]);
1738 } 1738 }
1739 } 1739 }
@@ -1742,11 +1742,11 @@ automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a)
1742 1742
1743 /* cleanup */ 1743 /* cleanup */
1744 sb_free (&complete_regex); 1744 sb_free (&complete_regex);
1745 for (i = 0; i < n; i++) 1745 for (i = 0; i < n; i++)
1746 for (j = 0; j < n; j++) 1746 for (j = 0; j < n; j++)
1747 { 1747 {
1748 sb_free (&R_cur[i * n + j]); 1748 sb_free (&R_cur[i * n + j]);
1749 sb_free (&R_last[i * n + j]); 1749 sb_free (&R_last[i * n + j]);
1750 } 1750 }
1751 GNUNET_free (R_cur); 1751 GNUNET_free (R_cur);
1752 GNUNET_free (R_last); 1752 GNUNET_free (R_last);
@@ -1804,15 +1804,15 @@ dfa_state_create (struct REGEX_INTERNAL_Context *ctx,
1804 pos += strlen (pos); 1804 pos += strlen (pos);
1805 1805
1806 /* Add a transition for each distinct label to NULL state */ 1806 /* Add a transition for each distinct label to NULL state */
1807 for (ctran = cstate->transitions_head; NULL != ctran; ctran = ctran->next) 1807 for (ctran = cstate->transitions_head; NULL != ctran; ctran = ctran->next)
1808 if (NULL != ctran->label) 1808 if (NULL != ctran->label)
1809 state_add_transition (ctx, s, ctran->label, NULL); 1809 state_add_transition (ctx, s, ctran->label, NULL);
1810 1810
1811 /* If the nfa_states contain an accepting state, the new dfa state is also 1811 /* If the nfa_states contain an accepting state, the new dfa state is also
1812 * accepting. */ 1812 * accepting. */
1813 if (cstate->accepting) 1813 if (cstate->accepting)
1814 s->accepting = 1; 1814 s->accepting = 1;
1815 } 1815 }
1816 pos[-1] = '}'; 1816 pos[-1] = '}';
1817 s->name = GNUNET_realloc (s->name, strlen (s->name) + 1); 1817 s->name = GNUNET_realloc (s->name, strlen (s->name) + 1);
1818 1818
@@ -2495,7 +2495,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret,
2495 /* Add start state to closure only for epsilon closure */ 2495 /* Add start state to closure only for epsilon closure */
2496 if (NULL == label) 2496 if (NULL == label)
2497 state_set_append (ret, s); 2497 state_set_append (ret, s);
2498 2498
2499 /* initialize work stack */ 2499 /* initialize work stack */
2500 cls_stack.head = NULL; 2500 cls_stack.head = NULL;
2501 cls_stack.tail = NULL; 2501 cls_stack.tail = NULL;
@@ -2506,7 +2506,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret,
2506 { 2506 {
2507 GNUNET_CONTAINER_MDLL_remove (ST, cls_stack.head, cls_stack.tail, 2507 GNUNET_CONTAINER_MDLL_remove (ST, cls_stack.head, cls_stack.tail,
2508 currentstate); 2508 currentstate);
2509 cls_stack.len--; 2509 cls_stack.len--;
2510 for (ctran = currentstate->transitions_head; NULL != ctran; 2510 for (ctran = currentstate->transitions_head; NULL != ctran;
2511 ctran = ctran->next) 2511 ctran = ctran->next)
2512 { 2512 {
@@ -2521,7 +2521,7 @@ nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret,
2521 clsstate); 2521 clsstate);
2522 cls_stack.len++; 2522 cls_stack.len++;
2523 clsstate->contained = 1; 2523 clsstate->contained = 1;
2524 } 2524 }
2525 } 2525 }
2526 } 2526 }
2527 for (i = 0; i < ret->off; i++) 2527 for (i = 0; i < ret->off; i++)
@@ -3429,9 +3429,9 @@ REGEX_INTERNAL_iterate_all_edges (struct REGEX_INTERNAL_Automaton *a,
3429 unsigned int num_edges; 3429 unsigned int num_edges;
3430 3430
3431 num_edges = state_get_edges (s, edges); 3431 num_edges = state_get_edges (s, edges);
3432 if ( ( (NULL != s->proof) && 3432 if ( ( (NULL != s->proof) &&
3433 (0 < strlen (s->proof)) ) || s->accepting) 3433 (0 < strlen (s->proof)) ) || s->accepting)
3434 iterator (iterator_cls, &s->hash, s->proof, 3434 iterator (iterator_cls, &s->hash, s->proof,
3435 s->accepting, 3435 s->accepting,
3436 num_edges, edges); 3436 num_edges, edges);
3437 s->marked = GNUNET_NO; 3437 s->marked = GNUNET_NO;
@@ -3439,7 +3439,7 @@ REGEX_INTERNAL_iterate_all_edges (struct REGEX_INTERNAL_Automaton *a,
3439 3439
3440 iterate_initial_edge (GNUNET_REGEX_INITIAL_BYTES, 3440 iterate_initial_edge (GNUNET_REGEX_INITIAL_BYTES,
3441 GNUNET_REGEX_INITIAL_BYTES, 3441 GNUNET_REGEX_INITIAL_BYTES,
3442 NULL, a->start, 3442 NULL, a->start,
3443 iterator, iterator_cls); 3443 iterator, iterator_cls);
3444} 3444}
3445 3445
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index ef0155177..55ca426cb 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -121,7 +121,7 @@ regex_iterator (void *cls,
121 ab.purpose.purpose = ntohl (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT); 121 ab.purpose.purpose = ntohl (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT);
122 ab.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_DHT_MAX_EXPIRATION)); 122 ab.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_DHT_MAX_EXPIRATION));
123 ab.key = *key; 123 ab.key = *key;
124 GNUNET_CRYPTO_ecc_key_get_public_for_signature (h->priv, 124 GNUNET_CRYPTO_ecc_key_get_public_for_signature (h->priv,
125 &ab.peer.public_key); 125 &ab.peer.public_key);
126 GNUNET_assert (GNUNET_OK == 126 GNUNET_assert (GNUNET_OK ==
127 GNUNET_CRYPTO_ecc_sign (h->priv, 127 GNUNET_CRYPTO_ecc_sign (h->priv,
@@ -151,7 +151,7 @@ regex_iterator (void *cls,
151 GNUNET_DHT_put (h->dht, key, 151 GNUNET_DHT_put (h->dht, key,
152 DHT_REPLICATION, 152 DHT_REPLICATION,
153 DHT_OPT, 153 DHT_OPT,
154 GNUNET_BLOCK_TYPE_REGEX, 154 GNUNET_BLOCK_TYPE_REGEX,
155 size, block, 155 size, block,
156 GNUNET_TIME_relative_to_absolute (DHT_TTL), 156 GNUNET_TIME_relative_to_absolute (DHT_TTL),
157 DHT_TTL, 157 DHT_TTL,
@@ -167,13 +167,13 @@ regex_iterator (void *cls,
167/** 167/**
168 * Announce a regular expression: put all states of the automaton in the DHT. 168 * Announce a regular expression: put all states of the automaton in the DHT.
169 * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that. 169 * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that.
170 * 170 *
171 * @param dht An existing and valid DHT service handle. CANNOT be NULL. 171 * @param dht An existing and valid DHT service handle. CANNOT be NULL.
172 * @param priv our private key, must remain valid until the announcement is cancelled 172 * @param priv our private key, must remain valid until the announcement is cancelled
173 * @param regex Regular expression to announce. 173 * @param regex Regular expression to announce.
174 * @param compression How many characters per edge can we squeeze? 174 * @param compression How many characters per edge can we squeeze?
175 * @param stats Optional statistics handle to report usage. Can be NULL. 175 * @param stats Optional statistics handle to report usage. Can be NULL.
176 * 176 *
177 * @return Handle to reuse o free cached resources. 177 * @return Handle to reuse o free cached resources.
178 * Must be freed by calling REGEX_INTERNAL_announce_cancel. 178 * Must be freed by calling REGEX_INTERNAL_announce_cancel.
179 */ 179 */
@@ -201,14 +201,14 @@ REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht,
201/** 201/**
202 * Announce again a regular expression previously announced. 202 * Announce again a regular expression previously announced.
203 * Does use caching to speed up process. 203 * Does use caching to speed up process.
204 * 204 *
205 * @param h Handle returned by a previous REGEX_INTERNAL_announce call. 205 * @param h Handle returned by a previous REGEX_INTERNAL_announce call.
206 */ 206 */
207void 207void
208REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h) 208REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h)
209{ 209{
210 GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */ 210 GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */
211 LOG (GNUNET_ERROR_TYPE_INFO, 211 LOG (GNUNET_ERROR_TYPE_INFO,
212 "REGEX_INTERNAL_reannounce: %s\n", 212 "REGEX_INTERNAL_reannounce: %s\n",
213 h->regex); 213 h->regex);
214 REGEX_INTERNAL_iterate_reachable_edges (h->dfa, &regex_iterator, h); 214 REGEX_INTERNAL_iterate_reachable_edges (h->dfa, &regex_iterator, h);
@@ -218,7 +218,7 @@ REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h)
218/** 218/**
219 * Clear all cached data used by a regex announce. 219 * Clear all cached data used by a regex announce.
220 * Does not close DHT connection. 220 * Does not close DHT connection.
221 * 221 *
222 * @param h Handle returned by a previous REGEX_INTERNAL_announce call. 222 * @param h Handle returned by a previous REGEX_INTERNAL_announce call.
223 */ 223 */
224void 224void
@@ -264,7 +264,7 @@ struct RegexSearchContext
264 264
265/** 265/**
266 * Type of values in 'dht_get_results'. 266 * Type of values in 'dht_get_results'.
267 */ 267 */
268struct Result 268struct Result
269{ 269{
270 /** 270 /**
@@ -306,7 +306,7 @@ struct REGEX_INTERNAL_Search
306 struct GNUNET_CONTAINER_MultiHashMap *dht_get_handles; 306 struct GNUNET_CONTAINER_MultiHashMap *dht_get_handles;
307 307
308 /** 308 /**
309 * Results from running DHT GETs, values are of type 309 * Results from running DHT GETs, values are of type
310 * 'struct Result'. 310 * 'struct Result'.
311 */ 311 */
312 struct GNUNET_CONTAINER_MultiHashMap *dht_get_results; 312 struct GNUNET_CONTAINER_MultiHashMap *dht_get_results;
@@ -320,7 +320,7 @@ struct REGEX_INTERNAL_Search
320 * Number of contexts (branches/steps in search). 320 * Number of contexts (branches/steps in search).
321 */ 321 */
322 unsigned int n_contexts; 322 unsigned int n_contexts;
323 323
324 /** 324 /**
325 * @param callback Callback for found peers. 325 * @param callback Callback for found peers.
326 */ 326 */
@@ -375,14 +375,14 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp,
375 struct RegexSearchContext *ctx = cls; 375 struct RegexSearchContext *ctx = cls;
376 struct REGEX_INTERNAL_Search *info = ctx->info; 376 struct REGEX_INTERNAL_Search *info = ctx->info;
377 377
378 LOG (GNUNET_ERROR_TYPE_DEBUG, 378 LOG (GNUNET_ERROR_TYPE_DEBUG,
379 "Regex result accept for %s (key %s)\n", 379 "Regex result accept for %s (key %s)\n",
380 info->description, GNUNET_h2s(key)); 380 info->description, GNUNET_h2s(key));
381 381
382 GNUNET_STATISTICS_update (info->stats, 382 GNUNET_STATISTICS_update (info->stats,
383 "# regex accepting blocks found", 383 "# regex accepting blocks found",
384 1, GNUNET_NO); 384 1, GNUNET_NO);
385 GNUNET_STATISTICS_update (info->stats, 385 GNUNET_STATISTICS_update (info->stats,
386 "# regex accepting block bytes found", 386 "# regex accepting block bytes found",
387 size, GNUNET_NO); 387 size, GNUNET_NO);
388 info->callback (info->callback_cls, 388 info->callback (info->callback_cls,
@@ -395,7 +395,7 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp,
395/** 395/**
396 * Find a path to a peer that offers a regex servcie compatible 396 * Find a path to a peer that offers a regex servcie compatible
397 * with a given string. 397 * with a given string.
398 * 398 *
399 * @param key The key of the accepting state. 399 * @param key The key of the accepting state.
400 * @param ctx Context containing info about the string, tunnel, etc. 400 * @param ctx Context containing info about the string, tunnel, etc.
401 */ 401 */
@@ -457,7 +457,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp,
457 size_t len; 457 size_t len;
458 struct Result *copy; 458 struct Result *copy;
459 459
460 LOG (GNUNET_ERROR_TYPE_INFO, 460 LOG (GNUNET_ERROR_TYPE_INFO,
461 "DHT GET result for %s (%s)\n", 461 "DHT GET result for %s (%s)\n",
462 GNUNET_h2s (key), ctx->info->description); 462 GNUNET_h2s (key), ctx->info->description);
463 copy = GNUNET_malloc (sizeof (struct Result) + size); 463 copy = GNUNET_malloc (sizeof (struct Result) + size);
@@ -503,18 +503,18 @@ regex_result_iterator (void *cls,
503 const struct RegexBlock *block = result->data; 503 const struct RegexBlock *block = result->data;
504 struct RegexSearchContext *ctx = cls; 504 struct RegexSearchContext *ctx = cls;
505 505
506 if ( (GNUNET_YES == 506 if ( (GNUNET_YES ==
507 GNUNET_BLOCK_is_accepting (block, result->size)) && 507 GNUNET_BLOCK_is_accepting (block, result->size)) &&
508 (ctx->position == strlen (ctx->info->description)) ) 508 (ctx->position == strlen (ctx->info->description)) )
509 { 509 {
510 LOG (GNUNET_ERROR_TYPE_INFO, 510 LOG (GNUNET_ERROR_TYPE_INFO,
511 "Found accepting known block\n"); 511 "Found accepting known block\n");
512 regex_find_path (key, ctx); 512 regex_find_path (key, ctx);
513 return GNUNET_YES; // We found an accept state! 513 return GNUNET_YES; // We found an accept state!
514 } 514 }
515 LOG (GNUNET_ERROR_TYPE_DEBUG, 515 LOG (GNUNET_ERROR_TYPE_DEBUG,
516 "* %u, %u, [%u]\n", 516 "* %u, %u, [%u]\n",
517 ctx->position, 517 ctx->position,
518 strlen (ctx->info->description), 518 strlen (ctx->info->description),
519 GNUNET_BLOCK_is_accepting (block, result->size)); 519 GNUNET_BLOCK_is_accepting (block, result->size));
520 regex_next_edge (block, result->size, ctx); 520 regex_next_edge (block, result->size, ctx);
@@ -554,12 +554,12 @@ regex_edge_iterator (void *cls,
554 if (len > current_len) 554 if (len > current_len)
555 { 555 {
556 LOG (GNUNET_ERROR_TYPE_DEBUG, "Token too long, END\n"); 556 LOG (GNUNET_ERROR_TYPE_DEBUG, "Token too long, END\n");
557 return GNUNET_YES; 557 return GNUNET_YES;
558 } 558 }
559 if (0 != strncmp (current, token, len)) 559 if (0 != strncmp (current, token, len))
560 { 560 {
561 LOG (GNUNET_ERROR_TYPE_DEBUG, "Token doesn't match, END\n"); 561 LOG (GNUNET_ERROR_TYPE_DEBUG, "Token doesn't match, END\n");
562 return GNUNET_YES; 562 return GNUNET_YES;
563 } 563 }
564 564
565 if (len > ctx->longest_match) 565 if (len > ctx->longest_match)
@@ -598,7 +598,7 @@ regex_next_edge (const struct RegexBlock *block,
598 int result; 598 int result;
599 599
600 LOG (GNUNET_ERROR_TYPE_DEBUG, "Next edge\n"); 600 LOG (GNUNET_ERROR_TYPE_DEBUG, "Next edge\n");
601 /* Find the longest match for the current string position, 601 /* Find the longest match for the current string position,
602 * among tokens in the given block */ 602 * among tokens in the given block */
603 ctx->longest_match = 0; 603 ctx->longest_match = 0;
604 result = REGEX_BLOCK_iterate (block, size, 604 result = REGEX_BLOCK_iterate (block, size,
@@ -608,7 +608,7 @@ regex_next_edge (const struct RegexBlock *block,
608 /* Did anything match? */ 608 /* Did anything match? */
609 if (0 == ctx->longest_match) 609 if (0 == ctx->longest_match)
610 { 610 {
611 LOG (GNUNET_ERROR_TYPE_DEBUG, 611 LOG (GNUNET_ERROR_TYPE_DEBUG,
612 "no match in block\n"); 612 "no match in block\n");
613 return; 613 return;
614 } 614 }
@@ -623,7 +623,7 @@ regex_next_edge (const struct RegexBlock *block,
623 if (GNUNET_YES == 623 if (GNUNET_YES ==
624 GNUNET_CONTAINER_multihashmap_contains (info->dht_get_handles, hash)) 624 GNUNET_CONTAINER_multihashmap_contains (info->dht_get_handles, hash))
625 { 625 {
626 LOG (GNUNET_ERROR_TYPE_DEBUG, 626 LOG (GNUNET_ERROR_TYPE_DEBUG,
627 "GET for %s running, END\n", 627 "GET for %s running, END\n",
628 GNUNET_h2s (hash)); 628 GNUNET_h2s (hash));
629 GNUNET_CONTAINER_multihashmap_get_multiple (info->dht_get_results, 629 GNUNET_CONTAINER_multihashmap_get_multiple (info->dht_get_results,
@@ -636,11 +636,11 @@ regex_next_edge (const struct RegexBlock *block,
636 GNUNET_STATISTICS_update (info->stats, "# regex nodes traversed", 636 GNUNET_STATISTICS_update (info->stats, "# regex nodes traversed",
637 1, GNUNET_NO); 637 1, GNUNET_NO);
638 638
639 LOG (GNUNET_ERROR_TYPE_INFO, 639 LOG (GNUNET_ERROR_TYPE_INFO,
640 "looking for %s\n", 640 "looking for %s\n",
641 GNUNET_h2s (hash)); 641 GNUNET_h2s (hash));
642 rest = &new_ctx->info->description[new_ctx->position]; 642 rest = &new_ctx->info->description[new_ctx->position];
643 get_h = 643 get_h =
644 GNUNET_DHT_get_start (info->dht, /* handle */ 644 GNUNET_DHT_get_start (info->dht, /* handle */
645 GNUNET_BLOCK_TYPE_REGEX, /* type */ 645 GNUNET_BLOCK_TYPE_REGEX, /* type */
646 hash, /* key to search */ 646 hash, /* key to search */
@@ -671,7 +671,7 @@ regex_next_edge (const struct RegexBlock *block,
671 * @param callback Callback for found peers. 671 * @param callback Callback for found peers.
672 * @param callback_cls Closure for @c callback. 672 * @param callback_cls Closure for @c callback.
673 * @param stats Optional statistics handle to report usage. Can be NULL. 673 * @param stats Optional statistics handle to report usage. Can be NULL.
674 * 674 *
675 * @return Handle to stop search and free resources. 675 * @return Handle to stop search and free resources.
676 * Must be freed by calling REGEX_INTERNAL_search_cancel. 676 * Must be freed by calling REGEX_INTERNAL_search_cancel.
677 */ 677 */
@@ -712,8 +712,8 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht,
712 ctx->position = size; 712 ctx->position = size;
713 ctx->info = h; 713 ctx->info = h;
714 GNUNET_array_append (h->contexts, h->n_contexts, ctx); 714 GNUNET_array_append (h->contexts, h->n_contexts, ctx);
715 LOG (GNUNET_ERROR_TYPE_DEBUG, 715 LOG (GNUNET_ERROR_TYPE_DEBUG,
716 "consumed %u bits out of %u, now looking for %s\n", 716 "consumed %u bits out of %u, now looking for %s\n",
717 size, len, 717 size, len,
718 GNUNET_h2s (&key)); 718 GNUNET_h2s (&key));
719 719
diff --git a/src/regex/regex_internal_lib.h b/src/regex/regex_internal_lib.h
index 96334c1c3..6b69d79eb 100644
--- a/src/regex/regex_internal_lib.h
+++ b/src/regex/regex_internal_lib.h
@@ -170,13 +170,13 @@ struct REGEX_INTERNAL_Search;
170/** 170/**
171 * Announce a regular expression: put all states of the automaton in the DHT. 171 * Announce a regular expression: put all states of the automaton in the DHT.
172 * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that. 172 * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that.
173 * 173 *
174 * @param dht An existing and valid DHT service handle. CANNOT be NULL. 174 * @param dht An existing and valid DHT service handle. CANNOT be NULL.
175 * @param priv our private key, must remain valid until the announcement is cancelled 175 * @param priv our private key, must remain valid until the announcement is cancelled
176 * @param regex Regular expression to announce. 176 * @param regex Regular expression to announce.
177 * @param compression How many characters per edge can we squeeze? 177 * @param compression How many characters per edge can we squeeze?
178 * @param stats Optional statistics handle to report usage. Can be NULL. 178 * @param stats Optional statistics handle to report usage. Can be NULL.
179 * 179 *
180 * @return Handle to reuse o free cached resources. 180 * @return Handle to reuse o free cached resources.
181 * Must be freed by calling REGEX_INTERNAL_announce_cancel. 181 * Must be freed by calling REGEX_INTERNAL_announce_cancel.
182 */ 182 */
@@ -191,7 +191,7 @@ REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht,
191/** 191/**
192 * Announce again a regular expression previously announced. 192 * Announce again a regular expression previously announced.
193 * Does use caching to speed up process. 193 * Does use caching to speed up process.
194 * 194 *
195 * @param h Handle returned by a previous REGEX_INTERNAL_announce call. 195 * @param h Handle returned by a previous REGEX_INTERNAL_announce call.
196 */ 196 */
197void 197void
@@ -201,7 +201,7 @@ REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h);
201/** 201/**
202 * Clear all cached data used by a regex announce. 202 * Clear all cached data used by a regex announce.
203 * Does not close DHT connection. 203 * Does not close DHT connection.
204 * 204 *
205 * @param h Handle returned by a previous REGEX_INTERNAL_announce call. 205 * @param h Handle returned by a previous REGEX_INTERNAL_announce call.
206 */ 206 */
207void 207void
@@ -236,7 +236,7 @@ typedef void (*REGEX_INTERNAL_Found)(void *cls,
236 * @param callback Callback for found peers. 236 * @param callback Callback for found peers.
237 * @param callback_cls Closure for @c callback. 237 * @param callback_cls Closure for @c callback.
238 * @param stats Optional statistics handle to report usage. Can be NULL. 238 * @param stats Optional statistics handle to report usage. Can be NULL.
239 * 239 *
240 * @return Handle to stop search and free resources. 240 * @return Handle to stop search and free resources.
241 * Must be freed by calling REGEX_INTERNAL_search_cancel. 241 * Must be freed by calling REGEX_INTERNAL_search_cancel.
242 */ 242 */
@@ -250,7 +250,7 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht,
250/** 250/**
251 * Stop search and free all data used by a REGEX_INTERNAL_search call. 251 * Stop search and free all data used by a REGEX_INTERNAL_search call.
252 * Does not close DHT connection. 252 * Does not close DHT connection.
253 * 253 *
254 * @param h Handle returned by a previous REGEX_INTERNAL_search call. 254 * @param h Handle returned by a previous REGEX_INTERNAL_search call.
255 */ 255 */
256void 256void
diff --git a/src/regex/regex_ipc.h b/src/regex/regex_ipc.h
index fd6440bb8..ab7aa45cd 100644
--- a/src/regex/regex_ipc.h
+++ b/src/regex/regex_ipc.h
@@ -43,7 +43,7 @@ struct AnnounceMessage
43 * How many characters can we squeeze per edge? 43 * How many characters can we squeeze per edge?
44 */ 44 */
45 uint16_t compression; 45 uint16_t compression;
46 46
47 /** 47 /**
48 * Always zero. 48 * Always zero.
49 */ 49 */
@@ -97,7 +97,7 @@ struct ResultMessage
97 * Identity of the peer that was found. 97 * Identity of the peer that was found.
98 */ 98 */
99 struct GNUNET_PeerIdentity id; 99 struct GNUNET_PeerIdentity id;
100 100
101 /* followed by GET path and PUT path arrays */ 101 /* followed by GET path and PUT path arrays */
102 102
103}; 103};
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c
index 449575150..b871ea872 100644
--- a/src/regex/regex_test_lib.c
+++ b/src/regex/regex_test_lib.c
@@ -1,17 +1,17 @@
1/* 1/*
2 * This file is part of GNUnet 2 * This file is part of GNUnet
3 * (C) 2012 Christian Grothoff (and other contributing authors) 3 * (C) 2012 Christian Grothoff (and other contributing authors)
4 * 4 *
5 * GNUnet is free software; you can redistribute it and/or modify 5 * GNUnet is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published 6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 3, or (at your 7 * by the Free Software Foundation; either version 3, or (at your
8 * option) any later version. 8 * option) any later version.
9 * 9 *
10 * GNUnet is distributed in the hope that it will be useful, but 10 * GNUnet is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details. 13 * General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with GNUnet; see the file COPYING. If not, write to the 16 * along with GNUnet; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -153,10 +153,10 @@ regex_combine (struct RegexCombineCtx *ctx)
153 153
154/** 154/**
155 * Get the number of matching characters on the prefix of both strings. 155 * Get the number of matching characters on the prefix of both strings.
156 * 156 *
157 * @param s1 String 1. 157 * @param s1 String 1.
158 * @param s2 String 2. 158 * @param s2 String 2.
159 * 159 *
160 * @return Number of characters of matching prefix. 160 * @return Number of characters of matching prefix.
161 */ 161 */
162static unsigned int 162static unsigned int
@@ -183,10 +183,10 @@ get_prefix_length (const char *s1, const char *s2)
183/** 183/**
184 * Return the child context with the longest prefix match with the regex. 184 * Return the child context with the longest prefix match with the regex.
185 * Usually only one child will match, search all just in case. 185 * Usually only one child will match, search all just in case.
186 * 186 *
187 * @param ctx Context whose children to search. 187 * @param ctx Context whose children to search.
188 * @param regex String to match. 188 * @param regex String to match.
189 * 189 *
190 * @return Child with the longest prefix, NULL if no child matches. 190 * @return Child with the longest prefix, NULL if no child matches.
191 */ 191 */
192static struct RegexCombineCtx * 192static struct RegexCombineCtx *
diff --git a/src/regex/regex_test_lib.h b/src/regex/regex_test_lib.h
index 87dcadf72..a9fcab2f1 100644
--- a/src/regex/regex_test_lib.h
+++ b/src/regex/regex_test_lib.h
@@ -1,17 +1,17 @@
1/* 1/*
2 * This file is part of GNUnet 2 * This file is part of GNUnet
3 * (C) 2012 Christian Grothoff (and other contributing authors) 3 * (C) 2012 Christian Grothoff (and other contributing authors)
4 * 4 *
5 * GNUnet is free software; you can redistribute it and/or modify 5 * GNUnet is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published 6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 3, or (at your 7 * by the Free Software Foundation; either version 3, or (at your
8 * option) any later version. 8 * option) any later version.
9 * 9 *
10 * GNUnet is distributed in the hope that it will be useful, but 10 * GNUnet is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details. 13 * General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with GNUnet; see the file COPYING. If not, write to the 16 * along with GNUnet; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
diff --git a/src/regex/test_regex_api.c b/src/regex/test_regex_api.c
index 81627e6e4..a35934c9c 100644
--- a/src/regex/test_regex_api.c
+++ b/src/regex/test_regex_api.c
@@ -84,7 +84,7 @@ end_badly ()
84 * @param put_path Path of the put request. 84 * @param put_path Path of the put request.
85 * @param put_path_length Length of the put_path. 85 * @param put_path_length Length of the put_path.
86 */ 86 */
87static void 87static void
88found_cb (void *cls, 88found_cb (void *cls,
89 const struct GNUNET_PeerIdentity *id, 89 const struct GNUNET_PeerIdentity *id,
90 const struct GNUNET_PeerIdentity *get_path, 90 const struct GNUNET_PeerIdentity *get_path,
@@ -106,7 +106,7 @@ run (void *cls,
106 die_task = 106 die_task =
107 GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, 107 GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT,
108 &end_badly, NULL); 108 &end_badly, NULL);
109 a = GNUNET_REGEX_announce (cfg, 109 a = GNUNET_REGEX_announce (cfg,
110 "my long prefix - hello world(0|1)*", 110 "my long prefix - hello world(0|1)*",
111 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 111 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
112 5), 112 5),
diff --git a/src/regex/test_regex_iterate_api.c b/src/regex/test_regex_iterate_api.c
index 69badb5d8..a86295abf 100644
--- a/src/regex/test_regex_iterate_api.c
+++ b/src/regex/test_regex_iterate_api.c
@@ -60,7 +60,7 @@ struct RegexStringPair
60 60
61 61
62static void 62static void
63key_iterator (void *cls, const struct GNUNET_HashCode *key, 63key_iterator (void *cls, const struct GNUNET_HashCode *key,
64 const char *proof, 64 const char *proof,
65 int accepting, unsigned int num_edges, 65 int accepting, unsigned int num_edges,
66 const struct REGEX_BLOCK_Edge *edges) 66 const struct REGEX_BLOCK_Edge *edges)