-remove debug message
[oweals/gnunet.git] / src / include / gnunet_nt_lib.h
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  */
20 /**
21  * @file network type characterization
22  * @author Christian Grothoff
23  * @author Matthias Wachs
24  *
25  * @defgroup nt  network type characterization
26  *
27  * @{
28  */
29 #ifndef GNUNET_NT_LIB_H
30 #define GNUNET_NT_LIB_H
31
32 /**
33  * Types of networks (with separate quotas) we support.
34  */
35 enum GNUNET_NetworkType
36 {
37   /**
38    * Category of last resort.
39    */
40   GNUNET_NT_UNSPECIFIED = 0,
41
42   /**
43    * Loopback (same host).
44    */
45   GNUNET_NT_LOOPBACK = 1,
46
47   /**
48    * Local area network.
49    */
50   GNUNET_NT_LAN = 2,
51
52   /**
53    * Wide area network (i.e. Internet)
54    */
55   GNUNET_NT_WAN = 3,
56
57   /**
58    * Wireless LAN (i.e. 802.11abgn)
59    */
60   GNUNET_NT_WLAN = 4,
61
62   /**
63    * Bluetooth LAN
64    */
65   GNUNET_NT_BT = 5
66
67 /**
68  * Number of network types supported by ATS
69  */
70 #define GNUNET_NT_COUNT 6
71 };
72
73
74 /**
75  * Convert a `enum GNUNET_NetworkType` to a string
76  *
77  * @param net the network type
78  * @return a string or NULL if invalid
79  */
80 const char *
81 GNUNET_NT_to_string (enum GNUNET_NetworkType net);
82
83
84 /**
85  * Handle for the LAN Characterization library.
86  */
87 struct GNUNET_NT_InterfaceScanner;
88
89
90 /**
91  * Returns where the address is located: loopback, LAN or WAN.
92  *
93  * @param is handle from #GNUNET_ATS_interface_scanner_init()
94  * @param addr address
95  * @param addrlen address length
96  * @return type of the network the address belongs to
97  */
98 enum GNUNET_NetworkType
99 GNUNET_NT_scanner_get_type (struct GNUNET_NT_InterfaceScanner *is,
100                             const struct sockaddr *addr,
101                             socklen_t addrlen);
102
103
104 /**
105  * Initialize the address characterization client handle.
106  *
107  * @return scanner handle, NULL on error
108  */
109 struct GNUNET_NT_InterfaceScanner *
110 GNUNET_NT_scanner_init (void);
111
112
113 /**
114  * Terminate interface scanner.
115  *
116  * @param is scanner we are done with
117  */
118 void
119 GNUNET_NT_scanner_done (struct GNUNET_NT_InterfaceScanner *is);
120
121
122 #endif
123
124 /** @} */  /* end of group */