aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_block_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_block_lib.h')
-rw-r--r--src/include/gnunet_block_lib.h81
1 files changed, 39 insertions, 42 deletions
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index 74ae2d322..ae6884869 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -39,113 +39,113 @@ extern "C"
39/** 39/**
40 * Blocks in the datastore and the datacache must have a unique type. 40 * Blocks in the datastore and the datacache must have a unique type.
41 */ 41 */
42enum GNUNET_BLOCK_Type 42enum GNUNET_BLOCK_Type
43 { 43{
44 /** 44 /**
45 * Any type of block, used as a wildcard when searching. Should 45 * Any type of block, used as a wildcard when searching. Should
46 * never be attached to a specific block. 46 * never be attached to a specific block.
47 */ 47 */
48 GNUNET_BLOCK_TYPE_ANY = 0, 48 GNUNET_BLOCK_TYPE_ANY = 0,
49 49
50 /** 50 /**
51 * Data block (leaf) in the CHK tree. 51 * Data block (leaf) in the CHK tree.
52 */ 52 */
53 GNUNET_BLOCK_TYPE_FS_DBLOCK = 1, 53 GNUNET_BLOCK_TYPE_FS_DBLOCK = 1,
54 54
55 /** 55 /**
56 * Inner block in the CHK tree. 56 * Inner block in the CHK tree.
57 */ 57 */
58 GNUNET_BLOCK_TYPE_FS_IBLOCK = 2, 58 GNUNET_BLOCK_TYPE_FS_IBLOCK = 2,
59 59
60 /** 60 /**
61 * Type of a block representing a keyword search result. Note that 61 * Type of a block representing a keyword search result. Note that
62 * the values for KBLOCK, SBLOCK and NBLOCK must be consecutive. 62 * the values for KBLOCK, SBLOCK and NBLOCK must be consecutive.
63 */ 63 */
64 GNUNET_BLOCK_TYPE_FS_KBLOCK = 3, 64 GNUNET_BLOCK_TYPE_FS_KBLOCK = 3,
65 65
66 /** 66 /**
67 * Type of a block that is used to advertise content in a namespace. 67 * Type of a block that is used to advertise content in a namespace.
68 */ 68 */
69 GNUNET_BLOCK_TYPE_FS_SBLOCK = 4, 69 GNUNET_BLOCK_TYPE_FS_SBLOCK = 4,
70 70
71 /** 71 /**
72 * Type of a block that is used to advertise a namespace. 72 * Type of a block that is used to advertise a namespace.
73 */ 73 */
74 GNUNET_BLOCK_TYPE_FS_NBLOCK = 5, 74 GNUNET_BLOCK_TYPE_FS_NBLOCK = 5,
75 75
76 /** 76 /**
77 * Type of a block representing a block to be encoded on demand from disk. 77 * Type of a block representing a block to be encoded on demand from disk.
78 * Should never appear on the network directly. 78 * Should never appear on the network directly.
79 */ 79 */
80 GNUNET_BLOCK_TYPE_FS_ONDEMAND = 6, 80 GNUNET_BLOCK_TYPE_FS_ONDEMAND = 6,
81 81
82 /** 82 /**
83 * Type of a block that contains a HELLO for a peer (for 83 * Type of a block that contains a HELLO for a peer (for
84 * DHT find-peer operations). 84 * DHT find-peer operations).
85 */ 85 */
86 GNUNET_BLOCK_TYPE_DHT_HELLO = 7, 86 GNUNET_BLOCK_TYPE_DHT_HELLO = 7,
87 87
88 /** 88 /**
89 * Block for testing. 89 * Block for testing.
90 */ 90 */
91 GNUNET_BLOCK_TYPE_TEST = 8, 91 GNUNET_BLOCK_TYPE_TEST = 8,
92 92
93#if HAVE_MALICIOUS 93#if HAVE_MALICIOUS
94 /** 94 /**
95 * Block for simulating malicious peers. 95 * Block for simulating malicious peers.
96 */ 96 */
97 GNUNET_BLOCK_DHT_MALICIOUS_MESSAGE_TYPE = 9, 97 GNUNET_BLOCK_DHT_MALICIOUS_MESSAGE_TYPE = 9,
98#endif 98#endif
99 99
100 /** 100 /**
101 * Block for storing .gnunet-domains 101 * Block for storing .gnunet-domains
102 */ 102 */
103 GNUNET_BLOCK_TYPE_DNS = 10 103 GNUNET_BLOCK_TYPE_DNS = 10
104 }; 104};
105 105
106 106
107/** 107/**
108 * Possible ways for how a block may relate to a query. 108 * Possible ways for how a block may relate to a query.
109 */ 109 */
110enum GNUNET_BLOCK_EvaluationResult 110enum GNUNET_BLOCK_EvaluationResult
111 { 111{
112 /** 112 /**
113 * Valid result, and there may be more. 113 * Valid result, and there may be more.
114 */ 114 */
115 GNUNET_BLOCK_EVALUATION_OK_MORE = 0, 115 GNUNET_BLOCK_EVALUATION_OK_MORE = 0,
116 116
117 /** 117 /**
118 * Last possible valid result. 118 * Last possible valid result.
119 */ 119 */
120 GNUNET_BLOCK_EVALUATION_OK_LAST = 1, 120 GNUNET_BLOCK_EVALUATION_OK_LAST = 1,
121 121
122 /** 122 /**
123 * Valid result, but suppressed because it is a duplicate. 123 * Valid result, but suppressed because it is a duplicate.
124 */ 124 */
125 GNUNET_BLOCK_EVALUATION_OK_DUPLICATE = 2, 125 GNUNET_BLOCK_EVALUATION_OK_DUPLICATE = 2,
126 126
127 /** 127 /**
128 * Block does not match query (invalid result) 128 * Block does not match query (invalid result)
129 */ 129 */
130 GNUNET_BLOCK_EVALUATION_RESULT_INVALID = 3, 130 GNUNET_BLOCK_EVALUATION_RESULT_INVALID = 3,
131 131
132 /** 132 /**
133 * Query is valid, no reply given. 133 * Query is valid, no reply given.
134 */ 134 */
135 GNUNET_BLOCK_EVALUATION_REQUEST_VALID = 4, 135 GNUNET_BLOCK_EVALUATION_REQUEST_VALID = 4,
136 136
137 /** 137 /**
138 * Query format does not match block type (invalid query). For 138 * Query format does not match block type (invalid query). For
139 * example, xquery not given or xquery_size not appropriate for 139 * example, xquery not given or xquery_size not appropriate for
140 * type. 140 * type.
141 */ 141 */
142 GNUNET_BLOCK_EVALUATION_REQUEST_INVALID = 5, 142 GNUNET_BLOCK_EVALUATION_REQUEST_INVALID = 5,
143 143
144 /** 144 /**
145 * Specified block type not supported by this plugin. 145 * Specified block type not supported by this plugin.
146 */ 146 */
147 GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED = 6 147 GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED = 6
148 }; 148};
149 149
150 150
151/** 151/**
@@ -163,8 +163,7 @@ struct GNUNET_BLOCK_Context;
163 */ 163 */
164void 164void
165GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, 165GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in,
166 uint32_t mingle_number, 166 uint32_t mingle_number, GNUNET_HashCode * hc);
167 GNUNET_HashCode * hc);
168 167
169 168
170/** 169/**
@@ -173,8 +172,9 @@ GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in,
173 * @param cfg configuration to use 172 * @param cfg configuration to use
174 * @return NULL on error 173 * @return NULL on error
175 */ 174 */
176struct GNUNET_BLOCK_Context * 175struct GNUNET_BLOCK_Context *GNUNET_BLOCK_context_create (const struct
177GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg); 176 GNUNET_CONFIGURATION_Handle
177 *cfg);
178 178
179 179
180/** 180/**
@@ -182,8 +182,7 @@ GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg);
182 * 182 *
183 * @param ctx context to destroy 183 * @param ctx context to destroy
184 */ 184 */
185void 185void GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx);
186GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx);
187 186
188 187
189/** 188/**
@@ -206,14 +205,13 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx);
206 */ 205 */
207enum GNUNET_BLOCK_EvaluationResult 206enum GNUNET_BLOCK_EvaluationResult
208GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx, 207GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
209 enum GNUNET_BLOCK_Type type, 208 enum GNUNET_BLOCK_Type type,
210 const GNUNET_HashCode *query, 209 const GNUNET_HashCode * query,
211 struct GNUNET_CONTAINER_BloomFilter **bf, 210 struct GNUNET_CONTAINER_BloomFilter **bf,
212 int32_t bf_mutator, 211 int32_t bf_mutator,
213 const void *xquery, 212 const void *xquery,
214 size_t xquery_size, 213 size_t xquery_size,
215 const void *reply_block, 214 const void *reply_block, size_t reply_block_size);
216 size_t reply_block_size);
217 215
218 216
219/** 217/**
@@ -231,10 +229,9 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
231 */ 229 */
232int 230int
233GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx, 231GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
234 enum GNUNET_BLOCK_Type type, 232 enum GNUNET_BLOCK_Type type,
235 const void *block, 233 const void *block,
236 size_t block_size, 234 size_t block_size, GNUNET_HashCode * key);
237 GNUNET_HashCode *key);
238 235
239 236
240#if 0 /* keep Emacsens' auto-indent happy */ 237#if 0 /* keep Emacsens' auto-indent happy */