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