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 struct GNUNET_CRYPTO_RsaSignature *
48 GNUNET_NAMESTORE_create_signature (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const char *name, struct GNUNET_NAMESTORE_RecordData *rd, unsigned int rd_count);
50 GNUNET_NETWORK_STRUCT_BEGIN
52 * A GNS record serialized for network transmission.
53 * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
55 struct GNUNET_NAMESTORE_NetworkRecord
58 * Expiration time for the DNS record.
60 struct GNUNET_TIME_AbsoluteNBO expiration;
63 * Number of bytes in 'data'.
68 * Type of the GNS/DNS record.
73 * Flags for the record.
81 * Connect to namestore service. FIXME: UNNECESSARY.
87 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_START
89 struct GNUNET_MessageHeader header;
94 * Generic namestore message with op id
96 struct GNUNET_NAMESTORE_Header
99 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
100 * header.size will be message size
102 struct GNUNET_MessageHeader header;
112 * Connect to namestore service
114 struct LookupNameMessage
116 struct GNUNET_NAMESTORE_Header gns_header;
119 GNUNET_HashCode zone;
121 /* Requested record type */
122 uint32_t record_type;
124 /* Requested record type */
132 * [struct LookupNameResponseMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
134 struct LookupNameResponseMessage
137 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE
139 struct GNUNET_NAMESTORE_Header gns_header;
141 struct GNUNET_TIME_AbsoluteNBO expire;
149 int32_t contains_sig;
151 /* Requested record type */
156 * Put a record to the namestore
158 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
160 struct RecordPutMessage
163 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
165 struct GNUNET_NAMESTORE_Header gns_header;
167 /* Contenct starts here */
172 /* Length of serialized rd data */
175 /* Number of records contained */
178 /* Length of pubkey */
181 struct GNUNET_TIME_AbsoluteNBO expire;
183 struct GNUNET_CRYPTO_RsaSignature signature;
188 * Put a record to the namestore response
190 struct RecordPutResponseMessage
193 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
195 struct GNUNET_MessageHeader header;
198 * Operation ID in NBO
202 /* Contenct starts here */
205 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
212 * Create a record and put it to the namestore
214 * [struct RecordCreateMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
216 struct RecordCreateMessage
219 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
221 struct GNUNET_NAMESTORE_Header gns_header;
223 /* Contenct starts here */
228 /* Record data length */
234 /* private key length */
240 * Create a record to the namestore response
243 struct RecordCreateResponseMessage
246 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
248 struct GNUNET_NAMESTORE_Header gns_header;
250 /* Contenct starts here */
253 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
261 * Remove a record from the namestore
263 * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
265 struct RecordRemoveMessage
268 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE
270 struct GNUNET_NAMESTORE_Header gns_header;
272 /* Contenct starts here */
277 /* Length of serialized rd data */
280 /* Number of records contained */
283 /* Length of pubkey */
286 GNUNET_NETWORK_STRUCT_END
290 * Remove a record from the namestore response
292 GNUNET_NETWORK_STRUCT_BEGIN
293 struct RecordRemoveResponseMessage
296 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE
298 struct GNUNET_NAMESTORE_Header gns_header;
300 /* Contenct starts here */
305 * 1 : no records for entry
306 * 2 : Could not find record to remove
307 * 3 : Failed to create new signature
308 * 4 : Failed to put new set of records in database
312 GNUNET_NETWORK_STRUCT_END
316 * Start a zone iteration for the given zone
318 GNUNET_NETWORK_STRUCT_BEGIN
319 struct ZoneIterationStartMessage
322 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
324 struct GNUNET_NAMESTORE_Header gns_header;
326 /* Contenct starts here */
328 uint16_t must_have_flags;
329 uint16_t must_not_have_flags;
331 GNUNET_HashCode zone;
333 GNUNET_NETWORK_STRUCT_END
336 * Ask for next result of zone iteration for the given operation
338 GNUNET_NETWORK_STRUCT_BEGIN
339 struct ZoneIterationNextMessage
342 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
344 struct GNUNET_NAMESTORE_Header gns_header;
346 GNUNET_NETWORK_STRUCT_END
350 * Stop zone iteration for the given operation
352 GNUNET_NETWORK_STRUCT_BEGIN
353 struct ZoneIterationStopMessage
356 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
358 struct GNUNET_NAMESTORE_Header gns_header;
360 GNUNET_NETWORK_STRUCT_END
363 * Ask for next result of zone iteration for the given operation
365 GNUNET_NETWORK_STRUCT_BEGIN
366 struct ZoneIterationResponseMessage
369 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
371 struct GNUNET_NAMESTORE_Header gns_header;
373 struct GNUNET_TIME_AbsoluteNBO expire;
377 uint16_t contains_sig;
379 /* Record data length */
383 GNUNET_NETWORK_STRUCT_END
386 /* end of namestore.h */