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 
39 {
40 
45 
49  const char *address;
50 
62 
67 
72 
77  uint32_t slot;
78 
79 };
80 
81 
86 {
87 
92 
97 
102 
107 
112 
117 
122 
127 
132 
133 };
134 
135 
136 
143 static void
145  const struct GNUNET_ATS_Properties *hbo)
146 {
147  nbo->delay = GNUNET_TIME_relative_hton (hbo->delay);
148  nbo->goodput_out = htonl (hbo->goodput_out);
149  nbo->goodput_in = htonl (hbo->goodput_in);
150  nbo->utilization_out = htonl (hbo->utilization_out);
151  nbo->utilization_in = htonl (hbo->utilization_in);
152  nbo->distance = htonl (hbo->distance);
153  nbo->mtu = htonl (hbo->mtu);
154  nbo->nt = htonl ((uint32_t) hbo->nt);
155  nbo->cc = htonl ((uint32_t) hbo->cc);
156 }
157 
158 
164 static void
166 
167 
173 static void
174 reconnect_task (void *cls)
175 {
176  struct GNUNET_ATS_TransportHandle *ath = cls;
177 
178  ath->task = NULL;
179  reconnect (ath);
180 }
181 
182 
188 static void
190 {
191  if (NULL != ath->mq)
192  {
193  GNUNET_MQ_destroy (ath->mq);
194  ath->mq = NULL;
195  }
196  /* FIXME: do we tell transport service about disconnect events? CON:
197  initially ATS will have a really screwed picture of the world and
198  the rapid change would be bad. PRO: if we don't, ATS and
199  transport may disagree about the allocation for a while...
200  For now: lazy: do nothing. */
204  ath);
205 }
206 
207 
214 static int
216  const struct AddressSuggestionMessage *m)
217 {
218  (void) cls;
220  return GNUNET_SYSERR;
221 }
222 
223 
230 static void
232  const struct AddressSuggestionMessage *m)
233 {
234  struct GNUNET_ATS_TransportHandle *ath = cls;
235  const char *address = (const char *) &m[1];
236 
237  ath->suggest_cb (ath->suggest_cb_cls,
238  &m->peer,
239  address);
240 }
241 
242 
247 {
251  uint32_t session_id;
252 
257 };
258 
259 
268 static int
269 match_session_cb (void *cls,
270  const struct GNUNET_PeerIdentity *pid,
271  void *value)
272 {
273  struct FindContext *fc = cls;
274  struct GNUNET_ATS_SessionRecord *sr = value;
275 
276  (void) pid;
277  if (fc->session_id == sr->slot)
278  {
279  fc->sr = sr;
280  return GNUNET_NO;
281  }
282  return GNUNET_YES;
283 }
284 
285 
286 
295 static struct GNUNET_ATS_SessionRecord *
297  uint32_t session_id,
298  const struct GNUNET_PeerIdentity *pid)
299 {
300  struct FindContext fc = {
302  .sr = NULL
303  };
305  pid,
307  &fc);
308  return fc.sr;
309 }
310 
311 
318 static void
320  const struct SessionAllocationMessage *m)
321 {
322  struct GNUNET_ATS_TransportHandle *ath = cls;
323  struct GNUNET_ATS_SessionRecord *ar;
324  uint32_t session_id;
325 
326  session_id = ntohl (m->session_id);
327  ar = find_session (ath,
328  session_id,
329  &m->peer);
330  if (NULL == ar)
331  {
332  /* this can (rarely) happen if ATS changes an sessiones allocation
333  just when the transport service deleted it */
335  "Allocation ignored, session unknown\n");
336  return;
337  }
340  "ATS allocates bandwidth for peer `%s' using address %s\n",
341  GNUNET_i2s (&ar->pid),
342  ar->address);
343  ath->alloc_cb (ath->alloc_cb_cls,
344  ar->session,
345  m->bandwidth_out,
346  m->bandwidth_in);
347 }
348 
349 
357 static void
358 error_handler (void *cls,
359  enum GNUNET_MQ_Error error)
360 {
361  struct GNUNET_ATS_TransportHandle *ath = cls;
362 
364  "ATS connection died (code %d), reconnecting\n",
365  (int) error);
366  force_reconnect (ath);
367 }
368 
369 
376 static void
378 {
379  struct GNUNET_ATS_TransportHandle *ath = ar->ath;
380  struct GNUNET_MQ_Envelope *ev;
381  struct SessionAddMessage *m;
382  size_t alen;
383 
384  if (NULL == ath->mq)
385  return; /* disconnected, skip for now */
386  alen = strlen (ar->address) + 1;
387  ev = GNUNET_MQ_msg_extra (m,
388  alen,
389  (NULL == ar->session)
392  m->peer = ar->pid;
393  m->session_id = htonl (ar->slot);
395  &ar->properties);
396  GNUNET_memcpy (&m[1],
397  ar->address,
398  alen);
399 
401  "Adding address `%s' for peer `%s'\n",
402  ar->address,
403  GNUNET_i2s (&ar->pid));
404  GNUNET_MQ_send (ath->mq,
405  ev);
406 }
407 
408 
417 static int
419  const struct GNUNET_PeerIdentity *pid,
420  void *value)
421 {
422  struct GNUNET_ATS_SessionRecord *ar = value;
423 
424  (void) cls;
425  (void) pid;
427  return GNUNET_OK;
428 }
429 
430 
436 static void
438 {
439  struct GNUNET_MQ_MessageHandler handlers[] = {
440  GNUNET_MQ_hd_var_size (ats_address_suggestion,
443  ath),
444  GNUNET_MQ_hd_fixed_size (ats_session_allocation,
447  ath),
449  };
450  struct GNUNET_MQ_Envelope *ev;
451  struct GNUNET_MessageHeader *init;
452 
453  GNUNET_assert (NULL == ath->mq);
454  ath->mq = GNUNET_CLIENT_connect (ath->cfg,
455  "ats",
456  handlers,
457  &error_handler,
458  ath);
459  if (NULL == ath->mq)
460  {
461  GNUNET_break (0);
462  force_reconnect (ath);
463  return;
464  }
465  ev = GNUNET_MQ_msg (init,
467  GNUNET_MQ_send (ath->mq,
468  ev);
469  if (NULL == ath->mq)
470  return;
473  ath);
474 }
475 
476 
490  void *alloc_cb_cls,
492  void *suggest_cb_cls)
493 {
495 
496  ath = GNUNET_new (struct GNUNET_ATS_TransportHandle);
497  ath->cfg = cfg;
498  ath->suggest_cb = suggest_cb;
500  ath->alloc_cb = alloc_cb;
501  ath->alloc_cb_cls = alloc_cb_cls;
503  GNUNET_YES);
504  reconnect (ath);
505  return ath;
506 }
507 
508 
517 static int
518 free_record (void *cls,
519  const struct GNUNET_PeerIdentity *pid,
520  void *value)
521 {
522  struct GNUNET_ATS_SessionRecord *ar = value;
523 
524  (void) cls;
525  (void) pid;
526  GNUNET_free (ar);
527  return GNUNET_OK;
528 }
529 
530 
536 void
538 {
539  if (NULL != ath->mq)
540  {
541  GNUNET_MQ_destroy (ath->mq);
542  ath->mq = NULL;
543  }
544  if (NULL != ath->task)
545  {
547  ath->task = NULL;
548  }
550  &free_record,
551  NULL);
553  GNUNET_free (ath);
554 }
555 
556 
573  const struct GNUNET_PeerIdentity *pid,
574  const char *address,
575  struct GNUNET_ATS_Session *session,
576  const struct GNUNET_ATS_Properties *prop)
577 {
578  struct GNUNET_ATS_SessionRecord *ar;
579  uint32_t s;
580  size_t alen;
581 
582  if (NULL == address)
583  {
584  /* we need a valid address */
585  GNUNET_break (0);
586  return NULL;
587  }
588  alen = strlen (address) + 1;
589  if ( (alen + sizeof (struct SessionAddMessage) >= GNUNET_MAX_MESSAGE_SIZE) ||
590  (alen >= GNUNET_MAX_MESSAGE_SIZE) )
591  {
592  /* address too large for us, this should not happen */
593  GNUNET_break (0);
594  return NULL;
595  }
596 
597  /* Spin 's' until we find an unused session ID for this pid */
599  UINT32_MAX);
600  NULL != find_session (ath,
601  s,
602  pid);
603  s++) ;
604 
605  alen = strlen (address) + 1;
606  ar = GNUNET_malloc (sizeof (struct GNUNET_ATS_SessionRecord) + alen);
607  ar->ath = ath;
608  ar->slot = s;
609  ar->session = session;
610  ar->address = (const char *) &ar[1];
611  ar->pid = *pid;
612  ar->properties = *prop;
613  memcpy (&ar[1],
614  address,
615  alen);
617  &ar->pid,
618  ar,
621  return ar;
622 }
623 
624 
636 void
638  const struct GNUNET_ATS_Properties *prop)
639 {
640  struct GNUNET_ATS_TransportHandle *ath = ar->ath;
641  struct GNUNET_MQ_Envelope *ev;
642  struct SessionUpdateMessage *m;
643 
645  "Updating address `%s' for peer `%s'\n",
646  ar->address,
647  GNUNET_i2s (&ar->pid));
648  ar->properties = *prop;
649  if (NULL == ath->mq)
650  return; /* disconnected, skip for now */
651  ev = GNUNET_MQ_msg (m,
653  m->session_id = htonl (ar->slot);
654  m->peer = ar->pid;
656  &ar->properties);
657  GNUNET_MQ_send (ath->mq,
658  ev);
659 }
660 
661 
669 void
671 {
672  struct GNUNET_ATS_TransportHandle *ath = ar->ath;
673  struct GNUNET_MQ_Envelope *ev;
674  struct SessionDelMessage *m;
675 
677  "Deleting address `%s' for peer `%s'\n",
678  ar->address,
679  GNUNET_i2s (&ar->pid));
680  if (NULL == ath->mq)
681  return;
682  ev = GNUNET_MQ_msg (m,
684  m->session_id = htonl (ar->slot);
685  m->peer = ar->pid;
686  GNUNET_MQ_send (ath->mq,
687  ev);
688 }
689 
690 
691 /* 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:210
uint32_t cc
What characteristics does this communicator have? A enum GNUNET_TRANSPORT_CommunicatorCharacteristics...
Definition: ats2.h:103
#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:78
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:901
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:255
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:155
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:227
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.
uint32_t goodput_out
Confirmed successful payload on this connection from this peer to the other peer. ...
Definition: ats2.h:54
#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:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#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:188
#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:143
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:70
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:91
#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:1246
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 ...
#define GNUNET_memcpy(dst, src, n)
uint32_t distance
Distance on network layer (required for distance-vector routing) in hops.
Definition: ats2.h:84
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:178
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:237
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:195
uint32_t session_id
Internal number this client uses to refer to this session.
Definition: ats2.h:220
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:260
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:248
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:200
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
#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:97
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
Definition: time.c:622
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:160
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:248
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:85
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:85
struct GNUNET_TIME_RelativeNBO delay
Delay.
Definition: ats2.h:46
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Definition: scheduler.c:134
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:62
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:824
#define GNUNET_YES
Definition: gnunet_common.h:80
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:266
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:353
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:265
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:165
#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:965