[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26533 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26533 - gnunet/src/transport |
Date: |
Thu, 21 Mar 2013 12:01:09 +0100 |
Author: wachs
Date: 2013-03-21 12:01:09 +0100 (Thu, 21 Mar 2013)
New Revision: 26533
Modified:
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/gnunet-service-transport_manipulation.c
gnunet/src/transport/gnunet-service-transport_manipulation.h
Log:
ats manipulation
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2013-03-21 10:18:02 UTC
(rev 26532)
+++ gnunet/src/transport/gnunet-service-transport.c 2013-03-21 11:01:09 UTC
(rev 26533)
@@ -696,12 +696,12 @@
GST_blacklist_start (GST_server);
GST_ats =
GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change, NULL);
- GST_manipulation_init (GST_cfg);
+ GST_manipulation_init (GST_cfg, &plugin_env_update_metrics);
GST_plugins_load (&GST_manipulation_recv,
&plugin_env_address_change_notification,
&plugin_env_session_end,
&plugin_env_address_to_type,
- &plugin_env_update_metrics);
+ &GST_manipulation_update_metrics);
GST_neighbours_start (NULL,
&neighbours_connect_notification,
&neighbours_disconnect_notification,
Modified: gnunet/src/transport/gnunet-service-transport_manipulation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_manipulation.c
2013-03-21 10:18:02 UTC (rev 26532)
+++ gnunet/src/transport/gnunet-service-transport_manipulation.c
2013-03-21 11:01:09 UTC (rev 26533)
@@ -52,6 +52,8 @@
{
struct GNUNET_CONTAINER_MultiHashMap *peers;
+ GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb;
+
/**
* General inbound delay
*/
@@ -343,6 +345,45 @@
GST_neighbours_send (target, msg, msg_size, timeout, cont, cont_cls);
}
+
+/**
+ * Function that will be called to figure if an address is an loopback,
+ * LAN, WAN etc. address
+ *
+ * @param cls closure
+ * @param addr binary address
+ * @param addrlen length of the address
+ * @return ATS Information containing the network type
+ */
+void
+GST_manipulation_update_metrics (void *cls,
+
const struct
GNUNET_PeerIdentity *peer,
+
const char *address,
+
uint16_t address_len,
+
struct Session *session,
+
struct GNUNET_ATS_Information
*ats,
+
uint32_t ats_count)
+{
+#if 0
+ struct GNUNET_ATS_Information ats_new[ats_count];
+ struct TM_Peer *tmp;
+
+ for (d = 0; d < ats_count; d++)
+ {
+ ats_new[d] = ats[d];
+ if ((ntohl(ats[d].type) == GNUNET_ATS_QUALITY_NET_DISTANCE) &&
+ (man_handle.distance_recv > 0))
+ ats_new[d].value = htonl(man_handle.distance_recv); /*
Global inbound distance */
+ }
+
+ if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers,
&peer->hashPubKey)))
+ {
+
+ }
+#endif
+ man_handle.metric_update_cb (cls, peer, address, address_len, session,
ats, ats_count);
+}
+
struct GNUNET_TIME_Relative
GST_manipulation_recv (void *cls,
const struct GNUNET_PeerIdentity *peer,
@@ -352,8 +393,7 @@
uint16_t sender_address_len)
{
struct TM_Peer *tmp;
- //int d;
- //struct GNUNET_ATS_Information ats_new[ats_count];
+
struct GNUNET_TIME_Relative quota_delay;
struct GNUNET_TIME_Relative m_delay;
@@ -400,8 +440,10 @@
}
void
-GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg)
+GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg,
+ GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb)
{
+ man_handle.metric_update_cb = metric_update_cb;
if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
"transport", "MANIPULATE_DISTANCE_IN",
&man_handle.distance_recv))
Modified: gnunet/src/transport/gnunet-service-transport_manipulation.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_manipulation.h
2013-03-21 10:18:02 UTC (rev 26532)
+++ gnunet/src/transport/gnunet-service-transport_manipulation.h
2013-03-21 11:01:09 UTC (rev 26533)
@@ -55,9 +55,19 @@
uint16_t sender_address_len);
void
-GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg);
+GST_manipulation_update_metrics (void *cls,
+
const struct
GNUNET_PeerIdentity *peer,
+
const char *address,
+
uint16_t address_len,
+
struct Session *session,
+
struct GNUNET_ATS_Information
*ats,
+
uint32_t ats_count);
void
+GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg,
+ GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb);
+
+void
GST_manipulation_stop ();
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26533 - gnunet/src/transport,
gnunet <=