aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-05-05 11:49:31 +0000
committerBart Polot <bart@net.in.tum.de>2011-05-05 11:49:31 +0000
commitd44e24bc22b673d5caa13451e733be3d9a392226 (patch)
treef90cbeefc59c6fe1cbc3096eb61d82381289420b /src
parent7c683b2ac68ff0dbe186f82376a1e277254553f8 (diff)
downloadgnunet-d44e24bc22b673d5caa13451e733be3d9a392226.tar.gz
gnunet-d44e24bc22b673d5caa13451e733be3d9a392226.zip
Separated structs used in network protocol into new file, as recommended in HACKING file
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh.c156
-rw-r--r--src/mesh/mesh_protocol.h201
2 files changed, 202 insertions, 155 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 14b74905a..faed1ac01 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -24,7 +24,6 @@
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * STRUCTURE: 26 * STRUCTURE:
27 * - MESH NETWORK MESSAGES
28 * - DATA STRUCTURES 27 * - DATA STRUCTURES
29 * - GLOBAL VARIABLES 28 * - GLOBAL VARIABLES
30 * - MESH NETWORK HANDLES 29 * - MESH NETWORK HANDLES
@@ -47,162 +46,9 @@
47#include "gnunet_protocols.h" 46#include "gnunet_protocols.h"
48 47
49#include "mesh.h" 48#include "mesh.h"
49#include "mesh_protocol.h"
50#include "gnunet_dht_service.h" 50#include "gnunet_dht_service.h"
51 51
52/******************************************************************************/
53/******************** MESH NETWORK MESSAGES **************************/
54/******************************************************************************/
55
56/**
57 * Message for mesh path management
58 */
59struct GNUNET_MESH_ManipulatePath
60{
61 /**
62 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DEL]
63 *
64 * Size: sizeof(struct GNUNET_MESH_ManipulatePath) +
65 * path_length * sizeof (struct GNUNET_PeerIdentity)
66 */
67 struct GNUNET_MessageHeader header;
68
69 /**
70 * Global id of the tunnel this path belongs to,
71 * unique in conjunction with the origin.
72 */
73 uint32_t tid GNUNET_PACKED;
74
75 /**
76 * Information about speed requirements. If the tunnel cannot sustain the
77 * minimum bandwidth, packets are to be dropped.
78 */
79 uint32_t speed_min GNUNET_PACKED;
80
81 /**
82 * 64-bit alignment.
83 */
84 uint32_t reserved GNUNET_PACKED;
85
86 /**
87 * path_length structs defining the *whole* path from the origin [0] to the
88 * final destination [path_length-1].
89 */
90 /* struct GNUNET_PeerIdentity peers[path_length]; */
91};
92
93/**
94 * Message for mesh data traffic to all tunnel targets.
95 */
96struct GNUNET_MESH_OriginMulticast
97{
98 /**
99 * Type: GNUNET_MESSAGE_TYPE_DATA_MULTICAST
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 * Payload follows
115 */
116};
117
118
119/**
120 * Message for mesh data traffic to a particular destination from origin.
121 */
122struct GNUNET_MESH_DataMessageFromOrigin
123{
124 /**
125 * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN
126 */
127 struct GNUNET_MessageHeader header;
128
129 /**
130 * TID of the tunnel
131 */
132 uint32_t tid GNUNET_PACKED;
133
134 /**
135 * OID of the tunnel
136 */
137 struct GNUNET_PeerIdentity oid;
138
139 /**
140 * Destination.
141 */
142 struct GNUNET_PeerIdentity destination;
143
144 /**
145 * Payload follows
146 */
147};
148
149
150/**
151 * Message for mesh data traffic from a tunnel participant to origin.
152 */
153struct GNUNET_MESH_DataMessageToOrigin
154{
155 /**
156 * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_TO_ORIGIN
157 */
158 struct GNUNET_MessageHeader header;
159
160 /**
161 * TID of the tunnel
162 */
163 uint32_t tid GNUNET_PACKED;
164
165 /**
166 * OID of the tunnel
167 */
168 struct GNUNET_PeerIdentity oid;
169
170 /**
171 * Sender of the message.
172 */
173 struct GNUNET_PeerIdentity sender;
174
175 /**
176 * Payload follows
177 */
178};
179
180/**
181 * Message for mesh flow control
182 */
183struct GNUNET_MESH_SpeedNotify
184{
185 /**
186 * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
187 */
188 struct GNUNET_MessageHeader header;
189
190 /**
191 * TID of the tunnel
192 */
193 uint32_t tid GNUNET_PACKED;
194
195 /**
196 * OID of the tunnel
197 */
198 struct GNUNET_PeerIdentity oid;
199
200 /**
201 * Slowest link down the path (above minimum speed requirement).
202 */
203 uint32_t speed_min;
204
205};
206 52
207/******************************************************************************/ 53/******************************************************************************/
208/************************ DATA STRUCTURES ****************************/ 54/************************ DATA STRUCTURES ****************************/
diff --git a/src/mesh/mesh_protocol.h b/src/mesh/mesh_protocol.h
new file mode 100644
index 000000000..50bb50b02
--- /dev/null
+++ b/src/mesh/mesh_protocol.h
@@ -0,0 +1,201 @@
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
30extern "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 */
44struct 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 */
81struct 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 */
107struct 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 */
138struct 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 */
168struct 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 */