/*
This file is part of GNUnet.
- (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
+ (C) 2003--2012 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
/**
* Hash of the original content, used for encryption.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Hash of the encrypted content, used for querying.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
};
+GNUNET_NETWORK_STRUCT_BEGIN
+
/**
* Message sent from a GNUnet (fs) publishing activity to the
* gnunet-fs-service to initiate indexing of a file. The service is
/**
* Hash of the file that we would like to index.
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
/* this is followed by a 0-terminated
* filename of a file with the hash
/**
* Hash of the indexed file.
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
/* this is followed by a 0-terminated
* filename of a file with the hash
/**
* Hash of the file that we will unindex.
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
};
+/**
+ * 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.
* nevertheless, we should probably not use it for a DHT-lookup
* or similar blunt actions in order to avoid exposing ourselves).
* <p>
- * If the request is for an SBLOCK, this is the identity of the
- * pseudonym to which the SBLOCK belongs.
- * <p>
- * If the request is for a KBLOCK, "target" must be all zeros.
+ * Otherwise, "target" must be all zeros.
*/
- GNUNET_HashCode target;
+ struct GNUNET_HashCode target;
/**
- * Hash of the keyword (aka query) for KBLOCKs; Hash of
- * the CHK-encoded block for DBLOCKS and IBLOCKS (aka query)
- * and hash of the identifier XORed with the target for
- * SBLOCKS (aka query).
+ * Hash of the public key for UBLOCKs; Hash of
+ * the CHK-encoded block for DBLOCKS and IBLOCKS.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
/* this is followed by the hash codes of already-known
* results (which should hence be excluded from what
* the service returns); naturally, this only applies
- * to queries that can have multiple results, such as
- * those for KBLOCKS (KSK) and SBLOCKS (SKS) */
+ * to queries that can have multiple results (UBLOCKS).
+ */
};
/**
- * Only the (mandatory) query is included.
- */
-#define GET_MESSAGE_BIT_QUERY_ONLY 0
-
-/**
- * The peer identity of a peer waiting for the
- * reply is included (used if the response
- * should be transmitted to someone other than
- * the sender of the GET).
- */
-#define GET_MESSAGE_BIT_RETURN_TO 1
-
-/**
- * The hash of the public key of the target
- * namespace is included (for SKS queries).
- */
-#define GET_MESSAGE_BIT_SKS_NAMESPACE 2
-
-/**
- * The peer identity of a peer that had claimed to have the content
- * previously is included (can be used if responder-anonymity is not
- * desired; note that the precursor presumably lacked a direct
- * connection to the specified peer; still, the receiver is in no way
- * required to limit forwarding only to the specified peer, it should
- * only prefer it somewhat if possible).
- */
-#define GET_MESSAGE_BIT_TRANSMIT_TO 4
-
-
-/**
- * Message sent between peers asking for FS-content.
+ * Response from FS service with a result for a previous FS search.
+ * Note that queries for DBLOCKS and IBLOCKS that have received a
+ * single response are considered done. This message is transmitted
+ * between peers.
*/
-struct GetMessage
+struct PutMessage
{
/**
- * Message type will be GNUNET_MESSAGE_TYPE_FS_GET.
+ * Message type will be GNUNET_MESSAGE_TYPE_FS_PUT.
*/
struct GNUNET_MessageHeader header;
/**
- * Type of the query (block type).
+ * Type of the block (in big endian). Should never be zero.
*/
uint32_t type GNUNET_PACKED;
/**
- * How important is this request (network byte order)
- */
- uint32_t priority GNUNET_PACKED;
-
- /**
- * Relative time to live in MILLISECONDS (network byte order)
- */
- int32_t ttl GNUNET_PACKED;
-
- /**
- * The content hash should be mutated using this value
- * before checking against the bloomfilter (used to
- * get many different filters for the same hash codes).
- * The number should be in big-endian format when used
- * for mingling.
- */
- uint32_t filter_mutator GNUNET_PACKED;
-
- /**
- * Which of the optional hash codes are present at the end of the
- * message? See GET_MESSAGE_BIT_xx constants. For each bit that is
- * set, an additional GNUNET_HashCode with the respective content
- * (in order of the bits) will be appended to the end of the GET
- * message.
+ * When does this result expire?
*/
- uint32_t hash_bitmap GNUNET_PACKED;
+ struct GNUNET_TIME_AbsoluteNBO expiration;
- /**
- * Hashcodes of the file(s) we're looking for.
- * Details depend on the query type.
- */
- GNUNET_HashCode query GNUNET_PACKED;
+ /* this is followed by the actual encrypted content */
- /* this is followed by hash codes
- * as specified in the "hash_bitmap";
- * after that, an optional bloomfilter
- * (with bits set for replies that should
- * be suppressed) can be present */
};
-
/**
* Response from FS service with a result for a previous FS search.
* Note that queries for DBLOCKS and IBLOCKS that have received a
* single response are considered done. This message is transmitted
- * between peers as well as between the service and a client.
+ * between the service and a client.
*/
-struct PutMessage
+struct ClientPutMessage
{
/**
*/
struct GNUNET_TIME_AbsoluteNBO expiration;
- /* this is followed by the actual encrypted content */
-
-};
-
-
-/**
- * Message send by a peer that wants to be excluded
- * from migration for a while.
- */
-struct MigrationStopMessage
-{
/**
- * Message type will be
- * GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP.
+ * When was the last time we've tried to download this block?
+ * (FOREVER if unknown/not relevant)
*/
- struct GNUNET_MessageHeader header;
+ struct GNUNET_TIME_AbsoluteNBO last_transmission;
/**
- * Always zero.
+ * How often did we transmit this query before getting an
+ * answer (estimate).
*/
- uint32_t reserved GNUNET_PACKED;
+ uint32_t num_transmissions;
/**
- * How long should the block last?
+ * How much respect did we offer (in total) before getting an
+ * answer (estimate).
*/
- struct GNUNET_TIME_RelativeNBO duration;
+ uint32_t respect_offered;
-};
+ /* this is followed by the actual encrypted content */
+};
+GNUNET_NETWORK_STRUCT_END
#endif