X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fexperimentation%2Fgnunet-daemon-experimentation_capabilities.c;h=7d74c2827432976748bdc35aeeb7de6be41e77be;hb=056f559d916d785164f40e63ca56c153ea0e9ebe;hp=c888db01946fabd26fac29187626967418793bdb;hpb=4456c3907fd3b463a204a986245680ce96425c10;p=oweals%2Fgnunet.git diff --git a/src/experimentation/gnunet-daemon-experimentation_capabilities.c b/src/experimentation/gnunet-daemon-experimentation_capabilities.c index c888db019..7d74c2827 100644 --- a/src/experimentation/gnunet-daemon-experimentation_capabilities.c +++ b/src/experimentation/gnunet-daemon-experimentation_capabilities.c @@ -25,16 +25,23 @@ * @author Matthias Wachs */ #include "platform.h" -#include "gnunet_getopt_lib.h" #include "gnunet_util_lib.h" #include "gnunet_core_service.h" #include "gnunet_statistics_service.h" #include "gnunet-daemon-experimentation.h" + +/** + * Capability value shared between components + */ uint32_t GSE_node_capabilities; -#define GNUNET_EXPERIMENTATION_capabilities_count 11; +/** + * Capabilities defined at the moment + */ +#define GNUNET_EXPERIMENTATION_capabilities_count 11 + /** * Capabilities a node has or an experiment requires string @@ -49,7 +56,7 @@ uint32_t GSE_node_capabilities; * @return the string to print */ const char * -GNUNET_EXPERIMENTATION_capability_to_str (uint32_t cap) +GED_capability_to_str (uint32_t cap) { char * capstr[] = GNUNET_EXPERIMENTATION_capabilities_string; unsigned index = 0; @@ -64,7 +71,7 @@ GNUNET_EXPERIMENTATION_capability_to_str (uint32_t cap) if (test != cap) return "UNDEFINED"; - if (index <= 11) + if (index < GNUNET_EXPERIMENTATION_capabilities_count) return capstr[index]; else return "UNDEFINED"; @@ -81,7 +88,7 @@ GNUNET_EXPERIMENTATION_capability_to_str (uint32_t cap) * @return GNUNET_YES or GNUNET_NO */ int -GNUNET_EXPERIMENTATION_capabilities_have (uint32_t have, uint32_t desired) +GED_capabilities_have (uint32_t have, uint32_t desired) { if (desired == (desired & have)) return GNUNET_YES; @@ -94,7 +101,7 @@ GNUNET_EXPERIMENTATION_capabilities_have (uint32_t have, uint32_t desired) * Start the detecting capabilities */ void -GNUNET_EXPERIMENTATION_capabilities_start () +GED_capabilities_start () { char *plugins; char *pos; @@ -104,7 +111,7 @@ GNUNET_EXPERIMENTATION_capabilities_start () /* Plugins configured */ - if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (GSE_cfg, + if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (GED_cfg, "TRANSPORT", "PLUGINS", &plugins)) { for (pos = strtok (plugins, " "); pos != NULL; pos = strtok (NULL, " ")) @@ -131,12 +138,12 @@ GNUNET_EXPERIMENTATION_capabilities_start () /* IPv6 enabled * FIXE: just having it not enabled is not really sufficient */ - if (GNUNET_NO == GNUNET_CONFIGURATION_get_value_yesno (GSE_cfg, + if (GNUNET_NO == GNUNET_CONFIGURATION_get_value_yesno (GED_cfg, "NAT", "DISABLEV6")) GSE_node_capabilities |= HAVE_IPV6; /* Behind NAT */ - if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (GSE_cfg, + if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (GED_cfg, "NAT", "BEHIND_NAT")) GSE_node_capabilities |= BEHIND_NAT; @@ -144,19 +151,20 @@ GNUNET_EXPERIMENTATION_capabilities_start () { index = 1; index = index << c1; - if (GNUNET_YES == GNUNET_EXPERIMENTATION_capabilities_have (GSE_node_capabilities, index)) + if (GNUNET_YES == GED_capabilities_have (GSE_node_capabilities, index)) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "We have `%s'\n", - GNUNET_EXPERIMENTATION_capability_to_str(index)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "We have `%s'\n", + GED_capability_to_str(index)); } } } + /** * Stop the detecting capabilities */ void -GNUNET_EXPERIMENTATION_capabilities_stop () +GED_capabilities_stop () { }