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 NOT Nathan Evans
29 #include "gnunet_common.h"
31 #define DEBUG_DV_GOSSIP GNUNET_NO
32 #define DEBUG_DV_GOSSIP_RECEIPT GNUNET_YES
33 #define DEBUG_DV GNUNET_NO
34 #define DEBUG_DV_API GNUNET_YES
36 typedef void (*GNUNET_DV_MessageReceivedHandler) (void *cls,
37 struct GNUNET_PeerIdentity *sender,
42 size_t sender_address_len);
45 * DV Message, contains a message that was received
46 * via DV for this peer!
48 * Sender address is copied to the end of this struct,
49 * followed by the actual message received.
51 struct GNUNET_DV_MessageReceived
54 * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_MESSAGE
56 struct GNUNET_MessageHeader header;
59 * The sender of the message
61 struct GNUNET_PeerIdentity sender;
64 * The message that was sent
69 * The distance to the peer that we received the message from
74 * Length of the sender address, appended to end of this message
76 uint32_t sender_address_len;
82 * DV Message, indicates that we have learned of a new DV level peer.
84 * Sender address is copied to the end of this struct.
86 struct GNUNET_DV_ConnectMessage
89 * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_MESSAGE
91 struct GNUNET_MessageHeader header;
94 * The sender of the message
96 struct GNUNET_PeerIdentity *sender;
99 * The message that was sent
101 struct GNUNET_MessageHeader *msg;
104 * The distance to the peer that we received the message from
109 * Length of the sender address, appended to end of this message
111 uint32_t sender_address_len;
117 * Message to send a message over DV via a specific peer
119 struct GNUNET_DV_SendMessage
122 * Type: GNUNET_MESSAGE_TYPE_DV_SEND
124 struct GNUNET_MessageHeader header;
127 * Intended final recipient of this message
129 struct GNUNET_PeerIdentity target;
132 * The size of the msgbuf
134 uint32_t msgbuf_size;
142 * How long can we delay sending?
144 struct GNUNET_TIME_Relative timeout;
147 * Size of the address (appended to end of struct)
152 * The message(s) to be sent.
157 * Sender, appended to end of struct tells via whom
158 * to send this message.
164 * Message that gets sent between nodes updating dv infos
169 struct GNUNET_MessageHeader header;
172 * Cost from received from node to neighbor node, takes distance into account
174 unsigned int cost GNUNET_PACKED;
177 * Identity of neighbor we learned information about
179 struct GNUNET_PeerIdentity neighbor;
182 * PublicKey of neighbor.
184 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
187 * Neighbor ID to use when sending to this peer
189 uint32_t neighbor_id GNUNET_PACKED;
191 } p2p_dv_MESSAGE_NeighborInfo;
194 * Message that gets sent between nodes carrying information
198 struct GNUNET_MessageHeader header;
201 * Identity of peer that ultimately sent the message.
202 * Should be looked up in the set of 'neighbor_id's of
203 * the referring peer.
205 unsigned int sender GNUNET_PACKED;
208 * Identity of neighbor this message is going to. Should
209 * be looked up in the set of our own identifiers for
212 unsigned int recipient GNUNET_PACKED;
214 } p2p_dv_MESSAGE_Data;
217 struct GNUNET_DV_Handle *
218 GNUNET_DV_connect (struct GNUNET_SCHEDULER_Handle *sched,
219 const struct GNUNET_CONFIGURATION_Handle *cfg,
220 GNUNET_DV_MessageReceivedHandler receive_handler,
221 void *receive_handler_cls);