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.hc
23 * @brief structs for communication between datastore service and API
24 * @author Christian Grothoff
30 #include "gnunet_util_lib.h"
33 * Message from datastore service informing client about
34 * the current size of the datastore.
39 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE.
41 struct GNUNET_MessageHeader header;
46 uint32_t reserved GNUNET_PACKED;
49 * Number of bytes to reserve.
51 uint64_t size GNUNET_PACKED;
54 * Number of items to reserve.
56 uint64_t items GNUNET_PACKED;
61 * Message from datastore service informing client about
62 * the success or failure of a requested operation.
63 * This header is optionally followed by a variable-size,
64 * 0-terminated error message.
69 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS.
71 struct GNUNET_MessageHeader header;
76 int32_t status GNUNET_PACKED;
82 * Message from datastore client informing service that
83 * the remainder of the reserved bytes can now be released
86 struct ReleaseReserveMessage
89 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE.
91 struct GNUNET_MessageHeader header;
96 int32_t rid GNUNET_PACKED;
102 * Message to the datastore service asking about specific
108 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET. Size
109 * can either be "sizeof(struct GetMessage)" or
110 * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
112 struct GNUNET_MessageHeader header;
115 * Desired content type.
117 uint32_t type GNUNET_PACKED;
120 * Desired key (optional). Check the "size" of the
121 * header to see if the key is actually present.
123 GNUNET_HashCode key GNUNET_PACKED;
129 * Message to the datastore service requesting an update
130 * to the priority or expiration for some content.
135 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE.
137 struct GNUNET_MessageHeader header;
140 * Desired priority increase.
142 int32_t priority GNUNET_PACKED;
145 * Desired new expiration time.
147 struct GNUNET_TIME_AbsoluteNBO expiration;
150 * Unique ID for the content.
158 * Message transmitting content from or to the datastore
164 * Type is either GNUNET_MESSAGE_TYPE_DATASTORE_PUT,
165 * GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE or
166 * GNUNET_MESSAGE_TYPE_DATASTORE_DATA. Depending on the message
167 * type, some fields may simply have values of zero.
169 struct GNUNET_MessageHeader header;
172 * Reservation ID to use; use zero for none.
174 uint32_t rid GNUNET_PACKED;
177 * Number of bytes in the item (NBO).
179 uint32_t size GNUNET_PACKED;
182 * Type of the item (NBO), zero for remove.
184 uint32_t type GNUNET_PACKED;
187 * Priority of the item (NBO), zero for remove.
189 uint32_t priority GNUNET_PACKED;
192 * Desired anonymity level (NBO), zero for remove.
194 uint32_t anonymity GNUNET_PACKED;
197 * Unique ID for the content (can be used for UPDATE).
202 * Expiration time (NBO); zero for remove.
204 struct GNUNET_TIME_AbsoluteNBO expiration;
207 * Key under which the item can be found.
209 GNUNET_HashCode key GNUNET_PACKED;