2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 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 2, 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 * @author Christian Grothoff
23 * @author Nathan Evans
30 #define DEBUG_DHT GNUNET_NO
32 typedef void (*GNUNET_DHT_MessageReceivedHandler) (void *cls,
33 const struct GNUNET_MessageHeader
39 struct GNUNET_DHT_StopMessage
42 * Type: GNUNET_MESSAGE_TYPE_DHT_MESSAGE
44 struct GNUNET_MessageHeader header;
49 uint32_t reserved GNUNET_PACKED;
52 * Unique ID identifying this request
54 uint64_t unique_id GNUNET_PACKED;
60 * Generic DHT message, wrapper for other message types
62 struct GNUNET_DHT_RouteMessage
65 * Type: GNUNET_MESSAGE_TYPE_DHT_ROUTE
67 struct GNUNET_MessageHeader header;
72 uint32_t options GNUNET_PACKED;
75 * The key to search for
80 * Unique ID identifying this request
82 uint64_t unique_id GNUNET_PACKED;
85 * Replication level for this message
87 uint32_t desired_replication_level GNUNET_PACKED;
90 * Is this message uniquely identified? If so it will
91 * be fire and forget, if not we will wait for a receipt
94 uint32_t unique GNUNET_PACKED;
96 /* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */
100 struct GNUNET_DHT_RouteResultMessage
103 * Type: GNUNET_MESSAGE_TYPE_DHT_ROUTE_RESULT
105 struct GNUNET_MessageHeader header;
110 uint32_t options GNUNET_PACKED;
113 * The key that was searched for
118 * Unique ID identifying this request
120 uint64_t unique_id GNUNET_PACKED;
122 /* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */
126 * Message to insert data into the DHT
128 struct GNUNET_DHT_PutMessage
131 * Type: GNUNET_MESSAGE_TYPE_DHT_PUT
133 struct GNUNET_MessageHeader header;
136 * The type of data to insert.
138 size_t type GNUNET_PACKED;
141 * How long should this data persist?
143 struct GNUNET_TIME_AbsoluteNBO expiration;
146 * The size of the data, appended to the end of this message.
148 size_t data_size GNUNET_PACKED;
154 * Message to request data from the DHT
156 struct GNUNET_DHT_GetMessage
159 * Type: GNUNET_MESSAGE_TYPE_DHT_GET
161 struct GNUNET_MessageHeader header;
164 * The type for the data for the GET request
171 * Message to return data from the DHT
173 struct GNUNET_DHT_GetResultMessage
176 * Type: GNUNET_MESSAGE_TYPE_DHT_GET_RESULT
178 struct GNUNET_MessageHeader header;
181 * The type for the data for the GET request
186 * The key to search for
191 * When does this entry expire?
193 struct GNUNET_TIME_Absolute expiration;