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
46 #define GNUNET_MESSAGE_TYPE_NAMESTORE_DISCONNECT 443
49 struct GNUNET_CRYPTO_RsaSignature *
50 GNUNET_NAMESTORE_create_signature (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const char *name, struct GNUNET_NAMESTORE_RecordData *rd, unsigned int rd_count);
53 * Compares if two records are equal
58 * @return GNUNET_YES or GNUNET_NO
61 GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
62 const struct GNUNET_NAMESTORE_RecordData *b);
64 GNUNET_NETWORK_STRUCT_BEGIN
66 * A GNS record serialized for network transmission.
67 * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
69 struct GNUNET_NAMESTORE_NetworkRecord
72 * Expiration time for the DNS record.
74 struct GNUNET_TIME_AbsoluteNBO expiration;
77 * Number of bytes in 'data'.
82 * Type of the GNS/DNS record.
87 * Flags for the record.
95 * Connect to namestore service. FIXME: UNNECESSARY.
101 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_START
103 struct GNUNET_MessageHeader header;
108 * Connect to namestore service. FIXME: UNNECESSARY.
110 struct DisconnectMessage
114 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_DISCONNECT
116 struct GNUNET_MessageHeader header;
120 * GNUNET_YES or _NO in NBO
127 * Generic namestore message with op id
129 struct GNUNET_NAMESTORE_Header
132 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
133 * header.size will be message size
135 struct GNUNET_MessageHeader header;
145 * Connect to namestore service
147 struct LookupNameMessage
149 struct GNUNET_NAMESTORE_Header gns_header;
152 GNUNET_HashCode zone;
154 /* Requested record type */
155 uint32_t record_type;
157 /* Requested record type */
165 * [struct LookupNameResponseMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
167 struct LookupNameResponseMessage
170 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE
172 struct GNUNET_NAMESTORE_Header gns_header;
174 struct GNUNET_TIME_AbsoluteNBO expire;
182 int32_t contains_sig;
184 /* Requested record type */
189 * Put a record to the namestore
191 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
193 struct RecordPutMessage
196 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
198 struct GNUNET_NAMESTORE_Header gns_header;
200 /* Contenct starts here */
205 /* Length of serialized rd data */
208 /* Number of records contained */
211 /* Length of pubkey */
214 struct GNUNET_TIME_AbsoluteNBO expire;
216 struct GNUNET_CRYPTO_RsaSignature signature;
221 * Put a record to the namestore response
223 struct RecordPutResponseMessage
226 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
228 struct GNUNET_MessageHeader header;
231 * Operation ID in NBO
235 /* Contenct starts here */
238 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
245 * Create a record and put it to the namestore
247 * [struct RecordCreateMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
249 struct RecordCreateMessage
252 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
254 struct GNUNET_NAMESTORE_Header gns_header;
256 /* Contenct starts here */
261 /* Record data length */
267 /* private key length */
273 * Create a record to the namestore response
276 struct RecordCreateResponseMessage
279 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
281 struct GNUNET_NAMESTORE_Header gns_header;
283 /* Contenct starts here */
286 * name length: GNUNET_NO already existsw, GNUNET_YES on success, GNUNET_SYSERR error
294 * Remove a record from the namestore
296 * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
298 struct RecordRemoveMessage
301 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE
303 struct GNUNET_NAMESTORE_Header gns_header;
305 /* Contenct starts here */
310 /* Length of serialized rd data */
313 /* Number of records contained */
316 /* Length of pubkey */
319 GNUNET_NETWORK_STRUCT_END
323 * Remove a record from the namestore response
325 GNUNET_NETWORK_STRUCT_BEGIN
326 struct RecordRemoveResponseMessage
329 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE
331 struct GNUNET_NAMESTORE_Header gns_header;
333 /* Contenct starts here */
338 * 1 : no records for entry
339 * 2 : Could not find record to remove
340 * 3 : Failed to create new signature
341 * 4 : Failed to put new set of records in database
345 GNUNET_NETWORK_STRUCT_END
349 * Start a zone iteration for the given zone
351 GNUNET_NETWORK_STRUCT_BEGIN
352 struct ZoneIterationStartMessage
355 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
357 struct GNUNET_NAMESTORE_Header gns_header;
359 /* Contenct starts here */
361 uint16_t must_have_flags;
362 uint16_t must_not_have_flags;
364 GNUNET_HashCode zone;
366 GNUNET_NETWORK_STRUCT_END
369 * Ask for next result of zone iteration for the given operation
371 GNUNET_NETWORK_STRUCT_BEGIN
372 struct ZoneIterationNextMessage
375 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
377 struct GNUNET_NAMESTORE_Header gns_header;
379 GNUNET_NETWORK_STRUCT_END
383 * Stop zone iteration for the given operation
385 GNUNET_NETWORK_STRUCT_BEGIN
386 struct ZoneIterationStopMessage
389 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
391 struct GNUNET_NAMESTORE_Header gns_header;
393 GNUNET_NETWORK_STRUCT_END
396 * Ask for next result of zone iteration for the given operation
398 GNUNET_NETWORK_STRUCT_BEGIN
399 struct ZoneIterationResponseMessage
402 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
404 struct GNUNET_NAMESTORE_Header gns_header;
406 struct GNUNET_TIME_AbsoluteNBO expire;
410 uint16_t contains_sig;
412 /* Record data length */
416 GNUNET_NETWORK_STRUCT_END
419 /* end of namestore.h */