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.
17 * @file namestore/namestore.h
18 * @brief common internal definitions for namestore service
19 * @author Matthias Wachs
20 * @author Christian Grothoff
26 * Maximum length of any name, including 0-termination.
28 #define MAX_NAME_LEN 256
30 GNUNET_NETWORK_STRUCT_BEGIN
33 * Generic namestore message with op id
35 struct GNUNET_NAMESTORE_Header
38 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
39 * header.size will be message size
41 struct GNUNET_MessageHeader header;
46 uint32_t r_id GNUNET_PACKED;
51 * Store a record to the namestore (as authority).
53 struct RecordStoreMessage
56 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE
58 struct GNUNET_NAMESTORE_Header gns_header;
63 struct GNUNET_TIME_AbsoluteNBO expire;
68 uint16_t name_len GNUNET_PACKED;
71 * Length of serialized record data
73 uint16_t rd_len GNUNET_PACKED;
76 * Number of records contained
78 uint16_t rd_count GNUNET_PACKED;
81 * always zero (for alignment)
83 uint16_t reserved GNUNET_PACKED;
86 * The private key of the authority.
88 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
91 * name with length name_len
92 * serialized record data with rd_count records
98 * Response to a record storage request.
100 struct RecordStoreResponseMessage
103 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE
105 struct GNUNET_NAMESTORE_Header gns_header;
108 * #GNUNET_SYSERR on failure, #GNUNET_OK on success
110 int32_t op_result GNUNET_PACKED;
117 struct LabelLookupMessage
120 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP
122 struct GNUNET_NAMESTORE_Header gns_header;
127 uint32_t label_len GNUNET_PACKED;
130 * The private key of the zone to look up in
132 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
135 * name with length name_len
143 struct LabelLookupResponseMessage
146 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE
148 struct GNUNET_NAMESTORE_Header gns_header;
153 uint16_t name_len GNUNET_PACKED;
156 * Length of serialized record data
158 uint16_t rd_len GNUNET_PACKED;
161 * Number of records contained
163 uint16_t rd_count GNUNET_PACKED;
166 * Was the label found in the database??
167 * #GNUNET_YES or #GNUNET_NO
169 uint16_t found GNUNET_PACKED;
172 * The private key of the authority.
174 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
177 * name with length name_len
178 * serialized record data with rd_count records
185 * Lookup a name for a zone hash
187 struct ZoneToNameMessage
190 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
192 struct GNUNET_NAMESTORE_Header gns_header;
195 * The private key of the zone to look up in
197 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
200 * The public key of the target zone
202 struct GNUNET_CRYPTO_EcdsaPublicKey value_zone;
207 * Respone for zone to name lookup
209 struct ZoneToNameResponseMessage
212 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
214 struct GNUNET_NAMESTORE_Header gns_header;
219 uint16_t name_len GNUNET_PACKED;
222 * Length of serialized record data
224 uint16_t rd_len GNUNET_PACKED;
227 * Number of records contained
229 uint16_t rd_count GNUNET_PACKED;
232 * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no
233 * results, #GNUNET_SYSERR on error
235 int16_t res GNUNET_PACKED;
238 * The private key of the zone that contained the name.
240 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
243 * name with length name_len
244 * serialized record data with rd_count records
251 * Record is returned from the namestore (as authority).
253 struct RecordResultMessage
256 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT
258 struct GNUNET_NAMESTORE_Header gns_header;
263 uint16_t name_len GNUNET_PACKED;
266 * Length of serialized record data
268 uint16_t rd_len GNUNET_PACKED;
271 * Number of records contained
273 uint16_t rd_count GNUNET_PACKED;
276 * always zero (for alignment)
278 uint16_t reserved GNUNET_PACKED;
281 * The private key of the authority.
283 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
286 * name with length name_len
287 * serialized record data with rd_count records
293 * Start monitoring a zone.
295 struct ZoneMonitorStartMessage
298 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START
300 struct GNUNET_MessageHeader header;
303 * #GNUNET_YES to first iterate over all records,
304 * #GNUNET_NO to only monitor changes.o
306 uint32_t iterate_first GNUNET_PACKED;
311 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
317 * Ask for next result of zone iteration for the given operation
319 struct ZoneMonitorNextMessage
322 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT
324 struct GNUNET_MessageHeader header;
332 * Number of records to return to the iterator in one shot
333 * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_MONITOR_NEXT
334 * should be send again). In NBO.
343 * Start a zone iteration for the given zone
345 struct ZoneIterationStartMessage
348 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
350 struct GNUNET_NAMESTORE_Header gns_header;
353 * Zone key. All zeros for "all zones".
355 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
361 * Ask for next result of zone iteration for the given operation
363 struct ZoneIterationNextMessage
366 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
368 struct GNUNET_NAMESTORE_Header gns_header;
371 * Number of records to return to the iterator in one shot
372 * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
373 * should be send again). In NBO.
381 * Stop zone iteration for the given operation
383 struct ZoneIterationStopMessage
386 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
388 struct GNUNET_NAMESTORE_Header gns_header;
392 GNUNET_NETWORK_STRUCT_END
395 /* end of namestore.h */