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_YES
32 typedef void (*GNUNET_DHT_MessageReceivedHandler) (void *cls,
33 const struct GNUNET_MessageHeader
37 * Message which indicates the DHT should cancel outstanding
38 * requests and discard any state.
40 struct GNUNET_DHT_StopMessage
43 * Type: GNUNET_MESSAGE_TYPE_DHT_STOP
45 struct GNUNET_MessageHeader header;
50 uint32_t reserved GNUNET_PACKED;
53 * Unique ID identifying this request
55 uint64_t unique_id GNUNET_PACKED;
61 * Generic DHT message, indicates that a route request
64 struct GNUNET_DHT_RouteMessage
67 * Type: GNUNET_MESSAGE_TYPE_DHT_ROUTE
69 struct GNUNET_MessageHeader header;
74 uint32_t options GNUNET_PACKED;
77 * The key to search for
82 * Unique ID identifying this request, if 0 then
83 * the client will not expect a response
85 uint64_t unique_id GNUNET_PACKED;
88 * Replication level for this message
90 uint32_t desired_replication_level GNUNET_PACKED;
93 /* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */
97 struct GNUNET_DHT_RouteResultMessage
100 * Type: GNUNET_MESSAGE_TYPE_DHT_ROUTE_RESULT
102 struct GNUNET_MessageHeader header;
107 uint32_t options GNUNET_PACKED;
110 * The key that was searched for
115 * Unique ID identifying this request
117 uint64_t unique_id GNUNET_PACKED;
119 /* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */
123 * Message to insert data into the DHT
125 struct GNUNET_DHT_PutMessage
128 * Type: GNUNET_MESSAGE_TYPE_DHT_PUT
130 struct GNUNET_MessageHeader header;
133 * The type of data to insert.
135 size_t type GNUNET_PACKED;
138 * How long should this data persist?
140 struct GNUNET_TIME_AbsoluteNBO expiration;
143 * The size of the data, appended to the end of this message.
145 size_t data_size GNUNET_PACKED;
151 * Message to request data from the DHT
153 struct GNUNET_DHT_GetMessage
156 * Type: GNUNET_MESSAGE_TYPE_DHT_GET
158 struct GNUNET_MessageHeader header;
161 * The type for the data for the GET request
168 * Message to return data from the DHT
170 struct GNUNET_DHT_GetResultMessage
173 * Type: GNUNET_MESSAGE_TYPE_DHT_GET_RESULT
175 struct GNUNET_MessageHeader header;
178 * The type for the data for the GET request
183 * The key to search for
188 * When does this entry expire?
190 struct GNUNET_TIME_Absolute expiration;