35 #define MAX_BANDWIDTH_CARRY_S 5
67 "Not connected, allowing reservation of %d bytes\n",
74 if (
ret.rel_value_us > 0)
77 "Delay to satisfy reservation for %d bytes is %s\n",
86 "Reserved %d bytes\n",
107 if (0 == ntohl (bandwidth_in.
value__))
148 "Received RESERVATION_REQUEST message\n");
149 amount = (int32_t) ntohl (
msg->amount);
155 result->amount = htonl (amount);
159 "# reservation requests processed",
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
automatic transport selection messages
static int ret
Return value of the commandline.
struct GNUNET_STATISTICS_Handle * GSA_stats
Handle for statistics.
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
static int result
Global testing status.
void GAS_reservations_set_bandwidth(const struct GNUNET_PeerIdentity *peer, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
Set the amount of bandwidth the other peer could currently transmit to us (as far as we know) to the ...
static struct GNUNET_CONTAINER_MultiPeerMap * trackers
Map of peer identities to struct GNUNET_BANDWIDTH_Tracker *s.
void GAS_handle_reservation_request(struct GNUNET_SERVICE_Client *client, const struct ReservationRequestMessage *msg)
Handle 'reservation request' messages from clients.
static int free_tracker(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Free memory of bandwidth tracker.
static struct GNUNET_TIME_Relative reservations_reserve(const struct GNUNET_PeerIdentity *peer, int32_t amount)
Reserve the given amount of incoming bandwidth (in bytes) from the given peer.
void GAS_reservations_done()
Shutdown reservations subsystem.
#define MAX_BANDWIDTH_CARRY_S
Number of seconds that available bandwidth carries over (can accumulate).
void GAS_reservations_init()
Initialize reservations subsystem.
ats service, inbound bandwidth reservation management
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.
void GNUNET_BANDWIDTH_tracker_update_quota(struct GNUNET_BANDWIDTH_Tracker *av, struct GNUNET_BANDWIDTH_Value32NBO bytes_per_second_limit)
Update quota of bandwidth tracker.
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.
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 g...
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
#define GNUNET_log(kind,...)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT
Type of the 'struct ReservationResultMessage' sent by ATS to clients in response to a reservation req...
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Struct to track available bandwidth.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
uint32_t value__
The actual value (bytes per second).
Internal representation of the hash map.
The identity of the host (wraps the signing key of the peer).
Handle to a client that is connected to a service.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.