- {
- case RP_PUT:
- memset (&key, 256 - crc->i, sizeof (GNUNET_HashCode));
- i = crc->j;
- k = crc->i;
- /* most content is 32k */
- size = 32 * 1024;
- if (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16) == 0) /* but some of it is less! */
- size = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 32 * 1024);
- crc->size = size = size - (size & 7); /* always multiple of 8 */
- GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &key);
- memset (data, i, size);
- if (i > 255)
- memset (data, i - 255, size / 2);
- data[0] = k;
- GNUNET_DATASTORE_put (datastore,
- 0,
- &key,
- size,
- data,
- i+1,
- GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100),
- i,
- GNUNET_TIME_relative_to_absolute
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
- GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000))),
- TIMEOUT,
- &check_success,
- crc);
- break;
- case RP_CUT:
- /* trim down below MAX_SIZE again */
- GNUNET_DATASTORE_get_random (datastore,
- &delete_value,
- crc,
- TIMEOUT);
- break;
- case RP_REPORT:
- printf (
+ {
+ case RP_PUT:
+ memset (&key, 256 - crc->i, sizeof (struct GNUNET_HashCode));
+ i = crc->j;
+ k = crc->i;
+ /* most content is 32k */
+ size = 32 * 1024;
+ if (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16) == 0) /* but some of it is less! */
+ size = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 32 * 1024);
+ crc->size = size = size - (size & 7); /* always multiple of 8 */
+ GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key);
+ memset (data, i, size);
+ if (i > 255)
+ memset (data, i - 255, size / 2);
+ data[0] = k;
+ GNUNET_assert (NULL !=
+ GNUNET_DATASTORE_put (datastore, 0, &key, size, data, i + 1,
+ GNUNET_CRYPTO_random_u32
+ (GNUNET_CRYPTO_QUALITY_WEAK, 100), i,
+ 0,
+ GNUNET_TIME_relative_to_absolute
+ (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS,
+ GNUNET_CRYPTO_random_u32
+ (GNUNET_CRYPTO_QUALITY_WEAK, 1000))),
+ 1, 1, TIMEOUT, &check_success, crc));
+ break;
+ case RP_CUT:
+ /* trim down below MAX_SIZE again */
+ GNUNET_assert (NULL !=
+ GNUNET_DATASTORE_get_for_replication (datastore, 1, 1,
+ TIMEOUT, &delete_value,
+ crc));
+ break;
+ case RP_REPORT:
+ printf (