aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_transport_hello_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_transport_hello_service.h')
-rw-r--r--src/include/gnunet_transport_hello_service.h201
1 files changed, 0 insertions, 201 deletions
diff --git a/src/include/gnunet_transport_hello_service.h b/src/include/gnunet_transport_hello_service.h
deleted file mode 100644
index fecffd527..000000000
--- a/src/include/gnunet_transport_hello_service.h
+++ /dev/null
@@ -1,201 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009-2016 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/**
22 * @author Christian Grothoff
23 *
24 * @file
25 * obtain information about our current address
26 *
27 * @deprecated, in TNG applications should query PEERSTORE directly!
28 *
29 * @defgroup transport Transport service
30 * address information
31 *
32 * @see [Documentation](https://gnunet.org/transport-service)
33 *
34 * @{
35 */
36#ifndef GNUNET_TRANSPORT_HELLO_SERVICE_H
37#define GNUNET_TRANSPORT_HELLO_SERVICE_H
38
39#ifdef __cplusplus
40extern "C" {
41#if 0 /* keep Emacsens' auto-indent happy */
42}
43#endif
44#endif
45
46#include "gnunet_util_lib.h"
47#include "gnunet_ats_service.h"
48
49/**
50 * Version number of the transport API.
51 */
52#define GNUNET_TRANSPORT_HELLO_VERSION 0x00000000
53
54
55/**
56 * Some addresses contain sensitive information or are
57 * not suitable for global distribution. We use address
58 * classes to filter addresses by which domain they make
59 * sense to be used in. These are used in a bitmask.
60 */
61enum GNUNET_TRANSPORT_AddressClass
62{
63 /**
64 * No address.
65 */
66 GNUNET_TRANSPORT_AC_NONE = 0,
67
68 /**
69 * Addresses that fall into no other category
70 * (i.e. incoming which we cannot use elsewhere).
71 */
72 GNUNET_TRANSPORT_AC_OTHER = 1,
73
74 /**
75 * Addresses that are global and are insensitive
76 * (i.e. IPv4).
77 */
78 GNUNET_TRANSPORT_AC_GLOBAL = 2,
79
80 /**
81 * Addresses that are global and are sensitive
82 * (i.e. IPv6 with our MAC).
83 */
84 GNUNET_TRANSPORT_AC_GLOBAL_PRIVATE = 4,
85
86 /**
87 * Addresses useful in the local wired network,
88 * i.e. a MAC. Sensitive, but obvious to people nearby.
89 * Useful for broadcasts.
90 */
91 GNUNET_TRANSPORT_AC_LAN = 8,
92
93 /**
94 * Addresses useful in the local wireless network,
95 * i.e. a MAC. Sensitive, but obvious to people nearby.
96 * Useful for broadcasts.
97 */
98 GNUNET_TRANSPORT_AC_WLAN = 16,
99
100 /**
101 * Addresses useful in the local bluetooth network. Sensitive, but
102 * obvious to people nearby. Useful for broadcasts.
103 */
104 GNUNET_TRANSPORT_AC_BT = 32,
105
106 /**
107 * Bitmask for "any" address.
108 */
109 GNUNET_TRANSPORT_AC_ANY = 65535
110};
111
112
113/**
114 * Function called whenever there is an update to the
115 * HELLO of this peer.
116 *
117 * @param cls closure
118 * @param hello our updated HELLO
119 */
120typedef void (*GNUNET_TRANSPORT_HelloUpdateCallback) (
121 void *cls,
122 const struct GNUNET_MessageHeader *hello);
123
124
125/**
126 * Handle to cancel a #GNUNET_TRANSPORT_hello_get() operation.
127 */
128struct GNUNET_TRANSPORT_HelloGetHandle;
129
130
131/**
132 * Obtain updates on changes to the HELLO message for this peer. The callback
133 * given in this function is never called synchronously.
134 *
135 * @param cfg configuration to use
136 * @param ac which network type should the addresses from the HELLO belong to?
137 * @param rec function to call with the HELLO
138 * @param rec_cls closure for @a rec
139 * @return handle to cancel the operation
140 */
141struct GNUNET_TRANSPORT_HelloGetHandle *
142GNUNET_TRANSPORT_hello_get (const struct GNUNET_CONFIGURATION_Handle *cfg,
143 enum GNUNET_TRANSPORT_AddressClass ac,
144 GNUNET_TRANSPORT_HelloUpdateCallback rec,
145 void *rec_cls);
146
147
148/**
149 * Stop receiving updates about changes to our HELLO message.
150 *
151 * @param ghh handle to cancel
152 */
153void
154GNUNET_TRANSPORT_hello_get_cancel (struct GNUNET_TRANSPORT_HelloGetHandle *ghh);
155
156
157/**
158 * Function with addresses found in a HELLO.
159 *
160 * @param cls closure
161 * @param peer identity of the peer
162 * @param address the address (UTF-8, 0-terminated)
163 * @param nt network type of the address
164 * @param expiration when does this address expire?
165 */
166typedef void (*GNUNET_TRANSPORT_AddressCallback) (
167 void *cls,
168 const struct GNUNET_PeerIdentity *peer,
169 const char *address,
170 enum GNUNET_NetworkType nt,
171 struct GNUNET_TIME_Absolute expiration);
172
173
174/**
175 * Parse a HELLO message that we have received into its
176 * constituent addresses.
177 *
178 * @param hello message to parse
179 * @param cb function to call on each address found
180 * @param cb_cls closure for @a cb
181 * @return #GNUNET_OK if hello was well-formed, #GNUNET_SYSERR if not
182 */
183int
184GNUNET_TRANSPORT_hello_parse (const struct GNUNET_MessageHeader *hello,
185 GNUNET_TRANSPORT_AddressCallback cb,
186 void *cb_cls);
187
188
189#if 0 /* keep Emacsens' auto-indent happy */
190{
191#endif
192#ifdef __cplusplus
193}
194#endif
195
196/* ifndef GNUNET_TRANSPORT_HELLO_SERVICE_H */
197#endif
198
199/** @} */ /* end of group */
200
201/* end of gnunet_transport_hello_service.h */