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 * Maximum length of any name, including 0-termination.
32 #define MAX_NAME_LEN 256
34 GNUNET_NETWORK_STRUCT_BEGIN
38 * A GNS record serialized for network transmission.
40 * Layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
42 struct GNUNET_NAMESTORE_NetworkRecord
45 * Expiration time for the DNS record.
47 struct GNUNET_TIME_AbsoluteNBO expiration;
50 * Number of bytes in 'data'.
55 * Type of the GNS/DNS record.
60 * Flags for the record.
68 * Connect to namestore service. FIXME: UNNECESSARY.
74 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_START
76 struct GNUNET_MessageHeader header;
82 * Generic namestore message with op id
84 struct GNUNET_NAMESTORE_Header
87 * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_*
88 * header.size will be message size
90 struct GNUNET_MessageHeader header;
100 * Lookup a name in the namestore
102 struct LookupNameMessage
104 struct GNUNET_NAMESTORE_Header gns_header;
109 struct GNUNET_CRYPTO_ShortHashCode zone;
112 * Requested record type
114 uint32_t record_type;
121 /* 0-terminated name here */
128 struct LookupNameResponseMessage
131 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE
133 struct GNUNET_NAMESTORE_Header gns_header;
138 struct GNUNET_TIME_AbsoluteNBO expire;
147 * Bytes of serialized record data
152 * Number of records contained
157 * Is the signature valid
158 * GNUNET_YES or GNUNET_NO
160 int16_t contains_sig;
163 * All zeros if 'contains_sig' is GNUNET_NO.
165 struct GNUNET_CRYPTO_EccSignature signature;
168 * The public key for the name
170 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key;
172 /* 0-terminated name and serialized record data */
173 /* rd_len bytes serialized record data */
178 * Put a record to the namestore
180 struct RecordPutMessage
183 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
185 struct GNUNET_NAMESTORE_Header gns_header;
190 struct GNUNET_TIME_AbsoluteNBO expire;
198 * Length of serialized record data
203 * Number of records contained
208 * always zero (for alignment)
215 struct GNUNET_CRYPTO_EccSignature signature;
220 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key;
222 /* name (0-terminated) followed by "rd_count" serialized records */
228 * Put a record to the namestore response
230 struct RecordPutResponseMessage
233 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
235 struct GNUNET_NAMESTORE_Header gns_header;
239 * GNUNET_SYSERR on failure
240 * GNUNET_OK on success
247 * Create a record and put it to the namestore
250 struct RecordCreateMessage
253 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
255 struct GNUNET_NAMESTORE_Header gns_header;
257 struct GNUNET_TIME_AbsoluteNBO expire;
265 * Length of serialized record data
280 * GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private key with length pkey_len
281 * name with length name_len
282 * serialized record data with length rd_len
288 * Create a record to the namestore response
290 struct RecordCreateResponseMessage
293 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
295 struct GNUNET_NAMESTORE_Header gns_header;
298 * name length: GNUNET_NO already exists, GNUNET_YES on success, GNUNET_SYSERR error
305 * Lookup a name for a zone hash
307 struct ZoneToNameMessage
310 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
312 struct GNUNET_NAMESTORE_Header gns_header;
315 * The hash of public key of the zone to look up in
317 struct GNUNET_CRYPTO_ShortHashCode zone;
320 * The hash of the public key of the target zone
322 struct GNUNET_CRYPTO_ShortHashCode value_zone;
326 * Respone for zone to name lookup
328 struct ZoneToNameResponseMessage
331 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
333 struct GNUNET_NAMESTORE_Header gns_header;
336 * Record block expiration
338 struct GNUNET_TIME_AbsoluteNBO expire;
346 * Length of serialized record data
351 * Number of records contained
355 /* result in NBO: GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error */
361 struct GNUNET_CRYPTO_EccSignature signature;
366 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded zone_key;
372 * Start monitoring a zone.
374 struct ZoneMonitorStartMessage
377 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START
379 struct GNUNET_NAMESTORE_Header gns_header;
384 struct GNUNET_CRYPTO_ShortHashCode zone;
387 * All zones. GNUNET_YES to monitor all zones,
388 * GNUNET_NO to only monitor 'zone'. In NBO.
390 uint32_t all_zones GNUNET_PACKED;
396 * Start a zone iteration for the given zone
398 struct ZoneIterationStartMessage
401 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
403 struct GNUNET_NAMESTORE_Header gns_header;
408 struct GNUNET_CRYPTO_ShortHashCode zone;
411 * Which flags must be included
413 uint16_t must_have_flags;
416 * Which flags must not be included
418 uint16_t must_not_have_flags;
423 * Ask for next result of zone iteration for the given operation
425 struct ZoneIterationNextMessage
428 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
430 struct GNUNET_NAMESTORE_Header gns_header;
435 * Stop zone iteration for the given operation
437 struct ZoneIterationStopMessage
440 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
442 struct GNUNET_NAMESTORE_Header gns_header;
447 * Next result of zone iteration for the given operation
448 * // FIXME: use 'struct LookupResponseMessage' instead? (identical except
449 * for having 'contains_sig' instead of 'reserved', but fully compatible otherwise).
451 struct ZoneIterationResponseMessage
454 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_RESPONSE
456 struct GNUNET_NAMESTORE_Header gns_header;
458 struct GNUNET_TIME_AbsoluteNBO expire;
468 * Number of records contained
473 * always zero (for alignment)
478 * All zeros if 'contains_sig' is GNUNET_NO.
480 struct GNUNET_CRYPTO_EccSignature signature;
485 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key;
492 GNUNET_NETWORK_STRUCT_END
495 /* end of namestore.h */