- integrate with DHT (need DHT API to fit block API better first; also, get rid of the continuation!)
* DHT: [Nate]
- use new block lib in service
- - provide block-lib compatible API in gnunet_dht_service.h
- - eliminate continuations in DHT API (not needed, we have auto-retransmit!)
+ - track paths content travels (PUT, reply-to-get) in messages,
+ pass to client (client API & protocol already support this!)
* CORE:
- authentication of ciphertexts [Nils]
- Jun 27 11:51:54 core-7670 ERROR Assertion failed at gnunet-service-core.c:3616.
struct GNUNET_MessageHeader header;
/**
- * For alignment, always zero.
+ * Number of peers recorded in the "PUT" path.
+ * (original path message took during "PUT"). These
+ * peer identities follow this message.
*/
- uint32_t reserved GNUNET_PACKED;
+ uint16_t put_path_length GNUNET_PACKED;
+
+ /**
+ * Number of peers recorded in the "GET" path
+ * (inverse of the path the GET message took). These
+ * peer identities follow this message.
+ */
+ uint16_t get_path_length GNUNET_PACKED;
/**
* Unique ID identifying this request (necessary for
*/
GNUNET_HashCode key;
+ /* PUT path */
+
+ /* GET path */
+
/* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */
};
*/
struct GNUNET_MessageHeader header;
+ /**
+ * Always zero.
+ */
+ uint32_t reserved GNUNET_PACKED;
+
/**
* Message options
*/
uint32_t hop_count GNUNET_PACKED;
/**
- * Network size estimate
+ * Replication level for this message
*/
- uint32_t network_size GNUNET_PACKED;
+ uint32_t desired_replication_level GNUNET_PACKED;
/**
- * Replication level for this message
+ * Network size estimate
*/
- uint32_t desired_replication_level GNUNET_PACKED;
+ uint32_t network_size GNUNET_PACKED;
/**
* Unique ID identifying this request
*/
struct GNUNET_MessageHeader header;
+ /**
+ * Number of peers recorded in the "PUT" path.
+ * (original path message took during "PUT"). These
+ * peer identities follow this message.
+ */
+ uint16_t put_path_length GNUNET_PACKED;
+
+ /**
+ * Number of peers recorded in the "GET" path
+ * (inverse of the path the GET message took). These
+ * peer identities follow this message.
+ */
+ uint16_t get_path_length GNUNET_PACKED;
+
/**
* Message options
*/
uint32_t network_size GNUNET_PACKED;
#endif
+
+ /* PUT path */
+
+ /* GET path */
+
/* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */
};
const struct GNUNET_MessageHeader *enc_msg;
size_t enc_size;
uint64_t uid;
- const struct GNUNET_PeerIdentity *const*get_path;
- const struct GNUNET_PeerIdentity *const*put_path;
+ const struct GNUNET_PeerIdentity **get_path;
+ const struct GNUNET_PeerIdentity **put_path;
+ const struct GNUNET_PeerIdentity *pos;
+ uint16_t gpl;
+ uint16_t ppl;
+ unsigned int i;
uid = GNUNET_ntohll (dht_msg->unique_id);
if (uid != rh->uid)
GNUNET_break (0);
return GNUNET_NO;
}
- enc_msg = (const struct GNUNET_MessageHeader *) &dht_msg[1];
+ pos = (const struct GNUNET_PeerIdentity *) &dht_msg[1];
+ ppl = ntohs (dht_msg->put_path_length);
+ gpl = ntohs (dht_msg->get_path_length);
+ if ( (ppl + gpl) * sizeof (struct GNUNET_PeerIdentity) > enc_size)
+ {
+ GNUNET_break (0);
+ return GNUNET_NO;
+ }
+ if (ppl > 0)
+ {
+ put_path = GNUNET_malloc ((ppl+1) * sizeof (struct GNUNET_PeerIdentity*));
+ for (i=0;i<ppl;i++)
+ {
+ put_path[i] = pos;
+ pos++;
+ }
+ put_path[ppl] = NULL;
+ }
+ else
+ put_path = NULL;
+ if (gpl > 0)
+ {
+ get_path = GNUNET_malloc ((gpl+1) * sizeof (struct GNUNET_PeerIdentity*));
+ for (i=0;i<gpl;i++)
+ {
+ get_path[i] = pos;
+ pos++;
+ }
+ get_path[gpl] = NULL;
+ }
+ else
+ get_path = NULL;
+ enc_size -= (ppl + gpl) * sizeof (struct GNUNET_PeerIdentity);
+ enc_msg = (const struct GNUNET_MessageHeader *) pos;
if (enc_size != ntohs (enc_msg->size))
{
GNUNET_break (0);
+ GNUNET_free_non_null (get_path);
+ GNUNET_free_non_null (put_path);
return GNUNET_NO;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Processing reply.\n");
- get_path = NULL; // FIXME: parse path info!
- put_path = NULL; // FIXME: parse path info!
rh->iter (rh->iter_cls,
&rh->key,
get_path,
put_path,
enc_msg);
+ GNUNET_free_non_null (get_path);
+ GNUNET_free_non_null (put_path);
return GNUNET_YES;
}
* @param peer the peer to forward the message to
* @param msg_ctx the context of the message (hop count, bloom, etc.)
*/
-static void forward_result_message (void *cls,
- const struct GNUNET_MessageHeader *msg,
- struct PeerInfo *peer,
- struct DHT_MessageContext *msg_ctx)
+static void
+forward_result_message (void *cls,
+ const struct GNUNET_MessageHeader *msg,
+ struct PeerInfo *peer,
+ struct DHT_MessageContext *msg_ctx)
{
struct GNUNET_DHT_P2PRouteResultMessage *result_message;
struct P2PPendingMessage *pending;
result_message = (struct GNUNET_DHT_P2PRouteResultMessage *)pending->msg;
result_message->header.size = htons(msize);
result_message->header.type = htons(GNUNET_MESSAGE_TYPE_DHT_P2P_ROUTE_RESULT);
+ result_message->put_path_length = htons(0); /* FIXME: implement */
+ result_message->get_path_length = htons(0); /* FIXME: implement */
result_message->options = htonl(msg_ctx->msg_options);
result_message->hop_count = htonl(msg_ctx->hop_count + 1);
GNUNET_assert(GNUNET_OK == GNUNET_CONTAINER_bloomfilter_get_raw_data(msg_ctx->bloom, result_message->bloomfilter, DHT_BLOOM_SIZE));
reply = (struct GNUNET_DHT_RouteResultMessage *)&pending_message[1];
reply->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_LOCAL_ROUTE_RESULT);
reply->header.size = htons (tsize);
- reply->reserved = 0;
+ reply->put_path_length = htons(0); /* FIXME: implement */
+ reply->get_path_length = htons(0); /* FIXME: implement */
reply->unique_id = GNUNET_htonll (uid);
reply->key = *key;
memcpy (&reply[1], message, msize);