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);
51 * Compares if two records are equal
56 * @return GNUNET_YES or GNUNET_NO
59 GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
60 const struct GNUNET_NAMESTORE_RecordData *b);
62 GNUNET_NETWORK_STRUCT_BEGIN
64 * A GNS record serialized for network transmission.
65 * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
67 struct GNUNET_NAMESTORE_NetworkRecord
70 * Expiration time for the DNS record.
72 struct GNUNET_TIME_AbsoluteNBO expiration;
75 * Number of bytes in 'data'.
80 * Type of the GNS/DNS record.
85 * Flags for the record.
93 * Connect to namestore service. FIXME: UNNECESSARY.
99 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_START
101 struct GNUNET_MessageHeader header;
106 * Generic namestore message with op id
108 struct GNUNET_NAMESTORE_Header
111 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
112 * header.size will be message size
114 struct GNUNET_MessageHeader header;
124 * Connect to namestore service
126 struct LookupNameMessage
128 struct GNUNET_NAMESTORE_Header gns_header;
131 GNUNET_HashCode zone;
133 /* Requested record type */
134 uint32_t record_type;
136 /* Requested record type */
144 * [struct LookupNameResponseMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
146 struct LookupNameResponseMessage
149 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE
151 struct GNUNET_NAMESTORE_Header gns_header;
153 struct GNUNET_TIME_AbsoluteNBO expire;
161 int32_t contains_sig;
163 /* Requested record type */
168 * Put a record to the namestore
170 * [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
172 struct RecordPutMessage
175 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
177 struct GNUNET_NAMESTORE_Header gns_header;
179 /* Contenct starts here */
184 /* Length of serialized rd data */
187 /* Number of records contained */
190 /* Length of pubkey */
193 struct GNUNET_TIME_AbsoluteNBO expire;
195 struct GNUNET_CRYPTO_RsaSignature signature;
200 * Put a record to the namestore response
202 struct RecordPutResponseMessage
205 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
207 struct GNUNET_MessageHeader header;
210 * Operation ID in NBO
214 /* Contenct starts here */
217 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
224 * Create a record and put it to the namestore
226 * [struct RecordCreateMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
228 struct RecordCreateMessage
231 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
233 struct GNUNET_NAMESTORE_Header gns_header;
235 /* Contenct starts here */
240 /* Record data length */
246 /* private key length */
252 * Create a record to the namestore response
255 struct RecordCreateResponseMessage
258 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
260 struct GNUNET_NAMESTORE_Header gns_header;
262 /* Contenct starts here */
265 * name length: GNUNET_NO (0) on error, GNUNET_OK (1) on success
273 * Remove a record from the namestore
275 * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
277 struct RecordRemoveMessage
280 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE
282 struct GNUNET_NAMESTORE_Header gns_header;
284 /* Contenct starts here */
289 /* Length of serialized rd data */
292 /* Number of records contained */
295 /* Length of pubkey */
298 GNUNET_NETWORK_STRUCT_END
302 * Remove a record from the namestore response
304 GNUNET_NETWORK_STRUCT_BEGIN
305 struct RecordRemoveResponseMessage
308 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_REMOVE_RESPONSE
310 struct GNUNET_NAMESTORE_Header gns_header;
312 /* Contenct starts here */
317 * 1 : no records for entry
318 * 2 : Could not find record to remove
319 * 3 : Failed to create new signature
320 * 4 : Failed to put new set of records in database
324 GNUNET_NETWORK_STRUCT_END
328 * Start a zone iteration for the given zone
330 GNUNET_NETWORK_STRUCT_BEGIN
331 struct ZoneIterationStartMessage
334 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
336 struct GNUNET_NAMESTORE_Header gns_header;
338 /* Contenct starts here */
340 uint16_t must_have_flags;
341 uint16_t must_not_have_flags;
343 GNUNET_HashCode zone;
345 GNUNET_NETWORK_STRUCT_END
348 * Ask for next result of zone iteration for the given operation
350 GNUNET_NETWORK_STRUCT_BEGIN
351 struct ZoneIterationNextMessage
354 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
356 struct GNUNET_NAMESTORE_Header gns_header;
358 GNUNET_NETWORK_STRUCT_END
362 * Stop zone iteration for the given operation
364 GNUNET_NETWORK_STRUCT_BEGIN
365 struct ZoneIterationStopMessage
368 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
370 struct GNUNET_NAMESTORE_Header gns_header;
372 GNUNET_NETWORK_STRUCT_END
375 * Ask for next result of zone iteration for the given operation
377 GNUNET_NETWORK_STRUCT_BEGIN
378 struct ZoneIterationResponseMessage
381 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
383 struct GNUNET_NAMESTORE_Header gns_header;
385 struct GNUNET_TIME_AbsoluteNBO expire;
389 uint16_t contains_sig;
391 /* Record data length */
395 GNUNET_NETWORK_STRUCT_END
398 /* end of namestore.h */