2 This file is part of GNUnet.
3 (C) 2012,2013 Christian Grothoff (and other contributing authors)
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
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
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
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @author Bartlomiej Polot
23 * @file regex/regex_block_lib.h
26 #ifndef REGEX_BLOCK_LIB_H_
27 #define REGEX_BLOCK_LIB_H_
33 /* keep Emacsens' auto-indent happy */
39 #include "block_regex.h"
42 * Check if the regex block is well formed, including all edges.
44 * @param block The start of the block.
45 * @param size The size of the block.
46 * @param xquery String describing the edge we are looking for.
47 * Can be NULL in case this is a put block.
49 * @return GNUNET_OK in case it's fine.
50 * GNUNET_NO in case the xquery exists and is not found (IRRELEVANT).
51 * GNUNET_SYSERR if the block is invalid.
54 GNUNET_REGEX_block_check (const struct RegexBlock *block,
59 * Iterator over edges in a block.
62 * @param token Token that follows to next state.
63 * @param len Length of token.
64 * @param key Hash of next state.
66 * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise.
68 typedef int (*GNUNET_REGEX_EgdeIterator)(void *cls,
71 const struct GNUNET_HashCode *key);
75 * Iterate over all edges of a block of a regex state.
77 * @param block Block to iterate over.
78 * @param size Size of block.
79 * @param iterator Function to call on each edge in the block.
80 * @param iter_cls Closure for the iterator.
82 * @return GNUNET_SYSERR if an error has been encountered.
83 * GNUNET_OK if no error has been encountered.
84 * Note that if the iterator stops the iteration by returning
85 * GNUNET_NO, the block will no longer be checked for further errors.
86 * The return value will be GNUNET_OK meaning that no errors were
87 * found until the edge last notified to the iterator, but there might
88 * be errors in further edges.
91 GNUNET_REGEX_block_iterate (const struct RegexBlock *block,
93 GNUNET_REGEX_EgdeIterator iterator,
96 #if 0 /* keep Emacsens' auto-indent happy */
103 /* ifndef REGEX_BLOCK_LIB_H */
105 /* end of regex_block_lib.h */