2 This file is part of GNUnet.
3 (C) 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 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
30 * Collect message types here, move to protocols later
32 #define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME 431
33 #define GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE 432
34 #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT 433
35 #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE 434
36 #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE 435
37 #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE 436
38 #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE 437
39 #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE 438
41 #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START 439
42 #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE 440
43 #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 441
44 #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 442
47 GNUNET_NETWORK_STRUCT_BEGIN
49 * A GNS record serialized for network transmission.
50 * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
52 struct GNUNET_NAMESTORE_NetworkRecord
55 * Expiration time for the DNS record.
57 struct GNUNET_TIME_AbsoluteNBO expiration;
60 * Number of bytes in 'data'.
65 * Type of the GNS/DNS record.
70 * Flags for the record.
78 * Connect to namestore service. FIXME: UNNECESSARY.
84 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_START
86 struct GNUNET_MessageHeader header;
91 * Generic namestore message with op id
93 struct GNUNET_NAMESTORE_Header
96 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
97 * header.size will be message size
99 struct GNUNET_MessageHeader header;
109 * Connect to namestore service
111 struct LookupNameMessage
113 struct GNUNET_NAMESTORE_Header gns_header;
116 GNUNET_HashCode zone;
118 /* Requested record type */
119 uint32_t record_type;
121 /* Requested record type */
129 * [struct LookupNameResponseMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
131 struct LookupNameResponseMessage
134 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE
136 struct GNUNET_NAMESTORE_Header gns_header;
138 struct GNUNET_TIME_AbsoluteNBO expire;
146 int32_t contains_sig;
148 /* Requested record type */
153 * Put a record to the namestore
155 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
157 struct RecordPutMessage
160 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
162 struct GNUNET_NAMESTORE_Header gns_header;
164 /* Contenct starts here */
169 /* Length of serialized rd data */
172 /* Number of records contained */
175 /* Length of pubkey */
178 struct GNUNET_TIME_AbsoluteNBO expire;
180 struct GNUNET_CRYPTO_RsaSignature signature;
185 * Put a record to the namestore response
187 struct RecordPutResponseMessage
190 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
192 struct GNUNET_MessageHeader header;
195 * Operation ID in NBO
199 /* Contenct starts here */
202 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
209 * Create a record and put it to the namestore
211 * [struct RecordCreateMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
213 struct RecordCreateMessage
216 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
218 struct GNUNET_NAMESTORE_Header gns_header;
220 /* Contenct starts here */
225 /* Record data length */
231 /* private key length */
237 * Create a record to the namestore response
240 struct RecordCreateResponseMessage
243 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
245 struct GNUNET_NAMESTORE_Header gns_header;
247 /* Contenct starts here */
250 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
258 * Remove a record from the namestore
260 * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
262 struct RecordRemoveMessage
265 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE
267 struct GNUNET_NAMESTORE_Header gns_header;
269 /* Contenct starts here */
274 /* Length of serialized rd data */
277 /* Number of records contained */
280 /* Length of pubkey */
283 GNUNET_NETWORK_STRUCT_END
287 * Remove a record from the namestore response
289 GNUNET_NETWORK_STRUCT_BEGIN
290 struct RecordRemoveResponseMessage
293 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE
295 struct GNUNET_NAMESTORE_Header gns_header;
297 /* Contenct starts here */
302 * 1 : no records for entry
303 * 2 : Could not find record to remove
304 * 3 : Failed to create new signature
305 * 4 : Failed to put new set of records in database
309 GNUNET_NETWORK_STRUCT_END
313 * Start a zone iteration for the given zone
315 GNUNET_NETWORK_STRUCT_BEGIN
316 struct ZoneIterationStartMessage
319 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
321 struct GNUNET_NAMESTORE_Header gns_header;
323 /* Contenct starts here */
325 uint16_t must_have_flags;
326 uint16_t must_not_have_flags;
328 GNUNET_HashCode zone;
330 GNUNET_NETWORK_STRUCT_END
333 * Ask for next result of zone iteration for the given operation
335 GNUNET_NETWORK_STRUCT_BEGIN
336 struct ZoneIterationNextMessage
339 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
341 struct GNUNET_NAMESTORE_Header gns_header;
343 GNUNET_NETWORK_STRUCT_END
347 * Stop zone iteration for the given operation
349 GNUNET_NETWORK_STRUCT_BEGIN
350 struct ZoneIterationStopMessage
353 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
355 struct GNUNET_NAMESTORE_Header gns_header;
357 GNUNET_NETWORK_STRUCT_END
360 * Ask for next result of zone iteration for the given operation
362 GNUNET_NETWORK_STRUCT_BEGIN
363 struct ZoneIterationResponseMessage
366 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
368 struct GNUNET_NAMESTORE_Header gns_header;
370 struct GNUNET_TIME_AbsoluteNBO expire;
374 uint16_t contains_sig;
376 /* Record data length */
380 GNUNET_NETWORK_STRUCT_END
383 /* end of namestore.h */