-hacking on dv
[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    * The distance to the peer that we used to have
73    */
74   uint32_t distance 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.
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
144    */ 
145   struct GNUNET_MessageHeader header;
146
147   /**
148    * Which message is being acknowledged?
149    */
150   uint32_t uid GNUNET_PACKED;
151
152   /**
153    * The (actual) target of the message
154    */
155   struct GNUNET_PeerIdentity target;
156
157 };
158 GNUNET_NETWORK_STRUCT_END
159
160 #endif