diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-05-23 11:28:50 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-05-23 11:28:50 +0000 |
commit | 1b838a4dd4cf51f93a925f3a8ca78d271a6f1ebd (patch) | |
tree | 1f967f539fd2a16c45824f6acb9e4a5f16c00270 /src | |
parent | 5e23e614f5571f125493e5d7de9808fba42d1600 (diff) | |
download | gnunet-1b838a4dd4cf51f93a925f3a8ca78d271a6f1ebd.tar.gz gnunet-1b838a4dd4cf51f93a925f3a8ca78d271a6f1ebd.zip |
documentation
Diffstat (limited to 'src')
-rw-r--r-- | src/experimentation/gnunet-daemon-experimentation.c | 17 | ||||
-rw-r--r-- | src/experimentation/gnunet-daemon-experimentation.h | 37 | ||||
-rw-r--r-- | src/experimentation/gnunet-daemon-experimentation_nodes.c | 20 |
3 files changed, 47 insertions, 27 deletions
diff --git a/src/experimentation/gnunet-daemon-experimentation.c b/src/experimentation/gnunet-daemon-experimentation.c index 708a1f7ea..5bcfe4275 100644 --- a/src/experimentation/gnunet-daemon-experimentation.c +++ b/src/experimentation/gnunet-daemon-experimentation.c | |||
@@ -31,10 +31,7 @@ | |||
31 | #include "gnunet_statistics_service.h" | 31 | #include "gnunet_statistics_service.h" |
32 | #include "gnunet-daemon-experimentation.h" | 32 | #include "gnunet-daemon-experimentation.h" |
33 | 33 | ||
34 | #define EXP_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | 34 | static struct GNUNET_STATISTICS_Handle *GSE_stats; |
35 | |||
36 | |||
37 | static struct GNUNET_STATISTICS_Handle *stats; | ||
38 | 35 | ||
39 | /** | 36 | /** |
40 | * Task run during shutdown. | 37 | * Task run during shutdown. |
@@ -52,10 +49,12 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
52 | 49 | ||
53 | 50 | ||
54 | /** | 51 | /** |
55 | * The main function for the experimentation daemon. | 52 | * Function starting all submodules of the experimentation daemon. |
56 | * | 53 | * |
57 | * @param argc number of arguments from the command line | 54 | * @param cls always NULL |
58 | * @param argv command line arguments | 55 | * @param args temaining command line arguments |
56 | * @param cfgfile configuration file used | ||
57 | * @param cfg configuration handle | ||
59 | */ | 58 | */ |
60 | static void | 59 | static void |
61 | run (void *cls, char *const *args, const char *cfgfile, | 60 | run (void *cls, char *const *args, const char *cfgfile, |
@@ -63,8 +62,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
63 | { | 62 | { |
64 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Experimentation daemon starting ...\n")); | 63 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Experimentation daemon starting ...\n")); |
65 | 64 | ||
66 | stats = GNUNET_STATISTICS_create ("experimentation", cfg); | 65 | GSE_stats = GNUNET_STATISTICS_create ("experimentation", cfg); |
67 | if (NULL == stats) | 66 | if (NULL == GSE_stats) |
68 | { | 67 | { |
69 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to create statistics!\n")); | 68 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to create statistics!\n")); |
70 | return; | 69 | return; |
diff --git a/src/experimentation/gnunet-daemon-experimentation.h b/src/experimentation/gnunet-daemon-experimentation.h index dda9c1dd3..3a4c9e181 100644 --- a/src/experimentation/gnunet-daemon-experimentation.h +++ b/src/experimentation/gnunet-daemon-experimentation.h | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file experimentation/gnunet-daemon-experimentation.c | 22 | * @file experimentation/gnunet-daemon-experimentation.h |
23 | * @brief experimentation daemon | 23 | * @brief experimentation daemon |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @author Matthias Wachs | 25 | * @author Matthias Wachs |
@@ -30,25 +30,47 @@ | |||
30 | #include "gnunet_core_service.h" | 30 | #include "gnunet_core_service.h" |
31 | #include "gnunet_statistics_service.h" | 31 | #include "gnunet_statistics_service.h" |
32 | 32 | ||
33 | |||
34 | /** | ||
35 | * Timeout between request and expected response | ||
36 | */ | ||
33 | #define EXP_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | 37 | #define EXP_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) |
38 | |||
39 | |||
34 | /** | 40 | /** |
35 | * A experimentation node | 41 | * A experimentation node |
36 | */ | 42 | */ |
37 | struct Node | 43 | struct Node |
38 | { | 44 | { |
45 | /** | ||
46 | * Peer id | ||
47 | */ | ||
39 | struct GNUNET_PeerIdentity id; | 48 | struct GNUNET_PeerIdentity id; |
40 | 49 | ||
50 | /** | ||
51 | * Task for response timeout | ||
52 | */ | ||
41 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; | 53 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; |
42 | 54 | ||
55 | /** | ||
56 | * Core transmission handle | ||
57 | */ | ||
43 | struct GNUNET_CORE_TransmitHandle *cth; | 58 | struct GNUNET_CORE_TransmitHandle *cth; |
44 | }; | 59 | }; |
45 | 60 | ||
46 | 61 | /** | |
62 | * Experimentation request message | ||
63 | * Used to detect experimentation capability | ||
64 | */ | ||
47 | struct Experimentation_Request | 65 | struct Experimentation_Request |
48 | { | 66 | { |
49 | struct GNUNET_MessageHeader msg; | 67 | struct GNUNET_MessageHeader msg; |
50 | }; | 68 | }; |
51 | 69 | ||
70 | /** | ||
71 | * Experimentation response message | ||
72 | * Sent if peer is running the daemon | ||
73 | */ | ||
52 | struct Experimentation_Response | 74 | struct Experimentation_Response |
53 | { | 75 | { |
54 | struct GNUNET_MessageHeader msg; | 76 | struct GNUNET_MessageHeader msg; |
@@ -56,15 +78,18 @@ struct Experimentation_Response | |||
56 | 78 | ||
57 | 79 | ||
58 | /** | 80 | /** |
59 | * The main function for the experimentation daemon. | 81 | * Start the nodes management |
60 | * | 82 | * |
61 | * @param argc number of arguments from the command line | 83 | * @param cfg configuration handle |
62 | * @param argv command line arguments | ||
63 | */ | 84 | */ |
64 | void | 85 | void |
65 | GNUNET_EXPERIMENTATION_nodes_start (const struct GNUNET_CONFIGURATION_Handle *cfg); | 86 | GNUNET_EXPERIMENTATION_nodes_start (const struct GNUNET_CONFIGURATION_Handle *cfg); |
66 | 87 | ||
88 | |||
89 | /** | ||
90 | * Stop the nodes management | ||
91 | */ | ||
67 | void | 92 | void |
68 | GNUNET_EXPERIMENTATION_nodes_stop (); | 93 | GNUNET_EXPERIMENTATION_nodes_stop (); |
69 | 94 | ||
70 | /* end of gnunet-daemon-experimentation.c */ | 95 | /* end of gnunet-daemon-experimentation.h */ |
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c index f2779cbe3..0b9b8d447 100644 --- a/src/experimentation/gnunet-daemon-experimentation_nodes.c +++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c | |||
@@ -19,8 +19,8 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file experimentation/gnunet-daemon-experimentation.c | 22 | * @file experimentation/gnunet-daemon-experimentation_nodes.c |
23 | * @brief experimentation daemon | 23 | * @brief experimentation daemon: node management |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @author Matthias Wachs | 25 | * @author Matthias Wachs |
26 | */ | 26 | */ |
@@ -31,8 +31,6 @@ | |||
31 | #include "gnunet_statistics_service.h" | 31 | #include "gnunet_statistics_service.h" |
32 | #include "gnunet-daemon-experimentation.h" | 32 | #include "gnunet-daemon-experimentation.h" |
33 | 33 | ||
34 | #define EXP_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | ||
35 | |||
36 | static struct GNUNET_CORE_Handle *ch; | 34 | static struct GNUNET_CORE_Handle *ch; |
37 | 35 | ||
38 | static struct GNUNET_PeerIdentity me; | 36 | static struct GNUNET_PeerIdentity me; |
@@ -409,16 +407,13 @@ core_receive_handler (void *cls, | |||
409 | 407 | ||
410 | 408 | ||
411 | /** | 409 | /** |
412 | * The main function for the experimentation daemon. | 410 | * Start the nodes management |
413 | * | 411 | * |
414 | * @param argc number of arguments from the command line | 412 | * @param cfg configuration handle |
415 | * @param argv command line arguments | ||
416 | */ | 413 | */ |
417 | void | 414 | void |
418 | GNUNET_EXPERIMENTATION_nodes_start (const struct GNUNET_CONFIGURATION_Handle *cfg) | 415 | GNUNET_EXPERIMENTATION_nodes_start (const struct GNUNET_CONFIGURATION_Handle *cfg) |
419 | { | 416 | { |
420 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Experimentation daemon starting ...\n")); | ||
421 | |||
422 | stats = GNUNET_STATISTICS_create ("experimentation", cfg); | 417 | stats = GNUNET_STATISTICS_create ("experimentation", cfg); |
423 | if (NULL == stats) | 418 | if (NULL == stats) |
424 | { | 419 | { |
@@ -444,11 +439,12 @@ GNUNET_EXPERIMENTATION_nodes_start (const struct GNUNET_CONFIGURATION_Handle *cf | |||
444 | nodes_inactive = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 439 | nodes_inactive = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); |
445 | } | 440 | } |
446 | 441 | ||
447 | 442 | /** | |
443 | * Stop the nodes management | ||
444 | */ | ||
448 | void | 445 | void |
449 | GNUNET_EXPERIMENTATION_nodes_stop () | 446 | GNUNET_EXPERIMENTATION_nodes_stop () |
450 | { | 447 | { |
451 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Experimentation daemon shutting down ...\n")); | ||
452 | if (NULL != ch) | 448 | if (NULL != ch) |
453 | { | 449 | { |
454 | GNUNET_CORE_disconnect (ch); | 450 | GNUNET_CORE_disconnect (ch); |
@@ -492,4 +488,4 @@ GNUNET_EXPERIMENTATION_nodes_stop () | |||
492 | } | 488 | } |
493 | } | 489 | } |
494 | 490 | ||
495 | /* end of gnunet-daemon-experimentation.c */ | 491 | /* end of gnunet-daemon-experimentation_nodes.c */ |