GNUnet  0.10.x
ats_api2_transport.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2010-2015, 2018 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
26 #include "platform.h"
28 #include "ats2.h"
29 
30 #define LOG(kind, ...) GNUNET_log_from(kind, "ats-transport-api", __VA_ARGS__)
31 
32 
43 
47  const char *address;
48 
60 
65 
70 
75  uint32_t slot;
76 };
77 
78 
87 
92 
97 
102 
107 
112 
117 
122 
127 };
128 
129 
130 
137 static void
139  const struct GNUNET_ATS_Properties *hbo)
140 {
142  nbo->goodput_out = htonl(hbo->goodput_out);
143  nbo->goodput_in = htonl(hbo->goodput_in);
144  nbo->utilization_out = htonl(hbo->utilization_out);
145  nbo->utilization_in = htonl(hbo->utilization_in);
146  nbo->distance = htonl(hbo->distance);
147  nbo->mtu = htonl(hbo->mtu);
148  nbo->nt = htonl((uint32_t)hbo->nt);
149  nbo->cc = htonl((uint32_t)hbo->cc);
150 }
151 
152 
158 static void
160 
161 
167 static void
168 reconnect_task(void *cls)
169 {
170  struct GNUNET_ATS_TransportHandle *ath = cls;
171 
172  ath->task = NULL;
173  reconnect(ath);
174 }
175 
176 
182 static void
184 {
185  if (NULL != ath->mq)
186  {
187  GNUNET_MQ_destroy(ath->mq);
188  ath->mq = NULL;
189  }
190  /* FIXME: do we tell transport service about disconnect events? CON:
191  initially ATS will have a really screwed picture of the world and
192  the rapid change would be bad. PRO: if we don't, ATS and
193  transport may disagree about the allocation for a while...
194  For now: lazy: do nothing. */
198  ath);
199 }
200 
201 
208 static int
210  const struct AddressSuggestionMessage *m)
211 {
212  (void)cls;
214  return GNUNET_SYSERR;
215 }
216 
217 
224 static void
226  const struct AddressSuggestionMessage *m)
227 {
228  struct GNUNET_ATS_TransportHandle *ath = cls;
229  const char *address = (const char *)&m[1];
230 
231  ath->suggest_cb(ath->suggest_cb_cls,
232  &m->peer,
233  address);
234 }
235 
236 
240 struct FindContext {
244  uint32_t session_id;
245 
250 };
251 
252 
261 static int
263  const struct GNUNET_PeerIdentity *pid,
264  void *value)
265 {
266  struct FindContext *fc = cls;
267  struct GNUNET_ATS_SessionRecord *sr = value;
268 
269  (void)pid;
270  if (fc->session_id == sr->slot)
271  {
272  fc->sr = sr;
273  return GNUNET_NO;
274  }
275  return GNUNET_YES;
276 }
277 
278 
279 
288 static struct GNUNET_ATS_SessionRecord *
290  uint32_t session_id,
291  const struct GNUNET_PeerIdentity *pid)
292 {
293  struct FindContext fc = {
295  .sr = NULL
296  };
297 
299  pid,
301  &fc);
302  return fc.sr;
303 }
304 
305 
312 static void
314  const struct SessionAllocationMessage *m)
315 {
316  struct GNUNET_ATS_TransportHandle *ath = cls;
317  struct GNUNET_ATS_SessionRecord *ar;
318  uint32_t session_id;
319 
320  session_id = ntohl(m->session_id);
321  ar = find_session(ath,
322  session_id,
323  &m->peer);
324  if (NULL == ar)
325  {
326  /* this can (rarely) happen if ATS changes an sessiones allocation
327  just when the transport service deleted it */
329  "Allocation ignored, session unknown\n");
330  return;
331  }
334  "ATS allocates bandwidth for peer `%s' using address %s\n",
335  GNUNET_i2s(&ar->pid),
336  ar->address);
337  ath->alloc_cb(ath->alloc_cb_cls,
338  ar->session,
339  m->bandwidth_out,
340  m->bandwidth_in);
341 }
342 
343 
351 static void
352 error_handler(void *cls,
353  enum GNUNET_MQ_Error error)
354 {
355  struct GNUNET_ATS_TransportHandle *ath = cls;
356 
358  "ATS connection died (code %d), reconnecting\n",
359  (int)error);
360  force_reconnect(ath);
361 }
362 
363 
370 static void
372 {
373  struct GNUNET_ATS_TransportHandle *ath = ar->ath;
374  struct GNUNET_MQ_Envelope *ev;
375  struct SessionAddMessage *m;
376  size_t alen;
377 
378  if (NULL == ath->mq)
379  return; /* disconnected, skip for now */
380  alen = strlen(ar->address) + 1;
381  ev = GNUNET_MQ_msg_extra(m,
382  alen,
383  (NULL == ar->session)
386  m->peer = ar->pid;
387  m->session_id = htonl(ar->slot);
389  &ar->properties);
390  GNUNET_memcpy(&m[1],
391  ar->address,
392  alen);
393 
395  "Adding address `%s' for peer `%s'\n",
396  ar->address,
397  GNUNET_i2s(&ar->pid));
398  GNUNET_MQ_send(ath->mq,
399  ev);
400 }
401 
402 
411 static int
413  const struct GNUNET_PeerIdentity *pid,
414  void *value)
415 {
416  struct GNUNET_ATS_SessionRecord *ar = value;
417 
418  (void)cls;
419  (void)pid;
421  return GNUNET_OK;
422 }
423 
424 
430 static void
432 {
433  struct GNUNET_MQ_MessageHandler handlers[] = {
434  GNUNET_MQ_hd_var_size(ats_address_suggestion,
437  ath),
438  GNUNET_MQ_hd_fixed_size(ats_session_allocation,
441  ath),
443  };
444  struct GNUNET_MQ_Envelope *ev;
445  struct GNUNET_MessageHeader *init;
446 
447  GNUNET_assert(NULL == ath->mq);
448  ath->mq = GNUNET_CLIENT_connect(ath->cfg,
449  "ats",
450  handlers,
451  &error_handler,
452  ath);
453  if (NULL == ath->mq)
454  {
455  GNUNET_break(0);
456  force_reconnect(ath);
457  return;
458  }
459  ev = GNUNET_MQ_msg(init,
461  GNUNET_MQ_send(ath->mq,
462  ev);
463  if (NULL == ath->mq)
464  return;
467  ath);
468 }
469 
470 
484  void *alloc_cb_cls,
486  void *suggest_cb_cls)
487 {
489 
491  ath->cfg = cfg;
492  ath->suggest_cb = suggest_cb;
494  ath->alloc_cb = alloc_cb;
495  ath->alloc_cb_cls = alloc_cb_cls;
497  GNUNET_YES);
498  reconnect(ath);
499  return ath;
500 }
501 
502 
511 static int
512 free_record(void *cls,
513  const struct GNUNET_PeerIdentity *pid,
514  void *value)
515 {
516  struct GNUNET_ATS_SessionRecord *ar = value;
517 
518  (void)cls;
519  (void)pid;
520  GNUNET_free(ar);
521  return GNUNET_OK;
522 }
523 
524 
530 void
532 {
533  if (NULL != ath->mq)
534  {
535  GNUNET_MQ_destroy(ath->mq);
536  ath->mq = NULL;
537  }
538  if (NULL != ath->task)
539  {
541  ath->task = NULL;
542  }
544  &free_record,
545  NULL);
547  GNUNET_free(ath);
548 }
549 
550 
567  const struct GNUNET_PeerIdentity *pid,
568  const char *address,
569  struct GNUNET_ATS_Session *session,
570  const struct GNUNET_ATS_Properties *prop)
571 {
572  struct GNUNET_ATS_SessionRecord *ar;
573  uint32_t s;
574  size_t alen;
575 
576  if (NULL == address)
577  {
578  /* we need a valid address */
579  GNUNET_break(0);
580  return NULL;
581  }
582  alen = strlen(address) + 1;
583  if ((alen + sizeof(struct SessionAddMessage) >= GNUNET_MAX_MESSAGE_SIZE) ||
584  (alen >= GNUNET_MAX_MESSAGE_SIZE))
585  {
586  /* address too large for us, this should not happen */
587  GNUNET_break(0);
588  return NULL;
589  }
590 
591  /* Spin 's' until we find an unused session ID for this pid */
593  UINT32_MAX);
594  NULL != find_session(ath,
595  s,
596  pid);
597  s++)
598  ;
599 
600  alen = strlen(address) + 1;
601  ar = GNUNET_malloc(sizeof(struct GNUNET_ATS_SessionRecord) + alen);
602  ar->ath = ath;
603  ar->slot = s;
604  ar->session = session;
605  ar->address = (const char *)&ar[1];
606  ar->pid = *pid;
607  ar->properties = *prop;
608  memcpy(&ar[1],
609  address,
610  alen);
612  &ar->pid,
613  ar,
616  return ar;
617 }
618 
619 
631 void
633  const struct GNUNET_ATS_Properties *prop)
634 {
635  struct GNUNET_ATS_TransportHandle *ath = ar->ath;
636  struct GNUNET_MQ_Envelope *ev;
637  struct SessionUpdateMessage *m;
638 
640  "Updating address `%s' for peer `%s'\n",
641  ar->address,
642  GNUNET_i2s(&ar->pid));
643  ar->properties = *prop;
644  if (NULL == ath->mq)
645  return; /* disconnected, skip for now */
646  ev = GNUNET_MQ_msg(m,
648  m->session_id = htonl(ar->slot);
649  m->peer = ar->pid;
651  &ar->properties);
652  GNUNET_MQ_send(ath->mq,
653  ev);
654 }
655 
656 
664 void
666 {
667  struct GNUNET_ATS_TransportHandle *ath = ar->ath;
668  struct GNUNET_MQ_Envelope *ev;
669  struct SessionDelMessage *m;
670 
672  "Deleting address `%s' for peer `%s'\n",
673  ar->address,
674  GNUNET_i2s(&ar->pid));
675  if (NULL == ath->mq)
676  return;
677  ev = GNUNET_MQ_msg(m,
679  m->session_id = htonl(ar->slot);
680  m->peer = ar->pid;
681  GNUNET_MQ_send(ath->mq,
682  ev);
683 }
684 
685 
686 /* end of ats_api2_transport.c */
Message sent by ATS client to ATS service when an session was destroyed and must thus henceforth no l...
Definition: ats2.h:201
uint32_t cc
What characteristics does this communicator have? A enum GNUNET_TRANSPORT_CommunicatorCharacteristics...
Definition: ats2.h:101
#define GNUNET_MESSAGE_TYPE_ATS_START
Type of the &#39;struct ClientStartMessage&#39; sent by clients to ATS to identify the type of the client...
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
Definition: ats2.h:76
void * alloc_cb_cls
Closure for alloc_cb.
static void reconnect(struct GNUNET_ATS_TransportHandle *ath)
Re-establish the connection to the ATS service.
static struct GNUNET_TIME_Relative backoff
How long should we wait to reconnect?
Definition: resolver_api.c:81
uint32_t goodput_out
Confirmed successful payload on this connection from this peer to the other peer. ...
static int match_session_cb(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
Finds matching session record.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:900
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
struct GNUNET_PeerIdentity peer
Which peer is this about? (Technically redundant, as the session_id should be sufficient, but may enable client to find the session faster and/or check consistency).
Definition: ats2.h:243
struct GNUNET_PeerIdentity pid
Identity of the peer reached at address.
uint32_t session_id
Internal number this client will henceforth use to refer to this session.
Definition: ats2.h:149
GNUNET_MQ_Error
Error codes for the queue.
struct GNUNET_ATS_SessionRecord * sr
Where to store the result.
GNUNET_ATS_AllocationCallback alloc_cb
Callback to invoke on allocations.
struct GNUNET_PeerIdentity peer
Which peer is this about? (Technically redundant, as the session_id should be sufficient, but enables ATS service to find the session faster).
Definition: ats2.h:217
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION
Type of the &#39;struct AddressSuggestionMessage&#39; sent by ATS to clients to suggest switching to a differ...
static void force_reconnect(struct GNUNET_ATS_TransportHandle *ath)
Disconnect from ATS and then reconnect.
static void reconnect_task(void *cls)
Re-establish the connection to the ATS service.
enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc
What characteristics does this communicator have?
struct GNUNET_ATS_TransportHandle * GNUNET_ATS_transport_init(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AllocationCallback alloc_cb, void *alloc_cb_cls, GNUNET_ATS_SuggestionCallback suggest_cb, void *suggest_cb_cls)
Initialize the ATS subsystem.
static void error_handler(void *cls, enum GNUNET_MQ_Error error)
We encountered an error handling the MQ to the ATS service.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint32_t goodput_out
Confirmed successful payload on this connection from this peer to the other peer. ...
Definition: ats2.h:52
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
static void properties_hton(struct PropertiesNBO *nbo, const struct GNUNET_ATS_Properties *hbo)
Convert ATS properties from host to network byte order.
struct GNUNET_CONTAINER_MultiPeerMap * records
Hash map mapping PIDs to session records.
static struct GNUNET_HashCode session_id
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_new(type)
Allocate a struct or union of the given type.
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).
static void handle_ats_session_allocation(void *cls, const struct SessionAllocationMessage *m)
We received a session allocation message from the service.
Closure for match_session_cb.
ATS performance characteristics for an address.
uint32_t session_id
Internal number this client uses to refer to this session.
Definition: ats2.h:180
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD_INBOUND_ONLY
Type of the &#39;struct SessionAddMessage&#39; send by transport clients to ATS to inform ATS about a session...
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
Transport client to ATS service: here is another session you can use.
Definition: ats2.h:138
Information we track per session, incoming or outgoing.
#define GNUNET_MESSAGE_TYPE_ATS_SESSION_ALLOCATION
Type of the &#39;struct SessionAllocationMessage&#39; send by ATS to the transport to tell it about resources...
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
Definition: ats2.h:68
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:99
uint32_t slot
Unique ID to identify this session at this pid in IPC messages.
uint32_t mtu
MTU of the network layer, UINT32_MAX for no MTU (stream).
Definition: ats2.h:89
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1237
void * suggest_cb_cls
Closure for suggest_cb.
#define GNUNET_MQ_check_zero_termination(m)
Insert code for a "check_" function that verifies that a given variable-length message received over ...
uint32_t distance
Distance on network layer (required for distance-vector routing) in hops.
Definition: ats2.h:82
static char * value
Value of the record to add/remove.
static struct GNUNET_ATS_SessionRecord * find_session(struct GNUNET_ATS_TransportHandle *ath, uint32_t session_id, const struct GNUNET_PeerIdentity *pid)
Find session record for peer pid and session session_id.
static void handle_ats_address_suggestion(void *cls, const struct AddressSuggestionMessage *m)
We received an address suggestion message from the service.
Information about ongoing sessions of the transport client.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
uint32_t session_id
Key to look for.
Message used to notify ATS that the performance characteristics for an session have changed...
Definition: ats2.h:171
GNUNET_ATS_SuggestionCallback suggest_cb
Callback to invoke on suggestions.
struct GNUNET_ATS_TransportHandle * ath
Transport handle this session record belongs to.
struct GNUNET_TIME_Relative delay
Delay.
struct GNUNET_SCHEDULER_Task * task
Task to trigger reconnect.
ATS Service allocates resources to an session identified by the given session_id for the given peer w...
Definition: ats2.h:226
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
struct GNUNET_PeerIdentity peer
Which peer is this about? (Technically redundant, as the session_id should be sufficient, but enables ATS service to find the session faster).
Definition: ats2.h:187
uint32_t session_id
Internal number this client uses to refer to this session.
Definition: ats2.h:210
Internal representation of the hash map.
automatic transport selection messages
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out
How much bandwidth we are allowed for sending.
Definition: ats2.h:248
Message handler for a specific message type.
uint32_t goodput_in
Confirmed useful payload on this connection to this peer from the other peer.
uint32_t session_id
Internal number this client uses to refer to the session this suggestion is about.
Definition: ats2.h:236
void(* GNUNET_ATS_AllocationCallback)(void *cls, struct GNUNET_ATS_Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
Signature of a function called by ATS with the current bandwidth allocation to be used as determined ...
struct GNUNET_ATS_Session * session
Session handle, NULL if inbound-only (also implies we cannot actually control inbound traffic via tra...
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
static int check_ats_address_suggestion(void *cls, const struct AddressSuggestionMessage *m)
Check format of address suggestion message from the service.
uint32_t mtu
MTU of the network layer, UINT32_MAX for no MTU (stream).
struct PropertiesNBO properties
Performance properties of the session.
Definition: ats2.h:192
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
#define GNUNET_MESSAGE_TYPE_ATS_SESSION_UPDATE
Type of the &#39;struct SessionUpdateMessage&#39; send by transport clients to ATS to inform ATS about proper...
uint32_t nt
Which network scope does the respective address belong to? A enum GNUNET_NetworkType nt in NBO...
Definition: ats2.h:95
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
Definition: time.c:623
static int free_record(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
Release memory associated with the session record.
struct GNUNET_PeerIdentity peer
Identity of the peer that this session is for.
Definition: ats2.h:154
static char * init
Set to the name of a service to start.
Definition: gnunet-arm.c:69
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
enum GNUNET_NetworkType nt
Which network scope does the respective address belong to?
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
static int send_add_session_cb(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
Send ATS information about the session record.
ATS Service suggests to the transport service to use the address identified by the given session_id f...
Definition: ats.h:237
void GNUNET_ATS_transport_done(struct GNUNET_ATS_TransportHandle *ath)
Client is done with ATS transport, release resources.
static void suggest_cb(void *cls, const struct GNUNET_PeerIdentity *pid, const char *address)
Function called by the solver to prompt the transport to try out a new address.
Allow multiple values with the same key.
Handle to a message queue.
Definition: mq.c:84
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.
void(* GNUNET_ATS_SuggestionCallback)(void *cls, const struct GNUNET_PeerIdentity *pid, const char *address)
Signature of a function called by ATS suggesting transport to try connecting with a particular addres...
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
The identity of the host (wraps the signing key of the peer).
const char * address
Address data.
configuration data
Definition: configuration.c:83
struct GNUNET_TIME_RelativeNBO delay
Delay.
Definition: ats2.h:44
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Definition: scheduler.c:131
struct GNUNET_ATS_Properties properties
Performance data about the session.
uint32_t goodput_in
Confirmed useful payload on this connection to this peer from the other peer.
Definition: ats2.h:60
void GNUNET_ATS_session_update(struct GNUNET_ATS_SessionRecord *ar, const struct GNUNET_ATS_Properties *prop)
We have updated performance statistics for a given session.
struct GNUNET_ATS_SessionRecord * GNUNET_ATS_session_add(struct GNUNET_ATS_TransportHandle *ath, const struct GNUNET_PeerIdentity *pid, const char *address, struct GNUNET_ATS_Session *session, const struct GNUNET_ATS_Properties *prop)
We have a new session ATS should know.
#define GNUNET_MESSAGE_TYPE_ATS_SESSION_DEL
Type of the &#39;struct SessionDelMessage&#39; send by transport clients to ATS to tell ATS that a session is...
#define LOG(kind,...)
Header for all communications.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:821
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_PeerIdentity peer
Which peer is this about? (Technically redundant, as the session_id should be sufficient, but may enable client to find the session faster and/or check consistency).
Definition: ats.h:254
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:351
ATS performance characteristics for an address.
Definition: ats2.h:39
void GNUNET_ATS_session_del(struct GNUNET_ATS_SessionRecord *ar)
A session was destroyed, ATS should now schedule and allocate under the assumption that this ar is no...
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in
How much bandwidth we are allowed for receiving.
Definition: ats2.h:253
static void send_add_session_message(const struct GNUNET_ATS_SessionRecord *ar)
Generate and transmit the struct SessionAddMessage for the given session record.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct GNUNET_TIME_Relative backoff
Reconnect backoff delay.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
int GNUNET_CONTAINER_multipeermap_get_multiple(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map that match a particular key.
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
#define GNUNET_malloc(size)
Wrapper around malloc.
Handle to the ATS subsystem for bandwidth/transport transport information.
struct PropertiesNBO properties
Performance properties of the session.
Definition: ats2.h:159
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
#define GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD
Type of the &#39;struct SessionAddMessage&#39; send by transport clients to ATS to ask ATS to allocate resour...
struct GNUNET_MQ_Handle * mq
Message queue for sending requests to the ATS service.
Bandwidth allocation API for the transport service.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956