+ struct GNUNET_BANDWIDTH_Value32NBO b2)
+{
+ return
+ GNUNET_BANDWIDTH_value_init (GNUNET_MIN
+ (ntohl (b1.value__), ntohl (b2.value__)));
+}
+
+
+/**
+ * At the given bandwidth, calculate how much traffic will be
+ * available until the given deadline.
+ *
+ * @param bps bandwidth
+ * @param deadline when is the deadline
+ * @return number of bytes available at bps until deadline
+ */
+uint64_t
+GNUNET_BANDWIDTH_value_get_available_until (struct GNUNET_BANDWIDTH_Value32NBO
+ bps,
+ struct GNUNET_TIME_Relative
+ deadline)
+{
+ uint64_t b;
+
+ b = ntohl (bps.value__);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Bandwidth has %llu bytes available until deadline in %s\n",
+ (unsigned long long) ((b * deadline.rel_value + 500LL) / 1000LL),
+ GNUNET_STRINGS_relative_time_to_string (deadline, GNUNET_YES));
+ return (b * deadline.rel_value + 500LL) / 1000LL;
+}
+
+
+/**
+ * At the given bandwidth, calculate how long it would take for
+ * 'size' bytes to be transmitted.
+ *
+ * @param bps bandwidth
+ * @param size number of bytes we want to have available
+ * @return how long it would take
+ */
+struct GNUNET_TIME_Relative
+GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps,
+ uint64_t size)