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 struct GNUNET_MessageHeader
37 * Generic DHT message, wrapper for other message types
39 struct GNUNET_DHT_StopMessage
42 * Type: GNUNET_MESSAGE_TYPE_DHT_MESSAGE
44 struct GNUNET_MessageHeader header;
47 * Unique ID identifying this request
55 * Generic DHT message, wrapper for other message types
57 struct GNUNET_DHT_Message
60 * Type: GNUNET_MESSAGE_TYPE_DHT_MESSAGE
62 struct GNUNET_MessageHeader header;
65 * The key to search for
70 * Replication level for this message
72 uint16_t desired_replication_level;
80 * Is this message uniquely identified? If so it will
81 * be fire and forget, if not we will wait for a receipt
88 * Unique ID identifying this request
93 /* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */
98 * Message to insert data into the DHT
100 struct GNUNET_DHT_PutMessage
103 * Type: GNUNET_MESSAGE_TYPE_DHT_PUT
105 struct GNUNET_MessageHeader header;
108 * The type of data to insert.
113 * The size of the data, appended to the end of this message.
118 * How long should this data persist?
120 struct GNUNET_TIME_Absolute expiration;
126 * Message to request data from the DHT
128 struct GNUNET_DHT_GetMessage
131 * Type: GNUNET_MESSAGE_TYPE_DHT_GET
133 struct GNUNET_MessageHeader header;
136 * The type for the data for the GET request
143 * Message to return data from the DHT
145 struct GNUNET_DHT_GetResultMessage
148 * Type: GNUNET_MESSAGE_TYPE_DHT_GET_RESULT
150 struct GNUNET_MessageHeader header;
153 * The type for the data for the GET request
158 * The key to search for
163 * When does this entry expire?
165 struct GNUNET_TIME_Absolute expiration;
168 * The size of the data, appended to the end of this message.
175 * Message to issue find peer request to the DHT
177 struct GNUNET_DHT_FindPeerMessage
180 * Type: GNUNET_MESSAGE_TYPE_DHT_FIND_PEER
182 struct GNUNET_MessageHeader header;
185 * Size of inject message (may be zero)
189 /* Followed by message to inject at found peers */
194 * Message to return data from the DHT
196 struct GNUNET_DHT_FindPeerResultMessage
199 * Type: GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT
201 struct GNUNET_MessageHeader header;
204 * The peer that was found
206 struct GNUNET_PeerIdentity peer;
209 * The size of the return message from the peer
210 * (defaults to HELLO for the peer),
211 * appended to the end of this message, 0 if