gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r27838 - gnunet/src/transport
Date: Tue, 9 Jul 2013 17:39:23 +0200

Author: wachs
Date: 2013-07-09 17:39:23 +0200 (Tue, 09 Jul 2013)
New Revision: 27838

Modified:
   gnunet/src/transport/plugin_transport_http_client.c
   gnunet/src/transport/plugin_transport_http_server.c
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/plugin_transport_udp.c
Log:
get function implementation in all plugins


Modified: gnunet/src/transport/plugin_transport_http_client.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_client.c 2013-07-09 15:28:51 UTC 
(rev 27837)
+++ gnunet/src/transport/plugin_transport_http_client.c 2013-07-09 15:39:23 UTC 
(rev 27838)
@@ -1437,7 +1437,22 @@
   return res;
 }
 
+/**
+ * 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 http_client_get_network (void *cls,
+                     void *session)
+{
+       struct Session *s = (struct Session *) session;
+       GNUNET_assert (NULL != s);
+       return ntohl(s->ats_address_network_type);
+}
 
+
 /**
  * Creates a new outbound session the transport service will use to send data 
to the
  * peer
@@ -1786,8 +1801,8 @@
   api->address_to_string = &http_plugin_address_to_string;
   api->string_to_address = &http_common_plugin_string_to_address;
   api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
+  api->get_network = &http_client_get_network;
 
-
 #if BUILD_HTTPS
   plugin->name = "transport-https_client";
   plugin->protocol = "https";

Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2013-07-09 15:28:51 UTC 
(rev 27837)
+++ gnunet/src/transport/plugin_transport_http_server.c 2013-07-09 15:39:23 UTC 
(rev 27838)
@@ -3004,6 +3004,20 @@
        return http_common_plugin_address_to_string (cls, p->protocol, addr, 
addrlen);
 }
 
+/**
+ * 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 http_server_get_network (void *cls,
+                     void *session)
+{
+       struct Session *s = (struct Session *) session;
+       GNUNET_assert (NULL != s);
+       return ntohl(s->ats_address_network_type);
+}
 
 /**
  * Entry point for the plugin.
@@ -3044,6 +3058,7 @@
   api->address_to_string = &http_plugin_address_to_string;
   api->string_to_address = &http_common_plugin_string_to_address;
   api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
+  api->get_network = &http_server_get_network;
 
 #if BUILD_HTTPS
   plugin->name = "transport-https_server";

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

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2013-07-09 15:28:51 UTC (rev 
27837)
+++ gnunet/src/transport/plugin_transport_udp.c 2013-07-09 15:39:23 UTC (rev 
27838)
@@ -1427,7 +1427,21 @@
   return GNUNET_YES;
 }
 
+/**
+ * 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 udp_get_network (void *cls,
+                     void *session)
+{
+       struct Session *s = (struct Session *) session;
 
+       return ntohl(s->ats.value);
+}
+
 /**
  * Creates a new outbound session the transport service will use to send data 
to the
  * peer
@@ -2967,6 +2981,7 @@
   api->check_address = &udp_plugin_check_address;
   api->get_session = &udp_plugin_get_session;
   api->send = &udp_plugin_send;
+  api->get_network = &udp_get_network;
 
   return api;
 }




reply via email to

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