aboutsummaryrefslogtreecommitdiff
path: root/src/set
diff options
context:
space:
mode:
Diffstat (limited to 'src/set')
-rw-r--r--src/set/plugin_block_set_test.c44
1 files changed, 2 insertions, 42 deletions
diff --git a/src/set/plugin_block_set_test.c b/src/set/plugin_block_set_test.c
index 3d66831bb..cb5cef5ad 100644
--- a/src/set/plugin_block_set_test.c
+++ b/src/set/plugin_block_set_test.c
@@ -30,46 +30,9 @@
30 30
31 31
32/** 32/**
33 * Function called to validate a reply or a request. For
34 * request evaluation, simply pass "NULL" for the reply_block.
35 *
36 * @param cls closure
37 * @param ctx block context
38 * @param type block type
39 * @param group block group to use
40 * @param eo control flags
41 * @param query original query (hash)
42 * @param xquery extrended query data (can be NULL, depending on type)
43 * @param xquery_size number of bytes in xquery
44 * @param reply_block response to validate
45 * @param reply_block_size number of bytes in reply block
46 * @return characterization of result
47 */
48static enum GNUNET_BLOCK_EvaluationResult
49block_plugin_set_test_evaluate (void *cls,
50 struct GNUNET_BLOCK_Context *ctx,
51 enum GNUNET_BLOCK_Type type,
52 struct GNUNET_BLOCK_Group *group,
53 enum GNUNET_BLOCK_EvaluationOptions eo,
54 const struct GNUNET_HashCode *query,
55 const void *xquery,
56 size_t xquery_size,
57 const void *reply_block,
58 size_t reply_block_size)
59{
60 if ((NULL == reply_block) ||
61 (reply_block_size == 0) ||
62 (0 != ((char *) reply_block)[0]))
63 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
64 return GNUNET_BLOCK_EVALUATION_OK_MORE;
65}
66
67
68/**
69 * Function called to validate a query. 33 * Function called to validate a query.
70 * 34 *
71 * @param cls closure 35 * @param cls closure
72 * @param ctx block context
73 * @param type block type 36 * @param type block type
74 * @param query original query (hash) 37 * @param query original query (hash)
75 * @param xquery extrended query data (can be NULL, depending on type) 38 * @param xquery extrended query data (can be NULL, depending on type)
@@ -92,7 +55,6 @@ block_plugin_set_test_check_query (void *cls,
92 * 55 *
93 * @param cls closure 56 * @param cls closure
94 * @param type block type 57 * @param type block type
95 * @param query key for the block (hash), must match exactly
96 * @param block block data to validate 58 * @param block block data to validate
97 * @param block_size number of bytes in @a block 59 * @param block_size number of bytes in @a block
98 * @return #GNUNET_OK if the block is fine, #GNUNET_NO if not 60 * @return #GNUNET_OK if the block is fine, #GNUNET_NO if not
@@ -100,7 +62,6 @@ block_plugin_set_test_check_query (void *cls,
100static enum GNUNET_GenericReturnValue 62static enum GNUNET_GenericReturnValue
101block_plugin_set_test_check_block (void *cls, 63block_plugin_set_test_check_block (void *cls,
102 enum GNUNET_BLOCK_Type type, 64 enum GNUNET_BLOCK_Type type,
103 const struct GNUNET_HashCode *query,
104 const void *block, 65 const void *block,
105 size_t block_size) 66 size_t block_size)
106{ 67{
@@ -141,7 +102,7 @@ block_plugin_set_test_check_reply (void *cls,
141 if ((NULL == reply_block) || 102 if ((NULL == reply_block) ||
142 (0 == reply_block_size) || 103 (0 == reply_block_size) ||
143 (0 != ((char *) reply_block)[0])) 104 (0 != ((char *) reply_block)[0]))
144 return GNUNET_BLOCK_REPLY_INVALID; 105 GNUNET_assert (0);
145 return GNUNET_BLOCK_REPLY_OK_MORE; 106 return GNUNET_BLOCK_REPLY_OK_MORE;
146} 107}
147 108
@@ -164,7 +125,7 @@ block_plugin_set_test_get_key (void *cls,
164 size_t block_size, 125 size_t block_size,
165 struct GNUNET_HashCode *key) 126 struct GNUNET_HashCode *key)
166{ 127{
167 return GNUNET_SYSERR; 128 return GNUNET_NO;
168} 129}
169 130
170 131
@@ -181,7 +142,6 @@ libgnunet_plugin_block_set_test_init (void *cls)
181 struct GNUNET_BLOCK_PluginFunctions *api; 142 struct GNUNET_BLOCK_PluginFunctions *api;
182 143
183 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); 144 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions);
184 api->evaluate = &block_plugin_set_test_evaluate;
185 api->get_key = &block_plugin_set_test_get_key; 145 api->get_key = &block_plugin_set_test_get_key;
186 api->check_query = &block_plugin_set_test_check_query; 146 api->check_query = &block_plugin_set_test_check_query;
187 api->check_block = &block_plugin_set_test_check_block; 147 api->check_block = &block_plugin_set_test_check_block;