gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 02/02: UTIL: Incorporate nt component. Fixes #7955


From: gnunet
Subject: [gnunet] 02/02: UTIL: Incorporate nt component. Fixes #7955
Date: Fri, 13 Oct 2023 23:03:44 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 5b8a20569176983c441c4d48030d213f55d95f99
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Fri Oct 13 23:03:36 2023 +0200

    UTIL: Incorporate nt component. Fixes #7955
---
 configure.ac                                       |   2 -
 po/POTFILES.in                                     |   2 +-
 src/Makefile.am                                    |   1 -
 src/include/Makefile.am                            |   2 -
 src/include/gnunet_fragmentation_lib.h             | 235 ---------------------
 src/include/gnunet_hello_lib.h                     |   2 +-
 src/include/gnunet_nt_lib.h                        |   5 +
 src/include/gnunet_transport_application_service.h |   3 +-
 .../gnunet_transport_communication_service.h       |   3 +-
 src/include/gnunet_util_lib.h                      |   1 +
 src/nt/Makefile.am                                 |  33 ---
 src/nt/meson.build                                 |  21 --
 src/transport/gnunet-communicator-tcp.c            |   1 -
 src/transport/gnunet-communicator-udp.c            |   1 -
 src/transport/gnunet-communicator-unix.c           |   1 -
 src/util/Makefile.am                               |   2 +-
 src/{nt => util}/nt.c                              |   3 +-
 17 files changed, 12 insertions(+), 306 deletions(-)

diff --git a/configure.ac b/configure.ac
index ba7bc4e21..b6d78c259 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1271,7 +1271,6 @@ src/nat-auto/Makefile
 src/nat-auto/nat-auto.conf
 src/nse/Makefile
 src/nse/nse.conf
-src/nt/Makefile
 src/peerstore/Makefile
 src/peerstore/peerstore.conf
 src/pq/Makefile
@@ -1323,7 +1322,6 @@ pkgconfig/gnunetdatacache.pc
 pkgconfig/gnunetdatastore.pc
 pkgconfig/gnunetdht.pc
 pkgconfig/gnunetdns.pc
-pkgconfig/gnunetfragmentation.pc
 pkgconfig/gnunetfs.pc
 pkgconfig/gnunetgns.pc
 pkgconfig/gnunethello.pc
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 52f79c89c..08315ecce 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -254,7 +254,6 @@ src/nse/gnunet-nse-profiler.c
 src/nse/gnunet-nse.c
 src/nse/gnunet-service-nse.c
 src/nse/nse_api.c
-src/nt/nt.c
 src/peerstore/gnunet-peerstore.c
 src/peerstore/gnunet-service-peerstore.c
 src/peerstore/peerstore_api.c
@@ -474,6 +473,7 @@ src/util/mq.c
 src/util/mst.c
 src/util/nc.c
 src/util/network.c
+src/util/nt.c
 src/util/op.c
 src/util/os_installation.c
 src/util/os_network.c
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
 SUBDIRS = \
   include $(INTLEMU_SUBDIRS) \
   util \
-  nt \
   hello \
   block \
   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 = \
   gnunet_dnsstub_lib.h \
   gnunet_dns_service.h \
   gnunet_error_codes.h \
-  gnunet_fragmentation_lib.h \
-  gnunet_friends_lib.h \
   gnunet_fs_service.h \
   gnunet_getopt_lib.h \
   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 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2009, 2011, 2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @addtogroup Backbone
- * @{
- *
- * @author Christian Grothoff
- *
- * @file
- * Library to help fragment messages
- *
- * @defgroup fragmentation  Fragmentation library
- * Library to help fragment messages
- * @{
- *
- * @todo Consider additional flow-control for sending from
- *       fragmentation based on continuations.
- */
-
-#ifndef GNUNET_FRAGMENTATION_LIB_H
-#define GNUNET_FRAGMENTATION_LIB_H
-
-
-#include "gnunet_util_lib.h"
-#include "gnunet_statistics_service.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0                           /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-
-/**
- * Fragmentation context.
- */
-struct GNUNET_FRAGMENT_Context;
-
-
-/**
- * Function that is called with messages created by the fragmentation
- * module.  In the case of the 'proc' callback of the
- * #GNUNET_FRAGMENT_context_create() function, this function must
- * eventually call #GNUNET_FRAGMENT_context_transmission_done().
- *
- * @param cls closure
- * @param msg the message that was created
- */
-typedef void
-(*GNUNET_FRAGMENT_MessageProcessor) (void *cls,
-                                     const struct GNUNET_MessageHeader *msg);
-
-
-/**
- * Create a fragmentation context for the given message.
- * Fragments the message into fragments of size @a mtu or
- * less.  Calls @a proc on each un-acknowledged fragment,
- * using both the expected @a msg_delay between messages and
- * acknowledgements and the given @a tracker to guide the
- * frequency of calls to @a proc.
- *
- * @param stats statistics context
- * @param mtu the maximum message size for each fragment
- * @param tracker bandwidth tracker to use for flow control (can be NULL)
- * @param msg_delay initial delay to insert between fragment transmissions
- *              based on previous messages
- * @param ack_delay expected delay between fragment transmission
- *              and ACK based on previous messages
- * @param msg the message to fragment
- * @param proc function to call for each fragment to transmit
- * @param proc_cls closure for proc
- * @return the fragmentation context
- */
-struct GNUNET_FRAGMENT_Context *
-GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
-                                uint16_t mtu,
-                                struct GNUNET_BANDWIDTH_Tracker *tracker,
-                                struct GNUNET_TIME_Relative msg_delay,
-                                struct GNUNET_TIME_Relative ack_delay,
-                                const struct GNUNET_MessageHeader *msg,
-                                GNUNET_FRAGMENT_MessageProcessor proc,
-                                void *proc_cls);
-
-
-/**
- * Continuation to call from the 'proc' function after the fragment
- * has been transmitted (and hence the next fragment can now be
- * given to proc).
- *
- * @param fc fragmentation context
- */
-void
-GNUNET_FRAGMENT_context_transmission_done (struct GNUNET_FRAGMENT_Context *fc);
-
-
-/**
- * Process an acknowledgement message we got from the other
- * side (to control re-transmits).
- *
- * @param fc fragmentation context
- * @param msg acknowledgement message we received
- * @return #GNUNET_OK if this ack completes the work of the 'fc'
- *                   (all fragments have been received);
- *         #GNUNET_NO if more messages are pending
- *         #GNUNET_SYSERR if this ack is not valid for this fc
- */
-int
-GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
-                             const struct GNUNET_MessageHeader *msg);
-
-
-/**
- * Destroy the given fragmentation context (stop calling 'proc', free
- * resources).
- *
- * @param fc fragmentation context
- * @param msg_delay where to store average delay between individual message 
transmissions the
- *         last message (OUT only)
- * @param ack_delay where to store average delay between transmission and ACK 
for the
- *         last message, set to FOREVER if the message was not fully 
transmitted (OUT only)
- */
-void
-GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc,
-                                 struct GNUNET_TIME_Relative *msg_delay,
-                                 struct GNUNET_TIME_Relative *ack_delay);
-
-
-/**
- * Convert an ACK message to a printable format suitable for logging.
- *
- * @param ack message to print
- * @return ack in human-readable format
- */
-const char *
-GNUNET_FRAGMENT_print_ack (const struct GNUNET_MessageHeader *ack);
-
-
-/**
- * Defragmentation context (one per connection).
- */
-struct GNUNET_DEFRAGMENT_Context;
-
-
-/**
- * Function that is called with acknowledgement messages created by
- * the fragmentation module.  Acknowledgements are cumulative,
- * so it is OK to only transmit the 'latest' ack message for the same
- * message ID.
- *
- * @param cls closure
- * @param id unique message ID (modulo collisions)
- * @param msg the message that was created
- */
-typedef void
-(*GNUNET_DEFRAGMENT_AckProcessor) (void *cls,
-                                   uint32_t id,
-                                   const struct GNUNET_MessageHeader *msg);
-
-
-/**
- * Create a defragmentation context.
- *
- * @param stats statistics context
- * @param mtu the maximum message size for each fragment
- * @param num_msgs how many fragmented messages
- *                 to we defragment at most at the same time?
- * @param cls closure for @a proc and @a ackp
- * @param proc function to call with defragmented messages
- * @param ackp function to call with acknowledgements (to send
- *             back to the other side)
- * @return the defragmentation context
- */
-struct GNUNET_DEFRAGMENT_Context *
-GNUNET_DEFRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
-                                  uint16_t mtu,
-                                  unsigned int num_msgs,
-                                  void *cls,
-                                  GNUNET_FRAGMENT_MessageProcessor proc,
-                                  GNUNET_DEFRAGMENT_AckProcessor ackp);
-
-
-/**
- * Destroy the given defragmentation context.
- *
- * @param dc defragmentation context
- */
-void
-GNUNET_DEFRAGMENT_context_destroy (struct GNUNET_DEFRAGMENT_Context *dc);
-
-
-/**
- * We have received a fragment.  Process it.
- *
- * @param dc the context
- * @param msg the message that was received
- * @return #GNUNET_OK on success,
- *         #GNUNET_NO if this was a duplicate,
- *         #GNUNET_SYSERR on error
- */
-int
-GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
-                                    const struct GNUNET_MessageHeader *msg);
-
-
-#if 0                           /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/** @} */  /* end of group */
-
-/** @} */ /* 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,
 
 
 /* NG API */
-#include "gnunet_nt_lib.h"
+#include "gnunet_util_lib.h"
 
 
 /**
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 @@
 
      SPDX-License-Identifier: AGPL3.0-or-later
  */
+
+#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
+#error "Only <gnunet_util_lib.h> can be included directly."
+#endif
+
 /**
  * @addtogroup Backbone
  * @{
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 @@
  */
 /**
  * @addtogroup Backbone
- * @{ 
+ * @{
  *
  * @file
  * Bandwidth allocation API for applications to interact with
@@ -36,7 +36,6 @@
 
 #include "gnunet_constants.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_nt_lib.h"
 #include "gnunet_testing_lib.h"
 #include "gnunet_testing_ng_lib.h"
 
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" {
 
 
 #include "gnunet_util_lib.h"
-#include "gnunet_nt_lib.h"
 
 /**
  * Version number of the transport communication API.
@@ -139,7 +138,7 @@ typedef void (*GNUNET_TRANSPORT_CommunicatorNotify) (
  * Connect to the transport service.
  *
  * @param cfg configuration to use
- * @param config_section_name section of the configuration to use for 
+ * @param config_section_name section of the configuration to use for
  *                            options
  * @param addr_prefix address prefix for addresses supported by this
  *        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"
 #include "gnunet_helper_lib.h"
 #include "gnunet_mst_lib.h"
 #include "gnunet_mq_lib.h"
+#include "gnunet_nt_lib.h"
 #include "gnunet_nc_lib.h"
 #include "gnunet_op_lib.h"
 #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 @@
-# This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
-
-if USE_COVERAGE
-  AM_CFLAGS = --coverage
-endif
-
-lib_LTLIBRARIES = libgnunetnt.la
-
-libgnunetnt_la_SOURCES = \
-  nt.c
-
-libgnunetnt_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la
-libgnunetnt_la_LDFLAGS = \
- $(GN_LIB_LDFLAGS) \
- $(GN_LIBINTL) \
-  -version-info 0:0:0
-
-#if ENABLE_TEST_RUN
-#TESTS = \
-# test_nt
-#endif
-
-#check_PROGRAMS= \
-# test_nt
-#
-#test_nt_SOURCES = \
-#  test_nt.c
-#test_nt_LDADD = \
-#  libgnunetnt.la \
-#  $(top_builddir)/src/util/libgnunetutil.la  \
-#   $(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 @@
-libgnunetnt_src = ['nt.c']
-
-if get_option('monolith')
-  foreach p : libgnunetnt_src
-    gnunet_src += 'nt/' + p
-  endforeach
-  subdir_done()
-endif
-
-libgnunetnt = library('gnunetnt',
-        libgnunetnt_src,
-        soversion: '0',
-        version: '0.0.0',
-        dependencies: libgnunetutil_dep,
-        include_directories: [incdir, configuration_inc],
-        install: true,
-        install_dir: get_option('libdir'))
-libgnunetnt_dep = declare_dependency(link_with : libgnunetnt)
-pkg.generate(libgnunetnt, url: 'https://www.gnunet.org',
-             description : 'Provides API for accessing GNUnet NT')
-
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 @@
 #include "gnunet_protocols.h"
 #include "gnunet_signatures.h"
 #include "gnunet_constants.h"
-#include "gnunet_nt_lib.h"
 #include "gnunet_nat_service.h"
 #include "gnunet_statistics_service.h"
 #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 @@
 #include "gnunet_protocols.h"
 #include "gnunet_signatures.h"
 #include "gnunet_constants.h"
-#include "gnunet_nt_lib.h"
 #include "gnunet_nat_service.h"
 #include "gnunet_statistics_service.h"
 #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 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_constants.h"
-#include "gnunet_nt_lib.h"
 #include "gnunet_statistics_service.h"
 #include "gnunet_transport_communication_service.h"
 
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 = \
   mq.c \
   nc.c \
   network.c \
+       nt.c \
   op.c \
   os_installation.c \
   os_network.c \
@@ -334,7 +335,6 @@ check_PROGRAMS = \
  test_os_start_process \
  test_common_logging_runtime_loglevels
 
-
 test_child_management_SOURCES = \
   test_child_management.c
 test_child_management_LDADD = \
diff --git a/src/nt/nt.c b/src/util/nt.c
similarity index 99%
rename from src/nt/nt.c
rename to src/util/nt.c
index 8dfacb02b..24471d9ad 100644
--- a/src/nt/nt.c
+++ b/src/util/nt.c
@@ -18,14 +18,13 @@
      SPDX-License-Identifier: AGPL3.0-or-later
  */
 /**
- * @file nt/nt_api_scanner.c
+ * @file util/nt.c
  * @brief LAN interface scanning to determine IPs in LAN
  * @author Christian Grothoff
  * @author Matthias Wachs
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_nt_lib.h"
 
 /**
  * How frequently do we scan the interfaces for changes to the addresses?

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]