common function to manipulate blocks stored by regex in the DHT More...
Go to the source code of this file.
Data Structures | |
| struct | REGEX_BLOCK_Edge |
| Edge representation. More... | |
Typedefs | |
| typedef int(* | REGEX_INTERNAL_EgdeIterator) (void *cls, const char *token, size_t len, const struct GNUNET_HashCode *key) |
| Iterator over edges in a block. | |
Functions | |
| int | REGEX_BLOCK_check_proof (const char *proof, size_t proof_len, const struct GNUNET_HashCode *key) |
| Check if the given 'proof' matches the given 'key'. | |
| int | REGEX_BLOCK_check (const struct RegexBlock *block, size_t size, const struct GNUNET_HashCode *query, const char *xquery) |
| Check if the regex block is well formed, including all edges. | |
| int | REGEX_BLOCK_iterate (const struct RegexBlock *block, size_t size, REGEX_INTERNAL_EgdeIterator iterator, void *iter_cls) |
| Iterate over all edges of a block of a regex state. | |
| int | REGEX_BLOCK_get_key (const struct RegexBlock *block, size_t block_len, struct GNUNET_HashCode *key) |
| Obtain the key that a particular block is to be stored under. | |
| int | GNUNET_BLOCK_is_accepting (const struct RegexBlock *block, size_t block_len) |
| Test if this block is marked as being an accept state. | |
| struct RegexBlock * | REGEX_BLOCK_create (const char *proof, unsigned int num_edges, const struct REGEX_BLOCK_Edge *edges, int accepting, size_t *rsize) |
| Construct a regex block to be stored in the DHT. | |
common function to manipulate blocks stored by regex in the DHT
Definition in file regex_block_lib.h.
| typedef int(* REGEX_INTERNAL_EgdeIterator) (void *cls, const char *token, size_t len, const struct GNUNET_HashCode *key) |
Iterator over edges in a block.
| cls | Closure. |
| token | Token that follows to next state. |
| len | Length of token. |
| key | Hash of next state. |
Definition at line 111 of file regex_block_lib.h.
| int REGEX_BLOCK_check_proof | ( | const char * | proof, |
| size_t | proof_len, | ||
| const struct GNUNET_HashCode * | key | ||
| ) |
Check if the given 'proof' matches the given 'key'.
| proof | partial regex of a state |
| proof_len | number of bytes in proof |
| key | hash of a state. |
Definition at line 114 of file regex_block_lib.c.
References GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hash_cmp(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NO, GNUNET_OK, key, and proof.
| int REGEX_BLOCK_check | ( | const struct RegexBlock * | block, |
| size_t | size, | ||
| const struct GNUNET_HashCode * | query, | ||
| const char * | xquery | ||
| ) |
Check if the regex block is well formed, including all edges.
| block | The start of the block. |
| size | The size of the block. |
| query | the query for the block |
| xquery | String describing the edge we are looking for. Can be NULL in case this is a put block. |
Definition at line 183 of file regex_block_lib.c.
References check_edge(), ctx, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_memcmp, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, RegexBlock::is_accepting, key, LOG, REGEX_BLOCK_get_key(), REGEX_BLOCK_iterate(), res, size, and CheckEdgeContext::xquery.
Referenced by block_plugin_regex_check_block(), and block_plugin_regex_check_reply().
| int REGEX_BLOCK_iterate | ( | const struct RegexBlock * | block, |
| size_t | size, | ||
| REGEX_INTERNAL_EgdeIterator | iterator, | ||
| void * | iter_cls | ||
| ) |
Iterate over all edges of a block of a regex state.
| block | Block to iterate over. |
| size | Size of block. |
| iterator | Function to call on each edge in the block. |
| iter_cls | Closure for the iterator. |
Definition at line 265 of file regex_block_lib.c.
References GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, LOG, RegexBlock::num_destinations, RegexBlock::num_edges, RegexBlock::proof_len, and size.
Referenced by REGEX_BLOCK_check(), and regex_next_edge().
| int REGEX_BLOCK_get_key | ( | const struct RegexBlock * | block, |
| size_t | block_len, | ||
| struct GNUNET_HashCode * | key | ||
| ) |
Obtain the key that a particular block is to be stored under.
| block | block to get the key from |
| block_len | number of bytes in block |
| key | where to store the key |
Definition at line 230 of file regex_block_lib.c.
References GNUNET_break_op, GNUNET_CRYPTO_hash(), GNUNET_OK, GNUNET_SYSERR, key, RegexBlock::num_destinations, RegexBlock::num_edges, and RegexBlock::proof_len.
Referenced by block_plugin_regex_get_key(), and REGEX_BLOCK_check().
| int GNUNET_BLOCK_is_accepting | ( | const struct RegexBlock * | block, |
| size_t | size | ||
| ) |
Test if this block is marked as being an accept state.
| block | block to test |
| size | number of bytes in block |
Definition at line 101 of file regex_block_lib.c.
References GNUNET_break_op, GNUNET_SYSERR, RegexBlock::is_accepting, and size.
Referenced by dht_get_string_handler(), and regex_result_iterator().
| struct RegexBlock * REGEX_BLOCK_create | ( | const char * | proof, |
| unsigned int | num_edges, | ||
| const struct REGEX_BLOCK_Edge * | edges, | ||
| int | accepting, | ||
| size_t * | rsize | ||
| ) |
Construct a regex block to be stored in the DHT.
| proof | proof string for the block |
| num_edges | number of edges in the block |
| edges | the edges of the block |
| accepting | is this an accepting state |
| rsize | set to the size of the returned block (OUT-only) |
Definition at line 346 of file regex_block_lib.c.
References REGEX_BLOCK_Edge::destination, EdgeInfo::destination_index, GNUNET_break, GNUNET_CONSTANTS_MAX_BLOCK_SIZE, GNUNET_malloc, GNUNET_memcpy, RegexBlock::is_accepting, RegexBlock::num_destinations, RegexBlock::num_edges, proof, RegexBlock::proof_len, and EdgeInfo::token_length.
Referenced by regex_iterator().