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;
146 * Bytes of serialized record data
151 * Number of records contained
156 * Is the signature valid
157 * GNUNET_YES or GNUNET_NO
159 int16_t contains_sig;
162 * All zeros if 'contains_sig' is GNUNET_NO.
164 struct GNUNET_CRYPTO_EccSignature signature;
167 * The public key for the name
169 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key;
171 /* 0-terminated name and serialized record data */
172 /* rd_len bytes serialized record data */
177 * Put a record to the namestore
179 struct RecordPutMessage
182 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_RECORD_PUT
184 struct GNUNET_NAMESTORE_Header gns_header;
189 struct GNUNET_TIME_AbsoluteNBO expire;
197 * Length of serialized record data
202 * Number of records contained
207 * always zero (for alignment)
214 struct GNUNET_CRYPTO_EccSignature signature;
219 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key;
221 /* name (0-terminated) followed by "rd_count" serialized records */
227 * Put a record to the namestore response
229 struct RecordPutResponseMessage
232 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE
234 struct GNUNET_NAMESTORE_Header gns_header;
238 * GNUNET_SYSERR on failure
239 * GNUNET_OK on success
246 * Create a record and put it to the namestore
249 struct RecordCreateMessage
252 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE
254 struct GNUNET_NAMESTORE_Header gns_header;
256 struct GNUNET_TIME_AbsoluteNBO expire;
264 * Length of serialized record data
279 * GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded private key with length pkey_len
280 * name with length name_len
281 * serialized record data with length rd_len
287 * Create a record to the namestore response
289 struct RecordCreateResponseMessage
292 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE
294 struct GNUNET_NAMESTORE_Header gns_header;
297 * name length: GNUNET_NO already exists, GNUNET_YES on success, GNUNET_SYSERR error
304 * Lookup a name for a zone hash
306 struct ZoneToNameMessage
309 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
311 struct GNUNET_NAMESTORE_Header gns_header;
314 * The hash of public key of the zone to look up in
316 struct GNUNET_CRYPTO_ShortHashCode zone;
319 * The hash of the public key of the target zone
321 struct GNUNET_CRYPTO_ShortHashCode value_zone;
325 * Respone for zone to name lookup
327 struct ZoneToNameResponseMessage
330 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
332 struct GNUNET_NAMESTORE_Header gns_header;
335 * Record block expiration
337 struct GNUNET_TIME_AbsoluteNBO expire;
345 * Length of serialized record data
350 * Number of records contained
355 * result in NBO: GNUNET_OK on success, GNUNET_NO if there were no
356 * results, GNUNET_SYSERR on error
363 struct GNUNET_CRYPTO_EccSignature signature;
368 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded zone_key;
374 * Start monitoring a zone.
376 struct ZoneMonitorStartMessage
379 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START
381 struct GNUNET_NAMESTORE_Header gns_header;
386 struct GNUNET_CRYPTO_ShortHashCode zone;
389 * All zones. GNUNET_YES to monitor all zones,
390 * GNUNET_NO to only monitor 'zone'. In NBO.
392 uint32_t all_zones GNUNET_PACKED;
398 * Start a zone iteration for the given zone
400 struct ZoneIterationStartMessage
403 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
405 struct GNUNET_NAMESTORE_Header gns_header;
410 struct GNUNET_CRYPTO_ShortHashCode zone;
413 * Which flags must be included
415 uint16_t must_have_flags;
418 * Which flags must not be included
420 uint16_t must_not_have_flags;
425 * Ask for next result of zone iteration for the given operation
427 struct ZoneIterationNextMessage
430 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
432 struct GNUNET_NAMESTORE_Header gns_header;
437 * Stop zone iteration for the given operation
439 struct ZoneIterationStopMessage
442 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
444 struct GNUNET_NAMESTORE_Header gns_header;
448 GNUNET_NETWORK_STRUCT_END
451 /* end of namestore.h */