2 This file is part of GNUnet.
3 Copyright (C) 2011-2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero 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.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @file namestore/namestore.h
21 * @brief common internal definitions for namestore service
22 * @author Matthias Wachs
23 * @author Christian Grothoff
29 * Maximum length of any name, including 0-termination.
31 #define MAX_NAME_LEN 256
33 GNUNET_NETWORK_STRUCT_BEGIN
36 * Generic namestore message with op id
38 struct GNUNET_NAMESTORE_Header
41 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
42 * header.size will be message size
44 struct GNUNET_MessageHeader header;
49 uint32_t r_id GNUNET_PACKED;
54 * Store a record to the namestore (as authority).
56 struct RecordStoreMessage
59 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE
61 struct GNUNET_NAMESTORE_Header gns_header;
66 struct GNUNET_TIME_AbsoluteNBO expire;
71 uint16_t name_len GNUNET_PACKED;
74 * Length of serialized record data
76 uint16_t rd_len GNUNET_PACKED;
79 * Number of records contained
81 uint16_t rd_count GNUNET_PACKED;
84 * always zero (for alignment)
86 uint16_t reserved GNUNET_PACKED;
89 * The private key of the authority.
91 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
94 * name with length name_len
95 * serialized record data with rd_count records
101 * Response to a record storage request.
103 struct RecordStoreResponseMessage
106 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE
108 struct GNUNET_NAMESTORE_Header gns_header;
111 * #GNUNET_SYSERR on failure, #GNUNET_OK on success
113 int32_t op_result GNUNET_PACKED;
120 struct LabelLookupMessage
123 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP
125 struct GNUNET_NAMESTORE_Header gns_header;
130 uint32_t label_len GNUNET_PACKED;
133 * The private key of the zone to look up in
135 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
138 * name with length name_len
146 struct LabelLookupResponseMessage
149 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE
151 struct GNUNET_NAMESTORE_Header gns_header;
156 uint16_t name_len GNUNET_PACKED;
159 * Length of serialized record data
161 uint16_t rd_len GNUNET_PACKED;
164 * Number of records contained
166 uint16_t rd_count GNUNET_PACKED;
169 * Was the label found in the database??
170 * #GNUNET_YES or #GNUNET_NO
172 uint16_t found GNUNET_PACKED;
175 * The private key of the authority.
177 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
180 * name with length name_len
181 * serialized record data with rd_count records
188 * Lookup a name for a zone hash
190 struct ZoneToNameMessage
193 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
195 struct GNUNET_NAMESTORE_Header gns_header;
198 * The private key of the zone to look up in
200 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
203 * The public key of the target zone
205 struct GNUNET_CRYPTO_EcdsaPublicKey value_zone;
210 * Respone for zone to name lookup
212 struct ZoneToNameResponseMessage
215 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
217 struct GNUNET_NAMESTORE_Header gns_header;
222 uint16_t name_len GNUNET_PACKED;
225 * Length of serialized record data
227 uint16_t rd_len GNUNET_PACKED;
230 * Number of records contained
232 uint16_t rd_count GNUNET_PACKED;
235 * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no
236 * results, #GNUNET_SYSERR on error
238 int16_t res GNUNET_PACKED;
241 * The private key of the zone that contained the name.
243 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
246 * name with length name_len
247 * serialized record data with rd_count records
254 * Record is returned from the namestore (as authority).
256 struct RecordResultMessage
259 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT
261 struct GNUNET_NAMESTORE_Header gns_header;
266 uint16_t name_len GNUNET_PACKED;
269 * Length of serialized record data
271 uint16_t rd_len GNUNET_PACKED;
274 * Number of records contained
276 uint16_t rd_count GNUNET_PACKED;
279 * always zero (for alignment)
281 uint16_t reserved GNUNET_PACKED;
284 * The private key of the authority.
286 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
289 * name with length name_len
290 * serialized record data with rd_count records
296 * Start monitoring a zone.
298 struct ZoneMonitorStartMessage
301 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START
303 struct GNUNET_MessageHeader header;
306 * #GNUNET_YES to first iterate over all records,
307 * #GNUNET_NO to only monitor changes.o
309 uint32_t iterate_first GNUNET_PACKED;
314 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
320 * Ask for next result of zone iteration for the given operation
322 struct ZoneMonitorNextMessage
325 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT
327 struct GNUNET_MessageHeader header;
335 * Number of records to return to the iterator in one shot
336 * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_MONITOR_NEXT
337 * should be send again). In NBO.
346 * Start a zone iteration for the given zone
348 struct ZoneIterationStartMessage
351 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
353 struct GNUNET_NAMESTORE_Header gns_header;
356 * Zone key. All zeros for "all zones".
358 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
364 * Ask for next result of zone iteration for the given operation
366 struct ZoneIterationNextMessage
369 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
371 struct GNUNET_NAMESTORE_Header gns_header;
374 * Number of records to return to the iterator in one shot
375 * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
376 * should be send again). In NBO.
384 * Stop zone iteration for the given operation
386 struct ZoneIterationStopMessage
389 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
391 struct GNUNET_NAMESTORE_Header gns_header;
395 GNUNET_NETWORK_STRUCT_END
398 /* end of namestore.h */