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_EXTRA_LOGGING
32 #include "gnunet_util_lib.h"
34 GNUNET_NETWORK_STRUCT_BEGIN
37 * Message from datastore service informing client about
38 * the current size of the datastore.
43 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE.
45 struct GNUNET_MessageHeader header;
48 * Number of items to reserve.
50 uint32_t entries GNUNET_PACKED;
53 * Number of bytes to reserve.
55 uint64_t amount GNUNET_PACKED;
60 * Message from datastore service informing client about
61 * the success or failure of a requested operation.
62 * This header is optionally followed by a variable-size,
63 * 0-terminated error message.
68 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS.
70 struct GNUNET_MessageHeader header;
73 * Status code, -1 for errors.
75 int32_t status GNUNET_PACKED;
78 * Minimum expiration time required for content to be stored
79 * by the datacache at this time, zero for unknown or no limit.
81 struct GNUNET_TIME_AbsoluteNBO min_expiration;
87 * Message from datastore client informing service that
88 * the remainder of the reserved bytes can now be released
91 struct ReleaseReserveMessage
94 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE.
96 struct GNUNET_MessageHeader header;
101 int32_t rid GNUNET_PACKED;
107 * Message to the datastore service asking about specific
113 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET. Size
114 * can either be "sizeof(struct GetMessage)" or
115 * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
117 struct GNUNET_MessageHeader header;
120 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
122 uint32_t type GNUNET_PACKED;
125 * Offset of the result.
127 uint64_t offset GNUNET_PACKED;
130 * Desired key (optional). Check the "size" of the
131 * header to see if the key is actually present.
133 GNUNET_HashCode key GNUNET_PACKED;
139 * Message to the datastore service asking about zero
142 struct GetZeroAnonymityMessage
145 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY.
147 struct GNUNET_MessageHeader header;
150 * Desired content type (actually an enum GNUNET_BLOCK_Type)
152 uint32_t type GNUNET_PACKED;
155 * Offset of the result.
157 uint64_t offset GNUNET_PACKED;
163 * Message to the datastore service requesting an update
164 * to the priority or expiration for some content.
169 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE.
171 struct GNUNET_MessageHeader header;
174 * Desired priority increase.
176 int32_t priority GNUNET_PACKED;
179 * Desired new expiration time.
181 struct GNUNET_TIME_AbsoluteNBO expiration;
184 * Unique ID for the content.
192 * Message transmitting content from or to the datastore
198 * Type is either GNUNET_MESSAGE_TYPE_DATASTORE_PUT,
199 * GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE or
200 * GNUNET_MESSAGE_TYPE_DATASTORE_DATA. Depending on the message
201 * type, some fields may simply have values of zero.
203 struct GNUNET_MessageHeader header;
206 * Reservation ID to use; use zero for none.
208 uint32_t rid GNUNET_PACKED;
211 * Number of bytes in the item (NBO).
213 uint32_t size GNUNET_PACKED;
216 * Type of the item (NBO), zero for remove, (actually an enum GNUNET_BLOCK_Type)
218 uint32_t type GNUNET_PACKED;
221 * Priority of the item (NBO), zero for remove.
223 uint32_t priority GNUNET_PACKED;
226 * Desired anonymity level (NBO), zero for remove.
228 uint32_t anonymity GNUNET_PACKED;
231 * Desired replication level. 0 from service to API.
233 uint32_t replication GNUNET_PACKED;
238 uint32_t reserved GNUNET_PACKED;
241 * Unique ID for the content (can be used for UPDATE);
242 * can be zero for remove (which indicates that
243 * the datastore should use whatever UID matches
244 * the key and content).
249 * Expiration time (NBO); zero for remove.
251 struct GNUNET_TIME_AbsoluteNBO expiration;
254 * Key under which the item can be found.
256 GNUNET_HashCode key GNUNET_PACKED;
259 GNUNET_NETWORK_STRUCT_END