WiP
[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      * Information about speed requirements.  If the tunnel cannot sustain the 
62      * minimum bandwidth, packets are to be dropped.
63      */
64     uint32_t                    speed_min GNUNET_PACKED;
65
66     /**
67      * 64-bit alignment.
68      */
69     uint32_t                    reserved GNUNET_PACKED;
70
71     /**
72      * path_length structs defining the *whole* path from the origin [0] to the
73      * final destination [path_length-1].
74      */
75     /* struct GNUNET_PeerIdentity peers[path_length]; */
76 };
77
78 /**
79  * Message for mesh data traffic to all tunnel targets.
80  */
81 struct GNUNET_MESH_OriginMulticast
82 {
83     /**
84      * Type: GNUNET_MESSAGE_TYPE_DATA_MULTICAST
85      */
86     struct GNUNET_MessageHeader header;
87
88     /**
89      * TID of the tunnel
90      */
91     uint32_t                    tid 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_DataMessageFromOrigin
108 {
109     /**
110      * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN
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_DataMessageToOrigin
139 {
140     /**
141      * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_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  * Message for mesh flow control
167  */
168 struct GNUNET_MESH_SpeedNotify
169 {
170     /**
171      * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
172      */
173     struct GNUNET_MessageHeader header;
174
175     /**
176      * TID of the tunnel
177      */
178     uint32_t                    tid GNUNET_PACKED;
179
180     /**
181      * OID of the tunnel
182      */
183     struct GNUNET_PeerIdentity  oid;
184
185     /**
186      * Slowest link down the path (above minimum speed requirement).
187      */
188     uint32_t                    speed_min;
189
190 };
191
192 #if 0                           /* keep Emacsens' auto-indent happy */
193 {
194 #endif
195 #ifdef __cplusplus
196 }
197 #endif
198
199 /* ifndef MES_PROTOCOL_H */
200 #endif
201 /* end of mesh_protocol.h */