aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex_block_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-26 11:50:16 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-26 11:50:16 +0000
commit5f38f9933e6f19fcef0ded8aad3d6db4e6cbb666 (patch)
tree7c17cf8ad811c21520f0e73fd7124d5a33c8935b /src/regex/regex_block_lib.h
parentae4ab9e6ce8d7529bec34bef3d7db62c393dd918 (diff)
-cleaning up block code, moving all of the block logic into the block library
Diffstat (limited to 'src/regex/regex_block_lib.h')
-rw-r--r--src/regex/regex_block_lib.h45
1 files changed, 42 insertions, 3 deletions
diff --git a/src/regex/regex_block_lib.h b/src/regex/regex_block_lib.h
index a6c5392291..ad4884f4d7 100644
--- a/src/regex/regex_block_lib.h
+++ b/src/regex/regex_block_lib.h
@@ -39,6 +39,24 @@ extern "C"
#include "platform.h"
#include "block_regex.h"
+
+/**
+ * Edge representation.
+ */
+struct REGEX_INTERNAL_Edge
+{
+ /**
+ * Label of the edge. FIXME: might want to not consume exactly multiples of 8 bits, need length!
+ */
+ const char *label;
+
+ /**
+ * Destionation of the edge.
+ */
+ struct GNUNET_HashCode destination;
+};
+
+
/**
* Check if the regex block is well formed, including all edges.
*
@@ -53,8 +71,11 @@ extern "C"
*/
int
REGEX_INTERNAL_block_check (const struct RegexBlock *block,
- size_t size,
- const char *xquery);
+ size_t size,
+ const char *xquery);
+
+
+/* FIXME: might want to use 'struct REGEX_INTERNAL_Edge' here instead of 3 arguments! */
/**
* Iterator over edges in a block.
@@ -62,7 +83,7 @@ REGEX_INTERNAL_block_check (const struct RegexBlock *block,
* @param cls Closure.
* @param token Token that follows to next state.
* @param len Length of token.
- * @param key Hash of next state.
+ * @param key Hash of next state.
*
* @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise.
*/
@@ -94,6 +115,24 @@ REGEX_INTERNAL_block_iterate (const struct RegexBlock *block,
REGEX_INTERNAL_EgdeIterator iterator,
void *iter_cls);
+
+/**
+ * Construct a regex block to be stored in the DHT.
+ *
+ * @param proof proof string for the block
+ * @param num_edges number of edges in the block
+ * @param edges the edges of the block
+ * @return the regex block
+ */
+struct RegexBlock *
+REGEX_INTERNAL_block_create (const struct GNUNET_HashCode *key,
+ const char *proof,
+ unsigned int num_edges,
+ const struct REGEX_INTERNAL_Edge *edges,
+ int accepting,
+ size_t *rsize);
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif