};
+/**
+ * No options.
+ */
+#define SEARCH_MESSAGE_OPTION_NONE 0
+
+/**
+ * Only search the local datastore (no network)
+ */
+#define SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY 1
+
+/**
+ * Request is too large to fit in 64k format. The list of
+ * already-known search results will be continued in another message
+ * for the same type/query/target and additional already-known results
+ * following this one).
+ */
+#define SEARCH_MESSAGE_OPTION_CONTINUED 2
+
+
/**
* Message sent from a GNUnet (fs) search activity to the
* gnunet-service-fs to start a search.
struct GNUNET_MessageHeader header;
/**
- * Bitmask with options. Zero for no options, one for loopback-only.
+ * Bitmask with options. Zero for no options, one for
+ * loopback-only, two for 'to be continued' (with a second search
+ * message for the same type/query/target and additional
+ * already-known results following this one). See
+ * SEARCH_MESSAGE_OPTION_ defines.
+ *
* Other bits are currently not defined.
*/
- int32_t options GNUNET_PACKED;
+ uint32_t options GNUNET_PACKED;
/**
* Type of the content that we're looking for.
sm->header.size = htons (sizeof (struct SearchMessage));
sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
if (0 != (dc->options & GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY))
- sm->options = htonl (1);
+ sm->options = htonl (GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY);
else
- sm->options = htonl (0);
+ sm->options = htonl (GNUNET_FS_SEARCH_OPTION_NONE);
if (dr->depth == 0)
sm->type = htonl (GNUNET_BLOCK_TYPE_FS_DBLOCK);
else
GNUNET_HashCode key;
GNUNET_HashCode idh;
unsigned int sqms;
+ uint32_t options;
if (NULL == buf)
{
sm = buf;
sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
mbc.xoff = (GNUNET_HashCode *) & sm[1];
+ options = SEARCH_MESSAGE_OPTION_NONE;
+ if (0 != (sc->options & GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY))
+ options |= SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY;
if (GNUNET_FS_uri_test_ksk (sc->uri))
{
msize = sizeof (struct SearchMessage);
GNUNET_assert (mbc.put_cnt > 0);
sm->header.size = htons (msize);
- if (0 != (sc->options & GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY))
- sm->options = htonl (1);
- else
- sm->options = htonl (0);
+ sm->options = htonl (options);
sm->type = htonl (GNUNET_BLOCK_TYPE_ANY);
sm->anonymity_level = htonl (sc->anonymity);
memset (&sm->target, 0, sizeof (GNUNET_HashCode));
GNUNET_assert (GNUNET_FS_uri_test_sks (sc->uri));
msize = sizeof (struct SearchMessage);
GNUNET_assert (size >= msize);
- if (0 != (sc->options & GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY))
- sm->options = htonl (1);
- else
- sm->options = htonl (0);
+ sm->options = htonl (options);
sm->type = htonl (GNUNET_BLOCK_TYPE_FS_SBLOCK);
sm->anonymity_level = htonl (sc->anonymity);
sm->target = sc->uri->data.sks.namespace;
cr->lc = lc;
GNUNET_CONTAINER_DLL_insert (lc->cr_head, lc->cr_tail, cr);
options = GSF_PRO_LOCAL_REQUEST;
- if (0 != (1 & ntohl (sm->options)))
+ if (0 != (GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
options |= GSF_PRO_LOCAL_ONLY;
- cr->pr = GSF_pending_request_create_ (options, type, &sm->query, (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) ? &sm->target /* namespace */
+ cr->pr = GSF_pending_request_create_ (options, type, &sm->query,
+ (type == GNUNET_BLOCK_TYPE_FS_SBLOCK) ? &sm->target /* namespace */
: NULL,
(0 !=
memcmp (&sm->target, &all_zeros,