aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.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/gnunet-service-transport.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/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 03fbc95db..2d2c0db46 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -633,36 +633,33 @@ plugin_env_session_end (void *cls, const struct GNUNET_HELLO_Address *address,
633 * 633 *
634 * @param cls closure 634 * @param cls closure
635 * @param addr binary address 635 * @param addr binary address
636 * @param addrlen length of the address 636 * @param addrlen length of the @a addr
637 * @return ATS Information containing the network type 637 * @return type of the network @a addr belongs to
638 */ 638 */
639static struct GNUNET_ATS_Information 639static enum GNUNET_ATS_Network_Type
640plugin_env_address_to_type (void *cls, const struct sockaddr *addr, 640plugin_env_address_to_type (void *cls,
641 size_t addrlen) 641 const struct sockaddr *addr,
642 size_t addrlen)
642{ 643{
643 struct GNUNET_ATS_Information ats;
644
645 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
646 ats.value = htonl (GNUNET_ATS_NET_UNSPECIFIED);
647 if (NULL == GST_ats) 644 if (NULL == GST_ats)
648 { 645 {
649 GNUNET_break(0); 646 GNUNET_break(0);
650 return ats; 647 return GNUNET_ATS_NET_UNSPECIFIED;
651 } 648 }
652 if (((addr->sa_family != AF_INET) && (addrlen != sizeof(struct sockaddr_in))) 649 if (((addr->sa_family != AF_INET) && (addrlen != sizeof(struct sockaddr_in)))
653 && ((addr->sa_family != AF_INET6) 650 && ((addr->sa_family != AF_INET6)
654 && (addrlen != sizeof(struct sockaddr_in6))) 651 && (addrlen != sizeof(struct sockaddr_in6)))
655 && (addr->sa_family != AF_UNIX)) 652 && (addr->sa_family != AF_UNIX))
656 { 653 {
657 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
658 "Malformed address with length %u `%s'\n", addrlen,
659 GNUNET_a2s (addr, addrlen));
660 GNUNET_break(0); 654 GNUNET_break(0);
661 return ats; 655 return GNUNET_ATS_NET_UNSPECIFIED;
662 } 656 }
663 return GNUNET_ATS_address_get_type (GST_ats, addr, addrlen); 657 return GNUNET_ATS_address_get_type (GST_ats,
658 addr,
659 addrlen);
664} 660}
665 661
662
666/** 663/**
667 * Notify ATS about the new address including the network this address is 664 * Notify ATS about the new address including the network this address is
668 * located in. 665 * located in.