GNUnet 0.21.2
gnunet_bandwidth_lib.h File Reference

Functions related to bandwidth (unit) More...

#include "gnunet_time_lib.h"
Include dependency graph for gnunet_bandwidth_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_BANDWIDTH_Value32NBO
 32-bit bandwidth used for network exchange by GNUnet, in bytes per second. More...
 
struct  GNUNET_BANDWIDTH_Tracker
 Struct to track available bandwidth. More...
 

Macros

#define GNUNET_BANDWIDTH_ZERO   GNUNET_BANDWIDTH_value_init (0)
 Convenience definition to use for 0-bandwidth. More...
 
#define GNUNET_BANDWIDTH_VALUE_MAX   GNUNET_BANDWIDTH_value_init (UINT32_MAX)
 Maximum possible bandwidth value. More...
 

Typedefs

typedef void(* GNUNET_BANDWIDTH_TrackerUpdateCallback) (void *cls)
 Callback to be called by the bandwidth tracker if the tracker was updated and the client should update it's delay values. More...
 
typedef void(* GNUNET_BANDWIDTH_ExcessNotificationCallback) (void *cls)
 Callback to be called by the bandwidth tracker if the tracker was updated and the client should update it's delay values. More...
 

Functions

struct GNUNET_BANDWIDTH_Value32NBO GNUNET_BANDWIDTH_value_init (uint32_t bytes_per_second)
 Create a new bandwidth value. More...
 
uint64_t GNUNET_BANDWIDTH_value_get_available_until (struct GNUNET_BANDWIDTH_Value32NBO bps, struct GNUNET_TIME_Relative deadline)
 At the given bandwidth, calculate how much traffic will be available until the given deadline. More...
 
struct GNUNET_TIME_Relative GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps, uint64_t size)
 At the given bandwidth, calculate how long it would take for 'size' bytes to be transmitted. More...
 
struct GNUNET_BANDWIDTH_Value32NBO GNUNET_BANDWIDTH_value_min (struct GNUNET_BANDWIDTH_Value32NBO b1, struct GNUNET_BANDWIDTH_Value32NBO b2)
 Compute the MIN of two bandwidth values. More...
 
struct GNUNET_BANDWIDTH_Value32NBO GNUNET_BANDWIDTH_value_max (struct GNUNET_BANDWIDTH_Value32NBO b1, struct GNUNET_BANDWIDTH_Value32NBO b2)
 Compute the MAX of two bandwidth values. More...
 
struct GNUNET_BANDWIDTH_Value32NBO GNUNET_BANDWIDTH_value_sum (struct GNUNET_BANDWIDTH_Value32NBO b1, struct GNUNET_BANDWIDTH_Value32NBO b2)
 Compute the SUM of two bandwidth values. More...
 
void GNUNET_BANDWIDTH_tracker_init (struct GNUNET_BANDWIDTH_Tracker *av, GNUNET_BANDWIDTH_TrackerUpdateCallback update_cb, void *update_cb_cls, struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit, uint32_t max_carry_s)
 Initialize bandwidth tracker. More...
 
void GNUNET_BANDWIDTH_tracker_init2 (struct GNUNET_BANDWIDTH_Tracker *av, GNUNET_BANDWIDTH_TrackerUpdateCallback update_cb, void *update_cb_cls, struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit, uint32_t max_carry_s, GNUNET_BANDWIDTH_ExcessNotificationCallback excess_cb, void *excess_cb_cls)
 Initialize bandwidth tracker. More...
 
void GNUNET_BANDWIDTH_tracker_notification_stop (struct GNUNET_BANDWIDTH_Tracker *av)
 Stop notifying about tracker updates and excess notifications. More...
 
int GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av, ssize_t size)
 Notify the tracker that a certain number of bytes of bandwidth have been consumed. More...
 
struct GNUNET_TIME_Relative GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, size_t size)
 Compute how long we should wait until consuming size bytes of bandwidth in order to stay within the given quota. More...
 
int64_t GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker *av)
 Compute how many bytes are available for consumption right now. More...
 
void GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av, struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit)
 Update quota of bandwidth tracker. More...
 

Detailed Description

Functions related to bandwidth (unit)

Definition in file gnunet_bandwidth_lib.h.