fix #3869: outdated FSF address
[oweals/gnunet.git] / src / dv / dv.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2013 Christian Grothoff (and other contributing authors)
4
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 3, or (at your
8      option) any later version.
9
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.
14
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., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @author Christian Grothoff
23  * @file dv/dv.h
24  * @brief IPC messages between DV service and DV plugin
25  */
26 #ifndef DV_H
27 #define DV_H
28
29 #include "gnunet_common.h"
30
31 GNUNET_NETWORK_STRUCT_BEGIN
32
33 /**
34  * DV service tells plugin about a DV-connection being
35  * now available.
36  */
37 struct GNUNET_DV_ConnectMessage
38 {
39   /**
40    * Type: #GNUNET_MESSAGE_TYPE_DV_CONNECT
41    */
42   struct GNUNET_MessageHeader header;
43
44   /**
45    * The distance to the peer that we are now connected to
46    */
47   uint32_t distance GNUNET_PACKED;
48
49   /**
50    * The other peer (at the given distance).
51    */
52   struct GNUNET_PeerIdentity peer;
53
54   /**
55    * The network the peer is in
56    */
57   uint32_t network GNUNET_PACKED;
58
59 };
60
61
62 /**
63  * DV service tells plugin about a DV-connection being
64  * no longer available.
65  *
66  * Sender address is copied to the end of this struct,
67  * followed by the actual message received.
68  */
69 struct GNUNET_DV_DisconnectMessage
70 {
71   /**
72    * Type: #GNUNET_MESSAGE_TYPE_DV_DISCONNECT
73    */
74   struct GNUNET_MessageHeader header;
75
76   /**
77    * Always zero.
78    */
79   uint32_t reserved GNUNET_PACKED;
80
81   /**
82    * The peer that is no longer available.
83    */
84   struct GNUNET_PeerIdentity peer;
85
86 };
87
88
89 /**
90  * DV Message, contains a message that was received via DV for this
91  * peer.  Send from the DV service to the DV plugin.
92  *
93  * Sender address is copied to the end of this struct,
94  * followed by the actual message received.
95  */
96 struct GNUNET_DV_ReceivedMessage
97 {
98   /**
99    * Type: #GNUNET_MESSAGE_TYPE_DV_RECV
100    */
101   struct GNUNET_MessageHeader header;
102
103   /**
104    * The distance to the peer that we received the message from
105    */
106   uint32_t distance GNUNET_PACKED;
107
108   /**
109    * The (actual) sender of the message
110    */
111   struct GNUNET_PeerIdentity sender;
112
113   /* payload follows */
114 };
115
116
117 /**
118  * Message from plugin to DV service, requesting a
119  * message to be routed.
120  */
121 struct GNUNET_DV_SendMessage
122 {
123   /**
124    * Type: #GNUNET_MESSAGE_TYPE_DV_SEND
125    */
126   struct GNUNET_MessageHeader header;
127
128   /**
129    * Unique ID for this message, for confirm callback, must never be zero.
130    */
131   uint32_t uid GNUNET_PACKED;
132
133   /**
134    * The (actual) target of the message
135    */
136   struct GNUNET_PeerIdentity target;
137
138 };
139
140
141 /**
142  * Message from service to DV plugin, saying that a
143  * SEND request was handled.
144  */
145 struct GNUNET_DV_AckMessage
146 {
147   /**
148    * Type: #GNUNET_MESSAGE_TYPE_DV_SEND_ACK or
149    * #GNUNET_MESSAGE_TYPE_DV_SEND_NACK.
150    */
151   struct GNUNET_MessageHeader header;
152
153   /**
154    * Which message is being acknowledged?
155    */
156   uint32_t uid GNUNET_PACKED;
157
158   /**
159    * The (actual) target of the message
160    */
161   struct GNUNET_PeerIdentity target;
162
163 };
164
165
166 /**
167  * Message from service to DV plugin, saying that our
168  * distance to another peer changed.
169  */
170 struct GNUNET_DV_DistanceUpdateMessage
171 {
172   /**
173    * Type: #GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED.
174    */
175   struct GNUNET_MessageHeader header;
176
177   /**
178    * What is the new distance?
179    */
180   uint32_t distance GNUNET_PACKED;
181
182   /**
183    * The peer for which the distance changed.
184    */
185   struct GNUNET_PeerIdentity peer;
186
187   /**
188    * The network the peer is in
189    */
190   uint32_t network GNUNET_PACKED;
191
192 };
193
194
195 GNUNET_NETWORK_STRUCT_END
196
197 #endif