struct Address *addr;
};
-struct Address addr[2];
+struct Address test_addr[2];
struct PeerContext p[2];
struct GNUNET_ATS_Information atsi[2];
GNUNET_assert (0 ==
memcmp (&address->peer, &p[0].id,
sizeof (struct GNUNET_PeerIdentity)));
- GNUNET_assert (0 == strcmp (address->transport_name, addr[0].plugin));
- GNUNET_assert (address->address_length == addr[0].addr_len);
+ GNUNET_assert (0 == strcmp (address->transport_name, test_addr[0].plugin));
+ GNUNET_assert (address->address_length == test_addr[0].addr_len);
GNUNET_assert (0 ==
- memcmp (address->address, addr[0].plugin,
+ memcmp (address->address, test_addr[0].plugin,
address->address_length));
- GNUNET_assert (addr[0].session == session);
+ GNUNET_assert (test_addr[0].session == session);
ret = 0;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n",
GNUNET_i2s (&p[1].id));
- addr[0].plugin = "test";
- addr[0].session = NULL;
- addr[0].addr = GNUNET_strdup ("test");
- addr[0].addr_len = 4;
+ test_addr[0].plugin = "test";
+ test_addr[0].session = NULL;
+ test_addr[0].addr = GNUNET_strdup ("test");
+ test_addr[0].addr_len = 4;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing address creation\n");
address0.peer = p[0].id;
- address0.transport_name = addr[0].plugin;
- address0.address = addr[0].addr;
- address0.address_length = addr[0].addr_len;
- GNUNET_ATS_address_add (ats, &address0, addr[0].session, NULL, 0);
- GNUNET_ATS_address_update (ats, &address0, addr[0].session, NULL, 0);
+ address0.transport_name = test_addr[0].plugin;
+ address0.address = test_addr[0].addr;
+ address0.address_length = test_addr[0].addr_len;
+ GNUNET_ATS_address_add (ats, &address0, test_addr[0].session, NULL, 0);
+ GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, NULL, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info creation\n");
atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_UP);
atsi[0].value = htonl (1024);
- GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 1);
+ GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, atsi, 1);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info update\n");
atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_DOWN);
atsi[1].value = htonl (1024);
- GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 2);
+ GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, atsi, 2);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requesting peer `%s'\n",
GNUNET_i2s (&p[0].id));
struct Address *addr;
};
-struct Address addr;
+struct Address test_addr;
struct PeerContext p;
struct GNUNET_ATS_Information atsi;
-struct GNUNET_HELLO_Address address0;
+struct GNUNET_HELLO_Address hello_address;
static void
stop_arm ()
GNUNET_assert (0 ==
memcmp (&address->peer, &p.id,
sizeof (struct GNUNET_PeerIdentity)));
- GNUNET_assert (0 == strcmp (address->transport_name, addr.plugin));
- GNUNET_assert (address->address_length == addr.addr_len);
+ GNUNET_assert (0 == strcmp (address->transport_name, test_addr.plugin));
+ GNUNET_assert (address->address_length == test_addr.addr_len);
GNUNET_assert (0 ==
- memcmp (address->address, addr.plugin,
+ memcmp (address->address, test_addr.plugin,
address->address_length));
- GNUNET_assert (addr.session == session);
+ GNUNET_assert (test_addr.session == session);
if (0 == stage)
{
/* Delete session */
- GNUNET_ATS_address_destroyed (ats, &address0, addr.session);
- addr.session = NULL;
+ GNUNET_ATS_address_destroyed (ats, &hello_address, test_addr.session);
+ test_addr.session = NULL;
GNUNET_ATS_suggest_address (ats, &p.id);
}
if (1 == stage)
{
/* Delete address */
- GNUNET_ATS_address_destroyed (ats, &address0, addr.session);
- addr.session = NULL;
+ GNUNET_ATS_address_destroyed (ats, &hello_address, test_addr.session);
+ test_addr.session = NULL;
GNUNET_ATS_suggest_address (ats, &p.id);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &end, NULL);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n",
GNUNET_i2s (&p.id));
- addr.plugin = "test";
- addr.session = &addr;
- addr.addr = GNUNET_strdup ("test");
- addr.addr_len = 4;
+ test_addr.plugin = "test";
+ test_addr.session = &test_addr;
+ test_addr.addr = GNUNET_strdup ("test");
+ test_addr.addr_len = 4;
/* Adding address with session */
- address0.peer = p.id;
- address0.transport_name = addr.plugin;
- address0.address = addr.addr;
- address0.address_length = addr.addr_len;
- GNUNET_ATS_address_add (ats, &address0, addr.session, NULL, 0);
+ hello_address.peer = p.id;
+ hello_address.transport_name = test_addr.plugin;
+ hello_address.address = test_addr.addr;
+ hello_address.address_length = test_addr.addr_len;
+ GNUNET_ATS_address_add (ats, &hello_address, test_addr.session, NULL, 0);
GNUNET_ATS_suggest_address (ats, &p.id);
}