diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-26 11:50:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-26 11:50:16 +0000 |
commit | 5f38f9933e6f19fcef0ded8aad3d6db4e6cbb666 (patch) | |
tree | 7c17cf8ad811c21520f0e73fd7124d5a33c8935b /src/regex/regex_block_lib.h | |
parent | ae4ab9e6ce8d7529bec34bef3d7db62c393dd918 (diff) | |
download | gnunet-5f38f9933e6f19fcef0ded8aad3d6db4e6cbb666.tar.gz gnunet-5f38f9933e6f19fcef0ded8aad3d6db4e6cbb666.zip |
-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.h | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/src/regex/regex_block_lib.h b/src/regex/regex_block_lib.h index a6c539229..ad4884f4d 100644 --- a/src/regex/regex_block_lib.h +++ b/src/regex/regex_block_lib.h | |||
@@ -39,6 +39,24 @@ extern "C" | |||
39 | #include "platform.h" | 39 | #include "platform.h" |
40 | #include "block_regex.h" | 40 | #include "block_regex.h" |
41 | 41 | ||
42 | |||
43 | /** | ||
44 | * Edge representation. | ||
45 | */ | ||
46 | struct REGEX_INTERNAL_Edge | ||
47 | { | ||
48 | /** | ||
49 | * Label of the edge. FIXME: might want to not consume exactly multiples of 8 bits, need length! | ||
50 | */ | ||
51 | const char *label; | ||
52 | |||
53 | /** | ||
54 | * Destionation of the edge. | ||
55 | */ | ||
56 | struct GNUNET_HashCode destination; | ||
57 | }; | ||
58 | |||
59 | |||
42 | /** | 60 | /** |
43 | * Check if the regex block is well formed, including all edges. | 61 | * Check if the regex block is well formed, including all edges. |
44 | * | 62 | * |
@@ -53,8 +71,11 @@ extern "C" | |||
53 | */ | 71 | */ |
54 | int | 72 | int |
55 | REGEX_INTERNAL_block_check (const struct RegexBlock *block, | 73 | REGEX_INTERNAL_block_check (const struct RegexBlock *block, |
56 | size_t size, | 74 | size_t size, |
57 | const char *xquery); | 75 | const char *xquery); |
76 | |||
77 | |||
78 | /* FIXME: might want to use 'struct REGEX_INTERNAL_Edge' here instead of 3 arguments! */ | ||
58 | 79 | ||
59 | /** | 80 | /** |
60 | * Iterator over edges in a block. | 81 | * Iterator over edges in a block. |
@@ -62,7 +83,7 @@ REGEX_INTERNAL_block_check (const struct RegexBlock *block, | |||
62 | * @param cls Closure. | 83 | * @param cls Closure. |
63 | * @param token Token that follows to next state. | 84 | * @param token Token that follows to next state. |
64 | * @param len Length of token. | 85 | * @param len Length of token. |
65 | * @param key Hash of next state. | 86 | * @param key Hash of next state. |
66 | * | 87 | * |
67 | * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise. | 88 | * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise. |
68 | */ | 89 | */ |
@@ -94,6 +115,24 @@ REGEX_INTERNAL_block_iterate (const struct RegexBlock *block, | |||
94 | REGEX_INTERNAL_EgdeIterator iterator, | 115 | REGEX_INTERNAL_EgdeIterator iterator, |
95 | void *iter_cls); | 116 | void *iter_cls); |
96 | 117 | ||
118 | |||
119 | /** | ||
120 | * Construct a regex block to be stored in the DHT. | ||
121 | * | ||
122 | * @param proof proof string for the block | ||
123 | * @param num_edges number of edges in the block | ||
124 | * @param edges the edges of the block | ||
125 | * @return the regex block | ||
126 | */ | ||
127 | struct RegexBlock * | ||
128 | REGEX_INTERNAL_block_create (const struct GNUNET_HashCode *key, | ||
129 | const char *proof, | ||
130 | unsigned int num_edges, | ||
131 | const struct REGEX_INTERNAL_Edge *edges, | ||
132 | int accepting, | ||
133 | size_t *rsize); | ||
134 | |||
135 | |||
97 | #if 0 /* keep Emacsens' auto-indent happy */ | 136 | #if 0 /* keep Emacsens' auto-indent happy */ |
98 | { | 137 | { |
99 | #endif | 138 | #endif |