}
+
+/**
+ * Function to obtain the network type for a session
+ * FIXME: we should probably look at the network type
+ * used by the next hop here. Or find some other way
+ * to properly allow ATS-DV resource allocation.
+ *
+ * @param cls closure ('struct Plugin*')
+ * @param session the session
+ * @return the network type
+ */
+static enum GNUNET_ATS_Network_Type
+dv_get_network (void *cls,
+ struct Session *session)
+{
+ GNUNET_assert (NULL != session);
+ return GNUNET_ATS_NET_UNSPECIFIED;
+}
+
+
/**
* Entry point for the plugin.
*/
api->check_address = &dv_plugin_check_address;
api->address_to_string = &dv_plugin_address_to_string;
api->string_to_address = &dv_plugin_string_to_address;
- api->get_session = dv_get_session;
+ api->get_session = &dv_get_session;
+ api->get_network = &dv_get_network;
return api;
}
/**
- * Function obtain the network type for a session
+ * Function to obtain the network type for a session
*
* @param cls closure ('struct Plugin*')
* @param session the session
* @return the network type
*/
typedef enum GNUNET_ATS_Network_Type (*GNUNET_TRANSPORT_GetNetworkType) (void *cls,
- void *session);
+ struct Session *session);
/**
*/
GNUNET_TRANSPORT_CreateSession get_session;
-
/**
* Function to obtain the network type for a session
*/
return pos;
}
+
/**
* Function obtain the network type for a session
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-bluetooth_get_network (void *cls, void *session)
+bluetooth_get_network (void *cls,
+ struct Session *session)
{
- GNUNET_assert (NULL != session);
- return GNUNET_ATS_NET_BT;
+ GNUNET_assert (NULL != session);
+ return GNUNET_ATS_NET_BT;
}
return res;
}
+
/**
* Function obtain the network type for a session
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-http_client_get_network (void *cls, void *session)
+http_client_get_network (void *cls,
+ struct Session *session)
{
- struct Session *s = (struct Session *) session;
- GNUNET_assert (NULL != s);
- return ntohl(s->ats_address_network_type);
+ GNUNET_assert (NULL != session);
+ return ntohl (session->ats_address_network_type);
}
}
+
/**
* Function obtain the network type for a session
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-http_server_get_network (void *cls, void *session)
+http_server_get_network (void *cls,
+ struct Session *session)
{
- struct Session *s = (struct Session *) session;
- GNUNET_assert (NULL != s);
- return ntohl(s->ats_address_network_type);
+ GNUNET_assert (NULL != session);
+ return ntohl (session->ats_address_network_type);
}
+
/**
* Entry point for the plugin.
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-tcp_get_network (void *cls,void *session)
+tcp_get_network (void *cls,
+ struct Session *session)
{
- struct Session *s = (struct Session *) session;
- GNUNET_assert (NULL != session);
- return ntohl(s->ats_address_network_type);
+ GNUNET_assert (NULL != session);
+ return ntohl (session->ats_address_network_type);
}
// FIXME
}
+
/**
* Function obtain the network type for a session
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-template_plugin_get_network (void *cls, void *session)
+template_plugin_get_network (void *cls,
+ struct Session *session)
{
- struct Session *s = (struct Session *) session;
- GNUNET_assert (NULL != s);
- return GNUNET_ATS_NET_UNSPECIFIED; /* Change to correct network type */
+ GNUNET_assert (NULL != session);
+ return GNUNET_ATS_NET_UNSPECIFIED; /* Change to correct network type */
}
+
/**
* Convert the transports address to a nice, human-readable
* format.
return GNUNET_YES;
}
+
/**
* Function obtain the network type for a session
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-udp_get_network (void *cls, void *session)
+udp_get_network (void *cls,
+ struct Session *session)
{
- struct Session *s = (struct Session *) session;
-
- return ntohl(s->ats.value);
+ return ntohl (session->ats.value);
}
+
/**
* Creates a new outbound session the transport service will use to send data to the
* peer
disconnect_session (s);
}
+
/**
* Function obtain the network type for a session
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-unix_get_network (void *cls, void *session)
+unix_get_network (void *cls,
+ struct Session *session)
{
- GNUNET_assert (NULL != session);
- return GNUNET_ATS_NET_LOOPBACK;
+ GNUNET_assert (NULL != session);
+ return GNUNET_ATS_NET_LOOPBACK;
}
return pos;
}
+
/**
* Function obtain the network type for a session
*
* @return the network type in HBO or GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
-wlan_get_network (void *cls, void *session)
+wlan_get_network (void *cls,
+ struct Session *session)
{
- GNUNET_assert (NULL != session);
- return GNUNET_ATS_NET_WLAN;
+ GNUNET_assert (NULL != session);
+ return GNUNET_ATS_NET_WLAN;
}
+
/**
* Creates a new outbound session the transport service will use to send data to the
* peer