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_EccPublicKey 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_EccPublicKey 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
278 struct GNUNET_CRYPTO_EccPrivateKey private_key;
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;
327 * Respone for zone to name lookup
329 struct ZoneToNameResponseMessage
332 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
334 struct GNUNET_NAMESTORE_Header gns_header;
337 * Record block expiration
339 struct GNUNET_TIME_AbsoluteNBO expire;
347 * Length of serialized record data
352 * Number of records contained
357 * result in NBO: GNUNET_OK on success, GNUNET_NO if there were no
358 * results, GNUNET_SYSERR on error
365 struct GNUNET_CRYPTO_EccSignature signature;
370 struct GNUNET_CRYPTO_EccPublicKey zone_key;
376 * Start monitoring a zone.
378 struct ZoneMonitorStartMessage
381 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START
383 struct GNUNET_NAMESTORE_Header gns_header;
388 struct GNUNET_CRYPTO_ShortHashCode zone;
391 * All zones. GNUNET_YES to monitor all zones,
392 * GNUNET_NO to only monitor 'zone'. In NBO.
394 uint32_t all_zones GNUNET_PACKED;
400 * Start a zone iteration for the given zone
402 struct ZoneIterationStartMessage
405 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START
407 struct GNUNET_NAMESTORE_Header gns_header;
412 struct GNUNET_CRYPTO_ShortHashCode zone;
415 * Which flags must be included
417 uint16_t must_have_flags;
420 * Which flags must not be included
422 uint16_t must_not_have_flags;
427 * Ask for next result of zone iteration for the given operation
429 struct ZoneIterationNextMessage
432 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT
434 struct GNUNET_NAMESTORE_Header gns_header;
439 * Stop zone iteration for the given operation
441 struct ZoneIterationStopMessage
444 * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP
446 struct GNUNET_NAMESTORE_Header gns_header;
450 GNUNET_NETWORK_STRUCT_END
453 /* end of namestore.h */