diff options
Diffstat (limited to 'src/include/gnunet_bandwidth_lib.h')
-rw-r--r-- | src/include/gnunet_bandwidth_lib.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/include/gnunet_bandwidth_lib.h b/src/include/gnunet_bandwidth_lib.h index 91ae3e2b8..0cade7902 100644 --- a/src/include/gnunet_bandwidth_lib.h +++ b/src/include/gnunet_bandwidth_lib.h | |||
@@ -52,6 +52,17 @@ struct GNUNET_BANDWIDTH_Value32NBO | |||
52 | }; | 52 | }; |
53 | GNUNET_NETWORK_STRUCT_END | 53 | GNUNET_NETWORK_STRUCT_END |
54 | 54 | ||
55 | |||
56 | /** | ||
57 | * Callback to be called by the bandwidth tracker if the tracker | ||
58 | * was updated and the client should update it's delay values | ||
59 | * | ||
60 | * @param cls a closure to pass | ||
61 | */ | ||
62 | void | ||
63 | typedef (*GNUNET_BANDWIDTH_tracker_update_cb) (void *cls); | ||
64 | |||
65 | |||
55 | /** | 66 | /** |
56 | * Struct to track available bandwidth. Combines a time stamp with a | 67 | * Struct to track available bandwidth. Combines a time stamp with a |
57 | * number of bytes transmitted, a quota and a maximum amount that | 68 | * number of bytes transmitted, a quota and a maximum amount that |
@@ -61,6 +72,10 @@ GNUNET_NETWORK_STRUCT_END | |||
61 | */ | 72 | */ |
62 | struct GNUNET_BANDWIDTH_Tracker | 73 | struct GNUNET_BANDWIDTH_Tracker |
63 | { | 74 | { |
75 | void *update_cb_cls; | ||
76 | |||
77 | GNUNET_BANDWIDTH_tracker_update_cb update_cb; | ||
78 | |||
64 | /** | 79 | /** |
65 | * Number of bytes consumed since we last updated the tracker. | 80 | * Number of bytes consumed since we last updated the tracker. |
66 | */ | 81 | */ |
@@ -129,7 +144,6 @@ GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps, | |||
129 | uint64_t size); | 144 | uint64_t size); |
130 | 145 | ||
131 | 146 | ||
132 | |||
133 | /** | 147 | /** |
134 | * Compute the MIN of two bandwidth values. | 148 | * Compute the MIN of two bandwidth values. |
135 | * | 149 | * |
@@ -152,14 +166,19 @@ GNUNET_BANDWIDTH_value_min (struct GNUNET_BANDWIDTH_Value32NBO b1, | |||
152 | * bytes). | 166 | * bytes). |
153 | * | 167 | * |
154 | * @param av tracker to initialize | 168 | * @param av tracker to initialize |
169 | * @param update_cb callback to notify a client about the tracker being updated | ||
170 | * @param update_cb_cls cls for the callback | ||
155 | * @param bytes_per_second_limit initial limit to assume | 171 | * @param bytes_per_second_limit initial limit to assume |
156 | * @param max_carry_s maximum number of seconds unused bandwidth | 172 | * @param max_carry_s maximum number of seconds unused bandwidth |
157 | * may accumulate before it expires | 173 | * may accumulate before it expires |
158 | */ | 174 | */ |
159 | void | 175 | void |
160 | GNUNET_BANDWIDTH_tracker_init (struct GNUNET_BANDWIDTH_Tracker *av, | 176 | GNUNET_BANDWIDTH_tracker_init (struct GNUNET_BANDWIDTH_Tracker *av, |
177 | GNUNET_BANDWIDTH_tracker_update_cb update_cb, | ||
178 | void *update_cb_cls, | ||
161 | struct GNUNET_BANDWIDTH_Value32NBO | 179 | struct GNUNET_BANDWIDTH_Value32NBO |
162 | bytes_per_second_limit, uint32_t max_carry_s); | 180 | bytes_per_second_limit, |
181 | uint32_t max_carry_s); | ||
163 | 182 | ||
164 | 183 | ||
165 | /** | 184 | /** |