gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27837 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r27837 - gnunet/src/transport
Date: Tue, 9 Jul 2013 17:28:51 +0200

Author: wachs
Date: 2013-07-09 17:28:51 +0200 (Tue, 09 Jul 2013)
New Revision: 27837

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/plugin_transport_unix.c
   gnunet/src/transport/plugin_transport_wlan.c
Log:
added function


Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2013-07-09 15:23:13 UTC (rev 
27836)
+++ gnunet/src/transport/plugin_transport_tcp.c 2013-07-09 15:28:51 UTC (rev 
27837)
@@ -2390,6 +2390,7 @@
                      void *session)
 {
        struct Session *s = (struct Session *) session;
+       GNUNET_assert (NULL != session);
        return s->ats_address_network_type;
 }
 

Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c        2013-07-09 15:23:13 UTC 
(rev 27836)
+++ gnunet/src/transport/plugin_transport_unix.c        2013-07-09 15:28:51 UTC 
(rev 27837)
@@ -726,7 +726,21 @@
   disconnect_session (s);
 }
 
+/**
+ * Function obtain the network type for a session
+ *
+ * @param cls closure ('struct Plugin*')
+ * @param session the session
+ * @return the network type in HBO or GNUNET_SYSERR
+ */
+int unix_get_network (void *cls,
+                     void *session)
+{
+       GNUNET_assert (NULL != session);
+       return GNUNET_ATS_NET_LOOPBACK;
+}
 
+
 /**
  * Creates a new outbound session the transport service will use to send data 
to the
  * peer
@@ -940,7 +954,12 @@
                                        ua_len);
   s = lookup_session (plugin, sender, ua, ua_len);
   if (NULL == s)
+  {
     s = unix_plugin_get_session (plugin, addr);
+    /* Notify transport and ATS about new session */
+    plugin->env->session_start (NULL, sender,
+               PLUGIN_NAME, ua, ua_len, s, &plugin->ats_network, 1);
+  }
   reschedule_session_timeout (s);
 
   plugin->env->receive (plugin->env->cls, sender, currhdr,
@@ -1599,6 +1618,7 @@
   api->address_to_string = &unix_address_to_string;
   api->check_address = &unix_check_address;
   api->string_to_address = &unix_string_to_address;
+  api->get_network = &unix_get_network;
   sockets_created = unix_transport_server_start (plugin);
   if (0 == sockets_created)
     LOG (GNUNET_ERROR_TYPE_WARNING,

Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c        2013-07-09 15:23:13 UTC 
(rev 27836)
+++ gnunet/src/transport/plugin_transport_wlan.c        2013-07-09 15:28:51 UTC 
(rev 27837)
@@ -1022,6 +1022,19 @@
   return pos;
 }
 
+/**
+ * Function obtain the network type for a session
+ *
+ * @param cls closure ('struct Plugin*')
+ * @param session the session
+ * @return the network type in HBO or GNUNET_SYSERR
+ */
+int wlan_get_network (void *cls,
+                     void *session)
+{
+       GNUNET_assert (NULL != session);
+       return GNUNET_ATS_NET_WLAN;
+}
 
 /**
  * Creates a new outbound session the transport service will use to send data 
to the
@@ -1876,6 +1889,7 @@
   api->check_address = &wlan_plugin_address_suggested;
   api->address_to_string = &wlan_plugin_address_to_string;
   api->string_to_address = &wlan_string_to_address;
+  api->get_network = &wlan_get_network;
   return api;
 }
 




reply via email to

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