[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25311 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25311 - gnunet/src/ats |
Date: |
Fri, 7 Dec 2012 16:32:47 +0100 |
Author: wachs
Date: 2012-12-07 16:32:46 +0100 (Fri, 07 Dec 2012)
New Revision: 25311
Modified:
gnunet/src/ats/gnunet-service-ats_addresses.c
gnunet/src/ats/gnunet-service-ats_addresses.h
gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c
gnunet/src/ats/gnunet-service-ats_addresses_simplistic.h
Log:
mod
Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c 2012-12-07 15:13:01 UTC
(rev 25310)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c 2012-12-07 15:32:46 UTC
(rev 25311)
@@ -314,11 +314,6 @@
struct CompareAddressContext *cac = cls;
struct ATS_Address *aa = value;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Comparing peer %4s: address length %u
session %u <-> address length %u session %u\n",
- GNUNET_h2s (key),
- aa->addr_len, aa->session_id,
- cac->search->addr_len, cac->search->session_id);
-
/* Find an matching exact address:
*
* Compare by:
@@ -400,12 +395,6 @@
GNUNET_CONTAINER_multihashmap_get_multiple (handle->addresses,
&peer->hashPubKey,
&compare_address_it, &cac);
-#if 0
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found exact address: %s base address: %s\n",
- (cac.exact_address != NULL) ? "YES" : "NO",
- (cac.base_address != NULL) ? "YES" : "NO");
-#endif
if (cac.exact_address == NULL)
return cac.base_address;
return cac.exact_address;
@@ -444,48 +433,6 @@
}
-#if 0
-static int
-compare_address_session_it (void *cls, const struct GNUNET_HashCode * key,
void *value)
-{
- struct CompareAddressContext *cac = cls;
- struct ATS_Address *aa = value;
-
- if ((aa->addr_len == cac->search->addr_len) && (0 == strcmp (aa->plugin,
cac->search->plugin)))
- {
- if ((0 == memcmp (aa->addr, cac->search->addr, aa->addr_len)) &&
(aa->session_id == cac->search->session_id))
- {
- cac->exact_address = aa;
- return GNUNET_NO;
- }
- }
- return GNUNET_YES;
-}
-
-
-/**
- * Find an existing equivalent address record.
- * Compares by peer identity and network address AND by session ID
- * (one of the two must match).
- *
- * @param peer peer to lookup addresses for
- * @param addr existing address record
- * @return existing address record, NULL for none
- */
-static struct ATS_Address *
-find_exact_address (const struct GNUNET_PeerIdentity *peer,
- const struct ATS_Address *addr)
-{
- struct CompareAddressContext cac;
-
- cac.exact_address = NULL;
- cac.search = addr;
- GNUNET_CONTAINER_multihashmap_get_multiple (handle->addresses,
&peer->hashPubKey,
- &compare_address_session_it,
&cac);
- return cac.exact_address;
-}
-#endif
-
void
GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
const char *plugin_name, const void *plugin_addr,
Modified: gnunet/src/ats/gnunet-service-ats_addresses.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.h 2012-12-07 15:13:01 UTC
(rev 25310)
+++ gnunet/src/ats/gnunet-service-ats_addresses.h 2012-12-07 15:32:46 UTC
(rev 25311)
@@ -147,12 +147,33 @@
};
+/**
+ * Init the simplistic problem solving component
+ *
+ * Quotas:
+ * network[i] contains the network type as type GNUNET_ATS_NetworkType[i]
+ * out_quota[i] contains outbound quota for network type i
+ * in_quota[i] contains inbound quota for network type i
+ *
+ * Example
+ * network = {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK,
GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN}
+ * network[2] == GNUNET_ATS_NET_LAN
+ * out_quota[2] == 65353
+ * in_quota[2] == 65353
+ *
+ * @param cfg configuration handle
+ * @param stats the GNUNET_STATISTICS handle
+ * @param network array of GNUNET_ATS_NetworkType with length dest_length
+ * @param out_quota array of outbound quotas
+ * param in_quota array of outbound quota
+ * @return handle for the solver on success, NULL on fail
+ */
typedef void *
(*GAS_solver_init) (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_STATISTICS_Handle *stats,
int *network,
- unsigned long long *out_dest,
- unsigned long long *in_dest,
+ unsigned long long *out_quota,
+ unsigned long long *in_quota,
int dest_length);
typedef void
Modified: gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c 2012-12-07
15:13:01 UTC (rev 25310)
+++ gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c 2012-12-07
15:32:46 UTC (rev 25311)
@@ -36,26 +36,62 @@
*/
struct GAS_SIMPLISTIC_Handle
{
+
unsigned int active_addresses;
+
+ /**
+ * Network type array
+ *
+ * quotas[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType;
+ *
+ */
int *quota_net;
+
+ /**
+ * Array of inbound quotas
+ *
+ */
unsigned long long *quota_in;
+
+ /**
+ * Array of outbound quotas
+ *
+ */
unsigned long long *quota_out;
+
+ /**
+ * Active addresses per network type
+ */
+ unsigned int *active_addresses_per_net;
};
-
/**
* Init the simplistic problem solving component
*
+ * Quotas:
+ * network[i] contains the network type as type GNUNET_ATS_NetworkType[i]
+ * out_quota[i] contains outbound quota for network type i
+ * in_quota[i] contains inbound quota for network type i
+ *
+ * Example
+ * network = {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK,
GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN}
+ * network[2] == GNUNET_ATS_NET_LAN
+ * out_quota[2] == 65353
+ * in_quota[2] == 65353
+ *
* @param cfg configuration handle
* @param stats the GNUNET_STATISTICS handle
+ * @param network array of GNUNET_ATS_NetworkType with length dest_length
+ * @param out_quota array of outbound quotas
+ * param in_quota array of outbound quota
* @return handle for the solver on success, NULL on fail
*/
void *
GAS_simplistic_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_STATISTICS_Handle *stats,
int *network,
- unsigned long long *out_dest,
- unsigned long long *in_dest,
+ unsigned long long *out_quota,
+ unsigned long long *in_quota,
int dest_length)
{
struct GAS_SIMPLISTIC_Handle *solver = GNUNET_malloc (sizeof (struct
GAS_SIMPLISTIC_Handle));
@@ -64,11 +100,13 @@
memcpy (solver->quota_net, network, dest_length * sizeof (int));
solver->quota_in = GNUNET_malloc (dest_length * sizeof (unsigned long
long));
- memcpy (solver->quota_in, out_dest, dest_length * sizeof (int));
+ memcpy (solver->quota_in, in_quota, dest_length * sizeof (int));
solver->quota_out = GNUNET_malloc (dest_length * sizeof (unsigned long
long));
- memcpy (solver->quota_out, out_dest, dest_length * sizeof (unsigned long
long));
+ memcpy (solver->quota_out, out_quota, dest_length * sizeof (unsigned long
long));
+ solver->active_addresses_per_net = GNUNET_malloc (dest_length * sizeof
(unsigned int));
+
return solver;
}
@@ -86,6 +124,7 @@
GNUNET_free (s->quota_net);
GNUNET_free (s->quota_in);
GNUNET_free (s->quota_out);
+ GNUNET_free (s->active_addresses_per_net);
GNUNET_free (s);
}
@@ -212,8 +251,6 @@
aa->assigned_bw_in.value__ = htonl (UINT32_MAX / s->active_addresses);
aa->assigned_bw_out.value__ = htonl (UINT32_MAX / s->active_addresses);
- //send_bw_notification (aa);
-
return GNUNET_OK;
}
@@ -284,7 +321,7 @@
enum GNUNET_ATS_PreferenceKind kind,
float score)
{
-
+ /* FIXME : implement this */
}
/* end of gnunet-service-ats_addresses_simplistic.c */
Modified: gnunet/src/ats/gnunet-service-ats_addresses_simplistic.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_simplistic.h 2012-12-07
15:13:01 UTC (rev 25310)
+++ gnunet/src/ats/gnunet-service-ats_addresses_simplistic.h 2012-12-07
15:32:46 UTC (rev 25311)
@@ -33,15 +33,31 @@
/**
* Init the simplistic problem solving component
*
+ * Quotas:
+ * network[i] contains the network type as type GNUNET_ATS_NetworkType[i]
+ * out_quota[i] contains outbound quota for network type i
+ * in_quota[i] contains inbound quota for network type i
+ *
+ * Example
+ * network = {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK,
GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN}
+ * network[2] == GNUNET_ATS_NET_LAN
+ * out_quota[2] == 65353
+ * in_quota[2] == 65353
+ *
* @param cfg configuration handle
* @param stats the GNUNET_STATISTICS handle
+ * @param network array of GNUNET_ATS_NetworkType with length dest_length
+ * @param out_quota array of outbound quotas
+ * param in_quota array of outbound quota
* @return handle for the solver on success, NULL on fail
*/
void *
GAS_simplistic_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_STATISTICS_Handle *stats,
- int *network,
- unsigned long long *out_dest, unsigned long long *in_dest, int
dest_length);
+ const struct GNUNET_STATISTICS_Handle *stats,
+ int *network,
+ unsigned long long *out_quota,
+ unsigned long long *in_quota,
+ int dest_length);
/**
* Shutdown the simplistic problem solving component
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25311 - gnunet/src/ats,
gnunet <=