2 This file is part of GNUnet
3 Copyright (C) 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
17 * @file datastore/datastore.h
18 * @brief structs for communication between datastore service and API
19 * @author Christian Grothoff
26 #include "gnunet_util_lib.h"
28 GNUNET_NETWORK_STRUCT_BEGIN
31 * Message from datastore service informing client about
32 * the current size of the datastore.
37 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE.
39 struct GNUNET_MessageHeader header;
42 * Number of items to reserve.
44 uint32_t entries GNUNET_PACKED;
47 * Number of bytes to reserve.
49 uint64_t amount GNUNET_PACKED;
54 * Message from datastore service informing client about
55 * the success or failure of a requested operation.
56 * This header is optionally followed by a variable-size,
57 * 0-terminated error message.
62 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS.
64 struct GNUNET_MessageHeader header;
67 * Status code, -1 for errors.
69 int32_t status GNUNET_PACKED;
72 * Minimum expiration time required for content to be stored
73 * by the datacache at this time, zero for unknown or no limit.
75 struct GNUNET_TIME_AbsoluteNBO min_expiration;
81 * Message from datastore client informing service that
82 * the remainder of the reserved bytes can now be released
85 struct ReleaseReserveMessage
88 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE.
90 struct GNUNET_MessageHeader header;
95 int32_t rid GNUNET_PACKED;
101 * Message to the datastore service asking about specific
107 * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET_KEY.
109 struct GNUNET_MessageHeader header;
112 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
114 uint32_t type GNUNET_PACKED;
117 * UID at which to start the search
119 uint64_t next_uid GNUNET_PACKED;
122 * If true return a random result
124 uint32_t random GNUNET_PACKED;
129 struct GNUNET_HashCode key;
135 * Message to the datastore service asking about specific
141 * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET.
143 struct GNUNET_MessageHeader header;
146 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
148 uint32_t type GNUNET_PACKED;
151 * UID at which to start the search
153 uint64_t next_uid GNUNET_PACKED;
156 * If true return a random result
158 uint32_t random GNUNET_PACKED;
164 * Message to the datastore service asking about zero
167 struct GetZeroAnonymityMessage
170 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY.
172 struct GNUNET_MessageHeader header;
175 * Desired content type (actually an enum GNUNET_BLOCK_Type)
177 uint32_t type GNUNET_PACKED;
180 * UID at which to start the search
182 uint64_t next_uid GNUNET_PACKED;
188 * Message transmitting content from or to the datastore
194 * Type is either GNUNET_MESSAGE_TYPE_DATASTORE_PUT,
195 * GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE or
196 * GNUNET_MESSAGE_TYPE_DATASTORE_DATA. Depending on the message
197 * type, some fields may simply have values of zero.
199 struct GNUNET_MessageHeader header;
202 * Reservation ID to use; use zero for none.
204 uint32_t rid GNUNET_PACKED;
207 * Number of bytes in the item (NBO).
209 uint32_t size GNUNET_PACKED;
212 * Type of the item (NBO), zero for remove, (actually an enum GNUNET_BLOCK_Type)
214 uint32_t type GNUNET_PACKED;
217 * Priority of the item (NBO), zero for remove.
219 uint32_t priority GNUNET_PACKED;
222 * Desired anonymity level (NBO), zero for remove.
224 uint32_t anonymity GNUNET_PACKED;
227 * Desired replication level.
229 uint32_t replication GNUNET_PACKED;
234 uint32_t reserved GNUNET_PACKED;
237 * Unique ID for the content (can be used for UPDATE);
238 * can be zero for remove (which indicates that
239 * the datastore should use whatever UID matches
240 * the key and content).
245 * Expiration time (NBO); zero for remove.
247 struct GNUNET_TIME_AbsoluteNBO expiration;
250 * Key under which the item can be found.
252 struct GNUNET_HashCode key;
255 GNUNET_NETWORK_STRUCT_END