Next: , Previous: , Up: Implementing a block plugin   [Contents]


4.7.3.2 Deriving a key from a reply

The DHT can operate more efficiently if it is possible to derive a key from the value of the corresponding block. The get\_key function is used to obtain the key of a block — for example, by means of hashing. If deriving the key is not possible, the function should simply return GNUNET\_SYSERR (the DHT will still work just fine with such blocks).

static int
block_plugin_SERVICE_get_key (void *cls, enum GNUNET_BLOCK_Type type,
                             const void *block, size_t block_size,
                             struct GNUNET_HashCode *key)
{
  // Store the key in the key argument, return GNUNET_OK on success.
}