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
30 #define DEBUG_DATASTORE GNUNET_NO
32 #include "gnunet_util_lib.h"
35 * Message from datastore service informing client about
36 * the current size of the datastore.
41 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE.
43 struct GNUNET_MessageHeader header;
46 * Number of items to reserve.
48 uint32_t entries GNUNET_PACKED;
51 * Number of bytes to reserve.
53 uint64_t amount GNUNET_PACKED;
58 * Message from datastore service informing client about
59 * the success or failure of a requested operation.
60 * This header is optionally followed by a variable-size,
61 * 0-terminated error message.
66 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS.
68 struct GNUNET_MessageHeader header;
71 * Status code, -1 for errors.
73 int32_t status GNUNET_PACKED;
79 * Message from datastore client informing service that
80 * the remainder of the reserved bytes can now be released
83 struct ReleaseReserveMessage
86 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE.
88 struct GNUNET_MessageHeader header;
93 int32_t rid GNUNET_PACKED;
99 * Message to the datastore service asking about specific
105 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET. Size
106 * can either be "sizeof(struct GetMessage)" or
107 * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
109 struct GNUNET_MessageHeader header;
112 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
114 uint32_t type GNUNET_PACKED;
117 * Offset of the result.
119 uint64_t offset GNUNET_PACKED;
122 * Desired key (optional). Check the "size" of the
123 * header to see if the key is actually present.
125 GNUNET_HashCode key GNUNET_PACKED;
131 * Message to the datastore service asking about zero
134 struct GetZeroAnonymityMessage
137 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY.
139 struct GNUNET_MessageHeader header;
142 * Desired content type (actually an enum GNUNET_BLOCK_Type)
144 uint32_t type GNUNET_PACKED;
147 * Offset of the result.
149 uint64_t offset GNUNET_PACKED;
155 * Message to the datastore service requesting an update
156 * to the priority or expiration for some content.
161 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE.
163 struct GNUNET_MessageHeader header;
166 * Desired priority increase.
168 int32_t priority GNUNET_PACKED;
171 * Desired new expiration time.
173 struct GNUNET_TIME_AbsoluteNBO expiration;
176 * Unique ID for the content.
184 * Message transmitting content from or to the datastore
190 * Type is either GNUNET_MESSAGE_TYPE_DATASTORE_PUT,
191 * GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE or
192 * GNUNET_MESSAGE_TYPE_DATASTORE_DATA. Depending on the message
193 * type, some fields may simply have values of zero.
195 struct GNUNET_MessageHeader header;
198 * Reservation ID to use; use zero for none.
200 uint32_t rid GNUNET_PACKED;
203 * Number of bytes in the item (NBO).
205 uint32_t size GNUNET_PACKED;
208 * Type of the item (NBO), zero for remove, (actually an enum GNUNET_BLOCK_Type)
210 uint32_t type GNUNET_PACKED;
213 * Priority of the item (NBO), zero for remove.
215 uint32_t priority GNUNET_PACKED;
218 * Desired anonymity level (NBO), zero for remove.
220 uint32_t anonymity GNUNET_PACKED;
223 * Desired replication level. 0 from service to API.
225 uint32_t replication GNUNET_PACKED;
230 uint32_t reserved GNUNET_PACKED;
233 * Unique ID for the content (can be used for UPDATE);
234 * can be zero for remove (which indicates that
235 * the datastore should use whatever UID matches
236 * the key and content).
241 * Expiration time (NBO); zero for remove.
243 struct GNUNET_TIME_AbsoluteNBO expiration;
246 * Key under which the item can be found.
248 GNUNET_HashCode key GNUNET_PACKED;