optical changes, small fix, draft for notification
[oweals/gnunet.git] / src / transport / gnunet-service-transport_ats.h
1 /*
2      This file is part of GNUnet.
3      (C) 2015 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      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      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20 /**
21  * @file transport/gnunet-service-transport_ats.h
22  * @brief interfacing between transport and ATS service
23  * @author Christian Grothoff
24  *
25  * FIXME:
26  * - add API to give ATS feedback about an address that was
27  *   suggested but did not work out (without fully 'deleting'
28  *   it forever)
29  * - improve ATS API to take advantage of this new subsystem
30  *   when calling ATS functions, make ATS API match this API
31  *   more closely
32  * - combine with API to tell ATS about address "use"
33  */
34 #ifndef GNUNET_SERVICE_TRANSPORT_ATS_H
35 #define GNUNET_SERVICE_TRANSPORT_ATS_H
36
37 #include "gnunet_ats_service.h"
38
39 /**
40  * Initialize ATS subsystem.
41  */
42 void
43 GST_ats_init (void);
44
45
46 /**
47  * Shutdown ATS subsystem.
48  */
49 void
50 GST_ats_done (void);
51
52
53 /**
54  * Notify ATS about the new address including the network this address is
55  * located in.
56  *
57  * @param address the address
58  * @param session the session
59  * @param ats ats information
60  * @param ats_count number of @a ats information
61  */
62 void
63 GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
64                      struct Session *session,
65                      const struct GNUNET_ATS_Information *ats,
66                      uint32_t ats_count);
67
68
69 /**
70  * Notify ATS about a new session now existing for the given
71  * address.
72  *
73  * @param address the address
74  * @param session the session
75  */
76 void
77 GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
78                      struct Session *session);
79
80
81 /**
82  * Notify ATS about property changes to an address
83  *
84  * @param address the address
85  * @param session the session
86  * @param ats performance information
87  * @param ats_count number of elements in @a ats
88  */
89 void
90 GST_ats_update_metrics (const struct GNUNET_HELLO_Address *address,
91                         struct Session *session,
92                         const struct GNUNET_ATS_Information *ats,
93                         uint32_t ats_count);
94
95
96 /**
97  * Notify ATS that the session (but not the address) of
98  * a given address is no longer relevant.
99  *
100  * @param address the address
101  * @param session the session
102  */
103 void
104 GST_ats_del_session (const struct GNUNET_HELLO_Address *address,
105                      struct Session *session);
106
107
108 /**
109  * Notify ATS that the address has expired and thus cannot
110  * be used any longer.  This function must only be called
111  * if the corresponding session is already gone.
112  *
113  * @param address the address
114  */
115 void
116 GST_ats_expire_address (const struct GNUNET_HELLO_Address *address);
117
118
119 #endif