aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-03-29 09:36:22 +0000
committerBart Polot <bart@net.in.tum.de>2011-03-29 09:36:22 +0000
commit6d324c54d68defac2c1727ab40e4d0258361b50b (patch)
treec99e743ee16de16b3433764ba249db439049431f /src/mesh/gnunet-service-mesh.c
parent76b1f350c95e6f4e28a0bc9d915f20e354fff1ab (diff)
downloadgnunet-6d324c54d68defac2c1727ab40e4d0258361b50b.tar.gz
gnunet-6d324c54d68defac2c1727ab40e4d0258361b50b.zip
Changed message declaration location, added api messages
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c187
1 files changed, 184 insertions, 3 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index e63b1ba40..1598603a6 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -22,6 +22,13 @@
22 * @file mesh/gnunet-service-mesh.c 22 * @file mesh/gnunet-service-mesh.c
23 * @brief GNUnet MESH service 23 * @brief GNUnet MESH service
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 *
26 * TODO:
27 * - soft stateing (keep-alive (CHANGE?) / timeout / disconnect) -- not a message issue
28 * - error reporting (CREATE/CHANGE/ADD/DEL?) -- new message!
29 * - partial disconnect reporting -- same as error reporting?
30 * - add vs create? change vs. keep-alive? same msg or different ones? -- thinking...
31 * - speed requirement specification (change?) in mesh API -- API call
25 */ 32 */
26 33
27#include <stdint.h> 34#include <stdint.h>
@@ -30,6 +37,174 @@
30#include "gnunet_core_service.h" 37#include "gnunet_core_service.h"
31#include <netinet/in.h> 38#include <netinet/in.h>
32 39
40
41/******************************************************************************/
42/******************** MESH NETWORK MESSAGES **************************/
43/******************************************************************************/
44
45/**
46 * Message for mesh path management
47 */
48struct GNUNET_MESH_ManipulatePath
49{
50 /**
51 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DEL]
52 *
53 * Size: sizeof(struct GNUNET_MESH_ManipulatePath) + path_length * sizeof (struct GNUNET_PeerIdentity)
54 */
55 struct GNUNET_MessageHeader header;
56
57 /**
58 * Id of the tunnel this path belongs to, unique in conjunction with the origin.
59 */
60 uint32_t tid GNUNET_PACKED;
61
62 /**
63 * Information about speed requirements. If the tunnel cannot sustain the
64 * minimum bandwidth, packets are to be dropped.
65 */
66 uint32_t speed_min GNUNET_PACKED;
67
68 /**
69 * path_length structs defining the *whole* path from the origin [0] to the
70 * final destination [path_length-1].
71 */
72 // struct GNUNET_PeerIdentity peers[path_length];
73};
74
75/**
76 * Message for mesh data traffic to all tunnel targets.
77 */
78struct GNUNET_MESH_OriginMulticast
79{
80 /**
81 * Type: GNUNET_MESSAGE_TYPE_DATA_MULTICAST
82 */
83 struct GNUNET_MessageHeader header;
84
85 /**
86 * TID of the tunnel
87 */
88 uint32_t tid GNUNET_PACKED;
89
90 /**
91 * OID of the tunnel
92 */
93 struct GNUNET_PeerIdentity oid;
94
95 /**
96 * FIXME: Some form of authentication
97 */
98 // uint32_t token;
99
100 /**
101 * Payload follows
102 */
103};
104
105
106/**
107 * Message for mesh data traffic to a particular destination from origin.
108 */
109struct GNUNET_MESH_DataMessageFromOrigin
110{
111 /**
112 * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN
113 */
114 struct GNUNET_MessageHeader header;
115
116 /**
117 * TID of the tunnel
118 */
119 uint32_t tid GNUNET_PACKED;
120
121 /**
122 * OID of the tunnel
123 */
124 struct GNUNET_PeerIdentity oid;
125
126 /**
127 * Destination.
128 */
129 struct GNUNET_PeerIdentity destination;
130
131 /**
132 * FIXME: Some form of authentication
133 */
134 // uint32_t token;
135
136 /**
137 * Payload follows
138 */
139};
140
141
142/**
143 * Message for mesh data traffic from a tunnel participant to origin.
144 */
145struct GNUNET_MESH_DataMessageToOrigin
146{
147 /**
148 * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_TO_ORIGIN
149 */
150 struct GNUNET_MessageHeader header;
151
152 /**
153 * TID of the tunnel
154 */
155 uint32_t tid GNUNET_PACKED;
156
157 /**
158 * OID of the tunnel
159 */
160 struct GNUNET_PeerIdentity oid;
161
162 /**
163 * Sender of the message.
164 */
165 struct GNUNET_PeerIdentity sender;
166
167 /**
168 * FIXME: Some form of authentication
169 */
170 // uint32_t token;
171
172 /**
173 * Payload follows
174 */
175};
176
177/**
178 * Message for mesh flow control
179 */
180struct GNUNET_MESH_SpeedNotify
181{
182 /**
183 * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
184 */
185 struct GNUNET_MessageHeader header;
186
187 /**
188 * TID of the tunnel
189 */
190 uint32_t tid GNUNET_PACKED;
191
192 /**
193 * OID of the tunnel
194 */
195 struct GNUNET_PeerIdentity oid;
196
197 /**
198 * Slowest link down the path (above minimum speed requirement).
199 */
200 uint32_t speed_min;
201
202};
203
204/******************************************************************************/
205/************************ DATA STRUCTURES ****************************/
206/******************************************************************************/
207
33/** 208/**
34 * All the states a peer participating in a tunnel can be in. 209 * All the states a peer participating in a tunnel can be in.
35 */ 210 */
@@ -183,6 +358,7 @@ struct Clients
183 358
184/** 359/**
185 * Handler for requests of creating new path 360 * Handler for requests of creating new path
361 * type: struct GNUNET_CORE_MessageHandler
186 * 362 *
187 * @param cls closure 363 * @param cls closure
188 * @param client the client this message is from 364 * @param client the client this message is from
@@ -212,6 +388,7 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
212 388
213/** 389/**
214 * Core handler for path creation 390 * Core handler for path creation
391 * struct GNUNET_CORE_MessageHandler
215 * 392 *
216 * @param cls closure 393 * @param cls closure
217 * @param message message 394 * @param message message
@@ -227,6 +404,10 @@ handle_mesh_path_create (void *cls,
227 *atsi) 404 *atsi)
228{ 405{
229 /* Extract path */ 406 /* Extract path */
407 /* Find origin & self */
408 /* Search for origin in local tunnels */
409 /* Create tunnel / add path */
410 /* Retransmit to next link in chain, if any (core_notify + callback) */
230 return GNUNET_OK; 411 return GNUNET_OK;
231} 412}
232 413
@@ -269,9 +450,9 @@ static struct GNUNET_CORE_MessageHandler core_handlers[] = {
269 * Functions to handle messages from clients 450 * Functions to handle messages from clients
270 */ 451 */
271static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = { 452static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = {
272 {&handle_local_path_create, NULL, GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE, 0}, 453 {&handle_local_path_create, NULL, GNUNET_MESSAGE_TYPE_LOCAL_PATH_CREATE, 0},
273 {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_GO, 0}, 454 {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_LOCAL_DATA_GO, 0},
274 {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_BACK, 0}, 455 {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_LOCAL_DATA_BACK, 0},
275 {NULL, NULL, 0, 0} 456 {NULL, NULL, 0, 0}
276}; 457};
277 458