aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex_block_lib.h
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-01-17 17:09:37 +0000
committerBart Polot <bart@net.in.tum.de>2013-01-17 17:09:37 +0000
commit47cb85c43071a16ec899e7f8fb45b3eec39895ec (patch)
tree4b3ec6dd6eb72488826053d0ce9fc45d26df3df6 /src/regex/regex_block_lib.h
parent37a8306064f1fe08c1471c46a3cd913cd22f8a60 (diff)
downloadgnunet-47cb85c43071a16ec899e7f8fb45b3eec39895ec.tar.gz
gnunet-47cb85c43071a16ec899e7f8fb45b3eec39895ec.zip
Move regex DHT integration from mesh to regex
Diffstat (limited to 'src/regex/regex_block_lib.h')
-rw-r--r--src/regex/regex_block_lib.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/regex/regex_block_lib.h b/src/regex/regex_block_lib.h
new file mode 100644
index 000000000..f591f5f61
--- /dev/null
+++ b/src/regex/regex_block_lib.h
@@ -0,0 +1,98 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012,2013 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19*/
20
21/**
22 * @author Bartlomiej Polot
23 * @file regex/regex_block_lib.h
24 */
25
26#ifndef REGEX_BLOCK_LIB_H_
27#define REGEX_BLOCK_LIB_H_
28
29#ifdef __cplusplus
30extern "C"
31{
32#if 0
33 /* keep Emacsens' auto-indent happy */
34}
35#endif
36#endif
37
38#include "platform.h"
39#include "block_regex.h"
40
41/**
42 * Check if the regex block is well formed, including all edges
43 *
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 *
48 * @return GNUNET_OK in case it's fine.
49 * GNUNET_NO in case the xquery is not found.
50 * GNUNET_SYSERR if the block is invalid.
51 */
52int
53GNUNET_REGEX_block_check (const struct RegexBlock *block,
54 size_t size,
55 const char *xquery);
56
57/**
58 * Iterator over edges in a block.
59 *
60 * @param cls Closure.
61 * @param token Token that follows to next state.
62 * @param len Length of token.
63 * @param key Hash of next state.
64 *
65 * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise.
66 */
67typedef int (*GNUNET_REGEX_EgdeIterator)(void *cls,
68 const char *token,
69 size_t len,
70 const struct GNUNET_HashCode *key);
71
72
73/**
74 * Iterate over all edges of a block of a regex state.
75 *
76 * @param block Block to iterate over.
77 * @param size Size of block.
78 * @param iterator Function to call on each edge in the block.
79 * @param iter_cls Closure for the iterator.
80 *
81 * @return GNUNET_SYSERR if an error has been encountered, GNUNET_OK otherwise
82 */
83int
84GNUNET_REGEX_block_iterate (const struct RegexBlock *block,
85 size_t size,
86 GNUNET_REGEX_EgdeIterator iterator,
87 void *iter_cls);
88
89#if 0 /* keep Emacsens' auto-indent happy */
90{
91#endif
92#ifdef __cplusplus
93}
94#endif
95
96/* ifndef REGEX_BLOCK_LIB_H */
97#endif
98/* end of regex_block_lib.h */