diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-17 21:31:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-17 21:31:48 +0000 |
commit | c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e (patch) | |
tree | 4d9fbf87fa9d65b8b966b51739af96205943be8f /src | |
parent | f6323d915af7494ecfeba39407d1c30dc06dc238 (diff) | |
download | gnunet-c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e.tar.gz gnunet-c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e.zip |
use ATS functions to convert quality network type to string, instead of using string API
Diffstat (limited to 'src')
-rw-r--r-- | src/ats-tool/gnunet-ats.c | 14 | ||||
-rw-r--r-- | src/ats/ats_api_scheduling.c | 80 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 73 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 47 | ||||
-rw-r--r-- | src/ats/plugin_ats_proportional.c | 21 | ||||
-rw-r--r-- | src/ats/test_ats_api_common.c | 68 | ||||
-rw-r--r-- | src/include/gnunet_ats_service.h | 304 | ||||
-rw-r--r-- | src/transport/test_quota_compliance.c | 17 |
8 files changed, 254 insertions, 370 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 217c075b2..111b8b78b 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c | |||
@@ -327,7 +327,6 @@ transport_addr_to_str_cb (void *cls, | |||
327 | struct PendingResolutions *pr = cls; | 327 | struct PendingResolutions *pr = cls; |
328 | char *ats_str; | 328 | char *ats_str; |
329 | char *ats_tmp; | 329 | char *ats_tmp; |
330 | char *ats_prop_arr[GNUNET_ATS_PropertyCount] = GNUNET_ATS_PropertyStrings; | ||
331 | char *ats_prop_value; | 330 | char *ats_prop_value; |
332 | unsigned int c; | 331 | unsigned int c; |
333 | uint32_t ats_type; | 332 | uint32_t ats_type; |
@@ -416,7 +415,7 @@ transport_addr_to_str_cb (void *cls, | |||
416 | GNUNET_asprintf (&ats_str, | 415 | GNUNET_asprintf (&ats_str, |
417 | "%s%s=%s, ", | 416 | "%s%s=%s, ", |
418 | ats_tmp, | 417 | ats_tmp, |
419 | ats_prop_arr[ats_type], | 418 | GNUNET_ATS_print_property_type (ats_type), |
420 | ats_prop_value); | 419 | ats_prop_value); |
421 | GNUNET_free(ats_tmp); | 420 | GNUNET_free(ats_tmp); |
422 | } | 421 | } |
@@ -675,7 +674,6 @@ ats_perf_cb (void *cls, | |||
675 | static unsigned int | 674 | static unsigned int |
676 | print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg) | 675 | print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg) |
677 | { | 676 | { |
678 | char *network_str[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; | ||
679 | char * entry_in = NULL; | 677 | char * entry_in = NULL; |
680 | char * entry_out = NULL; | 678 | char * entry_out = NULL; |
681 | char * quota_out_str; | 679 | char * quota_out_str; |
@@ -689,10 +687,10 @@ print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
689 | 687 | ||
690 | GNUNET_asprintf (&entry_out, | 688 | GNUNET_asprintf (&entry_out, |
691 | "%s_QUOTA_OUT", | 689 | "%s_QUOTA_OUT", |
692 | network_str[c]); | 690 | GNUNET_ATS_print_network_type (c)); |
693 | GNUNET_asprintf (&entry_in, | 691 | GNUNET_asprintf (&entry_in, |
694 | "%s_QUOTA_IN", | 692 | "%s_QUOTA_IN", |
695 | network_str[c]); | 693 | GNUNET_ATS_print_network_type (c)); |
696 | 694 | ||
697 | /* quota out */ | 695 | /* quota out */ |
698 | if (GNUNET_OK == | 696 | if (GNUNET_OK == |
@@ -714,7 +712,7 @@ print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
714 | { | 712 | { |
715 | FPRINTF (stderr, | 713 | FPRINTF (stderr, |
716 | "Outbound quota for network `%11s' not configured!\n", | 714 | "Outbound quota for network `%11s' not configured!\n", |
717 | network_str[c]); | 715 | GNUNET_ATS_print_network_type (c)); |
718 | GNUNET_asprintf ("a_out_str, "-"); | 716 | GNUNET_asprintf ("a_out_str, "-"); |
719 | } | 717 | } |
720 | GNUNET_free(entry_out); | 718 | GNUNET_free(entry_out); |
@@ -737,14 +735,14 @@ print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
737 | { | 735 | { |
738 | FPRINTF (stderr, | 736 | FPRINTF (stderr, |
739 | "Inbound quota for network `%11s' not configured!\n", | 737 | "Inbound quota for network `%11s' not configured!\n", |
740 | network_str[c]); | 738 | GNUNET_ATS_print_network_type (c)); |
741 | GNUNET_asprintf ("a_in_str, "-"); | 739 | GNUNET_asprintf ("a_in_str, "-"); |
742 | } | 740 | } |
743 | GNUNET_free(entry_in); | 741 | GNUNET_free(entry_in); |
744 | 742 | ||
745 | FPRINTF (stderr, | 743 | FPRINTF (stderr, |
746 | _("Quota for network `%11s' (in/out): %10s / %10s\n"), | 744 | _("Quota for network `%11s' (in/out): %10s / %10s\n"), |
747 | network_str[c], | 745 | GNUNET_ATS_print_network_type (c), |
748 | quota_in_str, | 746 | quota_in_str, |
749 | quota_out_str); | 747 | quota_out_str); |
750 | GNUNET_free(quota_out_str); | 748 | GNUNET_free(quota_out_str); |
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index 6bb595391..4cf48d761 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c | |||
@@ -77,7 +77,7 @@ struct SessionRecord | |||
77 | struct Session *session; | 77 | struct Session *session; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Set to GNUNET_YES if the slot is used. | 80 | * Set to #GNUNET_YES if the slot is used. |
81 | */ | 81 | */ |
82 | int slot_used; | 82 | int slot_used; |
83 | }; | 83 | }; |
@@ -122,7 +122,7 @@ struct GNUNET_ATS_SchedulingHandle | |||
122 | GNUNET_ATS_AddressSuggestionCallback suggest_cb; | 122 | GNUNET_ATS_AddressSuggestionCallback suggest_cb; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Closure for 'suggest_cb'. | 125 | * Closure for @e suggest_cb. |
126 | */ | 126 | */ |
127 | void *suggest_cb_cls; | 127 | void *suggest_cb_cls; |
128 | 128 | ||
@@ -833,34 +833,72 @@ get_addresses (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
833 | sh); | 833 | sh); |
834 | } | 834 | } |
835 | 835 | ||
836 | |||
836 | /** | 837 | /** |
837 | * Convert a GNUNET_ATS_NetworkType to a string | 838 | * Convert a `enum GNUNET_ATS_Network_Type` to a string |
838 | * | 839 | * |
839 | * @param net the network type | 840 | * @param net the network type |
840 | * @return a string or NULL if invalid | 841 | * @return a string or NULL if invalid |
841 | */ | 842 | */ |
842 | const char * | 843 | const char * |
843 | GNUNET_ATS_print_network_type (uint32_t net) | 844 | GNUNET_ATS_print_network_type (enum GNUNET_ATS_Network_Type net) |
844 | { | 845 | { |
845 | char *networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; | 846 | switch (net) |
846 | if (net < GNUNET_ATS_NetworkTypeCount) | 847 | { |
847 | return networks[net]; | 848 | case GNUNET_ATS_NET_UNSPECIFIED: |
848 | return NULL; | 849 | return "UNSPECIFIED"; |
850 | case GNUNET_ATS_NET_LOOPBACK: | ||
851 | return "LOOPBACK"; | ||
852 | case GNUNET_ATS_NET_LAN: | ||
853 | return "LAN"; | ||
854 | case GNUNET_ATS_NET_WAN: | ||
855 | return "WAN"; | ||
856 | case GNUNET_ATS_NET_WLAN: | ||
857 | return "WLAN"; | ||
858 | case GNUNET_ATS_NET_BT: | ||
859 | return "BLUETOOTH"; | ||
860 | default: | ||
861 | return NULL; | ||
862 | } | ||
849 | } | 863 | } |
850 | 864 | ||
865 | |||
851 | /** | 866 | /** |
852 | * Convert a ATS property to a string | 867 | * Convert a ATS property to a string |
853 | * | 868 | * |
854 | * @param type the atsi type | 869 | * @param type the property type |
855 | * @return a string or NULL if invalid | 870 | * @return a string or NULL if invalid |
856 | */ | 871 | */ |
857 | const char * | 872 | const char * |
858 | GNUNET_ATS_print_property_type (uint32_t type) | 873 | GNUNET_ATS_print_property_type (enum GNUNET_ATS_Property type) |
859 | { | 874 | { |
860 | char *props[GNUNET_ATS_PropertyCount] = GNUNET_ATS_PropertyStrings; | 875 | switch (type) |
861 | if ((type > 0) && (type < GNUNET_ATS_PropertyCount)) | 876 | { |
862 | return props[type]; | 877 | case GNUNET_ATS_ARRAY_TERMINATOR: |
863 | return NULL; | 878 | return "TERMINATOR"; |
879 | case GNUNET_ATS_UTILIZATION_OUT: | ||
880 | return "UTILIZATION_UP"; | ||
881 | case GNUNET_ATS_UTILIZATION_IN: | ||
882 | return "UTILIZATION_DOWN"; | ||
883 | case GNUNET_ATS_UTILIZATION_PAYLOAD_OUT: | ||
884 | return "UTILIZATION_PAYLOAD_UP"; | ||
885 | case GNUNET_ATS_UTILIZATION_PAYLOAD_IN: | ||
886 | return "UTILIZATION_PAYLOAD_DOWN"; | ||
887 | case GNUNET_ATS_NETWORK_TYPE: | ||
888 | return "NETWORK_TYPE"; | ||
889 | case GNUNET_ATS_QUALITY_NET_DELAY: | ||
890 | return "DELAY"; | ||
891 | case GNUNET_ATS_QUALITY_NET_DISTANCE: | ||
892 | return "DISTANCE"; | ||
893 | case GNUNET_ATS_COST_WAN: | ||
894 | return "COST_WAN"; | ||
895 | case GNUNET_ATS_COST_LAN: | ||
896 | return "COST_LAN"; | ||
897 | case GNUNET_ATS_COST_WLAN: | ||
898 | return "COST_WLAN"; | ||
899 | default: | ||
900 | return NULL; | ||
901 | } | ||
864 | } | 902 | } |
865 | 903 | ||
866 | 904 | ||
@@ -1057,17 +1095,17 @@ GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh, | |||
1057 | do_transmit (sh); | 1095 | do_transmit (sh); |
1058 | } | 1096 | } |
1059 | 1097 | ||
1098 | |||
1060 | /** | 1099 | /** |
1061 | * We would like to receive address suggestions for a peer. ATS will | 1100 | * We would like to receive address suggestions for a peer. ATS will |
1062 | * respond with a call to the continuation immediately containing an address or | 1101 | * respond with a call to the continuation immediately containing an address or |
1063 | * no address if none is available. ATS can suggest more addresses until we call | 1102 | * no address if none is available. ATS can suggest more addresses until we call |
1064 | * #GNUNET_ATS_suggest_address_cancel. | 1103 | * #GNUNET_ATS_suggest_address_cancel(). |
1065 | * | ||
1066 | * | 1104 | * |
1067 | * @param sh handle | 1105 | * @param sh handle |
1068 | * @param peer identity of the peer we need an address for | 1106 | * @param peer identity of the peer we need an address for |
1069 | * @param cont the continuation to call with the address | 1107 | * @param cont the continuation to call with the address |
1070 | * @param cont_cls the cls for the continuation | 1108 | * @param cont_cls the cls for the @a cont |
1071 | * @return suggest handle | 1109 | * @return suggest handle |
1072 | */ | 1110 | */ |
1073 | struct GNUNET_ATS_SuggestHandle * | 1111 | struct GNUNET_ATS_SuggestHandle * |
@@ -1269,9 +1307,9 @@ GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, | |||
1269 | * @param address the address | 1307 | * @param address the address |
1270 | * @param session session handle, can be NULL | 1308 | * @param session session handle, can be NULL |
1271 | * @param ats performance data for the address | 1309 | * @param ats performance data for the address |
1272 | * @param ats_count number of performance records in 'ats' | 1310 | * @param ats_count number of performance records in @a ats |
1273 | * @return GNUNET_YES on success, GNUNET_NO if address or session are unknown, | 1311 | * @return #GNUNET_YES on success, #GNUNET_NO if address or session are unknown, |
1274 | * GNUNET_SYSERR on hard failure | 1312 | * #GNUNET_SYSERR on hard failure |
1275 | */ | 1313 | */ |
1276 | int | 1314 | int |
1277 | GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh, | 1315 | GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh, |
@@ -1357,7 +1395,7 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh, | |||
1357 | * @param sh handle | 1395 | * @param sh handle |
1358 | * @param address the address | 1396 | * @param address the address |
1359 | * @param session session handle, can be NULL | 1397 | * @param session session handle, can be NULL |
1360 | * @param in_use GNUNET_YES if this address is now used, GNUNET_NO | 1398 | * @param in_use #GNUNET_YES if this address is now used, #GNUNET_NO |
1361 | * if address is not used any more | 1399 | * if address is not used any more |
1362 | */ | 1400 | */ |
1363 | void | 1401 | void |
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 0fa83d741..58fe03e25 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -1706,17 +1706,19 @@ load_op_stop_set_preference (struct GNUNET_ATS_TEST_Operation *o, | |||
1706 | return GNUNET_OK; | 1706 | return GNUNET_OK; |
1707 | } | 1707 | } |
1708 | 1708 | ||
1709 | |||
1709 | static enum GNUNET_ATS_Property | 1710 | static enum GNUNET_ATS_Property |
1710 | parse_property_string (const char * str) | 1711 | parse_property_string (const char *str) |
1711 | { | 1712 | { |
1712 | int c = 0; | 1713 | enum GNUNET_ATS_Property c; |
1713 | char *props[GNUNET_ATS_PropertyCount] = GNUNET_ATS_PropertyStrings; | ||
1714 | 1714 | ||
1715 | for (c = 0; c < GNUNET_ATS_PropertyCount; c++) | 1715 | for (c = 0; c < GNUNET_ATS_PropertyCount; c++) |
1716 | if (0 == strcmp(str, props[c])) | 1716 | if (0 == strcmp(str, |
1717 | GNUNET_ATS_print_property_type (c))) | ||
1717 | return c; | 1718 | return c; |
1718 | return 0; | 1719 | return 0; |
1719 | }; | 1720 | } |
1721 | |||
1720 | 1722 | ||
1721 | static int | 1723 | static int |
1722 | load_op_start_set_property(struct GNUNET_ATS_TEST_Operation *o, | 1724 | load_op_start_set_property(struct GNUNET_ATS_TEST_Operation *o, |
@@ -2770,7 +2772,6 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2770 | unsigned long long *in_dest, | 2772 | unsigned long long *in_dest, |
2771 | int dest_length) | 2773 | int dest_length) |
2772 | { | 2774 | { |
2773 | char *network_str[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; | ||
2774 | char * entry_in = NULL; | 2775 | char * entry_in = NULL; |
2775 | char * entry_out = NULL; | 2776 | char * entry_out = NULL; |
2776 | char * quota_out_str; | 2777 | char * quota_out_str; |
@@ -2782,8 +2783,12 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2782 | { | 2783 | { |
2783 | in_dest[c] = 0; | 2784 | in_dest[c] = 0; |
2784 | out_dest[c] = 0; | 2785 | out_dest[c] = 0; |
2785 | GNUNET_asprintf (&entry_out, "%s_QUOTA_OUT", network_str[c]); | 2786 | GNUNET_asprintf (&entry_out, |
2786 | GNUNET_asprintf (&entry_in, "%s_QUOTA_IN", network_str[c]); | 2787 | "%s_QUOTA_OUT", |
2788 | GNUNET_ATS_print_network_type (c)); | ||
2789 | GNUNET_asprintf (&entry_in, | ||
2790 | "%s_QUOTA_IN", | ||
2791 | GNUNET_ATS_print_network_type (c)); | ||
2787 | 2792 | ||
2788 | /* quota out */ | 2793 | /* quota out */ |
2789 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", entry_out, "a_out_str)) | 2794 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", entry_out, "a_out_str)) |
@@ -2801,21 +2806,28 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2801 | 2806 | ||
2802 | if (GNUNET_NO == res) | 2807 | if (GNUNET_NO == res) |
2803 | { | 2808 | { |
2804 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), | 2809 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2805 | network_str[c], quota_out_str, GNUNET_ATS_DefaultBandwidth); | 2810 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), |
2811 | GNUNET_ATS_print_network_type (c), | ||
2812 | quota_out_str, | ||
2813 | GNUNET_ATS_DefaultBandwidth); | ||
2806 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 2814 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
2807 | } | 2815 | } |
2808 | else | 2816 | else |
2809 | { | 2817 | { |
2810 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Outbound quota configure for network `%s' is %llu\n"), | 2818 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2811 | network_str[c], out_dest[c]); | 2819 | "Outbound quota configure for network `%s' is %llu\n", |
2820 | GNUNET_ATS_print_network_type (c), | ||
2821 | out_dest[c]); | ||
2812 | } | 2822 | } |
2813 | GNUNET_free (quota_out_str); | 2823 | GNUNET_free (quota_out_str); |
2814 | } | 2824 | } |
2815 | else | 2825 | else |
2816 | { | 2826 | { |
2817 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"), | 2827 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
2818 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 2828 | _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"), |
2829 | GNUNET_ATS_print_network_type (c), | ||
2830 | GNUNET_ATS_DefaultBandwidth); | ||
2819 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 2831 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
2820 | } | 2832 | } |
2821 | 2833 | ||
@@ -2835,30 +2847,42 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2835 | 2847 | ||
2836 | if (GNUNET_NO == res) | 2848 | if (GNUNET_NO == res) |
2837 | { | 2849 | { |
2838 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), | 2850 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2839 | network_str[c], quota_in_str, GNUNET_ATS_DefaultBandwidth); | 2851 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), |
2852 | GNUNET_ATS_print_network_type (c), | ||
2853 | quota_in_str, | ||
2854 | GNUNET_ATS_DefaultBandwidth); | ||
2840 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; | 2855 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; |
2841 | } | 2856 | } |
2842 | else | 2857 | else |
2843 | { | 2858 | { |
2844 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Inbound quota configured for network `%s' is %llu\n"), | 2859 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2845 | network_str[c], in_dest[c]); | 2860 | "Inbound quota configured for network `%s' is %llu\n", |
2861 | GNUNET_ATS_print_network_type (c), | ||
2862 | in_dest[c]); | ||
2846 | } | 2863 | } |
2847 | GNUNET_free (quota_in_str); | 2864 | GNUNET_free (quota_in_str); |
2848 | } | 2865 | } |
2849 | else | 2866 | else |
2850 | { | 2867 | { |
2851 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"), | 2868 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
2852 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 2869 | _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"), |
2870 | GNUNET_ATS_print_network_type (c), | ||
2871 | GNUNET_ATS_DefaultBandwidth); | ||
2853 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 2872 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
2854 | } | 2873 | } |
2855 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loaded quota for network `%s' (in/out): %llu %llu\n", network_str[c], in_dest[c], out_dest[c]); | 2874 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2875 | "Loaded quota for network `%s' (in/out): %llu %llu\n", | ||
2876 | GNUNET_ATS_print_network_type (c), | ||
2877 | in_dest[c], | ||
2878 | out_dest[c]); | ||
2856 | GNUNET_free (entry_out); | 2879 | GNUNET_free (entry_out); |
2857 | GNUNET_free (entry_in); | 2880 | GNUNET_free (entry_in); |
2858 | } | 2881 | } |
2859 | return GNUNET_ATS_NetworkTypeCount; | 2882 | return GNUNET_ATS_NetworkTypeCount; |
2860 | } | 2883 | } |
2861 | 2884 | ||
2885 | |||
2862 | /** | 2886 | /** |
2863 | * Information callback for the solver | 2887 | * Information callback for the solver |
2864 | * | 2888 | * |
@@ -2869,9 +2893,9 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2869 | */ | 2893 | */ |
2870 | static void | 2894 | static void |
2871 | solver_info_cb (void *cls, | 2895 | solver_info_cb (void *cls, |
2872 | enum GAS_Solver_Operation op, | 2896 | enum GAS_Solver_Operation op, |
2873 | enum GAS_Solver_Status stat, | 2897 | enum GAS_Solver_Status stat, |
2874 | enum GAS_Solver_Additional_Information add) | 2898 | enum GAS_Solver_Additional_Information add) |
2875 | { | 2899 | { |
2876 | char *add_info; | 2900 | char *add_info; |
2877 | switch (add) { | 2901 | switch (add) { |
@@ -3433,4 +3457,3 @@ main (int argc, char *argv[]) | |||
3433 | return res; | 3457 | return res; |
3434 | } | 3458 | } |
3435 | /* end of file ats-testing-experiment.c*/ | 3459 | /* end of file ats-testing-experiment.c*/ |
3436 | |||
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index f0af8f1a2..89158936d 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -1746,7 +1746,6 @@ static unsigned int | |||
1746 | load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1746 | load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1747 | unsigned long long *out_dest, unsigned long long *in_dest, int dest_length) | 1747 | unsigned long long *out_dest, unsigned long long *in_dest, int dest_length) |
1748 | { | 1748 | { |
1749 | char *network_str[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; | ||
1750 | char * entry_in = NULL; | 1749 | char * entry_in = NULL; |
1751 | char * entry_out = NULL; | 1750 | char * entry_out = NULL; |
1752 | char * quota_out_str; | 1751 | char * quota_out_str; |
@@ -1758,8 +1757,12 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1758 | { | 1757 | { |
1759 | in_dest[c] = 0; | 1758 | in_dest[c] = 0; |
1760 | out_dest[c] = 0; | 1759 | out_dest[c] = 0; |
1761 | GNUNET_asprintf (&entry_out, "%s_QUOTA_OUT", network_str[c]); | 1760 | GNUNET_asprintf (&entry_out, |
1762 | GNUNET_asprintf (&entry_in, "%s_QUOTA_IN", network_str[c]); | 1761 | "%s_QUOTA_OUT", |
1762 | GNUNET_ATS_print_network_type (c)); | ||
1763 | GNUNET_asprintf (&entry_in, | ||
1764 | "%s_QUOTA_IN", | ||
1765 | GNUNET_ATS_print_network_type (c)); | ||
1763 | 1766 | ||
1764 | /* quota out */ | 1767 | /* quota out */ |
1765 | if (GNUNET_OK | 1768 | if (GNUNET_OK |
@@ -1786,23 +1789,27 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1786 | if (GNUNET_NO == res) | 1789 | if (GNUNET_NO == res) |
1787 | { | 1790 | { |
1788 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1791 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1789 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), | 1792 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), |
1790 | network_str[c], quota_out_str, GNUNET_ATS_DefaultBandwidth); | 1793 | GNUNET_ATS_print_network_type (c), |
1794 | quota_out_str, | ||
1795 | GNUNET_ATS_DefaultBandwidth); | ||
1791 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 1796 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
1792 | } | 1797 | } |
1793 | else | 1798 | else |
1794 | { | 1799 | { |
1795 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 1800 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
1796 | _("Outbound quota configure for network `%s' is %llu\n"), | 1801 | _("Outbound quota configure for network `%s' is %llu\n"), |
1797 | network_str[c], out_dest[c]); | 1802 | GNUNET_ATS_print_network_type (c), |
1803 | out_dest[c]); | ||
1798 | } | 1804 | } |
1799 | GNUNET_free(quota_out_str); | 1805 | GNUNET_free(quota_out_str); |
1800 | } | 1806 | } |
1801 | else | 1807 | else |
1802 | { | 1808 | { |
1803 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1809 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1804 | _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"), | 1810 | _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"), |
1805 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 1811 | GNUNET_ATS_print_network_type (c), |
1812 | GNUNET_ATS_DefaultBandwidth); | ||
1806 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 1813 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
1807 | } | 1814 | } |
1808 | 1815 | ||
@@ -1830,28 +1837,34 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1830 | if (GNUNET_NO == res) | 1837 | if (GNUNET_NO == res) |
1831 | { | 1838 | { |
1832 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1839 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1833 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), | 1840 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), |
1834 | network_str[c], quota_in_str, GNUNET_ATS_DefaultBandwidth); | 1841 | GNUNET_ATS_print_network_type (c), |
1842 | quota_in_str, | ||
1843 | GNUNET_ATS_DefaultBandwidth); | ||
1835 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; | 1844 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; |
1836 | } | 1845 | } |
1837 | else | 1846 | else |
1838 | { | 1847 | { |
1839 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 1848 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
1840 | _("Inbound quota configured for network `%s' is %llu\n"), | 1849 | _("Inbound quota configured for network `%s' is %llu\n"), |
1841 | network_str[c], in_dest[c]); | 1850 | GNUNET_ATS_print_network_type (c), |
1851 | in_dest[c]); | ||
1842 | } | 1852 | } |
1843 | GNUNET_free(quota_in_str); | 1853 | GNUNET_free(quota_in_str); |
1844 | } | 1854 | } |
1845 | else | 1855 | else |
1846 | { | 1856 | { |
1847 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1857 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1848 | _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"), | 1858 | _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"), |
1849 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 1859 | GNUNET_ATS_print_network_type (c), |
1860 | GNUNET_ATS_DefaultBandwidth); | ||
1850 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; | 1861 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; |
1851 | } | 1862 | } |
1852 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1863 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1853 | "Loaded quota for network `%s' (in/out): %llu %llu\n", network_str[c], | 1864 | "Loaded quota for network `%s' (in/out): %llu %llu\n", |
1854 | in_dest[c], out_dest[c]); | 1865 | GNUNET_ATS_print_network_type (c), |
1866 | in_dest[c], | ||
1867 | out_dest[c]); | ||
1855 | GNUNET_free(entry_out); | 1868 | GNUNET_free(entry_out); |
1856 | GNUNET_free(entry_in); | 1869 | GNUNET_free(entry_in); |
1857 | } | 1870 | } |
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index 744602eb8..99cbb1b55 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_statistics_service.h" | 28 | #include "gnunet_statistics_service.h" |
29 | #include "gnunet_ats_plugin.h" | 29 | #include "gnunet_ats_plugin.h" |
30 | #include "gnunet_ats_service.h" | ||
30 | #include "gnunet-service-ats_addresses.h" | 31 | #include "gnunet-service-ats_addresses.h" |
31 | 32 | ||
32 | #define PROP_STABILITY_FACTOR 1.25 | 33 | #define PROP_STABILITY_FACTOR 1.25 |
@@ -317,7 +318,7 @@ struct Network | |||
317 | /** | 318 | /** |
318 | * Network description | 319 | * Network description |
319 | */ | 320 | */ |
320 | char *desc; | 321 | const char *desc; |
321 | 322 | ||
322 | /** | 323 | /** |
323 | * Total inbound quota | 324 | * Total inbound quota |
@@ -1293,7 +1294,7 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s, | |||
1293 | best_address->active = GNUNET_YES; | 1294 | best_address->active = GNUNET_YES; |
1294 | address_increment (s, net, GNUNET_NO, GNUNET_YES); | 1295 | address_increment (s, net, GNUNET_NO, GNUNET_YES); |
1295 | LOG (GNUNET_ERROR_TYPE_INFO, "Address %p for peer `%s' is now active\n", | 1296 | LOG (GNUNET_ERROR_TYPE_INFO, "Address %p for peer `%s' is now active\n", |
1296 | best_address, GNUNET_i2s (peer)); | 1297 | best_address, GNUNET_i2s (peer)); |
1297 | /* Distribute bandwidth */ | 1298 | /* Distribute bandwidth */ |
1298 | distribute_bandwidth_in_network (s, net); | 1299 | distribute_bandwidth_in_network (s, net); |
1299 | return best_address; | 1300 | return best_address; |
@@ -1936,7 +1937,6 @@ libgnunet_plugin_ats_proportional_init (void *cls) | |||
1936 | struct GNUNET_ATS_PluginEnvironment *env = cls; | 1937 | struct GNUNET_ATS_PluginEnvironment *env = cls; |
1937 | struct GAS_PROPORTIONAL_Handle *s; | 1938 | struct GAS_PROPORTIONAL_Handle *s; |
1938 | struct Network * cur; | 1939 | struct Network * cur; |
1939 | char * net_str[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; | ||
1940 | float f_tmp; | 1940 | float f_tmp; |
1941 | int c; | 1941 | int c; |
1942 | 1942 | ||
@@ -2022,19 +2022,22 @@ libgnunet_plugin_ats_proportional_init (void *cls) | |||
2022 | for (c = 0; c < env->network_count; c++) | 2022 | for (c = 0; c < env->network_count; c++) |
2023 | { | 2023 | { |
2024 | cur = &s->network_entries[c]; | 2024 | cur = &s->network_entries[c]; |
2025 | cur->total_addresses = 0; | ||
2026 | cur->active_addresses = 0; | ||
2027 | cur->type = env->networks[c]; | 2025 | cur->type = env->networks[c]; |
2028 | cur->total_quota_in = env->in_quota[c]; | 2026 | cur->total_quota_in = env->in_quota[c]; |
2029 | cur->total_quota_out = env->out_quota[c]; | 2027 | cur->total_quota_out = env->out_quota[c]; |
2030 | cur->desc = net_str[c]; | 2028 | cur->desc = GNUNET_ATS_print_network_type (c); |
2031 | GNUNET_asprintf (&cur->stat_total, | 2029 | GNUNET_asprintf (&cur->stat_total, |
2032 | "# ATS addresses %s total", cur->desc); | 2030 | "# ATS addresses %s total", |
2031 | cur->desc); | ||
2033 | GNUNET_asprintf (&cur->stat_active, | 2032 | GNUNET_asprintf (&cur->stat_active, |
2034 | "# ATS active addresses %s total", cur->desc); | 2033 | "# ATS active addresses %s total", |
2034 | cur->desc); | ||
2035 | LOG (GNUNET_ERROR_TYPE_INFO, | 2035 | LOG (GNUNET_ERROR_TYPE_INFO, |
2036 | "Added network %u `%s' (%llu/%llu)\n", | 2036 | "Added network %u `%s' (%llu/%llu)\n", |
2037 | c, cur->desc, cur->total_quota_in, cur->total_quota_out); | 2037 | c, |
2038 | cur->desc, | ||
2039 | cur->total_quota_in, | ||
2040 | cur->total_quota_out); | ||
2038 | } | 2041 | } |
2039 | return s; | 2042 | return s; |
2040 | } | 2043 | } |
diff --git a/src/ats/test_ats_api_common.c b/src/ats/test_ats_api_common.c index b603d6e6d..569ffbce1 100644 --- a/src/ats/test_ats_api_common.c +++ b/src/ats/test_ats_api_common.c | |||
@@ -95,7 +95,6 @@ compare_ats (const struct GNUNET_ATS_Information *ats_is, uint32_t ats_count_is, | |||
95 | { | 95 | { |
96 | unsigned int c_o; | 96 | unsigned int c_o; |
97 | unsigned int c_i; | 97 | unsigned int c_i; |
98 | char *prop[] = GNUNET_ATS_PropertyStrings; | ||
99 | uint32_t type1; | 98 | uint32_t type1; |
100 | uint32_t type2; | 99 | uint32_t type2; |
101 | uint32_t val1; | 100 | uint32_t val1; |
@@ -110,21 +109,24 @@ compare_ats (const struct GNUNET_ATS_Information *ats_is, uint32_t ats_count_is, | |||
110 | type2 = ntohl(ats_should[c_i].type); | 109 | type2 = ntohl(ats_should[c_i].type); |
111 | if (type1 == type2) | 110 | if (type1 == type2) |
112 | { | 111 | { |
113 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS type `%s'\n", | 112 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
114 | prop[type1]); | 113 | "ATS type `%s'\n", |
114 | GNUNET_ATS_print_property_type (type1)); | ||
115 | val1 = ntohl(ats_is[c_o].value); | 115 | val1 = ntohl(ats_is[c_o].value); |
116 | val2 = ntohl(ats_should[c_i].value); | 116 | val2 = ntohl(ats_should[c_i].value); |
117 | if (val1 != val2) | 117 | if (val1 != val2) |
118 | { | 118 | { |
119 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS value `%s' not equal: %u != %u\n", | 119 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
120 | prop[type1], | 120 | "ATS value `%s' not equal: %u != %u\n", |
121 | GNUNET_ATS_print_property_type (type1), | ||
121 | val1, val2); | 122 | val1, val2); |
122 | res = GNUNET_SYSERR; | 123 | res = GNUNET_SYSERR; |
123 | } | 124 | } |
124 | else | 125 | else |
125 | { | 126 | { |
126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS value `%s' equal: %u == %u\n", | 127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
127 | prop[type1], | 128 | "ATS value `%s' equal: %u == %u\n", |
129 | GNUNET_ATS_print_property_type (type1), | ||
128 | val1, val2); | 130 | val1, val2); |
129 | } | 131 | } |
130 | } | 132 | } |
@@ -161,8 +163,12 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
161 | { | 163 | { |
162 | in_dest[c] = 0; | 164 | in_dest[c] = 0; |
163 | out_dest[c] = 0; | 165 | out_dest[c] = 0; |
164 | GNUNET_asprintf (&entry_out, "%s_QUOTA_OUT", network_str[c]); | 166 | GNUNET_asprintf (&entry_out, |
165 | GNUNET_asprintf (&entry_in, "%s_QUOTA_IN", network_str[c]); | 167 | "%s_QUOTA_OUT", |
168 | GNUNET_ATS_print_network_type (c)); | ||
169 | GNUNET_asprintf (&entry_in, | ||
170 | "%s_QUOTA_IN", | ||
171 | GNUNET_ATS_print_network_type (c)); | ||
166 | 172 | ||
167 | /* quota out */ | 173 | /* quota out */ |
168 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", entry_out, "a_out_str)) | 174 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", entry_out, "a_out_str)) |
@@ -180,21 +186,28 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
180 | 186 | ||
181 | if (GNUNET_NO == res) | 187 | if (GNUNET_NO == res) |
182 | { | 188 | { |
183 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), | 189 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
184 | network_str[c], quota_out_str, GNUNET_ATS_DefaultBandwidth); | 190 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), |
191 | GNUNET_ATS_print_network_type (c), | ||
192 | quota_out_str, | ||
193 | GNUNET_ATS_DefaultBandwidth); | ||
185 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 194 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
186 | } | 195 | } |
187 | else | 196 | else |
188 | { | 197 | { |
189 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Outbound quota configure for network `%s' is %llu\n"), | 198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
190 | network_str[c], out_dest[c]); | 199 | "Outbound quota configure for network `%s' is %llu\n", |
200 | GNUNET_ATS_print_network_type (c), | ||
201 | out_dest[c]); | ||
191 | } | 202 | } |
192 | GNUNET_free (quota_out_str); | 203 | GNUNET_free (quota_out_str); |
193 | } | 204 | } |
194 | else | 205 | else |
195 | { | 206 | { |
196 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"), | 207 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
197 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 208 | _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"), |
209 | GNUNET_ATS_print_network_type (c), | ||
210 | GNUNET_ATS_DefaultBandwidth); | ||
198 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 211 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
199 | } | 212 | } |
200 | 213 | ||
@@ -214,24 +227,35 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
214 | 227 | ||
215 | if (GNUNET_NO == res) | 228 | if (GNUNET_NO == res) |
216 | { | 229 | { |
217 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), | 230 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
218 | network_str[c], quota_in_str, GNUNET_ATS_DefaultBandwidth); | 231 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), |
232 | GNUNET_ATS_print_network_type (c), | ||
233 | quota_in_str, | ||
234 | GNUNET_ATS_DefaultBandwidth); | ||
219 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; | 235 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; |
220 | } | 236 | } |
221 | else | 237 | else |
222 | { | 238 | { |
223 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Inbound quota configured for network `%s' is %llu\n"), | 239 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
224 | network_str[c], in_dest[c]); | 240 | "Inbound quota configured for network `%s' is %llu\n", |
241 | GNUNET_ATS_print_network_type (c), | ||
242 | in_dest[c]); | ||
225 | } | 243 | } |
226 | GNUNET_free (quota_in_str); | 244 | GNUNET_free (quota_in_str); |
227 | } | 245 | } |
228 | else | 246 | else |
229 | { | 247 | { |
230 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"), | 248 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
231 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 249 | _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"), |
250 | GNUNET_ATS_print_network_type (c), | ||
251 | GNUNET_ATS_DefaultBandwidth); | ||
232 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 252 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
233 | } | 253 | } |
234 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded quota for network `%s' (in/out): %llu %llu\n", network_str[c], in_dest[c], out_dest[c]); | 254 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
255 | "Loaded quota for network `%s' (in/out): %llu %llu\n", | ||
256 | GNUNET_ATS_print_network_type (c), | ||
257 | in_dest[c], | ||
258 | out_dest[c]); | ||
235 | GNUNET_free (entry_out); | 259 | GNUNET_free (entry_out); |
236 | GNUNET_free (entry_in); | 260 | GNUNET_free (entry_in); |
237 | } | 261 | } |
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index c19fa40b6..8b1aaf5c7 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010,2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -38,30 +38,53 @@ | |||
38 | /** | 38 | /** |
39 | * ATS network types as array initializer | 39 | * ATS network types as array initializer |
40 | */ | 40 | */ |
41 | #define GNUNET_ATS_NetworkType {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN, GNUNET_ATS_NET_BT} | 41 | #define GNUNET_ATS_NetworkType { GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN, GNUNET_ATS_NET_BT } |
42 | |||
42 | 43 | ||
43 | /** | 44 | /** |
44 | * ATS network types as string array initializer | 45 | * Types of networks (with separate quotas) we support. |
45 | */ | 46 | */ |
46 | #define GNUNET_ATS_NetworkTypeString {"UNSPECIFIED", "LOOPBACK", "LAN", "WAN", "WLAN", "BLUETOOTH"} | ||
47 | |||
48 | enum GNUNET_ATS_Network_Type | 47 | enum GNUNET_ATS_Network_Type |
49 | { | 48 | { |
49 | /** | ||
50 | * Category of last resort. | ||
51 | */ | ||
50 | GNUNET_ATS_NET_UNSPECIFIED = 0, | 52 | GNUNET_ATS_NET_UNSPECIFIED = 0, |
53 | |||
54 | /** | ||
55 | * Loopback (same host). | ||
56 | */ | ||
51 | GNUNET_ATS_NET_LOOPBACK = 1, | 57 | GNUNET_ATS_NET_LOOPBACK = 1, |
58 | |||
59 | /** | ||
60 | * Local area network. | ||
61 | */ | ||
52 | GNUNET_ATS_NET_LAN = 2, | 62 | GNUNET_ATS_NET_LAN = 2, |
63 | |||
64 | /** | ||
65 | * Wide area network (i.e. Internet) | ||
66 | */ | ||
53 | GNUNET_ATS_NET_WAN = 3, | 67 | GNUNET_ATS_NET_WAN = 3, |
68 | |||
69 | /** | ||
70 | * Wireless LAN (i.e. 802.11abgn) | ||
71 | */ | ||
54 | GNUNET_ATS_NET_WLAN = 4, | 72 | GNUNET_ATS_NET_WLAN = 4, |
73 | |||
74 | /** | ||
75 | * Bluetooth LAN | ||
76 | */ | ||
55 | GNUNET_ATS_NET_BT = 5 | 77 | GNUNET_ATS_NET_BT = 5 |
56 | }; | 78 | }; |
57 | 79 | ||
80 | |||
58 | /** | 81 | /** |
59 | * Default bandwidth assigned to a network : 64 KB/s | 82 | * Default bandwidth assigned to a network : 64 KB/s |
60 | */ | 83 | */ |
61 | #define GNUNET_ATS_DefaultBandwidth 65536 | 84 | #define GNUNET_ATS_DefaultBandwidth 65536 |
62 | 85 | ||
63 | /** | 86 | /** |
64 | * Undefined value for a GNUNET_ATS_Property | 87 | * Undefined value for an `enum GNUNET_ATS_Property` |
65 | */ | 88 | */ |
66 | #define GNUNET_ATS_VALUE_UNDEFINED UINT32_MAX | 89 | #define GNUNET_ATS_VALUE_UNDEFINED UINT32_MAX |
67 | 90 | ||
@@ -85,10 +108,6 @@ enum GNUNET_ATS_Network_Type | |||
85 | */ | 108 | */ |
86 | #define GNUNET_ATS_PropertyCount 11 | 109 | #define GNUNET_ATS_PropertyCount 11 |
87 | 110 | ||
88 | /** | ||
89 | * ATS properties types as string array initializer | ||
90 | */ | ||
91 | #define GNUNET_ATS_PropertyStrings {"TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", "UTILIZATION_PAYLOAD_UP", "UTILIZATION_PAYLOAD_DOWN", "NETWORK_TYPE", "DELAY", "DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN"} | ||
92 | 111 | ||
93 | /** | 112 | /** |
94 | * Enum defining all known property types for ATS Enum values are used | 113 | * Enum defining all known property types for ATS Enum values are used |
@@ -98,7 +117,7 @@ enum GNUNET_ATS_Network_Type | |||
98 | * Cost are always stored in uint32_t, so all units used to define costs | 117 | * Cost are always stored in uint32_t, so all units used to define costs |
99 | * have to be normalized to fit in uint32_t [0 .. UINT32_MAX-1] | 118 | * have to be normalized to fit in uint32_t [0 .. UINT32_MAX-1] |
100 | * | 119 | * |
101 | * UINT32_MAX is reserved for uninitialized values GNUNET_ATS_VALUE_UNDEFINED | 120 | * UINT32_MAX is reserved for uninitialized values #GNUNET_ATS_VALUE_UNDEFINED |
102 | */ | 121 | */ |
103 | enum GNUNET_ATS_Property | 122 | enum GNUNET_ATS_Property |
104 | { | 123 | { |
@@ -125,7 +144,6 @@ enum GNUNET_ATS_Property | |||
125 | */ | 144 | */ |
126 | GNUNET_ATS_UTILIZATION_IN, | 145 | GNUNET_ATS_UTILIZATION_IN, |
127 | 146 | ||
128 | |||
129 | /** | 147 | /** |
130 | * Actual traffic on this connection from this peer to the other peer. | 148 | * Actual traffic on this connection from this peer to the other peer. |
131 | * Only payload from layers > transport | 149 | * Only payload from layers > transport |
@@ -231,248 +249,10 @@ enum GNUNET_ATS_Property | |||
231 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] | 249 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] |
232 | */ | 250 | */ |
233 | GNUNET_ATS_COST_WLAN | 251 | GNUNET_ATS_COST_WLAN |
234 | /* Cost related values */ | 252 | |
235 | /* =================== */ | ||
236 | /** | ||
237 | * Volume based cost in financial units to transmit data | ||
238 | * | ||
239 | * Note: This value is not bound to a specific currency or unit and only | ||
240 | * used locally. | ||
241 | * "cent" just refers the smallest amount of money in the respective | ||
242 | * currency. | ||
243 | * | ||
244 | * Unit: [cent/MB] | ||
245 | * | ||
246 | * Interpretation: less is better | ||
247 | * | ||
248 | * Examples: | ||
249 | * LAN: 0 [cent/MB] | ||
250 | * 2G : 10 [cent/MB] | ||
251 | */ | ||
252 | // GNUNET_ATS_COST_FINANCIAL_PER_VOLUME = 1, | ||
253 | /** | ||
254 | * Time based cost in financial units to transmit data | ||
255 | * | ||
256 | * Note: This value is not bound to a specific currency or unit and only | ||
257 | * used locally. | ||
258 | * "cent" just refers the smallest amount of money in the respective | ||
259 | * currency. | ||
260 | * | ||
261 | * Unit: [cent/h] | ||
262 | * | ||
263 | * Interpretation: less is better | ||
264 | * | ||
265 | * Examples: | ||
266 | * LAN : 0 [cent/h] | ||
267 | * Dialup: 10 [cent/h] | ||
268 | */ | ||
269 | // GNUNET_ATS_COST_FINANCIAL_PER_TIME = 2, | ||
270 | /** | ||
271 | * Computational costs | ||
272 | * | ||
273 | * Effort of preparing data to be sent with this transport | ||
274 | * Includes encoding, encryption and conversion of data | ||
275 | * Partial values can be summed up: c_sum = c_enc + c_enc + c_conv | ||
276 | * Resulting values depend on local system properties, e.g. CPU | ||
277 | * | ||
278 | * Unit: [ms/GB] | ||
279 | * | ||
280 | * Interpretation: less is better | ||
281 | * | ||
282 | * Examples: | ||
283 | * | ||
284 | * HTTPS with AES CBC-256: 7,382 | ||
285 | * HTTPS with AES CBC-128: 5,279 | ||
286 | * HTTPS with RC4-1024: 2,652 | ||
287 | */ | ||
288 | // GNUNET_ATS_COST_COMPUTATIONAL = 3, | ||
289 | /** | ||
290 | * Energy consumption | ||
291 | * | ||
292 | * Energy consumption using this transport when sending with a certain | ||
293 | * power at a certain bitrate. This is only an approximation based on: | ||
294 | * Energy consumption E = P / D | ||
295 | * | ||
296 | * with: | ||
297 | * Power P in Watt (J/s) | ||
298 | * Datarate D in MBit/s | ||
299 | * | ||
300 | * Conversion between power P and dBm used by WLAN in radiotap's dBm TX power: | ||
301 | * | ||
302 | * Lp(dbm) = 10 log10 (P/ 1mW) | ||
303 | * | ||
304 | * => P = 1 mW * 10^(Lp(dbm)/10) | ||
305 | * | ||
306 | * Unit: [mJ/MB] | ||
307 | * | ||
308 | * Interpretation: less is better | ||
309 | * | ||
310 | * Examples: | ||
311 | * | ||
312 | * LAN: 0 | ||
313 | * WLAN: 89 (600 mW @ 802.11g /w 54 MBit/s) | ||
314 | * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s) | ||
315 | */ | ||
316 | // GNUNET_ATS_COST_ENERGY_CONSUMPTION = 4, | ||
317 | /** | ||
318 | * Connect cost | ||
319 | * How many bytes are transmitted to initiate a new connection using | ||
320 | * this transport? | ||
321 | * | ||
322 | * Unit: [bytes] | ||
323 | * | ||
324 | * Interpretation: less is better | ||
325 | * | ||
326 | * Examples: | ||
327 | * | ||
328 | * UDP (No connection) : | ||
329 | * 0 bytes | ||
330 | * TCP (TCP 3-Way handshake): | ||
331 | * 220 bytes Ethernet, 172 bytes TCP/IP, 122 bytes TCP | ||
332 | * HTTP (TCP + Header) : | ||
333 | * 477 bytes Ethernet, 429 bytes TCP/IP, 374 bytes TCP, 278 bytes HTTP | ||
334 | * HTTPS HTTP+TLS Handshake: | ||
335 | * 2129 bytes Ethernet, 1975 bytes TCP/IP, 1755 bytes TCP, 1403 bytes HTTPS | ||
336 | * | ||
337 | * */ | ||
338 | // GNUNET_ATS_COST_CONNECT = 5, | ||
339 | /** | ||
340 | * Bandwidth cost | ||
341 | * | ||
342 | * How many bandwidth is available to consume? | ||
343 | * Used to calculate which impact sending data with this transport has | ||
344 | * | ||
345 | * Unit: [kB/s] | ||
346 | * | ||
347 | * Interpretation: more is better | ||
348 | * | ||
349 | * Examples: | ||
350 | * LAN: 12,800 (100 MBit/s) | ||
351 | * WLAN: 6,912 (54 MBit/s) | ||
352 | * Dial-up: 8 (64 Kbit/s) | ||
353 | * | ||
354 | */ | ||
355 | // GNUNET_ATS_COST_BANDWITH_AVAILABLE = 6, | ||
356 | /** | ||
357 | * Network overhead | ||
358 | * | ||
359 | * How many bytes are sent over the wire when 1 kilobyte (1024 bytes) | ||
360 | * of application data is transmitted? | ||
361 | * A factor used with connect cost, bandwidth cost and energy cost | ||
362 | * to describe the overhead produced by the transport protocol | ||
363 | * | ||
364 | * Unit: [bytes/kb] | ||
365 | * | ||
366 | * Interpretation: less is better | ||
367 | * | ||
368 | * Examples: | ||
369 | * | ||
370 | * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb] | ||
371 | * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb] | ||
372 | * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb] | ||
373 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] | ||
374 | */ | ||
375 | // GNUNET_ATS_COST_NETWORK_OVERHEAD = 7, | ||
376 | /* Quality related values */ | ||
377 | /* ====================== */ | ||
378 | /* Physical layer quality properties */ | ||
379 | /** | ||
380 | * Signal strength on physical layer | ||
381 | * | ||
382 | * Unit: [dBm] | ||
383 | */ | ||
384 | // GNUNET_ATS_QUALITY_PHY_SIGNAL_STRENGTH = 1025, | ||
385 | /** | ||
386 | * Collision rate on physical layer | ||
387 | * | ||
388 | * Unit: [B/s] | ||
389 | */ | ||
390 | // GNUNET_ATS_QUALITY_PHY_COLLISION_RATE = 1026, | ||
391 | /** | ||
392 | * Error rate on physical layer | ||
393 | * | ||
394 | * Unit: [B/s] | ||
395 | */ | ||
396 | // GNUNET_ATS_QUALITY_PHY_ERROR_RATE = 1027, | ||
397 | /** | ||
398 | * Jitter | ||
399 | * Time variations of the delay | ||
400 | * 1st derivative of a delay function | ||
401 | * | ||
402 | * Unit: [ms] | ||
403 | */ | ||
404 | // GNUNET_ATS_QUALITY_NET_JITTER = 1029, | ||
405 | /** | ||
406 | * Error rate on network layer | ||
407 | * | ||
408 | * Unit: [B/s] | ||
409 | * | ||
410 | * Examples: | ||
411 | * | ||
412 | * LAN : 0 | ||
413 | * WLAN : 400 | ||
414 | * Bluetooth : 100 | ||
415 | * Note: This numbers are just assumptions as an example, not | ||
416 | * measured or somehow determined | ||
417 | */ | ||
418 | // GNUNET_ATS_QUALITY_NET_ERRORRATE = 1030, | ||
419 | /** | ||
420 | * Drop rate on network layer | ||
421 | * Bytes actively dismissed by a network component during transmission | ||
422 | * Reasons for dropped data can be full queues, congestion, quota violations... | ||
423 | * | ||
424 | * Unit: [B/s] | ||
425 | * | ||
426 | * Examples: | ||
427 | * | ||
428 | * LAN : 0 | ||
429 | * WLAN : 400 | ||
430 | * Bluetooth : 100 | ||
431 | * Note: This numbers are just assumptions as an example, not | ||
432 | * measured or somehow determined | ||
433 | */ | ||
434 | // GNUNET_ATS_QUALITY_NET_DROPRATE = 1031, | ||
435 | /** | ||
436 | * Loss rate on network layer | ||
437 | * Bytes lost during transmission | ||
438 | * Reasons can be collisions, ... | ||
439 | * | ||
440 | * Unit: [B/s] | ||
441 | * | ||
442 | * Examples: | ||
443 | * | ||
444 | * LAN : 0 | ||
445 | * WLAN : 40 | ||
446 | * Bluetooth : 10 | ||
447 | * Note: This numbers are just assumptions as an example, not measured | ||
448 | * or somehow determined | ||
449 | */ | ||
450 | // GNUNET_ATS_QUALITY_NET_LOSSRATE = 1032, | ||
451 | /** | ||
452 | * Throughput on network layer | ||
453 | * | ||
454 | * Unit: [kB/s] | ||
455 | * | ||
456 | * Examples: | ||
457 | * | ||
458 | * LAN : 3400 | ||
459 | * WLAN : 1200 | ||
460 | * Dialup: 4 | ||
461 | * | ||
462 | */ | ||
463 | // GNUNET_ATS_QUALITY_NET_THROUGHPUT = 1033, | ||
464 | /* Availability related values */ | ||
465 | /* =========================== */ | ||
466 | /** | ||
467 | * Is a peer reachable? | ||
468 | */ | ||
469 | // GNUNET_ATS_AVAILABILITY_REACHABLE = 2048, | ||
470 | /** | ||
471 | * Is there a connection established to a peer using this transport | ||
472 | */ | ||
473 | // GNUNET_ATS_AVAILABILITY_CONNECTED = 2049 | ||
474 | }; | 253 | }; |
475 | 254 | ||
255 | |||
476 | /** | 256 | /** |
477 | * Number of ATS quality properties | 257 | * Number of ATS quality properties |
478 | */ | 258 | */ |
@@ -481,7 +261,7 @@ enum GNUNET_ATS_Property | |||
481 | /** | 261 | /** |
482 | * ATS quality properties as array initializer | 262 | * ATS quality properties as array initializer |
483 | */ | 263 | */ |
484 | #define GNUNET_ATS_QualityProperties {GNUNET_ATS_QUALITY_NET_DELAY, GNUNET_ATS_QUALITY_NET_DISTANCE} | 264 | #define GNUNET_ATS_QualityProperties { GNUNET_ATS_QUALITY_NET_DELAY, GNUNET_ATS_QUALITY_NET_DISTANCE } |
485 | 265 | ||
486 | /** | 266 | /** |
487 | * ATS quality properties as string array initializer | 267 | * ATS quality properties as string array initializer |
@@ -559,7 +339,8 @@ struct Session; | |||
559 | typedef void | 339 | typedef void |
560 | (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, | 340 | (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, |
561 | const struct GNUNET_PeerIdentity *peer, | 341 | const struct GNUNET_PeerIdentity *peer, |
562 | const struct GNUNET_HELLO_Address *address, struct Session *session, | 342 | const struct GNUNET_HELLO_Address *address, |
343 | struct Session *session, | ||
563 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 344 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
564 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 345 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
565 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count); | 346 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count); |
@@ -589,7 +370,7 @@ GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh); | |||
589 | 370 | ||
590 | /** | 371 | /** |
591 | * We would like to reset the address suggestion block time for this | 372 | * We would like to reset the address suggestion block time for this |
592 | * peer | 373 | * peer. |
593 | * | 374 | * |
594 | * @param sh handle | 375 | * @param sh handle |
595 | * @param peer identity of the peer we want to reset | 376 | * @param peer identity of the peer we want to reset |
@@ -630,25 +411,26 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, | |||
630 | /** | 411 | /** |
631 | * Convert a ATS property to a string | 412 | * Convert a ATS property to a string |
632 | * | 413 | * |
633 | * @param type the atsi type | 414 | * @param type the property type |
634 | * @return a string or NULL if invalid | 415 | * @return a string or NULL if invalid |
635 | */ | 416 | */ |
636 | const char * | 417 | const char * |
637 | GNUNET_ATS_print_property_type (uint32_t type); | 418 | GNUNET_ATS_print_property_type (enum GNUNET_ATS_Property type); |
638 | 419 | ||
639 | 420 | ||
640 | /** | 421 | /** |
641 | * Convert a GNUNET_ATS_NetworkType to a string | 422 | * Convert a `enum GNUNET_ATS_Network_Type` to a string |
642 | * | 423 | * |
643 | * @param net the network type | 424 | * @param net the network type |
644 | * @return a string or NULL if invalid | 425 | * @return a string or NULL if invalid |
645 | */ | 426 | */ |
646 | const char * | 427 | const char * |
647 | GNUNET_ATS_print_network_type (uint32_t net); | 428 | GNUNET_ATS_print_network_type (enum GNUNET_ATS_Network_Type net); |
648 | 429 | ||
649 | 430 | ||
650 | /** | 431 | /** |
651 | * Returns where the address is located: LAN or WAN or ... | 432 | * Returns where the address is located: LAN or WAN or ... |
433 | * | ||
652 | * @param sh the `struct GNUNET_ATS_SchedulingHandle` handle | 434 | * @param sh the `struct GNUNET_ATS_SchedulingHandle` handle |
653 | * @param addr address | 435 | * @param addr address |
654 | * @param addrlen address length | 436 | * @param addrlen address length |
@@ -656,12 +438,12 @@ GNUNET_ATS_print_network_type (uint32_t net); | |||
656 | */ | 438 | */ |
657 | struct GNUNET_ATS_Information | 439 | struct GNUNET_ATS_Information |
658 | GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, | 440 | GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, |
659 | const struct sockaddr * addr, | 441 | const struct sockaddr *addr, |
660 | socklen_t addrlen); | 442 | socklen_t addrlen); |
661 | 443 | ||
662 | 444 | ||
663 | /** | 445 | /** |
664 | * Test if a address and a session is known to ATS | 446 | * Test if a address and a session is known to ATS. |
665 | * | 447 | * |
666 | * @param sh the scheduling handle | 448 | * @param sh the scheduling handle |
667 | * @param address the address | 449 | * @param address the address |
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 250d3279f..d1e388506 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -415,7 +415,6 @@ static char * | |||
415 | generate_config (char *cfg_file, unsigned long long quota_in, | 415 | generate_config (char *cfg_file, unsigned long long quota_in, |
416 | unsigned long long quota_out) | 416 | unsigned long long quota_out) |
417 | { | 417 | { |
418 | char *networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; | ||
419 | char *in_name; | 418 | char *in_name; |
420 | char *out_name; | 419 | char *out_name; |
421 | char *fname = NULL; | 420 | char *fname = NULL; |
@@ -430,12 +429,16 @@ generate_config (char *cfg_file, unsigned long long quota_in, | |||
430 | 429 | ||
431 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) | 430 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) |
432 | { | 431 | { |
433 | GNUNET_asprintf (&in_name, "%s_QUOTA_IN", networks[c]); | 432 | GNUNET_asprintf (&in_name, |
434 | GNUNET_asprintf (&out_name, "%s_QUOTA_OUT", networks[c]); | 433 | "%s_QUOTA_IN", |
435 | GNUNET_CONFIGURATION_set_value_number (cfg, "ats", in_name, quota_in); | 434 | GNUNET_ATS_print_network_type (c)); |
436 | GNUNET_CONFIGURATION_set_value_number (cfg, "ats", out_name, quota_out); | 435 | GNUNET_asprintf (&out_name, |
437 | GNUNET_free (in_name); | 436 | "%s_QUOTA_OUT", |
438 | GNUNET_free (out_name); | 437 | GNUNET_ATS_print_network_type (c)); |
438 | GNUNET_CONFIGURATION_set_value_number (cfg, "ats", in_name, quota_in); | ||
439 | GNUNET_CONFIGURATION_set_value_number (cfg, "ats", out_name, quota_out); | ||
440 | GNUNET_free (in_name); | ||
441 | GNUNET_free (out_name); | ||
439 | } | 442 | } |
440 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write (cfg, fname)); | 443 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_write (cfg, fname)); |
441 | GNUNET_CONFIGURATION_destroy (cfg); | 444 | GNUNET_CONFIGURATION_destroy (cfg); |