aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-12-22 00:06:17 +0000
committerChristian Grothoff <christian@grothoff.org>2013-12-22 00:06:17 +0000
commita1d7df8eb6f760367286cb609d52d6f7f7532042 (patch)
treedc4782528dc191d0697c2fd62e990b25551a7951 /src/regex
parent67284306ef172f705e0c421e7456199df3a55823 (diff)
downloadgnunet-a1d7df8eb6f760367286cb609d52d6f7f7532042.tar.gz
gnunet-a1d7df8eb6f760367286cb609d52d6f7f7532042.zip
-fix calculation of block size, doxygen
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/plugin_block_regex.c4
-rw-r--r--src/regex/regex_block_lib.c30
2 files changed, 16 insertions, 18 deletions
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index ac9eee07c..43ebe7b32 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -270,9 +270,9 @@ block_plugin_regex_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
270 * @param cls closure 270 * @param cls closure
271 * @param type block type 271 * @param type block type
272 * @param block block to get the key for 272 * @param block block to get the key for
273 * @param block_size number of bytes in block 273 * @param block_size number of bytes in @a block
274 * @param key set to the key (query) for the given block 274 * @param key set to the key (query) for the given block
275 * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported 275 * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported
276 * (or if extracting a key from a block of this type does not work) 276 * (or if extracting a key from a block of this type does not work)
277 */ 277 */
278static int 278static int
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c
index 8a1f08290..782827d5d 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -97,7 +97,7 @@ GNUNET_NETWORK_STRUCT_END
97 * 97 *
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,
@@ -118,8 +118,7 @@ GNUNET_BLOCK_is_accepting (const struct RegexBlock *block,
118 * @param proof partial regex of a state 118 * @param proof partial regex of a state
119 * @param proof_len number of bytes in 'proof' 119 * @param proof_len number of bytes in 'proof'
120 * @param key hash of a state. 120 * @param key hash of a state.
121 * 121 * @return #GNUNET_OK if the proof is valid for the given key.
122 * @return GNUNET_OK if the proof is valid for the given key.
123 */ 122 */
124int 123int
125REGEX_BLOCK_check_proof (const char *proof, 124REGEX_BLOCK_check_proof (const char *proof,
@@ -196,10 +195,9 @@ check_edge (void *cls,
196 * @param query the query for the block 195 * @param query the query for the block
197 * @param xquery String describing the edge we are looking for. 196 * @param xquery String describing the edge we are looking for.
198 * Can be NULL in case this is a put block. 197 * Can be NULL in case this is a put block.
199 * 198 * @return #GNUNET_OK in case it's fine.
200 * @return GNUNET_OK in case it's fine. 199 * #GNUNET_NO in case the xquery exists and is not found (IRRELEVANT).
201 * GNUNET_NO in case the xquery exists and is not found (IRRELEVANT). 200 * #GNUNET_SYSERR if the block is invalid.
202 * GNUNET_SYSERR if the block is invalid.
203 */ 201 */
204int 202int
205REGEX_BLOCK_check (const struct RegexBlock *block, 203REGEX_BLOCK_check (const struct RegexBlock *block,
@@ -253,7 +251,7 @@ REGEX_BLOCK_check (const struct RegexBlock *block,
253 * @param block block to get the key from 251 * @param block block to get the key from
254 * @param block_len number of bytes in block 252 * @param block_len number of bytes in block
255 * @param key where to store the key 253 * @param key where to store the key
256 * @return GNUNET_OK on success, GNUNET_SYSERR if the block is malformed 254 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block is malformed
257 */ 255 */
258int 256int
259REGEX_BLOCK_get_key (const struct RegexBlock *block, 257REGEX_BLOCK_get_key (const struct RegexBlock *block,
@@ -277,7 +275,7 @@ REGEX_BLOCK_get_key (const struct RegexBlock *block,
277 len = ntohs (block->proof_len); 275 len = ntohs (block->proof_len);
278 destinations = (const struct GNUNET_HashCode *) &block[1]; 276 destinations = (const struct GNUNET_HashCode *) &block[1];
279 edges = (const struct EdgeInfo *) &destinations[num_destinations]; 277 edges = (const struct EdgeInfo *) &destinations[num_destinations];
280 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges + sizeof (struct EdgeInfo) + len; 278 total = sizeof (struct RegexBlock) + num_destinations * sizeof (struct GNUNET_HashCode) + num_edges * sizeof (struct EdgeInfo) + len;
281 if (block_len < total) 279 if (block_len < total)
282 { 280 {
283 GNUNET_break_op (0); 281 GNUNET_break_op (0);
@@ -292,14 +290,13 @@ REGEX_BLOCK_get_key (const struct RegexBlock *block,
292 * Iterate over all edges of a block of a regex state. 290 * Iterate over all edges of a block of a regex state.
293 * 291 *
294 * @param block Block to iterate over. 292 * @param block Block to iterate over.
295 * @param size Size of block. 293 * @param size Size of @a block.
296 * @param iterator Function to call on each edge in the block. 294 * @param iterator Function to call on each edge in the block.
297 * @param iter_cls Closure for the iterator. 295 * @param iter_cls Closure for the @a iterator.
298 * 296 * @return #GNUNET_SYSERR if an error has been encountered.
299 * @return GNUNET_SYSERR if an error has been encountered. 297 * #GNUNET_OK if no error has been encountered.
300 * GNUNET_OK if no error has been encountered.
301 * Note that if the iterator stops the iteration by returning 298 * Note that if the iterator stops the iteration by returning
302 * GNUNET_NO, the block will no longer be checked for further errors. 299 * #GNUNET_NO, the block will no longer be checked for further errors.
303 * The return value will be GNUNET_OK meaning that no errors were 300 * The return value will be GNUNET_OK meaning that no errors were
304 * found until the edge last notified to the iterator, but there might 301 * found until the edge last notified to the iterator, but there might
305 * be errors in further edges. 302 * be errors in further edges.
@@ -356,7 +353,8 @@ REGEX_BLOCK_iterate (const struct RegexBlock *block,
356 for (n=0;n<num_edges;n++) 353 for (n=0;n<num_edges;n++)
357 { 354 {
358 LOG (GNUNET_ERROR_TYPE_DEBUG, 355 LOG (GNUNET_ERROR_TYPE_DEBUG,
359 " Edge %u/%u, off %u tokenlen %u (%.*s)\n", n+1, num_edges, off, 356 "Edge %u/%u, off %u tokenlen %u (%.*s)\n",
357 n+1, num_edges, off,
360 ntohs (edges[n].token_length), ntohs (edges[n].token_length), 358 ntohs (edges[n].token_length), ntohs (edges[n].token_length),
361 &aux[off]); 359 &aux[off]);
362 if (NULL != iterator) 360 if (NULL != iterator)