aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-12-11 15:46:20 +0000
committerwachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-12-11 15:46:20 +0000
commit476dde8565d3f652175ede19fbc2e8b25e59522d (patch)
tree1567360d3046c819150a1257e12838e1811639e7 /src
parent660c3324f7ee315ba146cc1c1030e82b53ea957d (diff)
changes
git-svn-id: https://gnunet.org/svn/gnunet@25398 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src')
-rw-r--r--src/ats/Makefile.am18
-rw-r--r--src/ats/gnunet-service-ats_addresses.c11
-rw-r--r--src/ats/gnunet-service-ats_addresses.h3
-rw-r--r--src/ats/gnunet-service-ats_addresses_mlp.c6
-rw-r--r--src/ats/gnunet-service-ats_addresses_mlp.h4
-rw-r--r--src/ats/gnunet-service-ats_addresses_simplistic.c53
-rw-r--r--src/ats/gnunet-service-ats_addresses_simplistic.h5
-rw-r--r--src/ats/test_ats_api_common.c139
-rw-r--r--src/ats/test_ats_api_common.h20
-rw-r--r--src/ats/test_ats_api_scheduling_add_address.c98
-rw-r--r--src/ats/test_ats_api_scheduling_add_session.c98
-rw-r--r--src/ats/test_ats_api_scheduling_block_and_reset.c98
-rw-r--r--src/ats/test_ats_api_scheduling_destroy_address.c55
-rw-r--r--src/ats/test_ats_api_scheduling_destroy_inbound_connection.c59
-rw-r--r--src/ats/test_ats_api_scheduling_destroy_session.c53
-rw-r--r--src/ats/test_ats_api_scheduling_update_address.c97
-rw-r--r--src/ats/test_ats_simplistic.c102
17 files changed, 220 insertions, 699 deletions
diff --git a/src/ats/Makefile.am b/src/ats/Makefile.am
index 70b7a57786..306c6e3272 100644
--- a/src/ats/Makefile.am
+++ b/src/ats/Makefile.am
@@ -79,56 +79,56 @@ TESTS = $(check_PROGRAMS)
endif
test_ats_api_scheduling_init_SOURCES = \
- test_ats_api_scheduling_init.c
+ test_ats_api_scheduling_init.c test_ats_api_common.c
test_ats_api_scheduling_init_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/ats/libgnunetats.la
test_ats_api_scheduling_add_address_SOURCES = \
- test_ats_api_scheduling_add_address.c
+ test_ats_api_scheduling_add_address.c test_ats_api_common.c
test_ats_api_scheduling_add_address_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/ats/libgnunetats.la
test_ats_api_scheduling_add_session_SOURCES = \
- test_ats_api_scheduling_add_session.c
+ test_ats_api_scheduling_add_session.c test_ats_api_common.c
test_ats_api_scheduling_add_session_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/ats/libgnunetats.la
test_ats_api_scheduling_update_address_SOURCES = \
- test_ats_api_scheduling_update_address.c
+ test_ats_api_scheduling_update_address.c test_ats_api_common.c
test_ats_api_scheduling_update_address_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/ats/libgnunetats.la
test_ats_api_scheduling_destroy_address_SOURCES = \
- test_ats_api_scheduling_destroy_address.c
+ test_ats_api_scheduling_destroy_address.c test_ats_api_common.c
test_ats_api_scheduling_destroy_address_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/ats/libgnunetats.la
test_ats_api_scheduling_destroy_session_SOURCES = \
- test_ats_api_scheduling_destroy_session.c
+ test_ats_api_scheduling_destroy_session.c test_ats_api_common.c
test_ats_api_scheduling_destroy_session_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/ats/libgnunetats.la
test_ats_api_scheduling_destroy_inbound_connection_SOURCES = \
- test_ats_api_scheduling_destroy_inbound_connection.c
+ test_ats_api_scheduling_destroy_inbound_connection.c test_ats_api_common.c
test_ats_api_scheduling_destroy_inbound_connection_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/ats/libgnunetats.la
test_ats_api_scheduling_block_and_reset_SOURCES = \
- test_ats_api_scheduling_block_and_reset.c
+ test_ats_api_scheduling_block_and_reset.c test_ats_api_common.c
test_ats_api_scheduling_block_and_reset_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -143,7 +143,7 @@ test_ats_api_performance_LDADD = \
$(top_builddir)/src/ats/libgnunetats.la
test_ats_simplistic_SOURCES = \
- test_ats_simplistic.c
+ test_ats_simplistic.c test_ats_api_common.c
test_ats_simplistic_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testing/libgnunettesting.la \
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 85ff1404ce..ef45144fac 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -636,7 +636,7 @@ destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, void *valu
GNUNET_i2s (&aa->peer), aa->session_id, aa);
/* Notify solver about deletion */
- handle->s_del (handle->solver, handle->addresses, aa);
+ handle->s_del (handle->solver, handle->addresses, aa, GNUNET_NO);
destroy_address (aa);
dc->result = GNUNET_NO;
return GNUNET_OK; /* Continue iteration */
@@ -666,7 +666,7 @@ destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, void *valu
GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id);
/* Notify solver about deletion */
- handle->s_del (handle->solver, handle->addresses, aa);
+ handle->s_del (handle->solver, handle->addresses, aa, GNUNET_NO);
destroy_address (aa);
dc->result = GNUNET_NO;
return GNUNET_OK; /* Continue iteration */
@@ -677,10 +677,9 @@ destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, void *valu
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Deleting session for peer `%s': `%s' %u\n",
GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id);
+ /* Notify solver to delete session */
+ handle->s_del (handle->solver, handle->addresses, aa, GNUNET_YES);
aa->session_id = 0;
-
- /* update address */
-
return GNUNET_OK;
}
}
@@ -1162,7 +1161,7 @@ free_address_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GAS_Addresses_Handle *handle = cls;
struct ATS_Address *aa = value;
- handle->s_del (handle->solver, handle->addresses, aa);
+ handle->s_del (handle->solver, handle->addresses, aa, GNUNET_NO);
destroy_address (aa);
return GNUNET_OK;
}
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index 634aed0bac..31b7473005 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -200,7 +200,8 @@ typedef void
typedef void
(*GAS_solver_address_delete) (void *solver,
struct GNUNET_CONTAINER_MultiHashMap *addresses,
- struct ATS_Address *address);
+ struct ATS_Address *address,
+ int session_only);
typedef void
(*GAS_solver_address_update) (void *solver,
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c
index dc6fa18196..fe212e78e6 100644
--- a/src/ats/gnunet-service-ats_addresses_mlp.c
+++ b/src/ats/gnunet-service-ats_addresses_mlp.c
@@ -1651,9 +1651,13 @@ GAS_mlp_address_update (void *solver, struct GNUNET_CONTAINER_MultiHashMap * add
* @param addresses the address hashmap
* the address has to be already removed from the hashmap
* @param address the address to delete
+ * @param session_only delete only session not whole address
*/
void
-GAS_mlp_address_delete (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address)
+GAS_mlp_address_delete (void *solver,
+ struct GNUNET_CONTAINER_MultiHashMap * addresses,
+ struct ATS_Address *address,
+ int session_only)
{
struct GAS_MLP_Handle *mlp = solver;
GNUNET_STATISTICS_update (mlp->stats,"# LP address deletions", 1, GNUNET_NO);
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.h b/src/ats/gnunet-service-ats_addresses_mlp.h
index 78010a0cfd..ea7f87af6e 100644
--- a/src/ats/gnunet-service-ats_addresses_mlp.h
+++ b/src/ats/gnunet-service-ats_addresses_mlp.h
@@ -368,11 +368,13 @@ GAS_mlp_address_update (void *solver,
* @param addresses the address hashmap
* the address has to be already removed from the hashmap
* @param address the address to delete
+ * @param session_only delete only session not whole address
*/
void
GAS_mlp_address_delete (void *solver,
struct GNUNET_CONTAINER_MultiHashMap *addresses,
- struct ATS_Address *address);
+ struct ATS_Address *address,
+ int session_only);
/**
diff --git a/src/ats/gnunet-service-ats_addresses_simplistic.c b/src/ats/gnunet-service-ats_addresses_simplistic.c
index 7a4b048468..6aa73f7db1 100644
--- a/src/ats/gnunet-service-ats_addresses_simplistic.c
+++ b/src/ats/gnunet-service-ats_addresses_simplistic.c
@@ -364,9 +364,12 @@ GAS_simplistic_address_update (void *solver, struct GNUNET_CONTAINER_MultiHashMa
* @param solver the solver handle
* @param addresses the address hashmap containing all addresses
* @param address the address to remove
+ * @param session_only delete only session not whole address
*/
void
-GAS_simplistic_address_delete (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address)
+GAS_simplistic_address_delete (void *solver,
+ struct GNUNET_CONTAINER_MultiHashMap * addresses,
+ struct ATS_Address *address, int session_only)
{
struct GAS_SIMPLISTIC_Handle *s = solver;
struct Network *net;
@@ -382,28 +385,40 @@ GAS_simplistic_address_delete (void *solver, struct GNUNET_CONTAINER_MultiHashMa
net = (struct Network *) address->solver_information;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s address %p for peer `%s' from network `%s' (total: %u/ active: %u)\n",
- (GNUNET_NO == address->active) ? "inactive" : "active",
- address, GNUNET_i2s (&address->peer),
- net->desc, net->total_addresses, net->active_addresses);
-
- if (net->total_addresses < 1)
- GNUNET_break (0);
- else
- net->total_addresses --;
- if (s->total_addresses < 1)
- GNUNET_break (0);
+ if (GNUNET_NO == session_only)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s address %p for peer `%s' from network `%s' (total: %u/ active: %u)\n",
+ (GNUNET_NO == address->active) ? "inactive" : "active",
+ address, GNUNET_i2s (&address->peer),
+ net->desc, net->total_addresses, net->active_addresses);
+
+ /* Remove address */
+ if (net->total_addresses < 1)
+ GNUNET_break (0);
+ else
+ net->total_addresses --;
+ if (s->total_addresses < 1)
+ GNUNET_break (0);
+ else
+ s->total_addresses --;
+
+ for (aw = net->head; NULL != aw; aw = aw->next)
+ {
+ if (aw->addr == address)
+ break;
+ }
+ GNUNET_CONTAINER_DLL_remove (net->head, net->tail, aw);
+ GNUNET_free (aw);
+ }
else
- s->total_addresses --;
-
- for (aw = net->head; NULL != aw; aw = aw->next)
{
- if (aw->addr == address)
- break;
+ /* Remove session only: remove if active and update */
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s session %p for peer `%s' from network `%s' (total: %u/ active: %u)\n",
+ (GNUNET_NO == address->active) ? "inactive" : "active",
+ address, GNUNET_i2s (&address->peer),
+ net->desc, net->total_addresses, net->active_addresses);
}
- GNUNET_CONTAINER_DLL_remove (net->head, net->tail, aw);
- GNUNET_free (aw);
if (GNUNET_YES == address->active)
{
diff --git a/src/ats/gnunet-service-ats_addresses_simplistic.h b/src/ats/gnunet-service-ats_addresses_simplistic.h
index f2005b8896..7737725831 100644
--- a/src/ats/gnunet-service-ats_addresses_simplistic.h
+++ b/src/ats/gnunet-service-ats_addresses_simplistic.h
@@ -97,9 +97,12 @@ GAS_simplistic_address_update (void *solver, struct GNUNET_CONTAINER_MultiHashMa
* @param solver the solver handle
* @param addresses the address hashmap containing all addresses
* @param address the address to remove
+ * @param session_only delete only session not whole address
*/
void
-GAS_simplistic_address_delete (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address);
+GAS_simplistic_address_delete (void *solver,
+ struct GNUNET_CONTAINER_MultiHashMap * addresses,
+ struct ATS_Address *address, int session_only);
/**
diff --git a/src/ats/test_ats_api_common.c b/src/ats/test_ats_api_common.c
new file mode 100644
index 0000000000..f1002f82b9
--- /dev/null
+++ b/src/ats/test_ats_api_common.c
@@ -0,0 +1,139 @@
+/*
+ This file is part of GNUnet.
+ (C) 2010,2011 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ 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.
+*/
+/**
+ * @file ats/test_ats_api_common.c
+ * @brief shared functions for ats test
+ * @author Christian Grothoff
+ * @author Matthias Wachs
+ */
+
+#include "test_ats_api_common.h"
+
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
+
+#define PEERID0 "2AK99KD8RM9UA9LC3QKA0IQ5UBFC0FBB50EBGCFQT8448DGGACNAC4CJQDD1CPFS494O41U88DJD1FLIG8VA5CQR9IN4L96GP104MVO"
+#define PEERID1 "5ED7I0AR3MSTAL7FQN04S22E0EQ3CR9RLASCDLVMM1BNFPUPTCT46DLKNJ4DACASJ6U0DR5J8S3R2UJL49682JS7MOVRAB8P8A4PJH0"
+
+void
+create_test_address (struct Test_Address *dest, char * plugin, void *session, void *addr, size_t addrlen)
+{
+
+ dest->plugin = GNUNET_strdup (plugin);
+ dest->session = session;
+ if (addrlen > 0)
+ {
+ dest->addr = GNUNET_malloc (addrlen);
+ memcpy (dest->addr, addr, addrlen);
+ }
+ else
+ dest->addr = NULL;
+ dest->addr_len = addrlen;
+}
+
+void
+free_test_address (struct Test_Address *dest)
+{
+ GNUNET_free (dest->plugin);
+ if (NULL != dest->addr)
+ GNUNET_free (dest->addr);
+}
+
+int
+compare_addresses (const struct GNUNET_HELLO_Address *address1, void *session1,
+ const struct GNUNET_HELLO_Address *address2, void *session2)
+{
+ if (0 != memcmp (&address1->peer, &address2->peer, sizeof (struct GNUNET_PeerIdentity)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid peer id'\n");
+ return GNUNET_SYSERR;
+ }
+ if (0 != strcmp (address1->transport_name, address2->transport_name))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid plugin'\n");
+ return GNUNET_SYSERR;
+ }
+ if (address1->address_length != address2->address_length)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address length'\n");
+ return GNUNET_SYSERR;
+
+ }
+ else if (0 != memcmp (address1->address, address2->address, address2->address_length))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address'\n");
+ return GNUNET_SYSERR;
+ }
+ if (session1 != session2)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid session1 %p vs session2 %p'\n",
+ session1, session2);
+ return GNUNET_SYSERR;
+
+ }
+ return GNUNET_OK;
+}
+
+
+int
+compare_ats (const struct GNUNET_ATS_Information *ats_is, uint32_t ats_count_is,
+ const struct GNUNET_ATS_Information *ats_should, uint32_t ats_count_should)
+{
+ unsigned int c_o;
+ unsigned int c_i;
+ char *prop[] = GNUNET_ATS_PropertyStrings;
+ uint32_t type1;
+ uint32_t type2;
+ uint32_t val1;
+ uint32_t val2;
+ int res = GNUNET_OK;
+
+ for (c_o = 0; c_o < ats_count_is; c_o++)
+ {
+ for (c_i = 0; c_i < ats_count_should; c_i++)
+ {
+ type1 = ntohl(ats_is[c_o].type);
+ type2 = ntohl(ats_should[c_i].type);
+ if (type1 == type2)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS type `%s'\n",
+ prop[type1]);
+ val1 = ntohl(ats_is[c_o].value);
+ val2 = ntohl(ats_should[c_i].value);
+ if (val1 != val2)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS value `%s' not equal: %u != %u\n",
+ prop[type1],
+ val1, val2);
+ res = GNUNET_SYSERR;
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS value `%s' equal: %u == %u\n",
+ prop[type1],
+ val1, val2);
+ }
+ }
+ }
+ }
+ return res;
+}
+
+
+/* end of file test_ats_api_common.c */
diff --git a/src/ats/test_ats_api_common.h b/src/ats/test_ats_api_common.h
index b406ecd3ee..04dd11b571 100644
--- a/src/ats/test_ats_api_common.h
+++ b/src/ats/test_ats_api_common.h
@@ -19,11 +19,15 @@
*/
/**
* @file ats/test_ats_api_common.h
- * @brief shared definitions
+ * @brief shared definitions for ats testcases
* @author Christian Grothoff
* @author Matthias Wachs
*/
+#include "platform.h"
+#include "gnunet_common.h"
+#include "gnunet_ats_service.h"
+
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
#define PEERID0 "2AK99KD8RM9UA9LC3QKA0IQ5UBFC0FBB50EBGCFQT8448DGGACNAC4CJQDD1CPFS494O41U88DJD1FLIG8VA5CQR9IN4L96GP104MVO"
@@ -54,4 +58,18 @@ struct PeerContext
unsigned long long bw_in_assigned;
};
+void
+free_test_address (struct Test_Address *dest);
+
+void
+create_test_address (struct Test_Address *dest, char * plugin, void *session, void *addr, size_t addrlen);
+
+int
+compare_addresses (const struct GNUNET_HELLO_Address *address1, void *session1,
+ const struct GNUNET_HELLO_Address *address2, void *session2);
+
+int
+compare_ats (const struct GNUNET_ATS_Information *ats_is, uint32_t ats_count_is,
+ const struct GNUNET_ATS_Information *ats_should, uint32_t ats_count_should);
+
/* end of file test_ats_api_common.h */
diff --git a/src/ats/test_ats_api_scheduling_add_address.c b/src/ats/test_ats_api_scheduling_add_address.c
index efbcb2da81..79e28d10b1 100644
--- a/src/ats/test_ats_api_scheduling_add_address.c
+++ b/src/ats/test_ats_api_scheduling_add_address.c
@@ -73,24 +73,6 @@ uint32_t test_ats_count;
static void
-create_test_address (struct Test_Address *dest, char * plugin, void *session, void *addr, size_t addrlen)
-{
- dest->plugin = GNUNET_strdup (plugin);
- dest->session = session;
- dest->addr = GNUNET_malloc (addrlen);
- memcpy (dest->addr, addr, addrlen);
- dest->addr_len = addrlen;
-}
-
-static void
-free_test_address (struct Test_Address *dest)
-{
- GNUNET_free (dest->plugin);
- GNUNET_free (dest->addr);
-}
-
-
-static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
die_task = GNUNET_SCHEDULER_NO_TASK;
@@ -117,86 +99,6 @@ end ()
free_test_address (&test_addr);
}
-static int
-compare_addresses (const struct GNUNET_HELLO_Address *address1, void *session1,
- const struct GNUNET_HELLO_Address *address2, void *session2)
-{
- if (0 != memcmp (&address1->peer, &address2->peer, sizeof (struct GNUNET_PeerIdentity)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid peer id'\n");
- return GNUNET_SYSERR;
- }
- if (0 != strcmp (address1->transport_name, address2->transport_name))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid plugin'\n");
- return GNUNET_SYSERR;
- }
- if (address1->address_length != address2->address_length)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address length'\n");
- return GNUNET_SYSERR;
-
- }
- else if (0 != memcmp (address1->address, address2->address, address2->address_length))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address'\n");
- return GNUNET_SYSERR;
- }
- if (session1 != session2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid session1 %p vs session2 %p'\n",
- session1, session2);
- return GNUNET_SYSERR;
-
- }
- return GNUNET_OK;
-}
-
-
-static int
-compare_ats (const struct GNUNET_ATS_Information *ats_is, uint32_t ats_count_is,
- const struct GNUNET_ATS_Information *ats_should, uint32_t ats_count_should)
-{
- unsigned int c_o;
- unsigned int c_i;
- char *prop[] = GNUNET_ATS_PropertyStrings;
- uint32_t type1;
- uint32_t type2;
- uint32_t val1;
- uint32_t val2;
- int res = GNUNET_OK;
-
- for (c_o = 0; c_o < ats_count_is; c_o++)
- {
- for (c_i = 0; c_i < ats_count_should; c_i++)
- {
- type1 = ntohl(ats_is[c_o].type);
- type2 = ntohl(ats_should[c_i].type);
- if (type1 == type2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS type `%s'\n",
- prop[type1]);
- val1 = ntohl(ats_is[c_o].value);
- val2 = ntohl(ats_should[c_i].value);
- if (val1 != val2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS value `%s' not equal: %u != %u\n",
- prop[type1],
- val1, val2);
- res = GNUNET_SYSERR;
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS value `%s' equal: %u == %u\n",
- prop[type1],
- val1, val2);
- }
- }
- }
- }
- return res;
-}
-
static void
address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
struct Session *session,
diff --git a/src/ats/test_ats_api_scheduling_add_session.c b/src/ats/test_ats_api_scheduling_add_session.c
index 250099d6a2..92ddc6ae74 100644
--- a/src/ats/test_ats_api_scheduling_add_session.c
+++ b/src/ats/test_ats_api_scheduling_add_session.c
@@ -73,24 +73,6 @@ uint32_t test_ats_count;
static void
-create_test_address (struct Test_Address *dest, char * plugin, void *session, void *addr, size_t addrlen)
-{
- dest->plugin = GNUNET_strdup (plugin);
- dest->session = session;
- dest->addr = GNUNET_malloc (addrlen);
- memcpy (dest->addr, addr, addrlen);
- dest->addr_len = addrlen;
-}
-
-static void
-free_test_address (struct Test_Address *dest)
-{
- GNUNET_free (dest->plugin);
- GNUNET_free (dest->addr);
-}
-
-
-static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
die_task = GNUNET_SCHEDULER_NO_TASK;
@@ -117,86 +99,6 @@ end ()
free_test_address (&test_addr);
}
-static int
-compare_addresses (const struct GNUNET_HELLO_Address *address1, void *session1,
- const struct GNUNET_HELLO_Address *address2, void *session2)
-{
- if (0 != memcmp (&address1->peer, &address2->peer, sizeof (struct GNUNET_PeerIdentity)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid peer id'\n");
- return GNUNET_SYSERR;
- }
- if (0 != strcmp (address1->transport_name, address2->transport_name))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid plugin'\n");
- return GNUNET_SYSERR;
- }
- if (address1->address_length != address2->address_length)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address length'\n");
- return GNUNET_SYSERR;
-
- }
- else if (0 != memcmp (address1->address, address2->address, address2->address_length))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address'\n");
- return GNUNET_SYSERR;
- }
- if (session1 != session2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid session1 %p vs session2 %p'\n",
- session1, session2);
- return GNUNET_SYSERR;
-
- }
- return GNUNET_OK;
-}
-
-
-static int
-compare_ats (const struct GNUNET_ATS_Information *ats_is, uint32_t ats_count_is,
- const struct GNUNET_ATS_Information *ats_should, uint32_t ats_count_should)
-{
- unsigned int c_o;
- unsigned int c_i;
- char *prop[] = GNUNET_ATS_PropertyStrings;
- uint32_t type1;
- uint32_t type2;
- uint32_t val1;
- uint32_t val2;
- int res = GNUNET_OK;
-
- for (c_o = 0; c_o < ats_count_is; c_o++)
- {
- for (c_i = 0; c_i < ats_count_should; c_i++)
- {
- type1 = ntohl(ats_is[c_o].type);
- type2 = ntohl(ats_should[c_i].type);
- if (type1 == type2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS type `%s'\n",
- prop[type1]);
- val1 = ntohl(ats_is[c_o].value);
- val2 = ntohl(ats_should[c_i].value);
- if (val1 != val2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS value `%s' not equal: %u != %u\n",
- prop[type1],
- val1, val2);
- res = GNUNET_SYSERR;
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS value `%s' equal: %u == %u\n",
- prop[type1],
- val1, val2);
- }
- }
- }
- }
- return res;
-}
-
static void
address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
struct Session *session,
diff --git a/src/ats/test_ats_api_scheduling_block_and_reset.c b/src/ats/test_ats_api_scheduling_block_and_reset.c
index 83e37e4eab..90ec0c7576 100644
--- a/src/ats/test_ats_api_scheduling_block_and_reset.c
+++ b/src/ats/test_ats_api_scheduling_block_and_reset.c
@@ -94,24 +94,6 @@ struct GNUNET_TIME_Absolute reset_block_start;
struct GNUNET_TIME_Relative reset_block_duration;
static void
-create_test_address (struct Test_Address *dest, char * plugin, void *session, void *addr, size_t addrlen)
-{
- dest->plugin = GNUNET_strdup (plugin);
- dest->session = session;
- dest->addr = GNUNET_malloc (addrlen);
- memcpy (dest->addr, addr, addrlen);
- dest->addr_len = addrlen;
-}
-
-static void
-free_test_address (struct Test_Address *dest)
-{
- GNUNET_free (dest->plugin);
- GNUNET_free (dest->addr);
-}
-
-
-static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
die_task = GNUNET_SCHEDULER_NO_TASK;
@@ -146,86 +128,6 @@ end ()
free_test_address (&test_addr);
}
-static int
-compare_addresses (const struct GNUNET_HELLO_Address *address1, void *session1,
- const struct GNUNET_HELLO_Address *address2, void *session2)
-{
- if (0 != memcmp (&address1->peer, &address2->peer, sizeof (struct GNUNET_PeerIdentity)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid peer id'\n");
- return GNUNET_SYSERR;
- }
- if (0 != strcmp (address1->transport_name, address2->transport_name))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid plugin'\n");
- return GNUNET_SYSERR;
- }
- if (address1->address_length != address2->address_length)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address length'\n");
- return GNUNET_SYSERR;
-
- }
- else if (0 != memcmp (address1->address, address2->address, address2->address_length))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address'\n");
- return GNUNET_SYSERR;
- }
- if (session1 != session2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid session1 %p vs session2 %p'\n",
- session1, session2);
- return GNUNET_SYSERR;
-
- }
- return GNUNET_OK;
-}
-
-
-static int
-compare_ats (const struct GNUNET_ATS_Information *ats_is, uint32_t ats_count_is,
- const struct GNUNET_ATS_Information *ats_should, uint32_t ats_count_should)
-{
- unsigned int c_o;
- unsigned int c_i;
- char *prop[] = GNUNET_ATS_PropertyStrings;
- uint32_t type1;
- uint32_t type2;
- uint32_t val1;
- uint32_t val2;
- int res = GNUNET_OK;
-
- for (c_o = 0; c_o < ats_count_is; c_o++)
- {
- for (c_i = 0; c_i < ats_count_should; c_i++)
- {
- type1 = ntohl(ats_is[c_o].type);
- type2 = ntohl(ats_should[c_i].type);
- if (type1 == type2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS type `%s'\n",
- prop[type1]);
- val1 = ntohl(ats_is[c_o].value);
- val2 = ntohl(ats_should[c_i].value);
- if (val1 != val2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS value `%s' not equal: %u != %u\n",
- prop[type1],
- val1, val2);
- res = GNUNET_SYSERR;
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS value `%s' equal: %u == %u\n",
- prop[type1],
- val1, val2);
- }
- }
- }
- }
- return res;
-}
-
static void
request_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
diff --git a/src/ats/test_ats_api_scheduling_destroy_address.c b/src/ats/test_ats_api_scheduling_destroy_address.c
index 40dc9d3516..ee847eec7f 100644
--- a/src/ats/test_ats_api_scheduling_destroy_address.c
+++ b/src/ats/test_ats_api_scheduling_destroy_address.c
@@ -78,26 +78,6 @@ struct GNUNET_ATS_Information test_ats_info[2];
uint32_t test_ats_count;
-
-static void
-create_test_address (struct Test_Address *dest, char * plugin, void *session, void *addr, size_t addrlen)
-{
-
- dest->plugin = GNUNET_strdup (plugin);
- dest->session = session;
- dest->addr = GNUNET_malloc (addrlen);
- memcpy (dest->addr, addr, addrlen);
- dest->addr_len = addrlen;
-}
-
-static void
-free_test_address (struct Test_Address *dest)
-{
- GNUNET_free (dest->plugin);
- GNUNET_free (dest->addr);
-}
-
-
static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
@@ -129,41 +109,6 @@ end ()
sched_ats = NULL;
}
-static int
-compare_addresses (const struct GNUNET_HELLO_Address *address1, void *session1,
- const struct GNUNET_HELLO_Address *address2, void *session2)
-{
- if (0 != memcmp (&address1->peer, &address2->peer, sizeof (struct GNUNET_PeerIdentity)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid peer id'\n");
- return GNUNET_SYSERR;
- }
- if (0 != strcmp (address1->transport_name, address2->transport_name))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid plugin'\n");
- return GNUNET_SYSERR;
- }
- if (address1->address_length != address2->address_length)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address length'\n");
- return GNUNET_SYSERR;
-
- }
- else if (0 != memcmp (address1->address, address2->address, address2->address_length))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid address'\n");
- return GNUNET_SYSERR;
- }
- if (session1 != session2)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Suggestion with invalid session1 %p vs session2 %p'\n",
- session1, session2);
- return GNUNET_SYSERR;
-
- }
- return GNUNET_