e51b0c890e50a4b250a7c6b91e39fe020e643029
[oweals/gnunet.git] / src / mesh / mesh.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.h
24  *
25  * TODO:
26  * - soft stateing (keep-alive (CHANGE?) / timeout / disconnect) -- not a message issue
27  * - error reporting (CREATE/CHANGE/ADD/DEL?) -- new message!
28  * - partial disconnect reporting -- same as error reporting?
29  * - add vs create? change vs. keep-alive? same msg or different ones? -- thinking...
30  * - speed requirement specification (change?) in mesh API -- API call
31  *
32  * - API messages!
33  */
34
35
36 #ifndef MESH_H_
37 #define MESH_H_
38 #include <stdint.h>
39 #include "gnunet_common.h"
40
41 /**
42  * Message for mesh path management
43  */
44 struct GNUNET_MESH_ManipulatePath
45 {
46     /**
47      * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DEL]
48      *
49      * Size: sizeof(struct GNUNET_MESH_ManipulatePath) + path_length * sizeof (struct GNUNET_PeerIdentity)
50      */
51     struct GNUNET_MessageHeader header;
52
53     /**
54      * Id of the tunnel this path belongs to, unique in conjunction with the origin.
55      */
56     uint32_t tid GNUNET_PACKED;
57
58     /**
59      * Information about speed requirements.  If the tunnel cannot sustain the 
60      * minimum bandwidth, packets are to be dropped.
61      */
62     uint32_t speed_min GNUNET_PACKED;
63
64     /**
65      * path_length structs defining the *whole* path from the origin [0] to the
66      * final destination [path_length-1].
67      */
68   // struct GNUNET_PeerIdentity peers[path_length];
69 };
70
71 /**
72  * Message for mesh data traffic to all tunnel targets.
73  */
74 struct GNUNET_MESH_OriginMulticast
75 {
76     /**
77      * Type: GNUNET_MESSAGE_TYPE_DATA_MULTICAST
78      */
79     struct GNUNET_MessageHeader header;
80
81     /**
82      * TID of the tunnel
83      */
84     uint32_t tid GNUNET_PACKED;
85
86     /**
87      * OID of the tunnel
88      */
89     struct GNUNET_PeerIdentity oid;
90
91     /**
92      * FIXME: Some form of authentication
93      */
94     // uint32_t token;
95
96     /**
97      * Payload follows
98      */
99 };
100
101
102 /**
103  * Message for mesh data traffic to a particular destination from origin.
104  */
105 struct GNUNET_MESH_DataMessageFromOrigin
106 {
107     /**
108      * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN
109      */
110     struct GNUNET_MessageHeader header;
111
112     /**
113      * TID of the tunnel
114      */
115     uint32_t tid GNUNET_PACKED;
116
117     /**
118      * OID of the tunnel
119      */
120     struct GNUNET_PeerIdentity oid;
121
122     /**
123      * Destination.
124      */
125     struct GNUNET_PeerIdentity destination;
126
127     /**
128      * FIXME: Some form of authentication
129      */
130     // uint32_t token;
131
132     /**
133      * Payload follows
134      */
135 };
136
137
138 /**
139  * Message for mesh data traffic from a tunnel participant to origin.
140  */
141 struct GNUNET_MESH_DataMessageToOrigin
142 {
143     /**
144      * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_TO_ORIGIN
145      */
146     struct GNUNET_MessageHeader header;
147
148     /**
149      * TID of the tunnel
150      */
151     uint32_t tid GNUNET_PACKED;
152
153     /**
154      * OID of the tunnel
155      */
156     struct GNUNET_PeerIdentity oid;
157
158     /**
159      * Sender of the message.
160      */
161     struct GNUNET_PeerIdentity sender;
162
163     /**
164      * FIXME: Some form of authentication
165      */
166     // uint32_t token;
167
168     /**
169      * Payload follows
170      */
171 };
172
173 /**
174  * Message for mesh flow control
175  */
176 struct GNUNET_MESH_SpeedNotify
177 {
178     /**
179      * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
180      */
181     struct GNUNET_MessageHeader header;
182
183     /**
184      * TID of the tunnel
185      */
186     uint32_t tid GNUNET_PACKED;
187
188     /**
189      * OID of the tunnel
190      */
191     struct GNUNET_PeerIdentity oid;
192
193     /**
194      * Slowest link down the path (above minimum speed requirement).
195      */
196     uint32_t speed_min;
197
198 };
199
200 #endif