aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_routing.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-27 12:01:04 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-27 12:01:04 +0000
commit6344484c91bce5989eec1cd33d94588661ea7bb0 (patch)
tree711f3ff92dc242bab47f2d6d946a4e97cb3ea6ae /src/dht/gnunet-service-dht_routing.c
parent621e141e0ce52f5793cce348ff070e90dad296cc (diff)
downloadgnunet-6344484c91bce5989eec1cd33d94588661ea7bb0.tar.gz
gnunet-6344484c91bce5989eec1cd33d94588661ea7bb0.zip
respect path tracking and demultiplex everywhere options
Diffstat (limited to 'src/dht/gnunet-service-dht_routing.c')
-rw-r--r--src/dht/gnunet-service-dht_routing.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c
index 4024c61fb..41996d654 100644
--- a/src/dht/gnunet-service-dht_routing.c
+++ b/src/dht/gnunet-service-dht_routing.c
@@ -83,6 +83,11 @@ struct RecentRequest
83 */ 83 */
84 uint32_t reply_bf_mutator; 84 uint32_t reply_bf_mutator;
85 85
86 /**
87 * Request options.
88 */
89 enum GNUNET_DHT_RouteOption options;
90
86}; 91};
87 92
88 93
@@ -162,10 +167,23 @@ process (void *cls,
162 struct ProcessContext *pc = cls; 167 struct ProcessContext *pc = cls;
163 struct RecentRequest *rr = value; 168 struct RecentRequest *rr = value;
164 enum GNUNET_BLOCK_EvaluationResult eval; 169 enum GNUNET_BLOCK_EvaluationResult eval;
170 unsigned int gpl;
171 unsigned int ppl;
165 172
166 if ( (rr->type != GNUNET_BLOCK_TYPE_ANY) && 173 if ( (rr->type != GNUNET_BLOCK_TYPE_ANY) &&
167 (rr->type != pc->type) ) 174 (rr->type != pc->type) )
168 return GNUNET_OK; /* type missmatch */ 175 return GNUNET_OK; /* type missmatch */
176
177 if (0 != (rr->options & GNUNET_DHT_RO_RECORD_ROUTE))
178 {
179 gpl = pc->get_path_length;
180 ppl = pc->put_path_length;
181 }
182 else
183 {
184 gpl = 0;
185 ppl = 0;
186 }
169 eval = GNUNET_BLOCK_evaluate (GDS_block_context, 187 eval = GNUNET_BLOCK_evaluate (GDS_block_context,
170 pc->type, 188 pc->type,
171 key, 189 key,
@@ -183,9 +201,9 @@ process (void *cls,
183 pc->type, 201 pc->type,
184 pc->expiration_time, 202 pc->expiration_time,
185 key, 203 key,
186 pc->put_path_length, 204 ppl,
187 pc->put_path, 205 pc->put_path,
188 pc->get_path_length, 206 gpl,
189 pc->get_path, 207 pc->get_path,
190 pc->data, 208 pc->data,
191 pc->data_size); 209 pc->data_size);
@@ -259,6 +277,7 @@ GDS_ROUTING_process (enum GNUNET_BLOCK_Type type,
259 * 277 *
260 * @param sender peer that originated the request 278 * @param sender peer that originated the request
261 * @param type type of the block 279 * @param type type of the block
280 * @param options options for processing
262 * @param key key for the content 281 * @param key key for the content
263 * @param xquery extended query 282 * @param xquery extended query
264 * @param xquery_size number of bytes in xquery 283 * @param xquery_size number of bytes in xquery
@@ -268,6 +287,7 @@ GDS_ROUTING_process (enum GNUNET_BLOCK_Type type,
268void 287void
269GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, 288GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
270 enum GNUNET_BLOCK_Type type, 289 enum GNUNET_BLOCK_Type type,
290 enum GNUNET_DHT_RouteOption options,
271 const GNUNET_HashCode *key, 291 const GNUNET_HashCode *key,
272 const void *xquery, 292 const void *xquery,
273 size_t xquery_size, 293 size_t xquery_size,
@@ -294,6 +314,7 @@ GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
294 recent_req->reply_bf = 314 recent_req->reply_bf =
295 GNUNET_CONTAINER_bloomfilter_copy (reply_bf); 315 GNUNET_CONTAINER_bloomfilter_copy (reply_bf);
296 recent_req->type = type; 316 recent_req->type = type;
317 recent_req->options = options;
297 recent_req->xquery = &recent_req[1]; 318 recent_req->xquery = &recent_req[1];
298 recent_req->xquery_size = xquery_size; 319 recent_req->xquery_size = xquery_size;
299 recent_req->reply_bf_mutator = reply_bf_mutator; 320 recent_req->reply_bf_mutator = reply_bf_mutator;