diff options
Diffstat (limited to 'src/block/plugin_block_template.c')
-rw-r--r-- | src/block/plugin_block_template.c | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/src/block/plugin_block_template.c b/src/block/plugin_block_template.c index 1918f00aa..5bfacb660 100644 --- a/src/block/plugin_block_template.c +++ b/src/block/plugin_block_template.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file block/plugin_block_template.c | 22 | * @file block/plugin_block_template.c |
@@ -56,37 +56,37 @@ | |||
56 | * by this @a type of block (this is not an error) | 56 | * by this @a type of block (this is not an error) |
57 | */ | 57 | */ |
58 | static struct GNUNET_BLOCK_Group * | 58 | static struct GNUNET_BLOCK_Group * |
59 | block_plugin_template_create_group (void *cls, | 59 | block_plugin_template_create_group(void *cls, |
60 | enum GNUNET_BLOCK_Type type, | 60 | enum GNUNET_BLOCK_Type type, |
61 | uint32_t nonce, | 61 | uint32_t nonce, |
62 | const void *raw_data, | 62 | const void *raw_data, |
63 | size_t raw_data_size, | 63 | size_t raw_data_size, |
64 | va_list va) | 64 | va_list va) |
65 | { | 65 | { |
66 | unsigned int bf_size; | 66 | unsigned int bf_size; |
67 | const char *guard; | 67 | const char *guard; |
68 | 68 | ||
69 | guard = va_arg (va, const char *); | 69 | guard = va_arg(va, const char *); |
70 | if (0 == strcmp (guard, | 70 | if (0 == strcmp(guard, |
71 | "seen-set-size")) | 71 | "seen-set-size")) |
72 | bf_size = GNUNET_BLOCK_GROUP_compute_bloomfilter_size (va_arg (va, unsigned int), | 72 | bf_size = GNUNET_BLOCK_GROUP_compute_bloomfilter_size(va_arg(va, unsigned int), |
73 | BLOOMFILTER_K); | 73 | BLOOMFILTER_K); |
74 | else if (0 == strcmp (guard, | 74 | else if (0 == strcmp(guard, |
75 | "filter-size")) | 75 | "filter-size")) |
76 | bf_size = va_arg (va, unsigned int); | 76 | bf_size = va_arg(va, unsigned int); |
77 | else | 77 | else |
78 | { | 78 | { |
79 | GNUNET_break (0); | 79 | GNUNET_break(0); |
80 | bf_size = TEMPLATE_BF_SIZE; | 80 | bf_size = TEMPLATE_BF_SIZE; |
81 | } | 81 | } |
82 | GNUNET_break (NULL == va_arg (va, const char *)); | 82 | GNUNET_break(NULL == va_arg(va, const char *)); |
83 | return GNUNET_BLOCK_GROUP_bf_create (cls, | 83 | return GNUNET_BLOCK_GROUP_bf_create(cls, |
84 | bf_size, | 84 | bf_size, |
85 | BLOOMFILTER_K, | 85 | BLOOMFILTER_K, |
86 | type, | 86 | type, |
87 | nonce, | 87 | nonce, |
88 | raw_data, | 88 | raw_data, |
89 | raw_data_size); | 89 | raw_data_size); |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
@@ -107,27 +107,27 @@ block_plugin_template_create_group (void *cls, | |||
107 | * @return characterization of result | 107 | * @return characterization of result |
108 | */ | 108 | */ |
109 | static enum GNUNET_BLOCK_EvaluationResult | 109 | static enum GNUNET_BLOCK_EvaluationResult |
110 | block_plugin_template_evaluate (void *cls, | 110 | block_plugin_template_evaluate(void *cls, |
111 | struct GNUNET_BLOCK_Context *ctx, | 111 | struct GNUNET_BLOCK_Context *ctx, |
112 | enum GNUNET_BLOCK_Type type, | 112 | enum GNUNET_BLOCK_Type type, |
113 | struct GNUNET_BLOCK_Group *group, | 113 | struct GNUNET_BLOCK_Group *group, |
114 | enum GNUNET_BLOCK_EvaluationOptions eo, | 114 | enum GNUNET_BLOCK_EvaluationOptions eo, |
115 | const struct GNUNET_HashCode *query, | 115 | const struct GNUNET_HashCode *query, |
116 | const void *xquery, | 116 | const void *xquery, |
117 | size_t xquery_size, | 117 | size_t xquery_size, |
118 | const void *reply_block, | 118 | const void *reply_block, |
119 | size_t reply_block_size) | 119 | size_t reply_block_size) |
120 | { | 120 | { |
121 | struct GNUNET_HashCode chash; | 121 | struct GNUNET_HashCode chash; |
122 | 122 | ||
123 | if (NULL == reply_block) | 123 | if (NULL == reply_block) |
124 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 124 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
125 | GNUNET_CRYPTO_hash (reply_block, | 125 | GNUNET_CRYPTO_hash(reply_block, |
126 | reply_block_size, | 126 | reply_block_size, |
127 | &chash); | 127 | &chash); |
128 | if (GNUNET_YES == | 128 | if (GNUNET_YES == |
129 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, | 129 | GNUNET_BLOCK_GROUP_bf_test_and_set(group, |
130 | &chash)) | 130 | &chash)) |
131 | return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; | 131 | return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; |
132 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; | 132 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; |
133 | } | 133 | } |
@@ -145,11 +145,11 @@ block_plugin_template_evaluate (void *cls, | |||
145 | * (or if extracting a key from a block of this type does not work) | 145 | * (or if extracting a key from a block of this type does not work) |
146 | */ | 146 | */ |
147 | static int | 147 | static int |
148 | block_plugin_template_get_key (void *cls, | 148 | block_plugin_template_get_key(void *cls, |
149 | enum GNUNET_BLOCK_Type type, | 149 | enum GNUNET_BLOCK_Type type, |
150 | const void *block, | 150 | const void *block, |
151 | size_t block_size, | 151 | size_t block_size, |
152 | struct GNUNET_HashCode *key) | 152 | struct GNUNET_HashCode *key) |
153 | { | 153 | { |
154 | return GNUNET_SYSERR; | 154 | return GNUNET_SYSERR; |
155 | } | 155 | } |
@@ -161,7 +161,7 @@ block_plugin_template_get_key (void *cls, | |||
161 | * @param cls a `const struct GNUNET_CONFIGURATION_Handle` | 161 | * @param cls a `const struct GNUNET_CONFIGURATION_Handle` |
162 | */ | 162 | */ |
163 | void * | 163 | void * |
164 | libgnunet_plugin_block_template_init (void *cls) | 164 | libgnunet_plugin_block_template_init(void *cls) |
165 | { | 165 | { |
166 | static enum GNUNET_BLOCK_Type types[] = | 166 | static enum GNUNET_BLOCK_Type types[] = |
167 | { | 167 | { |
@@ -170,7 +170,7 @@ libgnunet_plugin_block_template_init (void *cls) | |||
170 | }; | 170 | }; |
171 | struct GNUNET_BLOCK_PluginFunctions *api; | 171 | struct GNUNET_BLOCK_PluginFunctions *api; |
172 | 172 | ||
173 | api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); | 173 | api = GNUNET_new(struct GNUNET_BLOCK_PluginFunctions); |
174 | api->evaluate = &block_plugin_template_evaluate; | 174 | api->evaluate = &block_plugin_template_evaluate; |
175 | api->get_key = &block_plugin_template_get_key; | 175 | api->get_key = &block_plugin_template_get_key; |
176 | api->create_group = &block_plugin_template_create_group; | 176 | api->create_group = &block_plugin_template_create_group; |
@@ -183,11 +183,11 @@ libgnunet_plugin_block_template_init (void *cls) | |||
183 | * Exit point from the plugin. | 183 | * Exit point from the plugin. |
184 | */ | 184 | */ |
185 | void * | 185 | void * |
186 | libgnunet_plugin_block_template_done (void *cls) | 186 | libgnunet_plugin_block_template_done(void *cls) |
187 | { | 187 | { |
188 | struct GNUNET_BLOCK_PluginFunctions *api = cls; | 188 | struct GNUNET_BLOCK_PluginFunctions *api = cls; |
189 | 189 | ||
190 | GNUNET_free (api); | 190 | GNUNET_free(api); |
191 | return NULL; | 191 | return NULL; |
192 | } | 192 | } |
193 | 193 | ||