memset (sm, 0, sizeof (struct SearchMessage));
sm->header.size = htons (sizeof (struct SearchMessage));
sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
+ if (dc->pending->depth == dc->treedepth)
+ sm->type = htonl (GNUNET_DATASTORE_BLOCKTYPE_DBLOCK);
+ else
+ sm->type = htonl (GNUNET_DATASTORE_BLOCKTYPE_IBLOCK);
sm->anonymity_level = htonl (dc->anonymity);
sm->target = dc->target.hashPubKey;
sm->query = dc->pending->chk.query;
uint32_t ttl_decrement;
uint32_t type;
double preference;
+ int have_ns;
msize = ntohs(message->size);
if (msize < sizeof (struct GetMessage))
return GNUNET_SYSERR;
}
gm = (const struct GetMessage*) message;
+ type = ntohl (gm->type);
+ switch (type)
+ {
+ case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
+ case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
+ case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
+ case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
+ break;
+ default:
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
bm = ntohl (gm->hash_bitmap);
bits = 0;
while (bm > 0)
(unsigned int) ntohl (gm->type),
GNUNET_i2s (other));
#endif
+ have_ns = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE));
pr = GNUNET_malloc (sizeof (struct PendingRequest) +
- (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)?sizeof(GNUNET_HashCode):0);
- if ((bm & GET_MESSAGE_BIT_SKS_NAMESPACE))
+ (have_ns ? sizeof(GNUNET_HashCode) : 0));
+ if (have_ns)
pr->namespace = (GNUNET_HashCode*) &pr[1];
- pr->type = ntohl (gm->type);
+ pr->type = type;
pr->mingle = ntohl (gm->filter_mutator);
if (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE))
memcpy (&pr[1], &opt[bits++], sizeof (GNUNET_HashCode));
cps->inc_preference += preference;
/* process locally */
- type = pr->type;
if (type == GNUNET_DATASTORE_BLOCKTYPE_DBLOCK)
type = GNUNET_DATASTORE_BLOCKTYPE_ANY; /* to get on-demand as well */
timeout = GNUNET_TIME_relative_multiply (BASIC_DATASTORE_REQUEST_DELAY,
client_list = cl;
}
type = ntohl (sm->type);
+ switch (type)
+ {
+ case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
+ case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
+ case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
+ case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
+ break;
+ default:
+ GNUNET_break (0);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
+ return GNUNET_SYSERR;
+ }
#if DEBUG_FS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received request for `%s' of type %u from local client\n",