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_NAMESTORE_records_serialize (char ** dest,
48 unsigned int rd_count,
49 const struct GNUNET_NAMESTORE_RecordData *rd);
52 GNUNET_NAMESTORE_records_deserialize ( struct GNUNET_NAMESTORE_RecordData **dest, char *src, size_t len);
55 GNUNET_NAMESTORE_records_free (unsigned int rd_count, struct GNUNET_NAMESTORE_RecordData *rd);
58 * A GNS record serialized for network transmission.
59 * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
61 struct GNUNET_NAMESTORE_NetworkRecord
64 * Expiration time for the DNS record.
66 struct GNUNET_TIME_AbsoluteNBO expiration;
69 * Number of bytes in 'data'.
74 * Type of the GNS/DNS record.
79 * Flags for the record.
86 GNUNET_NETWORK_STRUCT_BEGIN
88 * Connect to namestore service
94 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_START
96 struct GNUNET_MessageHeader header;
99 GNUNET_NETWORK_STRUCT_END
102 GNUNET_NETWORK_STRUCT_BEGIN
104 * Generic namestore message with op id
106 struct GenericMessage
109 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
111 struct GNUNET_MessageHeader header;
114 * Operation ID in NBO
118 GNUNET_NETWORK_STRUCT_END
122 * Connect to namestore service
124 GNUNET_NETWORK_STRUCT_BEGIN
125 struct LookupNameMessage
128 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME
130 struct GNUNET_MessageHeader header;
133 * Operation ID in NBO
138 GNUNET_HashCode zone;
140 /* Requested record type */
141 uint32_t record_type;
143 /* Requested record type */
146 GNUNET_NETWORK_STRUCT_END
152 * [struct LookupNameResponseMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
154 GNUNET_NETWORK_STRUCT_BEGIN
155 struct LookupNameResponseMessage
158 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE
160 struct GNUNET_MessageHeader header;
163 * Operation ID in NBO
167 struct GNUNET_TIME_AbsoluteNBO expire;
171 uint16_t contains_sig;
173 /* Requested record type */
176 GNUNET_NETWORK_STRUCT_END
180 * Put a record to the namestore
182 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
184 GNUNET_NETWORK_STRUCT_BEGIN
185 struct RecordPutMessage
188 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
190 struct GNUNET_MessageHeader header;
193 * Operation ID in NBO
197 /* Contenct starts here */
202 /* Length of serialized rd data */
205 struct GNUNET_TIME_AbsoluteNBO expire;
207 struct GNUNET_CRYPTO_RsaSignature signature;
209 GNUNET_NETWORK_STRUCT_END
212 * Put a record to the namestore response
214 GNUNET_NETWORK_STRUCT_BEGIN
215 struct RecordPutResponseMessage
218 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
220 struct GNUNET_MessageHeader header;
223 * Operation ID in NBO
227 /* Contenct starts here */
230 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
234 GNUNET_NETWORK_STRUCT_END
238 * Put a record to the namestore
240 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
242 GNUNET_NETWORK_STRUCT_BEGIN
243 struct RecordCreateMessage
246 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
248 struct GNUNET_MessageHeader header;
251 * Operation ID in NBO
255 /* Contenct starts here */
260 struct GNUNET_CRYPTO_RsaSignature signature;
262 GNUNET_NETWORK_STRUCT_END
266 * Create a record to the namestore response
269 GNUNET_NETWORK_STRUCT_BEGIN
270 struct RecordCreateResponseMessage
273 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
275 struct GNUNET_MessageHeader header;
278 * Operation ID in NBO
282 /* Contenct starts here */
285 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
289 GNUNET_NETWORK_STRUCT_END
292 * Remove a record from the namestore
294 * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
296 GNUNET_NETWORK_STRUCT_BEGIN
297 struct RecordRemoveMessage
300 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE
302 struct GNUNET_MessageHeader header;
305 * Operation ID in NBO
309 /* Contenct starts here */
314 struct GNUNET_CRYPTO_RsaSignature signature;
316 GNUNET_NETWORK_STRUCT_END
320 * Remove a record from the namestore response
322 GNUNET_NETWORK_STRUCT_BEGIN
323 struct RecordRemoveResponseMessage
326 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE
328 struct GNUNET_MessageHeader header;
331 * Operation ID in NBO
335 /* Contenct starts here */
338 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
342 GNUNET_NETWORK_STRUCT_END
346 * Start a zone iteration for the given zone
348 GNUNET_NETWORK_STRUCT_BEGIN
349 struct ZoneIterationStartMessage
352 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
354 struct GNUNET_MessageHeader header;
357 * Operation ID in NBO
361 /* Contenct starts here */
363 uint16_t must_have_flags;
364 uint16_t must_not_have_flags;
366 GNUNET_HashCode zone;
368 GNUNET_NETWORK_STRUCT_END
371 * Ask for next result of zone iteration for the given operation
373 GNUNET_NETWORK_STRUCT_BEGIN
374 struct ZoneIterationNextMessage
377 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
379 struct GNUNET_MessageHeader header;
382 * Operation ID in NBO
386 GNUNET_NETWORK_STRUCT_END
390 * Stop zone iteration for the given operation
392 GNUNET_NETWORK_STRUCT_BEGIN
393 struct ZoneIterationStopMessage
396 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
398 struct GNUNET_MessageHeader header;
401 * Operation ID in NBO
405 GNUNET_NETWORK_STRUCT_END
408 * Ask for next result of zone iteration for the given operation
410 GNUNET_NETWORK_STRUCT_BEGIN
411 struct ZoneIterationResponseMessage
414 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
416 struct GNUNET_MessageHeader header;
419 * Operation ID in NBO
423 struct GNUNET_TIME_AbsoluteNBO expire;
427 uint16_t contains_sig;
429 /* Record data length */
433 GNUNET_NETWORK_STRUCT_END
436 /* end of namestore.h */