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/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
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 * Store a record to the namestore (as authority).
58 struct RecordStoreMessage
61 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE
63 struct GNUNET_NAMESTORE_Header gns_header;
68 struct GNUNET_TIME_AbsoluteNBO expire;
73 uint16_t name_len GNUNET_PACKED;
76 * Length of serialized record data
78 uint16_t rd_len GNUNET_PACKED;
81 * Number of records contained
83 uint16_t rd_count GNUNET_PACKED;
86 * always zero (for alignment)
88 uint16_t reserved GNUNET_PACKED;
91 * The private key of the authority.
93 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
96 * name with length name_len
97 * serialized record data with rd_count records
103 * Response to a record storage request.
105 struct RecordStoreResponseMessage
108 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE
110 struct GNUNET_NAMESTORE_Header gns_header;
113 * #GNUNET_SYSERR on failure, #GNUNET_OK on success
115 int32_t op_result GNUNET_PACKED;
122 struct LabelLookupMessage
125 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP
127 struct GNUNET_NAMESTORE_Header gns_header;
132 uint32_t label_len GNUNET_PACKED;
135 * The private key of the zone to look up in
137 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
140 * name with length name_len
148 struct LabelLookupResponseMessage
151 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE
153 struct GNUNET_NAMESTORE_Header gns_header;
158 uint16_t name_len GNUNET_PACKED;
161 * Length of serialized record data
163 uint16_t rd_len GNUNET_PACKED;
166 * Number of records contained
168 uint16_t rd_count GNUNET_PACKED;
171 * Was the label found in the database??
172 * #GNUNET_YES or #GNUNET_NO
174 uint16_t found GNUNET_PACKED;
177 * The private key of the authority.
179 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
182 * name with length name_len
183 * serialized record data with rd_count records
189 * Lookup a name for a zone hash
191 struct ZoneToNameMessage
194 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
196 struct GNUNET_NAMESTORE_Header gns_header;
199 * The private key of the zone to look up in
201 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
204 * The public key of the target zone
206 struct GNUNET_CRYPTO_EcdsaPublicKey value_zone;
211 * Respone for zone to name lookup
213 struct ZoneToNameResponseMessage
216 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
218 struct GNUNET_NAMESTORE_Header gns_header;
223 uint16_t name_len GNUNET_PACKED;
226 * Length of serialized record data
228 uint16_t rd_len GNUNET_PACKED;
231 * Number of records contained
233 uint16_t rd_count GNUNET_PACKED;
236 * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no
237 * results, #GNUNET_SYSERR on error
239 int16_t res GNUNET_PACKED;
242 * The private key of the zone that contained the name.
244 struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
247 * name with length name_len
248 * 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;
319 * Ask for next result of zone iteration for the given operation
321 struct ZoneMonitorNextMessage
324 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT
326 struct GNUNET_MessageHeader header;
334 * Number of records to return to the iterator in one shot
335 * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_MONITOR_NEXT
336 * 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;
360 * Ask for next result of zone iteration for the given operation
362 struct ZoneIterationNextMessage
365 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
367 struct GNUNET_NAMESTORE_Header gns_header;
370 * Number of records to return to the iterator in one shot
371 * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
372 * should be send again). In NBO.
379 * Stop zone iteration for the given operation
381 struct ZoneIterationStopMessage
384 * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
386 struct GNUNET_NAMESTORE_Header gns_header;
390 GNUNET_NETWORK_STRUCT_END
393 /* end of namestore.h */