aboutsummaryrefslogtreecommitdiff
path: root/src/block
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-11-05 21:54:44 +0000
committerChristian Grothoff <christian@grothoff.org>2010-11-05 21:54:44 +0000
commitbdc3b54372a92874c2ecb58069eac5bdfe6fcddc (patch)
tree575c606a8f81c1f0baabad43bf34789023513ee7 /src/block
parentf0963cfb7a694f9a7c7ff28471660242529f00a8 (diff)
downloadgnunet-bdc3b54372a92874c2ecb58069eac5bdfe6fcddc.tar.gz
gnunet-bdc3b54372a92874c2ecb58069eac5bdfe6fcddc.zip
moving plugin headers
Diffstat (limited to 'src/block')
-rw-r--r--src/block/Makefile.am2
-rw-r--r--src/block/block.c2
-rw-r--r--src/block/plugin_block.h118
-rw-r--r--src/block/plugin_block_dht.c2
-rw-r--r--src/block/plugin_block_dns.c2
-rw-r--r--src/block/plugin_block_fs.c2
-rw-r--r--src/block/plugin_block_template.c2
-rw-r--r--src/block/plugin_block_test.c2
8 files changed, 7 insertions, 125 deletions
diff --git a/src/block/Makefile.am b/src/block/Makefile.am
index 11dea77d7..1d24b1bfa 100644
--- a/src/block/Makefile.am
+++ b/src/block/Makefile.am
@@ -60,7 +60,7 @@ libgnunet_plugin_block_test_la_LDFLAGS = \
60 60
61 61
62libgnunetblock_la_SOURCES = \ 62libgnunetblock_la_SOURCES = \
63 block.c plugin_block.h 63 block.c
64libgnunetblock_la_LIBADD = \ 64libgnunetblock_la_LIBADD = \
65 $(top_builddir)/src/util/libgnunetutil.la 65 $(top_builddir)/src/util/libgnunetutil.la
66 66
diff --git a/src/block/block.c b/src/block/block.c
index 29382dad1..276f8ee77 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -27,7 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_signatures.h" 28#include "gnunet_signatures.h"
29#include "gnunet_block_lib.h" 29#include "gnunet_block_lib.h"
30#include "plugin_block.h" 30#include "gnunet_block_plugin.h"
31 31
32 32
33/** 33/**
diff --git a/src/block/plugin_block.h b/src/block/plugin_block.h
deleted file mode 100644
index e0a323d25..000000000
--- a/src/block/plugin_block.h
+++ /dev/null
@@ -1,118 +0,0 @@
1/*
2 This file is part of GNUnet
3 (C) 2010 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file block/plugin_block.h
23 * @brief API for block plugins. Each block plugin must conform to
24 * the API specified by this header.
25 * @author Christian Grothoff
26 */
27#ifndef PLUGIN_BLOCK_H
28#define PLUGIN_BLOCK_H
29
30#include "gnunet_util_lib.h"
31#include "gnunet_container_lib.h"
32#include "gnunet_block_lib.h"
33
34
35/**
36 * Function called to validate a reply or a request. For
37 * request evaluation, simply pass "NULL" for the reply_block.
38 * Note that it is assumed that the reply has already been
39 * matched to the key (and signatures checked) as it would
40 * be done with the "get_key" function.
41 *
42 * @param cls closure
43 * @param type block type
44 * @param query original query (hash)
45 * @param bf pointer to bloom filter associated with query; possibly updated (!)
46 * @param bf_mutator mutation value for bf
47 * @param xquery extrended query data (can be NULL, depending on type)
48 * @param xquery_size number of bytes in xquery
49 * @param reply_block response to validate
50 * @param reply_block_size number of bytes in reply block
51 * @return characterization of result
52 */
53typedef enum GNUNET_BLOCK_EvaluationResult
54 (*GNUNET_BLOCK_EvaluationFunction) (void *cls,
55 enum GNUNET_BLOCK_Type type,
56 const GNUNET_HashCode *query,
57 struct GNUNET_CONTAINER_BloomFilter **bf,
58 int32_t bf_mutator,
59 const void *xquery,
60 size_t xquery_size,
61 const void *reply_block,
62 size_t reply_block_size);
63
64
65/**
66 * Function called to obtain the key for a block.
67 *
68 * @param cls closure
69 * @param type block type
70 * @param block block to get the key for
71 * @param block_size number of bytes in block
72 * @param key set to the key (query) for the given block
73 * @return GNUNET_YES on success,
74 * GNUNET_NO if the block is malformed
75 * GNUNET_SYSERR if type not supported
76 * (or if extracting a key from a block of this type does not work)
77 */
78typedef int
79 (*GNUNET_BLOCK_GetKeyFunction) (void *cls,
80 enum GNUNET_BLOCK_Type type,
81 const void *block,
82 size_t block_size,
83 GNUNET_HashCode *key);
84
85
86
87/**
88 * Each plugin is required to return a pointer to a struct of this
89 * type as the return value from its entry point.
90 */
91struct GNUNET_BLOCK_PluginFunctions
92{
93
94 /**
95 * Closure for all of the callbacks.
96 */
97 void *cls;
98
99 /**
100 * 0-terminated array of block types supported by this plugin.
101 */
102 const enum GNUNET_BLOCK_Type *types;
103
104 /**
105 * Main function of a block plugin. Allows us to check if a
106 * block matches a query.
107 */
108 GNUNET_BLOCK_EvaluationFunction evaluate;
109
110 /**
111 * Obtain the key for a given block (if possible).
112 */
113 GNUNET_BLOCK_GetKeyFunction get_key;
114
115};
116
117
118#endif
diff --git a/src/block/plugin_block_dht.c b/src/block/plugin_block_dht.c
index c636f00c2..0e499b821 100644
--- a/src/block/plugin_block_dht.c
+++ b/src/block/plugin_block_dht.c
@@ -28,7 +28,7 @@
28 28
29#include "platform.h" 29#include "platform.h"
30#include "gnunet_hello_lib.h" 30#include "gnunet_hello_lib.h"
31#include "plugin_block.h" 31#include "gnunet_block_plugin.h"
32 32
33#define DEBUG_DHT GNUNET_NO 33#define DEBUG_DHT GNUNET_NO
34 34
diff --git a/src/block/plugin_block_dns.c b/src/block/plugin_block_dns.c
index 338e07dc2..4321baf34 100644
--- a/src/block/plugin_block_dns.c
+++ b/src/block/plugin_block_dns.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
28#include "plugin_block.h" 28#include "gnunet_block_plugin.h"
29#include "block_dns.h" 29#include "block_dns.h"
30#include "gnunet_signatures.h" 30#include "gnunet_signatures.h"
31 31
diff --git a/src/block/plugin_block_fs.c b/src/block/plugin_block_fs.c
index 248878765..caf009ddf 100644
--- a/src/block/plugin_block_fs.c
+++ b/src/block/plugin_block_fs.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
28#include "plugin_block.h" 28#include "gnunet_block_plugin.h"
29#include "block_fs.h" 29#include "block_fs.h"
30#include "gnunet_signatures.h" 30#include "gnunet_signatures.h"
31 31
diff --git a/src/block/plugin_block_template.c b/src/block/plugin_block_template.c
index 23a25ae02..77e7c0ab9 100644
--- a/src/block/plugin_block_template.c
+++ b/src/block/plugin_block_template.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
28#include "plugin_block.h" 28#include "gnunet_block_plugin.h"
29 29
30#define DEBUG_TEMPLATE GNUNET_NO 30#define DEBUG_TEMPLATE GNUNET_NO
31 31
diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c
index eb3e200b0..639a5c46e 100644
--- a/src/block/plugin_block_test.c
+++ b/src/block/plugin_block_test.c
@@ -26,7 +26,7 @@
26 */ 26 */
27 27
28#include "platform.h" 28#include "platform.h"
29#include "plugin_block.h" 29#include "gnunet_block_plugin.h"
30 30
31#define DEBUG_TEST GNUNET_NO 31#define DEBUG_TEST GNUNET_NO
32 32