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 * A GNS record serialized for network transmission.
56 * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
58 struct GNUNET_NAMESTORE_NetworkRecord
61 * Expiration time for the DNS record.
63 struct GNUNET_TIME_AbsoluteNBO expiration;
66 * Number of bytes in 'data'.
71 * Type of the GNS/DNS record.
76 * Flags for the record.
83 GNUNET_NETWORK_STRUCT_BEGIN
85 * Connect to namestore service
91 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_START
93 struct GNUNET_MessageHeader header;
96 GNUNET_NETWORK_STRUCT_END
99 GNUNET_NETWORK_STRUCT_BEGIN
101 * Generic namestore message with op id
103 struct GenericMessage
106 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
108 struct GNUNET_MessageHeader header;
111 * Operation ID in NBO
115 GNUNET_NETWORK_STRUCT_END
119 * Connect to namestore service
121 GNUNET_NETWORK_STRUCT_BEGIN
122 struct LookupNameMessage
125 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME
127 struct GNUNET_MessageHeader header;
130 * Operation ID in NBO
135 GNUNET_HashCode zone;
137 /* Requested record type */
138 uint32_t record_type;
140 /* Requested record type */
143 GNUNET_NETWORK_STRUCT_END
149 * [struct LookupNameResponseMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
151 GNUNET_NETWORK_STRUCT_BEGIN
152 struct LookupNameResponseMessage
155 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE
157 struct GNUNET_MessageHeader header;
160 * Operation ID in NBO
164 struct GNUNET_TIME_AbsoluteNBO expire;
168 uint16_t contains_sig;
170 /* Requested record type */
173 GNUNET_NETWORK_STRUCT_END
177 * Put a record to the namestore
179 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
181 GNUNET_NETWORK_STRUCT_BEGIN
182 struct RecordPutMessage
185 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
187 struct GNUNET_MessageHeader header;
190 * Operation ID in NBO
194 /* Contenct starts here */
199 /* Requested record type */
202 struct GNUNET_TIME_AbsoluteNBO expire;
204 struct GNUNET_CRYPTO_RsaSignature signature;
206 GNUNET_NETWORK_STRUCT_END
209 * Put a record to the namestore response
211 GNUNET_NETWORK_STRUCT_BEGIN
212 struct RecordPutResponseMessage
215 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
217 struct GNUNET_MessageHeader header;
220 * Operation ID in NBO
224 /* Contenct starts here */
227 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
231 GNUNET_NETWORK_STRUCT_END
235 * Put a record to the namestore
237 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
239 GNUNET_NETWORK_STRUCT_BEGIN
240 struct RecordCreateMessage
243 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
245 struct GNUNET_MessageHeader header;
248 * Operation ID in NBO
252 /* Contenct starts here */
257 struct GNUNET_CRYPTO_RsaSignature signature;
259 GNUNET_NETWORK_STRUCT_END
263 * Create a record to the namestore response
266 GNUNET_NETWORK_STRUCT_BEGIN
267 struct RecordCreateResponseMessage
270 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
272 struct GNUNET_MessageHeader header;
275 * Operation ID in NBO
279 /* Contenct starts here */
282 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
286 GNUNET_NETWORK_STRUCT_END
289 * Remove a record from the namestore
291 * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
293 GNUNET_NETWORK_STRUCT_BEGIN
294 struct RecordRemoveMessage
297 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE
299 struct GNUNET_MessageHeader header;
302 * Operation ID in NBO
306 /* Contenct starts here */
311 struct GNUNET_CRYPTO_RsaSignature signature;
313 GNUNET_NETWORK_STRUCT_END
317 * Remove a record from the namestore response
319 GNUNET_NETWORK_STRUCT_BEGIN
320 struct RecordRemoveResponseMessage
323 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE
325 struct GNUNET_MessageHeader header;
328 * Operation ID in NBO
332 /* Contenct starts here */
335 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
339 GNUNET_NETWORK_STRUCT_END
343 * Start a zone iteration for the given zone
345 GNUNET_NETWORK_STRUCT_BEGIN
346 struct ZoneIterationStartMessage
349 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
351 struct GNUNET_MessageHeader header;
354 * Operation ID in NBO
358 /* Contenct starts here */
360 uint16_t must_have_flags;
361 uint16_t must_not_have_flags;
363 GNUNET_HashCode zone;
365 GNUNET_NETWORK_STRUCT_END
368 * Ask for next result of zone iteration for the given operation
370 GNUNET_NETWORK_STRUCT_BEGIN
371 struct ZoneIterationNextMessage
374 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
376 struct GNUNET_MessageHeader header;
379 * Operation ID in NBO
383 GNUNET_NETWORK_STRUCT_END
387 * Stop zone iteration for the given operation
389 GNUNET_NETWORK_STRUCT_BEGIN
390 struct ZoneIterationStopMessage
393 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
395 struct GNUNET_MessageHeader header;
398 * Operation ID in NBO
402 GNUNET_NETWORK_STRUCT_END
405 * Ask for next result of zone iteration for the given operation
407 GNUNET_NETWORK_STRUCT_BEGIN
408 struct ZoneIterationResponseMessage
411 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
413 struct GNUNET_MessageHeader header;
416 * Operation ID in NBO
420 GNUNET_NETWORK_STRUCT_END
423 /* end of namestore.h */