Changed PeerInfo / Path structure
[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_OriginMulticast
71 {
72     /**
73      * Type: GNUNET_MESSAGE_TYPE_DATA_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_DataMessageFromOrigin
97 {
98     /**
99      * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN
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_DataMessageToOrigin
128 {
129     /**
130      * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_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  * Message for mesh flow control
156  */
157 struct GNUNET_MESH_SpeedNotify
158 {
159     /**
160      * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
161      */
162     struct GNUNET_MessageHeader header;
163
164     /**
165      * TID of the tunnel
166      */
167     uint32_t                    tid GNUNET_PACKED;
168
169     /**
170      * OID of the tunnel
171      */
172     struct GNUNET_PeerIdentity  oid;
173
174     /**
175      * Slowest link down the path (above minimum speed requirement).
176      */
177     uint32_t                    speed_min;
178
179 };
180
181 #if 0                           /* keep Emacsens' auto-indent happy */
182 {
183 #endif
184 #ifdef __cplusplus
185 }
186 #endif
187
188 /* ifndef MES_PROTOCOL_H */
189 #endif
190 /* end of mesh_protocol.h */