GNUNET_DHT_RO_RECORD_ROUTE |
GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
GNUNET_BLOCK_TYPE_MESH_PEER_BY_TYPE,
- sizeof (struct PBlock),
- &block,
+ sizeof (block),
+ (const char *) &block,
GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
APP_ANNOUNCE_TIME),
APP_ANNOUNCE_TIME, NULL, NULL);
static void
announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ struct PBlock block;
+
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
{
announce_id_task = GNUNET_SCHEDULER_NO_TASK;
*/
DEBUG_DHT ("DHT_put for ID %s started.\n", GNUNET_i2s (&my_full_id));
+ block.id = my_full_id;
+ block.type = htonl (0);
GNUNET_DHT_put (dht_handle, /* DHT handle */
&my_full_id.hashPubKey, /* Key to use */
10, /* Replication level */
GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, /* DHT options */
GNUNET_BLOCK_TYPE_MESH_PEER, /* Block type */
- sizeof (my_full_id), /* Size of the data */
- (char *) &my_full_id, /* Data itself */
+ sizeof (block), /* Size of the data */
+ (const char *) &block, /* Data itself */
GNUNET_TIME_UNIT_FOREVER_ABS, /* Data expiration */
GNUNET_TIME_UNIT_FOREVER_REL, /* Retry time */
NULL, /* Continuation */
struct GNUNET_HashCode * key)
{
const struct PBlock *pb;
+ pb = block;
switch (type)
{
case GNUNET_BLOCK_TYPE_MESH_PEER:
if (sizeof (struct PBlock) != block_size)
return GNUNET_SYSERR;
- pb = block;
*key = pb->id.hashPubKey;
return GNUNET_OK;
- // FIXME: other types...
+ case GNUNET_BLOCK_TYPE_MESH_PEER_BY_TYPE:
+ GNUNET_CRYPTO_hash (&pb->type, sizeof(GNUNET_MESH_ApplicationType), key);
+ return GNUNET_OK;
default:
return GNUNET_SYSERR;
}