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 GNUNET_NETWORK_STRUCT_BEGIN
60 * A GNS record serialized for network transmission.
61 * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
63 struct GNUNET_NAMESTORE_NetworkRecord
66 * Expiration time for the DNS record.
68 struct GNUNET_TIME_AbsoluteNBO expiration;
71 * Number of bytes in 'data'.
76 * Type of the GNS/DNS record.
81 * Flags for the record.
89 * Connect to namestore service. FIXME: UNNECESSARY.
95 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_START
97 struct GNUNET_MessageHeader header;
102 * Generic namestore message with op id
104 struct GenericMessage
107 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
109 struct GNUNET_MessageHeader header;
112 * Operation ID in NBO // BETTER: request ID
119 * Connect to namestore service
121 struct LookupNameMessage
124 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME
126 struct GNUNET_MessageHeader header;
128 // FIXME: use 'struct GenericMessage'
130 * Operation ID in NBO
135 GNUNET_HashCode zone;
137 /* Requested record type */
138 uint32_t record_type;
140 /* Requested record type */
148 * [struct LookupNameResponseMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
150 struct LookupNameResponseMessage
153 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE
155 struct GNUNET_MessageHeader header;
158 * Operation ID in NBO
162 struct GNUNET_TIME_AbsoluteNBO expire;
168 int32_t contains_sig;
170 /* Requested record type */
175 * Put a record to the namestore
177 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
179 struct RecordPutMessage
182 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
184 struct GNUNET_MessageHeader header;
187 * Operation ID in NBO
191 /* Contenct starts here */
196 /* Length of serialized rd data */
199 /* Length of pubkey */
202 struct GNUNET_TIME_AbsoluteNBO expire;
204 struct GNUNET_CRYPTO_RsaSignature signature;
209 * Put a record to the namestore response
211 struct RecordPutResponseMessage
214 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
216 struct GNUNET_MessageHeader header;
219 * Operation ID in NBO
223 /* Contenct starts here */
226 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
233 * Create a record and put it to the namestore
235 * [struct RecordCreateMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
237 struct RecordCreateMessage
240 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
242 struct GNUNET_MessageHeader header;
245 * Operation ID in NBO
249 /* Contenct starts here */
254 /* Record data length */
257 /* private key length */
263 * Create a record to the namestore response
266 struct RecordCreateResponseMessage
269 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
271 struct GNUNET_MessageHeader header;
274 * Operation ID in NBO
278 /* Contenct starts here */
281 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
289 * Remove a record from the namestore
291 * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
293 struct RecordRemoveMessage
296 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE
298 struct GNUNET_MessageHeader header;
301 * Operation ID in NBO
305 /* Contenct starts here */
310 struct GNUNET_CRYPTO_RsaSignature signature;
312 GNUNET_NETWORK_STRUCT_END
316 * Remove a record from the namestore response
318 GNUNET_NETWORK_STRUCT_BEGIN
319 struct RecordRemoveResponseMessage
322 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE
324 struct GNUNET_MessageHeader header;
327 * Operation ID in NBO
331 /* Contenct starts here */
334 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
338 GNUNET_NETWORK_STRUCT_END
342 * Start a zone iteration for the given zone
344 GNUNET_NETWORK_STRUCT_BEGIN
345 struct ZoneIterationStartMessage
348 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
350 struct GNUNET_MessageHeader header;
353 * Operation ID in NBO
357 /* Contenct starts here */
359 uint16_t must_have_flags;
360 uint16_t must_not_have_flags;
362 GNUNET_HashCode zone;
364 GNUNET_NETWORK_STRUCT_END
367 * Ask for next result of zone iteration for the given operation
369 GNUNET_NETWORK_STRUCT_BEGIN
370 struct ZoneIterationNextMessage
373 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
375 struct GNUNET_MessageHeader header;
378 * Operation ID in NBO
382 GNUNET_NETWORK_STRUCT_END
386 * Stop zone iteration for the given operation
388 GNUNET_NETWORK_STRUCT_BEGIN
389 struct ZoneIterationStopMessage
392 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
394 struct GNUNET_MessageHeader header;
397 * Operation ID in NBO
401 GNUNET_NETWORK_STRUCT_END
404 * Ask for next result of zone iteration for the given operation
406 GNUNET_NETWORK_STRUCT_BEGIN
407 struct ZoneIterationResponseMessage
410 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
412 struct GNUNET_MessageHeader header;
415 * Operation ID in NBO
419 struct GNUNET_TIME_AbsoluteNBO expire;
423 uint16_t contains_sig;
425 /* Record data length */
429 GNUNET_NETWORK_STRUCT_END
432 /* end of namestore.h */