+GNUNET_NETWORK_STRUCT_BEGIN
+
+/**
+ * Information for each edge.
+ */
+struct EdgeInfo
+{
+ /**
+ * Index of the destination of this edge in the
+ * unique destinations array.
+ */
+ uint16_t destination_index GNUNET_PACKED;
+
+ /**
+ * Number of bytes the token for this edge takes in the
+ * token area.
+ */
+ uint16_t token_length GNUNET_PACKED;
+};
+
+
+/**
+ * @brief Block to announce a regex state.
+ */
+struct RegexBlock
+{
+
+ /**
+ * Length of the proof regex string.
+ */
+ uint16_t proof_len GNUNET_PACKED;
+
+ /**
+ * Is this state an accepting state?
+ */
+ int16_t is_accepting GNUNET_PACKED;
+
+ /**
+ * Number of edges parting from this state.
+ */
+ uint16_t num_edges GNUNET_PACKED;
+
+ /**
+ * Nubmer of unique destinations reachable from this state.
+ */
+ uint16_t num_destinations GNUNET_PACKED;
+
+ /* followed by 'struct GNUNET_HashCode[num_destinations]' */
+
+ /* followed by 'struct EdgeInfo[edge_destination_indices]' */
+
+ /* followed by 'char proof[n_proof]', NOT 0-terminated */
+
+ /* followed by 'char tokens[num_edges][edge_info[k].token_length]';
+ essentially all of the tokens one after the other in the
+ order of the edges; tokens are NOT 0-terminated */
+
+};
+
+
+GNUNET_NETWORK_STRUCT_END
+
+
+/**
+ * Test if this block is marked as being an accept state.
+ *
+ * @param block block to test
+ * @param size number of bytes in block
+ * @return #GNUNET_YES if the block is accepting, #GNUNET_NO if not
+ */
+int
+GNUNET_BLOCK_is_accepting (const struct RegexBlock *block,
+ size_t size)
+{
+ if (size < sizeof (struct RegexBlock))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ return ntohs (block->is_accepting);
+}
+
+
+/**
+ * Check if the given 'proof' matches the given 'key'.
+ *
+ * @param proof partial regex of a state
+ * @param proof_len number of bytes in 'proof'
+ * @param key hash of a state.
+ * @return #GNUNET_OK if the proof is valid for the given key.
+ */
+int
+REGEX_BLOCK_check_proof (const char *proof,
+ size_t proof_len,
+ const struct GNUNET_HashCode *key)
+{
+ struct GNUNET_HashCode key_check;
+
+ if ( (NULL == proof) || (NULL == key))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Proof check failed, was NULL.\n");
+ return GNUNET_NO;
+ }
+ GNUNET_CRYPTO_hash (proof, proof_len, &key_check);
+ return (0 ==
+ GNUNET_CRYPTO_hash_cmp (key, &key_check)) ? GNUNET_OK : GNUNET_NO;
+}
+
+