+
+/**
+ * Function obtain the network type for an address.
+ *
+ * @param env the environment
+ * @param address the address
+ * @return the network type
+ */
+enum GNUNET_ATS_Network_Type
+http_common_get_network_for_address (struct GNUNET_TRANSPORT_PluginEnvironment *env,
+ const struct GNUNET_HELLO_Address *address)
+{
+
+ struct sockaddr *sa;
+ enum GNUNET_ATS_Network_Type net_type;
+ size_t salen = 0;
+ int res;
+
+ net_type = GNUNET_ATS_NET_UNSPECIFIED;
+ sa = http_common_socket_from_address (address->address,
+ address->address_length,
+ &res);
+ if (GNUNET_SYSERR == res)
+ return net_type;
+ if (GNUNET_YES == res)
+ {
+ GNUNET_assert (NULL != sa);
+ if (AF_INET == sa->sa_family)
+ {
+ salen = sizeof (struct sockaddr_in);
+ }
+ else if (AF_INET6 == sa->sa_family)
+ {
+ salen = sizeof (struct sockaddr_in6);
+ }
+ net_type = env->get_address_type (env->cls,
+ sa,
+ salen);
+ GNUNET_free (sa);
+ }
+ return net_type;
+}
+
+
+