determine network scope for ATS even if we do not yet have a session and only have...
[oweals/gnunet.git] / src / transport / plugin_transport_wlan.c
index 3a25e921b42361704d1e26f020427bf8ad67d43a..d5932bb30df2b70e9dd9480c1c6230a79dbddce1 100644 (file)
@@ -14,8 +14,8 @@
 
   You should have received a copy of the GNU General Public License
   along with GNUnet; see the file COPYING.  If not, write to the
-  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-  Boston, MA 02111-1307, USA.
+  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -1291,6 +1291,25 @@ wlan_plugin_get_network (void *cls,
 }
 
 
+/**
+ * Function obtain the network type for an address.
+ *
+ * @param cls closure (`struct Plugin *`)
+ * @param address the address
+ * @return the network type
+ */
+static enum GNUNET_ATS_Network_Type
+wlan_plugin_get_network_for_address (void *cls,
+                                    const struct GNUNET_HELLO_Address *address)
+{
+#if BUILD_WLAN
+  return GNUNET_ATS_NET_WLAN;
+#else
+  return GNUNET_ATS_NET_BT;
+#endif
+}
+
+
 /**
  * Creates a new outbound session the transport service will use to
  * send data to the peer
@@ -1481,7 +1500,7 @@ process_data (void *cls,
                                              PLUGIN_NAME,
                                              &mas->endpoint->wlan_addr,
                                              sizeof (mas->endpoint->wlan_addr),
-                                             GNUNET_HELLO_ADDRESS_INFO_INBOUND);
+                                             GNUNET_HELLO_ADDRESS_INFO_NONE);
     mas->session = lookup_session (mas->endpoint,
                                    &tmpsource);
     if (NULL == mas->session)
@@ -1609,7 +1628,7 @@ process_data (void *cls,
                                                PLUGIN_NAME,
                                                &mas->endpoint->wlan_addr,
                                                sizeof (struct WlanAddress),
-                                               GNUNET_HELLO_ADDRESS_INFO_INBOUND);
+                                               GNUNET_HELLO_ADDRESS_INFO_NONE);
       plugin->env->session_start (plugin->env->cls,
                                   address,
                                   mas->session,
@@ -2332,6 +2351,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
   api->address_to_string = &wlan_plugin_address_to_string;
   api->string_to_address = &wlan_plugin_string_to_address;
   api->get_network = &wlan_plugin_get_network;
+  api->get_network_for_address = &wlan_plugin_get_network_for_address;
   api->update_session_timeout = &wlan_plugin_update_session_timeout;
   api->update_inbound_delay = &wlan_plugin_update_inbound_delay;
   api->setup_monitor = &wlan_plugin_setup_monitor;