fix memory leak
[oweals/gnunet.git] / src / dv / dv.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2013 GNUnet e.V.
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    * Reserved for alignment. 0.
130    */
131   uint32_t reserved 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 our
143  * distance to another peer changed.
144  */
145 struct GNUNET_DV_DistanceUpdateMessage
146 {
147   /**
148    * Type: #GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED.
149    */
150   struct GNUNET_MessageHeader header;
151
152   /**
153    * What is the new distance?
154    */
155   uint32_t distance GNUNET_PACKED;
156
157   /**
158    * The peer for which the distance changed.
159    */
160   struct GNUNET_PeerIdentity peer;
161
162   /**
163    * The network the peer is in
164    */
165   uint32_t network GNUNET_PACKED;
166
167 };
168
169
170 GNUNET_NETWORK_STRUCT_END
171
172 #endif