diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-04-05 18:08:47 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-04-05 18:08:47 +0000 |
commit | 8de8a462ddd6c327f7134763a8e89b523e8ffa6b (patch) | |
tree | 63273572a55ca6bf9062c1eb4c10099db92bb674 /src/mesh | |
parent | 5fdb7650cecf3cc5b4315c6f9312f9356a52fdee (diff) | |
download | gnunet-8de8a462ddd6c327f7134763a8e89b523e8ffa6b.tar.gz gnunet-8de8a462ddd6c327f7134763a8e89b523e8ffa6b.zip |
Make mesh service compile
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/Makefile.am | 10 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 128 | ||||
-rw-r--r-- | src/mesh/mesh.h | 2 |
3 files changed, 96 insertions, 44 deletions
diff --git a/src/mesh/Makefile.am b/src/mesh/Makefile.am index d731db8ad..81b127883 100644 --- a/src/mesh/Makefile.am +++ b/src/mesh/Makefile.am | |||
@@ -9,6 +9,8 @@ if USE_COVERAGE | |||
9 | XLIB = -lgcov | 9 | XLIB = -lgcov |
10 | endif | 10 | endif |
11 | 11 | ||
12 | bin_PROGRAMS = $(STUD_PROGS) \ | ||
13 | gnunet-service-mesh | ||
12 | 14 | ||
13 | lib_LTLIBRARIES = \ | 15 | lib_LTLIBRARIES = \ |
14 | libgnunetmesh.la | 16 | libgnunetmesh.la |
@@ -22,3 +24,11 @@ libgnunetmesh_la_LIBADD = \ | |||
22 | libgnunetmesh_la_LDFLAGS = \ | 24 | libgnunetmesh_la_LDFLAGS = \ |
23 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ | 25 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ |
24 | -version-info 0:0:0 | 26 | -version-info 0:0:0 |
27 | |||
28 | gnunet_service_mesh_SOURCES = \ | ||
29 | gnunet-service-mesh.c | ||
30 | |||
31 | gnunet_service_mesh_LDADD = \ | ||
32 | $(top_builddir)/src/core/libgnunetcore.la | ||
33 | # $(top_builddir)/src/transport/libgnunettransport.la \ | ||
34 | # $(top_builddir)/src/util/libgnunetutil.la | ||
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 20c2315be..fce2d1406 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -31,11 +31,12 @@ | |||
31 | * - speed requirement specification (change?) in mesh API -- API call | 31 | * - speed requirement specification (change?) in mesh API -- API call |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <stdint.h> | 34 | #include "platform.h" |
35 | #include "gnunet_common.h" | 35 | #include "gnunet_common.h" |
36 | #include "gnunet_util_lib.h" | 36 | #include "gnunet_util_lib.h" |
37 | #include "gnunet_core_service.h" | 37 | #include "gnunet_core_service.h" |
38 | #include <netinet/in.h> | 38 | #include "gnunet_protocols.h" |
39 | #include "mesh.h" | ||
39 | 40 | ||
40 | 41 | ||
41 | /******************************************************************************/ | 42 | /******************************************************************************/ |
@@ -244,7 +245,7 @@ struct PeerInfo | |||
244 | /** | 245 | /** |
245 | * Is the peer reachable? Is the peer even connected? | 246 | * Is the peer reachable? Is the peer even connected? |
246 | */ | 247 | */ |
247 | struct PeerState state; | 248 | enum PeerState state; |
248 | 249 | ||
249 | /** | 250 | /** |
250 | * Who to send the data to | 251 | * Who to send the data to |
@@ -275,7 +276,7 @@ struct Path | |||
275 | /** | 276 | /** |
276 | * List of all the peers that form the path from origin to target | 277 | * List of all the peers that form the path from origin to target |
277 | */ | 278 | */ |
278 | PeerInfo *peers; | 279 | struct PeerInfo *peers; |
279 | }; | 280 | }; |
280 | 281 | ||
281 | /** | 282 | /** |
@@ -356,35 +357,11 @@ struct Clients | |||
356 | int fixme; | 357 | int fixme; |
357 | }; | 358 | }; |
358 | 359 | ||
359 | /** | ||
360 | * Handler for requests of creating new path | ||
361 | * type: struct GNUNET_CORE_MessageHandler | ||
362 | * | ||
363 | * @param cls closure | ||
364 | * @param client the client this message is from | ||
365 | * @param message the message received | ||
366 | */ | ||
367 | static void | ||
368 | handle_mesh_path_create (void *cls, | ||
369 | struct GNUNET_SERVER_Client *client, | ||
370 | const struct GNUNET_MessageHeader *message) | ||
371 | { | ||
372 | return; | ||
373 | } | ||
374 | 360 | ||
375 | /** | 361 | |
376 | * Handler for client disconnection | 362 | /******************************************************************************/ |
377 | * | 363 | /******************** MESH NETWORK HANDLERS **************************/ |
378 | * @param cls closure | 364 | /******************************************************************************/ |
379 | * @param client identification of the client; NULL | ||
380 | * for the last call when the server is destroyed | ||
381 | */ | ||
382 | static void | ||
383 | handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | ||
384 | { | ||
385 | /* Remove client from list, delete all timers and queues associated */ | ||
386 | return; | ||
387 | } | ||
388 | 365 | ||
389 | /** | 366 | /** |
390 | * Core handler for path creation | 367 | * Core handler for path creation |
@@ -394,6 +371,8 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | |||
394 | * @param message message | 371 | * @param message message |
395 | * @param peer peer identity this notification is about | 372 | * @param peer peer identity this notification is about |
396 | * @param atsi performance data | 373 | * @param atsi performance data |
374 | * @return GNUNET_OK to keep the connection open, | ||
375 | * GNUNET_SYSERR to close it (signal serious error) | ||
397 | * | 376 | * |
398 | */ | 377 | */ |
399 | static int | 378 | static int |
@@ -418,7 +397,8 @@ handle_mesh_path_create (void *cls, | |||
418 | * @param message message | 397 | * @param message message |
419 | * @param peer peer identity this notification is about | 398 | * @param peer peer identity this notification is about |
420 | * @param atsi performance data | 399 | * @param atsi performance data |
421 | * | 400 | * @return GNUNET_OK to keep the connection open, |
401 | * GNUNET_SYSERR to close it (signal serious error) | ||
422 | */ | 402 | */ |
423 | static int | 403 | static int |
424 | handle_mesh_network_traffic (void *cls, | 404 | handle_mesh_network_traffic (void *cls, |
@@ -440,12 +420,77 @@ handle_mesh_network_traffic (void *cls, | |||
440 | * Functions to handle messages from core | 420 | * Functions to handle messages from core |
441 | */ | 421 | */ |
442 | static struct GNUNET_CORE_MessageHandler core_handlers[] = { | 422 | static struct GNUNET_CORE_MessageHandler core_handlers[] = { |
443 | {&handle_mesh_path_create, NULL, GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE, 0}, | 423 | {&handle_mesh_path_create, GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE, 0}, |
444 | {&handle_mesh_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_GO, 0}, | 424 | {&handle_mesh_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_GO, 0}, |
445 | {&handle_mesh_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_BACK, 0}, | 425 | {&handle_mesh_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_BACK, 0}, |
446 | {NULL, 0, 0} | 426 | {NULL, 0, 0} |
447 | }; | 427 | }; |
448 | 428 | ||
429 | |||
430 | |||
431 | /******************************************************************************/ | ||
432 | /********************* MESH LOCAL HANDLES **************************/ | ||
433 | /******************************************************************************/ | ||
434 | |||
435 | /** | ||
436 | * Handler for client disconnection | ||
437 | * | ||
438 | * @param cls closure | ||
439 | * @param client identification of the client; NULL | ||
440 | * for the last call when the server is destroyed | ||
441 | */ | ||
442 | static void | ||
443 | handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | ||
444 | { | ||
445 | /* Remove client from list, delete all timers and queues associated */ | ||
446 | return; | ||
447 | } | ||
448 | |||
449 | /** | ||
450 | * Handler for new clients | ||
451 | * | ||
452 | * @param cls closure | ||
453 | * @param client identification of the client | ||
454 | * @param message the actual message, which includes messages the client wants | ||
455 | */ | ||
456 | static void | ||
457 | handle_local_new_client (void *cls, | ||
458 | struct GNUNET_SERVER_Client *client, | ||
459 | const struct GNUNET_MessageHeader *message) | ||
460 | { | ||
461 | return; | ||
462 | } | ||
463 | |||
464 | /** | ||
465 | * Handler for connection requests | ||
466 | * | ||
467 | * @param cls closure | ||
468 | * @param client identification of the client | ||
469 | * @param message the actual message | ||
470 | */ | ||
471 | static void | ||
472 | handle_local_connect (void *cls, | ||
473 | struct GNUNET_SERVER_Client *client, | ||
474 | const struct GNUNET_MessageHeader *message) | ||
475 | { | ||
476 | return; | ||
477 | } | ||
478 | |||
479 | /** | ||
480 | * Handler for client traffic | ||
481 | * | ||
482 | * @param cls closure | ||
483 | * @param client identification of the client | ||
484 | * @param message the actual message | ||
485 | */ | ||
486 | static void | ||
487 | handle_local_network_traffic (void *cls, | ||
488 | struct GNUNET_SERVER_Client *client, | ||
489 | const struct GNUNET_MessageHeader *message) | ||
490 | { | ||
491 | return; | ||
492 | } | ||
493 | |||
449 | /** | 494 | /** |
450 | * Functions to handle messages from clients | 495 | * Functions to handle messages from clients |
451 | */ | 496 | */ |
@@ -464,16 +509,16 @@ static struct GNUNET_CORE_MessageHandler core_handlers[] = { | |||
464 | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST 283 | 509 | #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST 283 |
465 | */ | 510 | */ |
466 | static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = { | 511 | static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = { |
467 | {&handle_local_new_client, NULL, GNUNET_MESSAGE_TYPE_LOCAL_CONNECT, 0}, | 512 | {&handle_local_new_client, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0}, |
468 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ANY, 0}, | 513 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ANY, 0}, |
469 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ALL, 0}, | 514 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ALL, 0}, |
470 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ADD, 0}, | 515 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ADD, 0}, |
471 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_DEL, 0}, | 516 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_DEL, 0}, |
472 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE, sizeof(struct GNUNET_MESH_ConnectPeerByType)}, | 517 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE, sizeof(struct GNUNET_MESH_ConnectPeerByType)}, |
473 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL, sizeof(struct GNUNET_MESH_Control)}, | 518 | {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL, sizeof(struct GNUNET_MESH_Control)}, |
474 | {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_LOCAL_TRANSMIT_READY, sizeof(struct GNUNET_MESH_Control)}, | 519 | {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_TRANSMIT_READY, sizeof(struct GNUNET_MESH_Control)}, |
475 | {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_LOCAL_DATA, 0}, /* FIXME needed? */ | 520 | {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0}, /* FIXME needed? */ |
476 | {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_LOCAL_DATA_BROADCAST, 0}, /* FIXME needed? */ | 521 | {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST, 0}, /* FIXME needed? */ |
477 | {NULL, NULL, 0, 0} | 522 | {NULL, NULL, 0, 0} |
478 | }; | 523 | }; |
479 | 524 | ||
@@ -525,7 +570,7 @@ core_disconnect (void *cls, | |||
525 | } | 570 | } |
526 | 571 | ||
527 | /** | 572 | /** |
528 | * Process mesh requests. FIXME NON FUNCTIONAL, COPIED FROM DHT!! | 573 | * Process mesh requests. FIXME NON FUNCTIONAL, SKELETON |
529 | * | 574 | * |
530 | * @param cls closure | 575 | * @param cls closure |
531 | * @param server the initialized server | 576 | * @param server the initialized server |
@@ -536,10 +581,7 @@ run (void *cls, | |||
536 | struct GNUNET_SERVER_Handle *server, | 581 | struct GNUNET_SERVER_Handle *server, |
537 | const struct GNUNET_CONFIGURATION_Handle *c) | 582 | const struct GNUNET_CONFIGURATION_Handle *c) |
538 | { | 583 | { |
539 | struct GNUNET_TIME_Relative next_send_time; | 584 | struct GNUNET_CORE_Handle *core; |
540 | unsigned long long temp_config_num; | ||
541 | char *converge_modifier_buf; | ||
542 | GNUNET_CORE_Handle *core; | ||
543 | 585 | ||
544 | GNUNET_SERVER_add_handlers (server, plugin_handlers); | 586 | GNUNET_SERVER_add_handlers (server, plugin_handlers); |
545 | GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); | 587 | GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); |
diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h index 5d404c88d..2c260030d 100644 --- a/src/mesh/mesh.h +++ b/src/mesh/mesh.h | |||
@@ -112,7 +112,7 @@ struct GNUNET_MESH_Data { | |||
112 | 112 | ||
113 | uint32_t tunnel_id GNUNET_PACKED; | 113 | uint32_t tunnel_id GNUNET_PACKED; |
114 | 114 | ||
115 | struct GNUNET_PeerIdentity destination GNUNET_PACKED; | 115 | struct GNUNET_PeerIdentity destination; |
116 | 116 | ||
117 | /* uint8_t data[] */ | 117 | /* uint8_t data[] */ |
118 | }; | 118 | }; |