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 GNUNET_YES
32 #define DEBUG_DV_API GNUNET_YES
34 typedef void (*GNUNET_DV_MessageReceivedHandler) (void *cls,
35 struct GNUNET_PeerIdentity *sender,
36 struct GNUNET_MessageHeader *msg,
37 unsigned int distance,
39 size_t sender_address_len);
42 * DV Message, contains a message that was received
43 * via DV for this peer!
45 * Sender address is copied to the end of this struct.
47 struct GNUNET_DV_MessageReceived
50 * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_MESSAGE
52 struct GNUNET_MessageHeader header;
55 * The sender of the message
57 struct GNUNET_PeerIdentity *sender;
60 * The message that was sent
62 struct GNUNET_MessageHeader *msg;
65 * The distance to the peer that we received the message from
70 * Length of the sender address, appended to end of this message
72 size_t sender_address_len;
78 * DV Message, indicates that we have learned of a new DV level peer.
80 * Sender address is copied to the end of this struct.
82 struct GNUNET_DV_ConnectMessage
85 * Type: GNUNET_MESSAGE_TYPE_TRANSPORT_DV_MESSAGE
87 struct GNUNET_MessageHeader header;
90 * The sender of the message
92 struct GNUNET_PeerIdentity *sender;
95 * The message that was sent
97 struct GNUNET_MessageHeader *msg;
100 * The distance to the peer that we received the message from
105 * Length of the sender address, appended to end of this message
107 size_t sender_address_len;
113 * Message to send a message over DV via a specific peer
115 struct GNUNET_DV_SendMessage
118 * Type: GNUNET_MESSAGE_TYPE_DV_SEND
120 struct GNUNET_MessageHeader header;
123 * Intended final recipient of this message
125 struct GNUNET_PeerIdentity target;
128 * The message(s) to be sent.
133 * The size of the msgbuf
143 * How long can we delay sending?
145 struct GNUNET_TIME_Relative timeout;
148 * Size of the address (appended to end of struct)
153 * Sender, appended to end of struct tells via whom
154 * to send this message.
159 struct GNUNET_DV_Handle *
160 GNUNET_DV_connect (struct GNUNET_SCHEDULER_Handle *sched,
161 const struct GNUNET_CONFIGURATION_Handle *cfg,
162 GNUNET_DV_MessageReceivedHandler receive_handler,
163 void *receive_handler_cls);