aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-05-13 19:17:54 +0000
committerBart Polot <bart@net.in.tum.de>2011-05-13 19:17:54 +0000
commit7da20a5380636b140c671f5a00aceabae0feccc1 (patch)
tree52a1e7960a81c8983560e6c46e6687051a42f9a8 /src/mesh
parent8a6d4585745ca9b7d4ea4638a5f0334edbd3a5e9 (diff)
downloadgnunet-7da20a5380636b140c671f5a00aceabae0feccc1.tar.gz
gnunet-7da20a5380636b140c671f5a00aceabae0feccc1.zip
WiP
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/mesh.h2
-rw-r--r--src/mesh/mesh_api_new.c22
2 files changed, 19 insertions, 5 deletions
diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h
index 88106ca9a..8f9f8a84a 100644
--- a/src/mesh/mesh.h
+++ b/src/mesh/mesh.h
@@ -57,7 +57,7 @@
57 * EVENT MESSAGE USED 57 * EVENT MESSAGE USED
58 * ----- ------------ 58 * ----- ------------
59 * notify_transmit_ready reply GNUNET_MESH_TransmitReady 59 * notify_transmit_ready reply GNUNET_MESH_TransmitReady
60 * notify_transmit_ready data GNUNET_MESH_Data or 60 * notify_transmit_ready data GNUNET_MESH_Data OR
61 * GNUNET_MESH_DataBroadcast 61 * GNUNET_MESH_DataBroadcast
62 * new incoming tunnel GNUNET_MESH_PeerControl 62 * new incoming tunnel GNUNET_MESH_PeerControl
63 * peer connects to a tunnel GNUNET_MESH_PeerControl 63 * peer connects to a tunnel GNUNET_MESH_PeerControl
diff --git a/src/mesh/mesh_api_new.c b/src/mesh/mesh_api_new.c
index 750e3cc48..c435f878a 100644
--- a/src/mesh/mesh_api_new.c
+++ b/src/mesh/mesh_api_new.c
@@ -269,20 +269,29 @@ msg_received (void *cls, const struct GNUNET_MessageHeader * msg)
269 } 269 }
270 270
271 switch (ntohs(msg->type)) { 271 switch (ntohs(msg->type)) {
272 /* Notify of a new incoming tunnel */
273 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE:
274 /* */
275 break;
276 /* Notify of a new peer in the tunnel */
272 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_CONNECTED: 277 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_CONNECTED:
273 break; 278 break;
279 /* Notify of a peer leaving the tunnel */
280 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DISCONNECTED:
281 break;
282 /* Notify of a new data packet in the tunnel */
274 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA: 283 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA:
275 payload = &msg[1]; 284 payload = &msg[1];
276 for (i = 0, type = ntohs(payload->type); i < h->n_handlers; i++) { 285 for (i = 0, type = ntohs(payload->type); i < h->n_handlers; i++) {
277 handler = &h->message_handlers[i]; 286 handler = &h->message_handlers[i];
278 if (handler->type == type) { 287 if (handler->type == type) {
279 if (GNUNET_OK == handler->callback (cls, 288 /* FIXME */
289 if (GNUNET_OK == handler->callback (h->cls,
280 NULL, 290 NULL,
281 NULL, 291 NULL,
282 NULL, 292 NULL,
283 NULL, 293 NULL,
284 NULL 294 NULL))
285 ))
286 { 295 {
287 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 296 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
288 "MESH: callback completed successfully\n"); 297 "MESH: callback completed successfully\n");
@@ -294,14 +303,19 @@ msg_received (void *cls, const struct GNUNET_MessageHeader * msg)
294 } 303 }
295 } 304 }
296 break; 305 break;
306 /* We shouldn't get any other packages, log and ignore */
297 default: 307 default:
298 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 308 GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
299 "MESH: unsolited message form service (type %d)\n", 309 "MESH: unsolicited message form service (type %d)\n",
300 ntohs(msg->type)); 310 ntohs(msg->type));
301 } 311 }
302 312
303 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 313 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
304 "received a message from mesh\n"); 314 "received a message from mesh\n");
315 GNUNET_CLIENT_receive (h->client,
316 &msg_received,
317 h,
318 GNUNET_TIME_UNIT_FOREVER_REL);
305 return; 319 return;
306} 320}
307 321