aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-17 22:20:18 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-17 22:20:18 +0000
commit81b92caa24a83620032438df9c5ee3ea51663a02 (patch)
tree2b2df659c94e1ead5bbdb5082e50018c39e68796 /src/transport/plugin_transport_udp.c
parent4756cb0779daf3e4c33b6e876dce956de7ee6dd8 (diff)
downloadgnunet-81b92caa24a83620032438df9c5ee3ea51663a02.tar.gz
gnunet-81b92caa24a83620032438df9c5ee3ea51663a02.zip
simplify ATS API and plugin API by returning the network type, instead of an ATS_Information struct
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 48535f28b..76c9dfdec 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1799,6 +1799,7 @@ udp_plugin_create_session (void *cls,
1799 if (sizeof (struct IPv4UdpAddress) == address->address_length) 1799 if (sizeof (struct IPv4UdpAddress) == address->address_length)
1800 { 1800 {
1801 struct sockaddr_in v4; 1801 struct sockaddr_in v4;
1802
1802 udp_v4 = (struct IPv4UdpAddress *) address->address; 1803 udp_v4 = (struct IPv4UdpAddress *) address->address;
1803 memset (&v4, '\0', sizeof (v4)); 1804 memset (&v4, '\0', sizeof (v4));
1804 v4.sin_family = AF_INET; 1805 v4.sin_family = AF_INET;
@@ -1807,9 +1808,10 @@ udp_plugin_create_session (void *cls,
1807#endif 1808#endif
1808 v4.sin_port = udp_v4->u4_port; 1809 v4.sin_port = udp_v4->u4_port;
1809 v4.sin_addr.s_addr = udp_v4->ipv4_addr; 1810 v4.sin_addr.s_addr = udp_v4->ipv4_addr;
1810 s->ats = plugin->env->get_address_type (plugin->env->cls, 1811 s->ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1811 (const struct sockaddr *) &v4, 1812 s->ats.value = htonl (plugin->env->get_address_type (plugin->env->cls,
1812 sizeof (v4)); 1813 (const struct sockaddr *) &v4,
1814 sizeof (v4)));
1813 } 1815 }
1814 else if (sizeof (struct IPv6UdpAddress) == address->address_length) 1816 else if (sizeof (struct IPv6UdpAddress) == address->address_length)
1815 { 1817 {
@@ -1822,8 +1824,10 @@ udp_plugin_create_session (void *cls,
1822#endif 1824#endif
1823 v6.sin6_port = udp_v6->u6_port; 1825 v6.sin6_port = udp_v6->u6_port;
1824 v6.sin6_addr = udp_v6->ipv6_addr; 1826 v6.sin6_addr = udp_v6->ipv6_addr;
1825 s->ats = plugin->env->get_address_type (plugin->env->cls, 1827 s->ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1826 (const struct sockaddr *) &v6, sizeof (v6)); 1828 s->ats.value = htonl (plugin->env->get_address_type (plugin->env->cls,
1829 (const struct sockaddr *) &v6,
1830 sizeof (v6)));
1827 } 1831 }
1828 1832
1829 if (NULL == s) 1833 if (NULL == s)
@@ -2871,11 +2875,11 @@ analyze_send_error (struct Plugin *plugin,
2871 const struct sockaddr *sa, 2875 const struct sockaddr *sa,
2872 socklen_t slen, int error) 2876 socklen_t slen, int error)
2873{ 2877{
2874 struct GNUNET_ATS_Information type; 2878 enum GNUNET_ATS_Network_Type type;
2875 2879
2876 type = plugin->env->get_address_type (plugin->env->cls, sa, slen); 2880 type = plugin->env->get_address_type (plugin->env->cls, sa, slen);
2877 if (((GNUNET_ATS_NET_LAN == ntohl (type.value)) 2881 if (((GNUNET_ATS_NET_LAN == type)
2878 || (GNUNET_ATS_NET_WAN == ntohl (type.value))) 2882 || (GNUNET_ATS_NET_WAN == type))
2879 && ((ENETUNREACH == errno)|| (ENETDOWN == errno))) 2883 && ((ENETUNREACH == errno)|| (ENETDOWN == errno)))
2880 { 2884 {
2881 if (slen == sizeof (struct sockaddr_in)) 2885 if (slen == sizeof (struct sockaddr_in))