2 This file is part of GNUnet
3 (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file datastore/datastore.h
23 * @brief structs for communication between datastore service and API
24 * @author Christian Grothoff
31 #include "gnunet_util_lib.h"
33 GNUNET_NETWORK_STRUCT_BEGIN
36 * Message from datastore service informing client about
37 * the current size of the datastore.
42 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE.
44 struct GNUNET_MessageHeader header;
47 * Number of items to reserve.
49 uint32_t entries GNUNET_PACKED;
52 * Number of bytes to reserve.
54 uint64_t amount GNUNET_PACKED;
59 * Message from datastore service informing client about
60 * the success or failure of a requested operation.
61 * This header is optionally followed by a variable-size,
62 * 0-terminated error message.
67 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS.
69 struct GNUNET_MessageHeader header;
72 * Status code, -1 for errors.
74 int32_t status GNUNET_PACKED;
77 * Minimum expiration time required for content to be stored
78 * by the datacache at this time, zero for unknown or no limit.
80 struct GNUNET_TIME_AbsoluteNBO min_expiration;
86 * Message from datastore client informing service that
87 * the remainder of the reserved bytes can now be released
90 struct ReleaseReserveMessage
93 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE.
95 struct GNUNET_MessageHeader header;
100 int32_t rid GNUNET_PACKED;
106 * Message to the datastore service asking about specific
112 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET. Size
113 * can either be "sizeof(struct GetMessage)" or
114 * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
116 struct GNUNET_MessageHeader header;
119 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
121 uint32_t type GNUNET_PACKED;
124 * Offset of the result.
126 uint64_t offset GNUNET_PACKED;
129 * Desired key (optional). Check the "size" of the
130 * header to see if the key is actually present.
138 * Message to the datastore service asking about zero
141 struct GetZeroAnonymityMessage
144 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY.
146 struct GNUNET_MessageHeader header;
149 * Desired content type (actually an enum GNUNET_BLOCK_Type)
151 uint32_t type GNUNET_PACKED;
154 * Offset of the result.
156 uint64_t offset GNUNET_PACKED;
162 * Message to the datastore service requesting an update
163 * to the priority or expiration for some content.
168 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE.
170 struct GNUNET_MessageHeader header;
173 * Desired priority increase.
175 int32_t priority GNUNET_PACKED;
178 * Desired new expiration time.
180 struct GNUNET_TIME_AbsoluteNBO expiration;
183 * Unique ID for the content.
191 * Message transmitting content from or to the datastore
197 * Type is either GNUNET_MESSAGE_TYPE_DATASTORE_PUT,
198 * GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE or
199 * GNUNET_MESSAGE_TYPE_DATASTORE_DATA. Depending on the message
200 * type, some fields may simply have values of zero.
202 struct GNUNET_MessageHeader header;
205 * Reservation ID to use; use zero for none.
207 uint32_t rid GNUNET_PACKED;
210 * Number of bytes in the item (NBO).
212 uint32_t size GNUNET_PACKED;
215 * Type of the item (NBO), zero for remove, (actually an enum GNUNET_BLOCK_Type)
217 uint32_t type GNUNET_PACKED;
220 * Priority of the item (NBO), zero for remove.
222 uint32_t priority GNUNET_PACKED;
225 * Desired anonymity level (NBO), zero for remove.
227 uint32_t anonymity GNUNET_PACKED;
230 * Desired replication level. 0 from service to API.
232 uint32_t replication GNUNET_PACKED;
237 uint32_t reserved GNUNET_PACKED;
240 * Unique ID for the content (can be used for UPDATE);
241 * can be zero for remove (which indicates that
242 * the datastore should use whatever UID matches
243 * the key and content).
248 * Expiration time (NBO); zero for remove.
250 struct GNUNET_TIME_AbsoluteNBO expiration;
253 * Key under which the item can be found.
258 GNUNET_NETWORK_STRUCT_END