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 /* Length of pubkey */
208 struct GNUNET_TIME_AbsoluteNBO expire;
210 struct GNUNET_CRYPTO_RsaSignature signature;
212 GNUNET_NETWORK_STRUCT_END
215 * Put a record to the namestore response
217 GNUNET_NETWORK_STRUCT_BEGIN
218 struct RecordPutResponseMessage
221 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
223 struct GNUNET_MessageHeader header;
226 * Operation ID in NBO
230 /* Contenct starts here */
233 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
237 GNUNET_NETWORK_STRUCT_END
241 * Create a record and put it to the namestore
243 * [struct RecordCreateMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
245 GNUNET_NETWORK_STRUCT_BEGIN
246 struct RecordCreateMessage
249 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
251 struct GNUNET_MessageHeader header;
254 * Operation ID in NBO
258 /* Contenct starts here */
263 /* Record data length */
266 /* private key length */
269 GNUNET_NETWORK_STRUCT_END
273 * Create a record to the namestore response
276 GNUNET_NETWORK_STRUCT_BEGIN
277 struct RecordCreateResponseMessage
280 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
282 struct GNUNET_MessageHeader header;
285 * Operation ID in NBO
289 /* Contenct starts here */
292 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
298 GNUNET_NETWORK_STRUCT_END
301 * Remove a record from the namestore
303 * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
305 GNUNET_NETWORK_STRUCT_BEGIN
306 struct RecordRemoveMessage
309 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE
311 struct GNUNET_MessageHeader header;
314 * Operation ID in NBO
318 /* Contenct starts here */
323 struct GNUNET_CRYPTO_RsaSignature signature;
325 GNUNET_NETWORK_STRUCT_END
329 * Remove a record from the namestore response
331 GNUNET_NETWORK_STRUCT_BEGIN
332 struct RecordRemoveResponseMessage
335 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE
337 struct GNUNET_MessageHeader header;
340 * Operation ID in NBO
344 /* Contenct starts here */
347 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
351 GNUNET_NETWORK_STRUCT_END
355 * Start a zone iteration for the given zone
357 GNUNET_NETWORK_STRUCT_BEGIN
358 struct ZoneIterationStartMessage
361 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
363 struct GNUNET_MessageHeader header;
366 * Operation ID in NBO
370 /* Contenct starts here */
372 uint16_t must_have_flags;
373 uint16_t must_not_have_flags;
375 GNUNET_HashCode zone;
377 GNUNET_NETWORK_STRUCT_END
380 * Ask for next result of zone iteration for the given operation
382 GNUNET_NETWORK_STRUCT_BEGIN
383 struct ZoneIterationNextMessage
386 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
388 struct GNUNET_MessageHeader header;
391 * Operation ID in NBO
395 GNUNET_NETWORK_STRUCT_END
399 * Stop zone iteration for the given operation
401 GNUNET_NETWORK_STRUCT_BEGIN
402 struct ZoneIterationStopMessage
405 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
407 struct GNUNET_MessageHeader header;
410 * Operation ID in NBO
414 GNUNET_NETWORK_STRUCT_END
417 * Ask for next result of zone iteration for the given operation
419 GNUNET_NETWORK_STRUCT_BEGIN
420 struct ZoneIterationResponseMessage
423 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
425 struct GNUNET_MessageHeader header;
428 * Operation ID in NBO
432 struct GNUNET_TIME_AbsoluteNBO expire;
436 uint16_t contains_sig;
438 /* Record data length */
442 GNUNET_NETWORK_STRUCT_END
445 /* end of namestore.h */