aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/include/Makefile.am2
-rw-r--r--src/include/gnunet_fragmentation_lib.h235
-rw-r--r--src/include/gnunet_hello_lib.h2
-rw-r--r--src/include/gnunet_nt_lib.h5
-rw-r--r--src/include/gnunet_transport_application_service.h3
-rw-r--r--src/include/gnunet_transport_communication_service.h3
-rw-r--r--src/include/gnunet_util_lib.h1
-rw-r--r--src/nt/Makefile.am33
-rw-r--r--src/nt/meson.build21
-rw-r--r--src/transport/gnunet-communicator-tcp.c1
-rw-r--r--src/transport/gnunet-communicator-udp.c1
-rw-r--r--src/transport/gnunet-communicator-unix.c1
-rw-r--r--src/util/Makefile.am2
-rw-r--r--src/util/nt.c (renamed from src/nt/nt.c)3
15 files changed, 11 insertions, 303 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 43dc8d1b8..2112bfca8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,7 +34,6 @@ REST_DIR = rest
34SUBDIRS = \ 34SUBDIRS = \
35 include $(INTLEMU_SUBDIRS) \ 35 include $(INTLEMU_SUBDIRS) \
36 util \ 36 util \
37 nt \
38 hello \ 37 hello \
39 block \ 38 block \
40 statistics \ 39 statistics \
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 2f45ebdaf..e39f467b9 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -47,8 +47,6 @@ gnunetinclude_HEADERS = \
47 gnunet_dnsstub_lib.h \ 47 gnunet_dnsstub_lib.h \
48 gnunet_dns_service.h \ 48 gnunet_dns_service.h \
49 gnunet_error_codes.h \ 49 gnunet_error_codes.h \
50 gnunet_fragmentation_lib.h \
51 gnunet_friends_lib.h \
52 gnunet_fs_service.h \ 50 gnunet_fs_service.h \
53 gnunet_getopt_lib.h \ 51 gnunet_getopt_lib.h \
54 gnunet_gns_service.h \ 52 gnunet_gns_service.h \
diff --git a/src/include/gnunet_fragmentation_lib.h b/src/include/gnunet_fragmentation_lib.h
deleted file mode 100644
index c8e99826a..000000000
--- a/src/include/gnunet_fragmentation_lib.h
+++ /dev/null
@@ -1,235 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2009, 2011, 2015 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 * @addtogroup Backbone
22 * @{
23 *
24 * @author Christian Grothoff
25 *
26 * @file
27 * Library to help fragment messages
28 *
29 * @defgroup fragmentation Fragmentation library
30 * Library to help fragment messages
31 * @{
32 *
33 * @todo Consider additional flow-control for sending from
34 * fragmentation based on continuations.
35 */
36
37#ifndef GNUNET_FRAGMENTATION_LIB_H
38#define GNUNET_FRAGMENTATION_LIB_H
39
40
41#include "gnunet_util_lib.h"
42#include "gnunet_statistics_service.h"
43
44#ifdef __cplusplus
45extern "C"
46{
47#if 0 /* keep Emacsens' auto-indent happy */
48}
49#endif
50#endif
51
52
53/**
54 * Fragmentation context.
55 */
56struct GNUNET_FRAGMENT_Context;
57
58
59/**
60 * Function that is called with messages created by the fragmentation
61 * module. In the case of the 'proc' callback of the
62 * #GNUNET_FRAGMENT_context_create() function, this function must
63 * eventually call #GNUNET_FRAGMENT_context_transmission_done().
64 *
65 * @param cls closure
66 * @param msg the message that was created
67 */
68typedef void
69(*GNUNET_FRAGMENT_MessageProcessor) (void *cls,
70 const struct GNUNET_MessageHeader *msg);
71
72
73/**
74 * Create a fragmentation context for the given message.
75 * Fragments the message into fragments of size @a mtu or
76 * less. Calls @a proc on each un-acknowledged fragment,
77 * using both the expected @a msg_delay between messages and
78 * acknowledgements and the given @a tracker to guide the
79 * frequency of calls to @a proc.
80 *
81 * @param stats statistics context
82 * @param mtu the maximum message size for each fragment
83 * @param tracker bandwidth tracker to use for flow control (can be NULL)
84 * @param msg_delay initial delay to insert between fragment transmissions
85 * based on previous messages
86 * @param ack_delay expected delay between fragment transmission
87 * and ACK based on previous messages
88 * @param msg the message to fragment
89 * @param proc function to call for each fragment to transmit
90 * @param proc_cls closure for proc
91 * @return the fragmentation context
92 */
93struct GNUNET_FRAGMENT_Context *
94GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
95 uint16_t mtu,
96 struct GNUNET_BANDWIDTH_Tracker *tracker,
97 struct GNUNET_TIME_Relative msg_delay,
98 struct GNUNET_TIME_Relative ack_delay,
99 const struct GNUNET_MessageHeader *msg,
100 GNUNET_FRAGMENT_MessageProcessor proc,
101 void *proc_cls);
102
103
104/**
105 * Continuation to call from the 'proc' function after the fragment
106 * has been transmitted (and hence the next fragment can now be
107 * given to proc).
108 *
109 * @param fc fragmentation context
110 */
111void
112GNUNET_FRAGMENT_context_transmission_done (struct GNUNET_FRAGMENT_Context *fc);
113
114
115/**
116 * Process an acknowledgement message we got from the other
117 * side (to control re-transmits).
118 *
119 * @param fc fragmentation context
120 * @param msg acknowledgement message we received
121 * @return #GNUNET_OK if this ack completes the work of the 'fc'
122 * (all fragments have been received);
123 * #GNUNET_NO if more messages are pending
124 * #GNUNET_SYSERR if this ack is not valid for this fc
125 */
126int
127GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
128 const struct GNUNET_MessageHeader *msg);
129
130
131/**
132 * Destroy the given fragmentation context (stop calling 'proc', free
133 * resources).
134 *
135 * @param fc fragmentation context
136 * @param msg_delay where to store average delay between individual message transmissions the
137 * last message (OUT only)
138 * @param ack_delay where to store average delay between transmission and ACK for the
139 * last message, set to FOREVER if the message was not fully transmitted (OUT only)
140 */
141void
142GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc,
143 struct GNUNET_TIME_Relative *msg_delay,
144 struct GNUNET_TIME_Relative *ack_delay);
145
146
147/**
148 * Convert an ACK message to a printable format suitable for logging.
149 *
150 * @param ack message to print
151 * @return ack in human-readable format
152 */
153const char *
154GNUNET_FRAGMENT_print_ack (const struct GNUNET_MessageHeader *ack);
155
156
157/**
158 * Defragmentation context (one per connection).
159 */
160struct GNUNET_DEFRAGMENT_Context;
161
162
163/**
164 * Function that is called with acknowledgement messages created by
165 * the fragmentation module. Acknowledgements are cumulative,
166 * so it is OK to only transmit the 'latest' ack message for the same
167 * message ID.
168 *
169 * @param cls closure
170 * @param id unique message ID (modulo collisions)
171 * @param msg the message that was created
172 */
173typedef void
174(*GNUNET_DEFRAGMENT_AckProcessor) (void *cls,
175 uint32_t id,
176 const struct GNUNET_MessageHeader *msg);
177
178
179/**
180 * Create a defragmentation context.
181 *
182 * @param stats statistics context
183 * @param mtu the maximum message size for each fragment
184 * @param num_msgs how many fragmented messages
185 * to we defragment at most at the same time?
186 * @param cls closure for @a proc and @a ackp
187 * @param proc function to call with defragmented messages
188 * @param ackp function to call with acknowledgements (to send
189 * back to the other side)
190 * @return the defragmentation context
191 */
192struct GNUNET_DEFRAGMENT_Context *
193GNUNET_DEFRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
194 uint16_t mtu,
195 unsigned int num_msgs,
196 void *cls,
197 GNUNET_FRAGMENT_MessageProcessor proc,
198 GNUNET_DEFRAGMENT_AckProcessor ackp);
199
200
201/**
202 * Destroy the given defragmentation context.
203 *
204 * @param dc defragmentation context
205 */
206void
207GNUNET_DEFRAGMENT_context_destroy (struct GNUNET_DEFRAGMENT_Context *dc);
208
209
210/**
211 * We have received a fragment. Process it.
212 *
213 * @param dc the context
214 * @param msg the message that was received
215 * @return #GNUNET_OK on success,
216 * #GNUNET_NO if this was a duplicate,
217 * #GNUNET_SYSERR on error
218 */
219int
220GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
221 const struct GNUNET_MessageHeader *msg);
222
223
224#if 0 /* keep Emacsens' auto-indent happy */
225{
226#endif
227#ifdef __cplusplus
228}
229#endif
230
231#endif
232
233/** @} */ /* end of group */
234
235/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h
index 20a61cbfb..b57f48ac5 100644
--- a/src/include/gnunet_hello_lib.h
+++ b/src/include/gnunet_hello_lib.h
@@ -476,7 +476,7 @@ GNUNET_HELLO_parse_uri (const char *uri,
476 476
477 477
478/* NG API */ 478/* NG API */
479#include "gnunet_nt_lib.h" 479#include "gnunet_util_lib.h"
480 480
481 481
482/** 482/**
diff --git a/src/include/gnunet_nt_lib.h b/src/include/gnunet_nt_lib.h
index 144a3daa3..014b4fbe0 100644
--- a/src/include/gnunet_nt_lib.h
+++ b/src/include/gnunet_nt_lib.h
@@ -17,6 +17,11 @@
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19 */ 19 */
20
21#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
22#error "Only <gnunet_util_lib.h> can be included directly."
23#endif
24
20/** 25/**
21 * @addtogroup Backbone 26 * @addtogroup Backbone
22 * @{ 27 * @{
diff --git a/src/include/gnunet_transport_application_service.h b/src/include/gnunet_transport_application_service.h
index 47f07a5f8..66512089a 100644
--- a/src/include/gnunet_transport_application_service.h
+++ b/src/include/gnunet_transport_application_service.h
@@ -19,7 +19,7 @@
19 */ 19 */
20/** 20/**
21 * @addtogroup Backbone 21 * @addtogroup Backbone
22 * @{ 22 * @{
23 * 23 *
24 * @file 24 * @file
25 * Bandwidth allocation API for applications to interact with 25 * Bandwidth allocation API for applications to interact with
@@ -36,7 +36,6 @@
36 36
37#include "gnunet_constants.h" 37#include "gnunet_constants.h"
38#include "gnunet_util_lib.h" 38#include "gnunet_util_lib.h"
39#include "gnunet_nt_lib.h"
40#include "gnunet_testing_lib.h" 39#include "gnunet_testing_lib.h"
41#include "gnunet_testing_ng_lib.h" 40#include "gnunet_testing_ng_lib.h"
42 41
diff --git a/src/include/gnunet_transport_communication_service.h b/src/include/gnunet_transport_communication_service.h
index a705b1970..92facb0e0 100644
--- a/src/include/gnunet_transport_communication_service.h
+++ b/src/include/gnunet_transport_communication_service.h
@@ -47,7 +47,6 @@ extern "C" {
47 47
48 48
49#include "gnunet_util_lib.h" 49#include "gnunet_util_lib.h"
50#include "gnunet_nt_lib.h"
51 50
52/** 51/**
53 * Version number of the transport communication API. 52 * Version number of the transport communication API.
@@ -139,7 +138,7 @@ typedef void (*GNUNET_TRANSPORT_CommunicatorNotify) (
139 * Connect to the transport service. 138 * Connect to the transport service.
140 * 139 *
141 * @param cfg configuration to use 140 * @param cfg configuration to use
142 * @param config_section_name section of the configuration to use for 141 * @param config_section_name section of the configuration to use for
143 * options 142 * options
144 * @param addr_prefix address prefix for addresses supported by this 143 * @param addr_prefix address prefix for addresses supported by this
145 * communicator, could be NULL for incoming-only communicators 144 * communicator, could be NULL for incoming-only communicators
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h
index c8737dc60..ee850bc3c 100644
--- a/src/include/gnunet_util_lib.h
+++ b/src/include/gnunet_util_lib.h
@@ -77,6 +77,7 @@ extern "C"
77#include "gnunet_helper_lib.h" 77#include "gnunet_helper_lib.h"
78#include "gnunet_mst_lib.h" 78#include "gnunet_mst_lib.h"
79#include "gnunet_mq_lib.h" 79#include "gnunet_mq_lib.h"
80#include "gnunet_nt_lib.h"
80#include "gnunet_nc_lib.h" 81#include "gnunet_nc_lib.h"
81#include "gnunet_op_lib.h" 82#include "gnunet_op_lib.h"
82#include "gnunet_os_lib.h" 83#include "gnunet_os_lib.h"
diff --git a/src/nt/Makefile.am b/src/nt/Makefile.am
deleted file mode 100644
index 2c55ab88f..000000000
--- a/src/nt/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
1# This Makefile.am is in the public domain
2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4if USE_COVERAGE
5 AM_CFLAGS = --coverage
6endif
7
8lib_LTLIBRARIES = libgnunetnt.la
9
10libgnunetnt_la_SOURCES = \
11 nt.c
12
13libgnunetnt_la_LIBADD = \
14 $(top_builddir)/src/util/libgnunetutil.la
15libgnunetnt_la_LDFLAGS = \
16 $(GN_LIB_LDFLAGS) \
17 $(GN_LIBINTL) \
18 -version-info 0:0:0
19
20#if ENABLE_TEST_RUN
21#TESTS = \
22# test_nt
23#endif
24
25#check_PROGRAMS= \
26# test_nt
27#
28#test_nt_SOURCES = \
29# test_nt.c
30#test_nt_LDADD = \
31# libgnunetnt.la \
32# $(top_builddir)/src/util/libgnunetutil.la \
33# $(XLIB)
diff --git a/src/nt/meson.build b/src/nt/meson.build
deleted file mode 100644
index 9b2a97568..000000000
--- a/src/nt/meson.build
+++ /dev/null
@@ -1,21 +0,0 @@
1libgnunetnt_src = ['nt.c']
2
3if get_option('monolith')
4 foreach p : libgnunetnt_src
5 gnunet_src += 'nt/' + p
6 endforeach
7 subdir_done()
8endif
9
10libgnunetnt = library('gnunetnt',
11 libgnunetnt_src,
12 soversion: '0',
13 version: '0.0.0',
14 dependencies: libgnunetutil_dep,
15 include_directories: [incdir, configuration_inc],
16 install: true,
17 install_dir: get_option('libdir'))
18libgnunetnt_dep = declare_dependency(link_with : libgnunetnt)
19pkg.generate(libgnunetnt, url: 'https://www.gnunet.org',
20 description : 'Provides API for accessing GNUnet NT')
21
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 1273465c3..e7d989021 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -34,7 +34,6 @@
34#include "gnunet_protocols.h" 34#include "gnunet_protocols.h"
35#include "gnunet_signatures.h" 35#include "gnunet_signatures.h"
36#include "gnunet_constants.h" 36#include "gnunet_constants.h"
37#include "gnunet_nt_lib.h"
38#include "gnunet_nat_service.h" 37#include "gnunet_nat_service.h"
39#include "gnunet_statistics_service.h" 38#include "gnunet_statistics_service.h"
40#include "gnunet_transport_communication_service.h" 39#include "gnunet_transport_communication_service.h"
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index a58423c95..f9bbe91f6 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -43,7 +43,6 @@
43#include "gnunet_protocols.h" 43#include "gnunet_protocols.h"
44#include "gnunet_signatures.h" 44#include "gnunet_signatures.h"
45#include "gnunet_constants.h" 45#include "gnunet_constants.h"
46#include "gnunet_nt_lib.h"
47#include "gnunet_nat_service.h" 46#include "gnunet_nat_service.h"
48#include "gnunet_statistics_service.h" 47#include "gnunet_statistics_service.h"
49#include "gnunet_transport_application_service.h" 48#include "gnunet_transport_application_service.h"
diff --git a/src/transport/gnunet-communicator-unix.c b/src/transport/gnunet-communicator-unix.c
index d7e18f87a..0ff16ab08 100644
--- a/src/transport/gnunet-communicator-unix.c
+++ b/src/transport/gnunet-communicator-unix.c
@@ -30,7 +30,6 @@
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_protocols.h" 31#include "gnunet_protocols.h"
32#include "gnunet_constants.h" 32#include "gnunet_constants.h"
33#include "gnunet_nt_lib.h"
34#include "gnunet_statistics_service.h" 33#include "gnunet_statistics_service.h"
35#include "gnunet_transport_communication_service.h" 34#include "gnunet_transport_communication_service.h"
36 35
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 431bd7d0d..3647ca08e 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -88,6 +88,7 @@ libgnunetutil_la_SOURCES = \
88 mq.c \ 88 mq.c \
89 nc.c \ 89 nc.c \
90 network.c \ 90 network.c \
91 nt.c \
91 op.c \ 92 op.c \
92 os_installation.c \ 93 os_installation.c \
93 os_network.c \ 94 os_network.c \
@@ -334,7 +335,6 @@ check_PROGRAMS = \
334 test_os_start_process \ 335 test_os_start_process \
335 test_common_logging_runtime_loglevels 336 test_common_logging_runtime_loglevels
336 337
337
338test_child_management_SOURCES = \ 338test_child_management_SOURCES = \
339 test_child_management.c 339 test_child_management.c
340test_child_management_LDADD = \ 340test_child_management_LDADD = \
diff --git a/src/nt/nt.c b/src/util/nt.c
index 8dfacb02b..24471d9ad 100644
--- a/src/nt/nt.c
+++ b/src/util/nt.c
@@ -18,14 +18,13 @@
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19 */ 19 */
20/** 20/**
21 * @file nt/nt_api_scanner.c 21 * @file util/nt.c
22 * @brief LAN interface scanning to determine IPs in LAN 22 * @brief LAN interface scanning to determine IPs in LAN
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * @author Matthias Wachs 24 * @author Matthias Wachs
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_nt_lib.h"
29 28
30/** 29/**
31 * How frequently do we scan the interfaces for changes to the addresses? 30 * How frequently do we scan the interfaces for changes to the addresses?