added ATS addresstype information to unix
[oweals/gnunet.git] / src / mesh / mesh_protocol.h
1 /*
2      This file is part of GNUnet.
3      (C) 2001 - 2011 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 Bartlomiej Polot
23  * @file mesh/mesh_protocol.h
24  */
25
26 #ifndef MESH_PROTOCOL_H_
27 #define MESH_PROTOCOL_H_
28
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #if 0
33   /* keep Emacsens' auto-indent happy */
34 }
35 #endif
36 #endif
37
38 /******************************************************************************/
39 /********************      MESH NETWORK MESSAGES     **************************/
40 /******************************************************************************/
41
42 /**
43  * Message for mesh path management
44  */
45 struct GNUNET_MESH_ManipulatePath
46 {
47     /**
48      * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DEL]
49      *
50      * Size: sizeof(struct GNUNET_MESH_ManipulatePath) +
51      *       path_length * sizeof (struct GNUNET_PeerIdentity)
52      */
53   struct GNUNET_MessageHeader header;
54
55     /**
56      * Global id of the tunnel this path belongs to,
57      * unique in conjunction with the origin.
58      */
59   uint32_t tid GNUNET_PACKED;
60
61     /**
62      * path_length structs defining the *whole* path from the origin [0] to the
63      * final destination [path_length-1].
64      */
65   /* struct GNUNET_PeerIdentity peers[path_length]; */
66 };
67
68 /**
69  * Message for mesh data traffic to all tunnel targets.
70  */
71 struct GNUNET_MESH_Multicast
72 {
73     /**
74      * Type: GNUNET_MESSAGE_TYPE_MESH_MULTICAST
75      */
76   struct GNUNET_MessageHeader header;
77
78     /**
79      * TID of the tunnel
80      */
81   uint32_t tid GNUNET_PACKED;
82
83     /**
84      * Number of hops to live
85      */
86   uint32_t ttl GNUNET_PACKED;
87
88     /**
89      * Unique ID of the packet
90      */
91   uint32_t mid GNUNET_PACKED;
92
93     /**
94      * OID of the tunnel
95      */
96   struct GNUNET_PeerIdentity oid;
97
98     /**
99      * Payload follows
100      */
101 };
102
103
104 /**
105  * Message for mesh data traffic to a particular destination from origin.
106  */
107 struct GNUNET_MESH_Unicast
108 {
109     /**
110      * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST
111      */
112   struct GNUNET_MessageHeader header;
113
114     /**
115      * TID of the tunnel
116      */
117   uint32_t tid GNUNET_PACKED;
118
119     /**
120      * OID of the tunnel
121      */
122   struct GNUNET_PeerIdentity oid;
123
124     /**
125      * Destination.
126      */
127   struct GNUNET_PeerIdentity destination;
128
129     /**
130      * Payload follows
131      */
132 };
133
134
135 /**
136  * Message for mesh data traffic from a tunnel participant to origin.
137  */
138 struct GNUNET_MESH_ToOrigin
139 {
140     /**
141      * Type: GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
142      */
143   struct GNUNET_MessageHeader header;
144
145     /**
146      * TID of the tunnel
147      */
148   uint32_t tid GNUNET_PACKED;
149
150     /**
151      * OID of the tunnel
152      */
153   struct GNUNET_PeerIdentity oid;
154
155     /**
156      * Sender of the message.
157      */
158   struct GNUNET_PeerIdentity sender;
159
160     /**
161      * Payload follows
162      */
163 };
164
165
166 /**
167  * Message for ack'ing a path
168  */
169 struct GNUNET_MESH_PathACK
170 {
171     /**
172      * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_ACK
173      */
174   struct GNUNET_MessageHeader header;
175
176     /**
177      * TID of the tunnel
178      */
179   uint32_t tid GNUNET_PACKED;
180
181     /**
182      * OID of the tunnel
183      */
184   struct GNUNET_PeerIdentity oid;
185
186     /**
187      * ID of the endpoint
188      */
189   struct GNUNET_PeerIdentity peer_id;
190
191   /* TODO: signature */
192 };
193
194
195 /**
196  * Message for notifying a disconnection in a path
197  */
198 struct GNUNET_MESH_PathBroken
199 {
200     /**
201      * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN
202      */
203   struct GNUNET_MessageHeader header;
204
205     /**
206      * TID of the tunnel
207      */
208   uint32_t tid GNUNET_PACKED;
209
210     /**
211      * OID of the tunnel
212      */
213   struct GNUNET_PeerIdentity oid;
214
215     /**
216      * ID of the endpoint
217      */
218   struct GNUNET_PeerIdentity peer1;
219
220     /**
221      * ID of the endpoint
222      */
223   struct GNUNET_PeerIdentity peer2;
224
225   /* TODO: signature */
226 };
227
228
229 /**
230  * Message to destroy a tunnel
231  */
232 struct GNUNET_MESH_TunnelDestroy
233 {
234     /**
235      * Type: GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY
236      */
237   struct GNUNET_MessageHeader header;
238
239     /**
240      * TID of the tunnel
241      */
242   uint32_t tid GNUNET_PACKED;
243
244     /**
245      * OID of the tunnel
246      */
247   struct GNUNET_PeerIdentity oid;
248
249   /* TODO: signature */
250 };
251
252
253 /**
254  * Message for mesh flow control
255  */
256 struct GNUNET_MESH_SpeedNotify
257 {
258     /**
259      * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
260      */
261   struct GNUNET_MessageHeader header;
262
263     /**
264      * TID of the tunnel
265      */
266   uint32_t tid GNUNET_PACKED;
267
268     /**
269      * OID of the tunnel
270      */
271   struct GNUNET_PeerIdentity oid;
272
273     /**
274      * Slowest link down the path (above minimum speed requirement).
275      */
276   uint32_t speed_min;
277
278 };
279
280 #if 0                           /* keep Emacsens' auto-indent happy */
281 {
282 #endif
283 #ifdef __cplusplus
284 }
285 #endif
286
287 /* ifndef MES_PROTOCOL_H */
288 #endif
289 /* end of mesh_protocol.h */