blocks used for regex storage and search More...
#include "platform.h"
#include "gnunet_block_plugin.h"
#include "gnunet_block_group_lib.h"
#include "block_regex.h"
#include "regex_block_lib.h"
#include "gnunet_signatures.h"
Go to the source code of this file.
Macros | |
#define | BLOOMFILTER_K 16 |
Number of bits we set per entry in the bloomfilter. More... | |
#define | REGEX_BF_SIZE 8 |
How big is the BF we use for REGEX blocks? More... | |
Functions | |
static struct GNUNET_BLOCK_Group * | block_plugin_regex_create_group (void *cls, enum GNUNET_BLOCK_Type type, const void *raw_data, size_t raw_data_size, va_list va) |
Create a new block group. More... | |
static enum GNUNET_GenericReturnValue | block_plugin_regex_check_query (void *cls, enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode *query, const void *xquery, size_t xquery_size) |
Function called to validate a query. More... | |
static enum GNUNET_GenericReturnValue | block_plugin_regex_check_block (void *cls, enum GNUNET_BLOCK_Type type, const void *block, size_t block_size) |
Function called to validate a block for storage. More... | |
static enum GNUNET_BLOCK_ReplyEvaluationResult | block_plugin_regex_check_reply (void *cls, enum GNUNET_BLOCK_Type type, struct GNUNET_BLOCK_Group *group, const struct GNUNET_HashCode *query, const void *xquery, size_t xquery_size, const void *reply_block, size_t reply_block_size) |
Function called to validate a reply to a request. More... | |
static enum GNUNET_GenericReturnValue | block_plugin_regex_get_key (void *cls, enum GNUNET_BLOCK_Type type, const void *block, size_t block_size, struct GNUNET_HashCode *key) |
Function called to obtain the key for a block. More... | |
void * | libgnunet_plugin_block_regex_init (void *cls) |
Entry point for the plugin. More... | |
void * | libgnunet_plugin_block_regex_done (void *cls) |
Exit point from the plugin. More... | |
blocks used for regex storage and search
Definition in file plugin_block_regex.c.
#define BLOOMFILTER_K 16 |
Number of bits we set per entry in the bloomfilter.
Do not change!
Definition at line 38 of file plugin_block_regex.c.
#define REGEX_BF_SIZE 8 |
How big is the BF we use for REGEX blocks?
Definition at line 44 of file plugin_block_regex.c.
|
static |
Create a new block group.
ctx | block context in which the block group is created |
type | type of the block for which we are creating the group |
raw_data | optional serialized prior state of the group, NULL if unavailable/fresh |
raw_data_size | number of bytes in raw_data, 0 if unavailable/fresh |
va | variable arguments specific to type |
Definition at line 59 of file plugin_block_regex.c.
References BLOOMFILTER_K, GNUNET_BLOCK_GROUP_bf_create(), GNUNET_BLOCK_GROUP_compute_bloomfilter_size(), GNUNET_break, REGEX_BF_SIZE, and type.
Referenced by libgnunet_plugin_block_regex_init().
|
static |
Function called to validate a query.
cls | closure |
ctx | block context |
type | block type |
query | original query (hash) |
xquery | extrended query data (can be NULL, depending on type) |
xquery_size | number of bytes in xquery |
Definition at line 104 of file plugin_block_regex.c.
References GNUNET_BLOCK_TYPE_REGEX, GNUNET_BLOCK_TYPE_REGEX_ACCEPT, GNUNET_break, GNUNET_break_op, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, and type.
Referenced by libgnunet_plugin_block_regex_init().
|
static |
Function called to validate a block for storage.
cls | closure |
type | block type |
block | block data to validate |
block_size | number of bytes in block |
Definition at line 149 of file plugin_block_regex.c.
References RegexAcceptBlock::expiration_time, GNUNET_BLOCK_TYPE_REGEX, GNUNET_BLOCK_TYPE_REGEX_ACCEPT, GNUNET_break, GNUNET_break_op, GNUNET_CRYPTO_eddsa_verify_(), GNUNET_NO, GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT, GNUNET_SYSERR, GNUNET_TIME_absolute_is_past(), GNUNET_TIME_absolute_ntoh(), RegexAcceptBlock::peer, GNUNET_PeerIdentity::public_key, RegexAcceptBlock::purpose, REGEX_BLOCK_check(), RegexAcceptBlock::signature, GNUNET_CRYPTO_EccSignaturePurpose::size, and type.
Referenced by libgnunet_plugin_block_regex_init().
|
static |
Function called to validate a reply to a request.
Note that it is assumed that the reply has already been matched to the key (and signatures checked) as it would be done with the GetKeyFunction and the BlockEvaluationFunction.
cls | closure |
type | block type |
group | which block group to use for evaluation |
query | original query (hash) |
xquery | extrended query data (can be NULL, depending on type) |
xquery_size | number of bytes in xquery |
reply_block | response to validate |
reply_block_size | number of bytes in reply_block |
Definition at line 222 of file plugin_block_regex.c.
References GNUNET_assert, GNUNET_BLOCK_GROUP_bf_test_and_set(), GNUNET_BLOCK_REPLY_IRRELEVANT, GNUNET_BLOCK_REPLY_OK_DUPLICATE, GNUNET_BLOCK_REPLY_OK_MORE, GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED, GNUNET_BLOCK_TYPE_REGEX, GNUNET_BLOCK_TYPE_REGEX_ACCEPT, GNUNET_break, GNUNET_CRYPTO_hash(), GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, RegexAcceptBlock::purpose, REGEX_BLOCK_check(), GNUNET_CRYPTO_EccSignaturePurpose::size, and type.
Referenced by libgnunet_plugin_block_regex_init().
|
static |
Function called to obtain the key for a block.
cls | closure |
type | block type |
block | block to get the key for |
block_size | number of bytes in block |
key | set to the key (query) for the given block |
Definition at line 304 of file plugin_block_regex.c.
References GNUNET_BLOCK_TYPE_REGEX, GNUNET_BLOCK_TYPE_REGEX_ACCEPT, GNUNET_break, GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, key, REGEX_BLOCK_get_key(), and type.
Referenced by libgnunet_plugin_block_regex_init().
void * libgnunet_plugin_block_regex_init | ( | void * | cls | ) |
Entry point for the plugin.
Definition at line 349 of file plugin_block_regex.c.
References block_plugin_regex_check_block(), block_plugin_regex_check_query(), block_plugin_regex_check_reply(), block_plugin_regex_create_group(), block_plugin_regex_get_key(), GNUNET_BLOCK_PluginFunctions::check_block, GNUNET_BLOCK_PluginFunctions::check_query, GNUNET_BLOCK_PluginFunctions::check_reply, GNUNET_BLOCK_PluginFunctions::create_group, GNUNET_BLOCK_PluginFunctions::get_key, GNUNET_BLOCK_TYPE_ANY, GNUNET_BLOCK_TYPE_REGEX, GNUNET_BLOCK_TYPE_REGEX_ACCEPT, GNUNET_new, and GNUNET_BLOCK_PluginFunctions::types.
void * libgnunet_plugin_block_regex_done | ( | void * | cls | ) |
Exit point from the plugin.
Definition at line 375 of file plugin_block_regex.c.
References GNUNET_BLOCK_PluginFunctions::cls, and GNUNET_free.