2 This file is part of GNUnet.
3 (C) 2011-2013 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 3, 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 namestore/namestore.h
23 * @brief common internal definitions for namestore service
24 * @author Matthias Wachs
25 * @author Christian Grothoff
31 * Maximum length of any name, including 0-termination.
33 #define MAX_NAME_LEN 256
35 GNUNET_NETWORK_STRUCT_BEGIN
38 * Generic namestore message with op id
40 struct GNUNET_NAMESTORE_Header
43 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
44 * header.size will be message size
46 struct GNUNET_MessageHeader header;
51 uint32_t r_id GNUNET_PACKED;
56 * Lookup a block in the namestore
58 struct LookupBlockMessage
61 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK
63 struct GNUNET_NAMESTORE_Header gns_header;
68 struct GNUNET_HashCode query GNUNET_PACKED;
76 struct LookupBlockResponseMessage
79 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE
81 struct GNUNET_NAMESTORE_Header gns_header;
86 struct GNUNET_TIME_AbsoluteNBO expire;
91 struct GNUNET_CRYPTO_EcdsaSignature signature;
96 struct GNUNET_CRYPTO_EcdsaPublicKey derived_key;
98 /* followed by encrypted block data */
103 * Cache a record in the namestore.
105 struct BlockCacheMessage
108 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_BLOCK_CACHE
110 struct GNUNET_NAMESTORE_Header gns_header;
115 struct GNUNET_TIME_AbsoluteNBO expire;
120 struct GNUNET_CRYPTO_EcdsaSignature signature;
123 * Derived public key.
125 struct GNUNET_CRYPTO_EcdsaPublicKey derived_key;
127 /* follwed by encrypted block data */
132 * Response to a request to cache a block.
134 struct BlockCacheResponseMessage
137 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_BLOCK_CACHE_RESPONSE
139 struct GNUNET_NAMESTORE_Header gns_header;
142 * #GNUNET_OK on success, #GNUNET_SYSERR error
144 int32_t op_result GNUNET_PACKED;
149 * Store a record to the namestore (as authority).
151 struct RecordStoreMessage
154 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE
156 struct GNUNET_NAMESTORE_Header gns_header;
161 struct GNUNET_TIME_AbsoluteNBO expire;
166 uint16_t name_len GNUNET_PACKED;
169 * Length of serialized record data
171 uint16_t rd_len GNUNET_PACKED;
174 * Number of records contained
176 uint16_t rd_count GNUNET_PACKED;
179 * always zero (for alignment)
181 uint16_t reserved GNUNET_PACKED;
184 * The private key of the authority.
186 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
189 * name with length name_len
190 * serialized record data with rd_count records
196 * Response to a record storage request.
198 struct RecordStoreResponseMessage
201 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE
203 struct GNUNET_NAMESTORE_Header gns_header;
206 * #GNUNET_SYSERR on failure, #GNUNET_OK on success
208 int32_t op_result GNUNET_PACKED;
215 struct LabelLookupMessage
218 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP
220 struct GNUNET_NAMESTORE_Header gns_header;
225 uint32_t label_len GNUNET_PACKED;
228 * The private key of the zone to look up in
230 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
233 * name with length name_len
241 * Lookup a name for a zone hash
243 struct ZoneToNameMessage
246 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
248 struct GNUNET_NAMESTORE_Header gns_header;
251 * The private key of the zone to look up in
253 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
256 * The public key of the target zone
258 struct GNUNET_CRYPTO_EcdsaPublicKey value_zone;
263 * Respone for zone to name lookup
265 struct ZoneToNameResponseMessage
268 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
270 struct GNUNET_NAMESTORE_Header gns_header;
275 uint16_t name_len GNUNET_PACKED;
278 * Length of serialized record data
280 uint16_t rd_len GNUNET_PACKED;
283 * Number of records contained
285 uint16_t rd_count GNUNET_PACKED;
288 * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no
289 * results, #GNUNET_SYSERR on error
291 int16_t res GNUNET_PACKED;
294 * The private key of the zone that contained the name.
296 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
299 * name with length name_len
300 * serialized record data with rd_count records
307 * Record is returned from the namestore (as authority).
309 struct RecordResultMessage
312 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT
314 struct GNUNET_NAMESTORE_Header gns_header;
319 uint16_t name_len GNUNET_PACKED;
322 * Length of serialized record data
324 uint16_t rd_len GNUNET_PACKED;
327 * Number of records contained
329 uint16_t rd_count GNUNET_PACKED;
332 * always zero (for alignment)
334 uint16_t reserved GNUNET_PACKED;
337 * The private key of the authority.
339 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
342 * name with length name_len
343 * serialized record data with rd_count records
349 * Start monitoring a zone.
351 struct ZoneMonitorStartMessage
354 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START
356 struct GNUNET_MessageHeader header;
359 * #GNUNET_YES to first iterate over all records,
360 * #GNUNET_NO to only monitor changes.o
362 uint32_t iterate_first GNUNET_PACKED;
367 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
373 * Start a zone iteration for the given zone
375 struct ZoneIterationStartMessage
378 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
380 struct GNUNET_NAMESTORE_Header gns_header;
383 * Zone key. All zeros for "all zones".
385 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
391 * Ask for next result of zone iteration for the given operation
393 struct ZoneIterationNextMessage
396 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
398 struct GNUNET_NAMESTORE_Header gns_header;
403 * Stop zone iteration for the given operation
405 struct ZoneIterationStopMessage
408 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
410 struct GNUNET_NAMESTORE_Header gns_header;
414 GNUNET_NETWORK_STRUCT_END
417 /* end of namestore.h */