-remove trailing whitespace
[oweals/gnunet.git] / src / dv / dv.h
1 /*
2      This file is part of GNUnet.
3      (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., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, 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_TRANSPORT_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
56
57 /**
58  * DV service tells plugin about a DV-connection being
59  * no longer available.
60  *
61  * Sender address is copied to the end of this struct,
62  * followed by the actual message received.
63  */
64 struct GNUNET_DV_DisconnectMessage
65 {
66   /**
67    * Type:  GNUNET_MESSAGE_TYPE_TRANSPORT_DV_DISCONNECT
68    */
69   struct GNUNET_MessageHeader header;
70
71   /**
72    * Always zero.
73    */
74   uint32_t reserved GNUNET_PACKED;
75
76   /**
77    * The peer that is no longer available.
78    */
79   struct GNUNET_PeerIdentity peer;
80
81 };
82
83
84 /**
85  * DV Message, contains a message that was received via DV for this
86  * peer.  Send from the DV service to the DV plugin.
87  *
88  * Sender address is copied to the end of this struct,
89  * followed by the actual message received.
90  */
91 struct GNUNET_DV_ReceivedMessage
92 {
93   /**
94    * Type:  GNUNET_MESSAGE_TYPE_TRANSPORT_DV_RECV
95    */
96   struct GNUNET_MessageHeader header;
97
98   /**
99    * The distance to the peer that we received the message from
100    */
101   uint32_t distance GNUNET_PACKED;
102
103   /**
104    * The (actual) sender of the message
105    */
106   struct GNUNET_PeerIdentity sender;
107
108   /* payload follows */
109 };
110
111
112 /**
113  * Message from plugin to DV service, requesting a
114  * message to be routed.
115  */
116 struct GNUNET_DV_SendMessage
117 {
118   /**
119    * Type: GNUNET_MESSAGE_TYPE_DV_SEND
120    */
121   struct GNUNET_MessageHeader header;
122
123   /**
124    * Unique ID for this message, for confirm callback, must never be zero.
125    */
126   uint32_t uid GNUNET_PACKED;
127
128   /**
129    * The (actual) target of the message
130    */
131   struct GNUNET_PeerIdentity target;
132
133 };
134
135
136 /**
137  * Message from service to DV plugin, saying that a
138  * SEND request was handled.
139  */
140 struct GNUNET_DV_AckMessage
141 {
142   /**
143    * Type: GNUNET_MESSAGE_TYPE_DV_SEND_ACK or
144    * GNUNET_MESSAGE_TYPE_DV_SEND_NACK.
145    */
146   struct GNUNET_MessageHeader header;
147
148   /**
149    * Which message is being acknowledged?
150    */
151   uint32_t uid GNUNET_PACKED;
152
153   /**
154    * The (actual) target of the message
155    */
156   struct GNUNET_PeerIdentity target;
157
158 };
159
160
161 /**
162  * Message from service to DV plugin, saying that our
163  * distance to another peer changed.
164  */
165 struct GNUNET_DV_DistanceUpdateMessage
166 {
167   /**
168    * Type: GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED.
169    */
170   struct GNUNET_MessageHeader header;
171
172   /**
173    * What is the new distance?
174    */
175   uint32_t distance GNUNET_PACKED;
176
177   /**
178    * The peer for which the distance changed.
179    */
180   struct GNUNET_PeerIdentity peer;
181
182 };
183
184
185 GNUNET_NETWORK_STRUCT_END
186
187 #endif