gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (75c351e31 -> 478a4c062)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (75c351e31 -> 478a4c062)
Date: Thu, 15 Nov 2018 13:56:45 +0100

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

grothoff pushed a change to branch master
in repository gnunet.

    from 75c351e31 fix #5477
     new ad1244d95 make copy of transport_api_core.c
     new 478a4c062 get gnunet-service-tng to build

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/gnunet_transport_core_service.h        |  12 +-
 src/transport/Makefile.am                          |  20 ++++
 src/transport/gnunet-service-tng.c                 |  59 +---------
 src/transport/transport-testing.c                  |   4 +-
 src/transport/transport-testing.h                  |   8 +-
 ...{transport_api_core.c => transport_api2_core.c} | 128 ++++++++-------------
 src/transport/transport_api_core.c                 |  12 +-
 7 files changed, 89 insertions(+), 154 deletions(-)
 copy src/transport/{transport_api_core.c => transport_api2_core.c} (92%)

diff --git a/src/include/gnunet_transport_core_service.h 
b/src/include/gnunet_transport_core_service.h
index 5fbfcee21..b52dbe5f8 100644
--- a/src/include/gnunet_transport_core_service.h
+++ b/src/include/gnunet_transport_core_service.h
@@ -66,7 +66,7 @@ struct GNUNET_TRANSPORT_CoreHandle;
  * @return closure to use in MQ handlers
  */
 typedef void *
-(*GNUNET_TRANSPORT_NotifyConnecT) (void *cls,
+(*GNUNET_TRANSPORT_NotifyConnect) (void *cls,
                                    const struct GNUNET_PeerIdentity *peer,
                                    struct GNUNET_MQ_Handle *mq);
 
@@ -83,7 +83,7 @@ typedef void *
  *                    connect notification callback
  */
 typedef void
-(*GNUNET_TRANSPORT_NotifyDisconnecT) (void *cls,
+(*GNUNET_TRANSPORT_NotifyDisconnect) (void *cls,
                                       const struct GNUNET_PeerIdentity *peer,
                                       void *handler_cls);
 
@@ -105,7 +105,7 @@ typedef void
  *                    connect notification callback
  */
 typedef void
-(*GNUNET_TRANSPORT_NotifyExcessBandwidtH)(void *cls,
+(*GNUNET_TRANSPORT_NotifyExcessBandwidth)(void *cls,
                                           const struct GNUNET_PeerIdentity 
*neighbour,
                                           void *handlers_cls);
 
@@ -133,9 +133,9 @@ GNUNET_TRANSPORT_core_connect (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
                                const struct GNUNET_PeerIdentity *self,
                                const struct GNUNET_MQ_MessageHandler *handlers,
                                void *cls,
-                               GNUNET_TRANSPORT_NotifyConnecT nc,
-                               GNUNET_TRANSPORT_NotifyDisconnecT nd,
-                               GNUNET_TRANSPORT_NotifyExcessBandwidtH neb);
+                               GNUNET_TRANSPORT_NotifyConnect nc,
+                               GNUNET_TRANSPORT_NotifyDisconnect nd,
+                               GNUNET_TRANSPORT_NotifyExcessBandwidth neb);
 
 
 /**
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 2a549d413..ad39abe6a 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -141,6 +141,7 @@ endif
 noinst_PROGRAMS = \
  gnunet-transport-profiler \
  gnunet-communicator-unix \
+ gnunet-service-tng \
  $(WLAN_BIN_SENDER) \
  $(WLAN_BIN_RECEIVER)
 
@@ -150,6 +151,7 @@ endif
 
 lib_LTLIBRARIES = \
   libgnunettransport.la \
+  libgnunettransportcore.la \
   libgnunettransportcommunicator.la \
   libgnunettransportmonitor.la \
   $(TESTING_LIBS)
@@ -192,6 +194,15 @@ libgnunettransport_la_LDFLAGS = \
 
 
 
+libgnunettransportcore_la_SOURCES = \
+  transport_api2_core.c
+libgnunettransportcore_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+libgnunettransportcore_la_LDFLAGS = \
+  $(GN_LIB_LDFLAGS) $(WINFLAGS) \
+  -version-info 0:0:0
+
 libgnunettransportcommunicator_la_SOURCES = \
   transport_api2_communication.c
 libgnunettransportcommunicator_la_LIBADD = \
@@ -311,6 +322,15 @@ gnunet_service_transport_CFLAGS = \
   $(CFLAGS)
 # -DANALYZE
 
+
+gnunet_service_tng_SOURCES = \
+ gnunet-service-tng.c
+gnunet_service_tng_LDADD = \
+  $(top_builddir)/src/ats/libgnunetats.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(GN_LIBINTL)
+
 plugin_LTLIBRARIES = \
   libgnunet_plugin_transport_tcp.la \
   libgnunet_plugin_transport_udp.la \
diff --git a/src/transport/gnunet-service-tng.c 
b/src/transport/gnunet-service-tng.c
index d92964654..73b295442 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -233,7 +233,6 @@ handle_client_start (void *cls,
                     const struct StartMessage *start)
 {
   struct TransportClient *tc = cls;
-  const struct GNUNET_MessageHeader *hello;
   uint32_t options;
 
   options = ntohl (start->options);
@@ -255,46 +254,6 @@ handle_client_start (void *cls,
     return;
   }
   tc->type = CT_CORE;
-#if 0
-  hello = GST_hello_get ();
-  if (NULL != hello)
-    unicast (tc,
-             hello,
-             GNUNET_NO);
-#endif
-  GNUNET_SERVICE_client_continue (tc->client);
-}
-
-
-/**
- * Client sent us a HELLO.  Check the request.
- *
- * @param cls the client
- * @param message the HELLO message
- */
-static int
-check_client_hello (void *cls,
-                   const struct GNUNET_MessageHeader *message)
-{
-  (void) cls;
-  return GNUNET_OK; /* FIXME: check here? */
-}
-
-
-/**
- * Client sent us a HELLO.  Process the request.
- *
- * @param cls the client
- * @param message the HELLO message
- */
-static void
-handle_client_hello (void *cls,
-                    const struct GNUNET_MessageHeader *message)
-{
-  struct TransportClient *tc = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-             "Received HELLO message\n");
   GNUNET_SERVICE_client_continue (tc->client);
 }
 
@@ -395,7 +354,7 @@ handle_communicator_available (void *cls,
   tc->type = CT_COMMUNICATOR;
   size = ntohs (cam->header.size) - sizeof (*cam);
   if (0 == size)
-    return GNUNET_OK; /* receive-only communicator */
+    return; /* receive-only communicator */
   tc->details.address_prefix = GNUNET_strdup ((const char *) &cam[1]);
   GNUNET_SERVICE_client_continue (tc->client);
 }
@@ -421,7 +380,7 @@ check_add_address (void *cls,
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
-  addr = (const char *) &cam[1];
+  addr = (const char *) &aam[1];
   if ('\0' != addr[size-1])
   {
     GNUNET_break (0);
@@ -651,15 +610,7 @@ run (void *cls,
 {
   /* setup globals */
   GST_cfg = c;
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_time (c,
-                                           "transport",
-                                           "HELLO_EXPIRATION",
-                                           &hello_expiration))
-  {
-    hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
-  }
-  GST_my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg);
+  GST_my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration 
(GST_cfg);
   if (NULL == GST_my_private_key)
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
@@ -696,10 +647,6 @@ GNUNET_SERVICE_MAIN
                          GNUNET_MESSAGE_TYPE_TRANSPORT_START,
                          struct StartMessage,
                          NULL),
- GNUNET_MQ_hd_var_size (client_hello,
-                       GNUNET_MESSAGE_TYPE_HELLO,
-                       struct GNUNET_MessageHeader,
-                       NULL),
  GNUNET_MQ_hd_var_size (client_send,
                        GNUNET_MESSAGE_TYPE_TRANSPORT_SEND,
                        struct OutboundMessage,
diff --git a/src/transport/transport-testing.c 
b/src/transport/transport-testing.c
index e3d4b7a9b..4295446d2 100644
--- a/src/transport/transport-testing.c
+++ b/src/transport/transport-testing.c
@@ -374,8 +374,8 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct 
GNUNET_TRANSPORT_TESTING_Handle *tth
                                      const char *cfgname,
                                      int peer_id,
                                      const struct GNUNET_MQ_MessageHandler 
*handlers,
-                                     GNUNET_TRANSPORT_NotifyConnecT nc,
-                                     GNUNET_TRANSPORT_NotifyDisconnecT nd,
+                                     GNUNET_TRANSPORT_NotifyConnect nc,
+                                     GNUNET_TRANSPORT_NotifyDisconnect nd,
                                     void *cb_cls,
                                      GNUNET_SCHEDULER_TaskCallback start_cb,
                                      void *start_cb_cls)
diff --git a/src/transport/transport-testing.h 
b/src/transport/transport-testing.h
index a4cfd89f6..3a638580d 100644
--- a/src/transport/transport-testing.h
+++ b/src/transport/transport-testing.h
@@ -115,12 +115,12 @@ struct GNUNET_TRANSPORT_TESTING_PeerContext
   /**
    * Notify connect callback
    */
-  GNUNET_TRANSPORT_NotifyConnecT nc;
+  GNUNET_TRANSPORT_NotifyConnect nc;
 
   /**
    * Notify disconnect callback
    */
-  GNUNET_TRANSPORT_NotifyDisconnecT nd;
+  GNUNET_TRANSPORT_NotifyDisconnect nd;
 
   /**
    * Startup completed callback
@@ -291,8 +291,8 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct 
GNUNET_TRANSPORT_TESTING_Handle *tth
                                      const char *cfgname,
                                      int peer_id,
                                      const struct GNUNET_MQ_MessageHandler 
*handlers,
-                                     GNUNET_TRANSPORT_NotifyConnecT nc,
-                                     GNUNET_TRANSPORT_NotifyDisconnecT nd,
+                                     GNUNET_TRANSPORT_NotifyConnect nc,
+                                     GNUNET_TRANSPORT_NotifyDisconnect nd,
                                     void *cb_cls,
                                      GNUNET_SCHEDULER_TaskCallback start_cb,
                                      void *start_cb_cls);
diff --git a/src/transport/transport_api_core.c 
b/src/transport/transport_api2_core.c
similarity index 92%
copy from src/transport/transport_api_core.c
copy to src/transport/transport_api2_core.c
index b7edc3cc1..78d8dcce0 100644
--- a/src/transport/transport_api_core.c
+++ b/src/transport/transport_api2_core.c
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009-2013, 2016 GNUnet e.V.
+     Copyright (C) 2009-2013, 2016, 2018 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
@@ -33,12 +33,6 @@
 #define LOG(kind,...) GNUNET_log_from (kind, "transport-api-core",__VA_ARGS__)
 
 /**
- * If we could not send any payload to a peer for this amount of
- * time, we print a warning.
- */
-#define UNREADY_WARN_TIME GNUNET_TIME_UNIT_MINUTES
-
-/**
  * How large to start with for the hashmap of neighbours.
  */
 #define STARTING_NEIGHBOURS_SIZE 16
@@ -49,6 +43,12 @@
  */
 struct Neighbour
 {
+
+  /**
+   * Identity of this neighbour.
+   */
+  struct GNUNET_PeerIdentity id;
+
   /**
    * Overall transport handle.
    */
@@ -70,16 +70,6 @@ struct Neighbour
   void *handlers_cls;
 
   /**
-   * Identity of this neighbour.
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Outbound bandwidh tracker.
-   */
-  struct GNUNET_BANDWIDTH_Tracker out_tracker;
-
-  /**
    * Entry in our readyness heap (which is sorted by @e next_ready
    * value).  NULL if there is no pending transmission request for
    * this neighbour or if we're waiting for @e is_ready to become
@@ -96,6 +86,11 @@ struct Neighbour
   struct GNUNET_SCHEDULER_Task *timeout_task;
 
   /**
+   * Outbound bandwidh tracker.
+   */
+  struct GNUNET_BANDWIDTH_Tracker out_tracker;
+
+  /**
    * Sending consumed more bytes on wire than payload was announced
    * This overhead is added to the delay of next sending operation
    */
@@ -136,17 +131,17 @@ struct GNUNET_TRANSPORT_CoreHandle
   /**
    * function to call on connect events
    */
-  GNUNET_TRANSPORT_NotifyConnecT nc_cb;
+  GNUNET_TRANSPORT_NotifyConnect nc_cb;
 
   /**
    * function to call on disconnect events
    */
-  GNUNET_TRANSPORT_NotifyDisconnecT nd_cb;
+  GNUNET_TRANSPORT_NotifyDisconnect nd_cb;
 
   /**
    * function to call on excess bandwidth events
    */
-  GNUNET_TRANSPORT_NotifyExcessBandwidtH neb_cb;
+  GNUNET_TRANSPORT_NotifyExcessBandwidth neb_cb;
 
   /**
    * My client connection to the transport service.
@@ -306,44 +301,6 @@ mq_error_handler (void *cls,
 
 
 /**
- * Function we use for checking incoming HELLO messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param msg message received
- * @return #GNUNET_OK if message is well-formed
- */
-static int
-check_hello (void *cls,
-             const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_PeerIdentity me;
-
-  if (GNUNET_OK !=
-      GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) msg,
-                           &me))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Function we use for handling incoming HELLO messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param msg message received
- */
-static void
-handle_hello (void *cls,
-              const struct GNUNET_MessageHeader *msg)
-{
-  /* we do not care => FIXME: signal in options to NEVER send HELLOs! */
-}
-
-
-/**
  * A message from the handler's message queue to a neighbour was
  * transmitted.  Now trigger (possibly delayed) notification of the
  * neighbour's message queue that we are done and thus ready for
@@ -551,7 +508,8 @@ handle_connect (void *cls,
        "Receiving CONNECT message for `%s' with quota %u\n",
        GNUNET_i2s (&cim->id),
        ntohl (cim->quota_out.value__));
-  n = neighbour_find (h, &cim->id);
+  n = neighbour_find (h,
+                     &cim->id);
   if (NULL != n)
   {
     GNUNET_break (0);
@@ -613,7 +571,8 @@ handle_disconnect (void *cls,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Receiving DISCONNECT message for `%s'.\n",
        GNUNET_i2s (&dim->peer));
-  n = neighbour_find (h, &dim->peer);
+  n = neighbour_find (h,
+                     &dim->peer);
   if (NULL == n)
   {
     GNUNET_break (0);
@@ -647,7 +606,9 @@ handle_send_ok (void *cls,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Receiving SEND_OK message, transmission to %s %s.\n",
        GNUNET_i2s (&okm->peer),
-       ntohl (okm->success) == GNUNET_OK ? "succeeded" : "failed");
+       (GNUNET_OK == ntohl (okm->success))
+       ? "succeeded"
+       : "failed");
   n = neighbour_find (h,
                       &okm->peer);
   if (NULL == n)
@@ -662,8 +623,8 @@ handle_send_ok (void *cls,
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Overhead for %u byte message was %u\n",
-         bytes_msg,
-         bytes_physical - bytes_msg);
+         (unsigned int) bytes_msg,
+         (unsigned int) (bytes_physical - bytes_msg));
     n->traffic_overhead += bytes_physical - bytes_msg;
   }
 }
@@ -677,7 +638,7 @@ handle_send_ok (void *cls,
  */
 static int
 check_recv (void *cls,
-             const struct InboundMessage *im)
+           const struct InboundMessage *im)
 {
   const struct GNUNET_MessageHeader *imm;
   uint16_t size;
@@ -718,7 +679,8 @@ handle_recv (void *cls,
        (unsigned int) ntohs (imm->type),
        (unsigned int) ntohs (imm->size),
        GNUNET_i2s (&im->peer));
-  n = neighbour_find (h, &im->peer);
+  n = neighbour_find (h,
+                     &im->peer);
   if (NULL == n)
   {
     GNUNET_break (0);
@@ -754,7 +716,7 @@ handle_set_quota (void *cls,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Receiving SET_QUOTA message for `%s' with quota %u\n",
        GNUNET_i2s (&qm->peer),
-       ntohl (qm->quota.value__));
+       (unsigned int) ntohl (qm->quota.value__));
   GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker,
                                          qm->quota);
 }
@@ -770,10 +732,6 @@ reconnect (void *cls)
 {
   struct GNUNET_TRANSPORT_CoreHandle *h = cls;
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (hello,
-                           GNUNET_MESSAGE_TYPE_HELLO,
-                           struct GNUNET_MessageHeader,
-                           h),
     GNUNET_MQ_hd_fixed_size (connect,
                              GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT,
                              struct ConnectInfoMessage,
@@ -826,16 +784,13 @@ reconnect (void *cls)
 
 
 /**
- * Function that will schedule the job that will try
- * to connect us again to the client.
+ * Disconnect from the transport service.
  *
  * @param h transport service to reconnect
  */
 static void
-disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_CoreHandle *h)
+disconnect (struct GNUNET_TRANSPORT_CoreHandle *h)
 {
-  GNUNET_assert (NULL == h->reconnect_task);
-  /* Forget about all neighbours that we used to be connected to */
   GNUNET_CONTAINER_multipeermap_iterate (h->neighbours,
                                          &neighbour_delete,
                                          h);
@@ -844,6 +799,20 @@ disconnect_and_schedule_reconnect (struct 
GNUNET_TRANSPORT_CoreHandle *h)
     GNUNET_MQ_destroy (h->mq);
     h->mq = NULL;
   }
+}
+
+
+/**
+ * Function that will schedule the job that will try
+ * to connect us again to the client.
+ *
+ * @param h transport service to reconnect
+ */
+static void
+disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_CoreHandle *h)
+{
+  GNUNET_assert (NULL == h->reconnect_task);
+  disconnect (h);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Scheduling task to reconnect to transport service in %s.\n",
        GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay,
@@ -896,9 +865,9 @@ GNUNET_TRANSPORT_core_connect (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
                               const struct GNUNET_PeerIdentity *self,
                               const struct GNUNET_MQ_MessageHandler *handlers,
                               void *cls,
-                              GNUNET_TRANSPORT_NotifyConnecT nc,
-                              GNUNET_TRANSPORT_NotifyDisconnecT nd,
-                              GNUNET_TRANSPORT_NotifyExcessBandwidtH neb)
+                              GNUNET_TRANSPORT_NotifyConnect nc,
+                              GNUNET_TRANSPORT_NotifyDisconnect nd,
+                              GNUNET_TRANSPORT_NotifyExcessBandwidth neb)
 {
   struct GNUNET_TRANSPORT_CoreHandle *h;
   unsigned int i;
@@ -951,8 +920,7 @@ GNUNET_TRANSPORT_core_disconnect (struct 
GNUNET_TRANSPORT_CoreHandle *handle)
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Transport disconnect called!\n");
   /* this disconnects all neighbours... */
-  if (NULL == handle->reconnect_task)
-    disconnect_and_schedule_reconnect (handle);
+  disconnect (handle);
   /* and now we stop trying to connect again... */
   if (NULL != handle->reconnect_task)
   {
diff --git a/src/transport/transport_api_core.c 
b/src/transport/transport_api_core.c
index b7edc3cc1..5310054fd 100644
--- a/src/transport/transport_api_core.c
+++ b/src/transport/transport_api_core.c
@@ -136,17 +136,17 @@ struct GNUNET_TRANSPORT_CoreHandle
   /**
    * function to call on connect events
    */
-  GNUNET_TRANSPORT_NotifyConnecT nc_cb;
+  GNUNET_TRANSPORT_NotifyConnect nc_cb;
 
   /**
    * function to call on disconnect events
    */
-  GNUNET_TRANSPORT_NotifyDisconnecT nd_cb;
+  GNUNET_TRANSPORT_NotifyDisconnect nd_cb;
 
   /**
    * function to call on excess bandwidth events
    */
-  GNUNET_TRANSPORT_NotifyExcessBandwidtH neb_cb;
+  GNUNET_TRANSPORT_NotifyExcessBandwidth neb_cb;
 
   /**
    * My client connection to the transport service.
@@ -896,9 +896,9 @@ GNUNET_TRANSPORT_core_connect (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
                               const struct GNUNET_PeerIdentity *self,
                               const struct GNUNET_MQ_MessageHandler *handlers,
                               void *cls,
-                              GNUNET_TRANSPORT_NotifyConnecT nc,
-                              GNUNET_TRANSPORT_NotifyDisconnecT nd,
-                              GNUNET_TRANSPORT_NotifyExcessBandwidtH neb)
+                              GNUNET_TRANSPORT_NotifyConnect nc,
+                              GNUNET_TRANSPORT_NotifyDisconnect nd,
+                              GNUNET_TRANSPORT_NotifyExcessBandwidth neb)
 {
   struct GNUNET_TRANSPORT_CoreHandle *h;
   unsigned int i;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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