indentation
[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                           /* keep Emacsens' auto-indent happy */
33 }
34 #endif
35 #endif
36
37 /******************************************************************************/
38 /********************      MESH NETWORK MESSAGES     **************************/
39 /******************************************************************************/
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) +
50      *       path_length * sizeof (struct GNUNET_PeerIdentity)
51      */
52   struct GNUNET_MessageHeader header;
53
54     /**
55      * Global id of the tunnel this path belongs to,
56      * unique in conjunction with the origin.
57      */
58   uint32_t tid GNUNET_PACKED;
59
60     /**
61      * path_length structs defining the *whole* path from the origin [0] to the
62      * final destination [path_length-1].
63      */
64   /* struct GNUNET_PeerIdentity peers[path_length]; */
65 };
66
67 /**
68  * Message for mesh data traffic to all tunnel targets.
69  */
70 struct GNUNET_MESH_Multicast
71 {
72     /**
73      * Type: GNUNET_MESSAGE_TYPE_MESH_MULTICAST
74      */
75   struct GNUNET_MessageHeader header;
76
77     /**
78      * TID of the tunnel
79      */
80   uint32_t tid GNUNET_PACKED;
81
82     /**
83      * OID of the tunnel
84      */
85   struct GNUNET_PeerIdentity oid;
86
87     /**
88      * Payload follows
89      */
90 };
91
92
93 /**
94  * Message for mesh data traffic to a particular destination from origin.
95  */
96 struct GNUNET_MESH_Unicast
97 {
98     /**
99      * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST
100      */
101   struct GNUNET_MessageHeader header;
102
103     /**
104      * TID of the tunnel
105      */
106   uint32_t tid GNUNET_PACKED;
107
108     /**
109      * OID of the tunnel
110      */
111   struct GNUNET_PeerIdentity oid;
112
113     /**
114      * Destination.
115      */
116   struct GNUNET_PeerIdentity destination;
117
118     /**
119      * Payload follows
120      */
121 };
122
123
124 /**
125  * Message for mesh data traffic from a tunnel participant to origin.
126  */
127 struct GNUNET_MESH_ToOrigin
128 {
129     /**
130      * Type: GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
131      */
132   struct GNUNET_MessageHeader header;
133
134     /**
135      * TID of the tunnel
136      */
137   uint32_t tid GNUNET_PACKED;
138
139     /**
140      * OID of the tunnel
141      */
142   struct GNUNET_PeerIdentity oid;
143
144     /**
145      * Sender of the message.
146      */
147   struct GNUNET_PeerIdentity sender;
148
149     /**
150      * Payload follows
151      */
152 };
153
154
155 /**
156  * Message for ack'ing a path
157  */
158 struct GNUNET_MESH_PathACK
159 {
160     /**
161      * Type: GNUNET_MESSAGE_TYPE_PATH_ACK
162      */
163   struct GNUNET_MessageHeader header;
164
165     /**
166      * TID of the tunnel
167      */
168   uint32_t tid GNUNET_PACKED;
169
170     /**
171      * OID of the tunnel
172      */
173   struct GNUNET_PeerIdentity oid;
174
175     /**
176      * ID of the endpoint
177      */
178   struct GNUNET_PeerIdentity peer_id;
179
180   /* TODO: signature */
181 };
182
183
184 /**
185  * Message for mesh flow control
186  */
187 struct GNUNET_MESH_SpeedNotify
188 {
189     /**
190      * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
191      */
192   struct GNUNET_MessageHeader header;
193
194     /**
195      * TID of the tunnel
196      */
197   uint32_t tid GNUNET_PACKED;
198
199     /**
200      * OID of the tunnel
201      */
202   struct GNUNET_PeerIdentity oid;
203
204     /**
205      * Slowest link down the path (above minimum speed requirement).
206      */
207   uint32_t speed_min;
208
209 };
210
211 #if 0                           /* keep Emacsens' auto-indent happy */
212 {
213 #endif
214 #ifdef __cplusplus
215 }
216 #endif
217
218 /* ifndef MES_PROTOCOL_H */
219 #endif
220 /* end of mesh_protocol.h */