aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/testcases/socket_test.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2005-12-06 16:00:07 +0000
committerMartin Willi <martin@strongswan.org>2005-12-06 16:00:07 +0000
commit2b547481315c3b641b716023858efdbb2c3e422a (patch)
tree14f5f4f27b0fb602c20ef10e5e20f96bfeae1ea2 /Source/charon/testcases/socket_test.c
parent4b41a0d4047fa483578f458ef21af5cad64b572b (diff)
downloadstrongswan-2b547481315c3b641b716023858efdbb2c3e422a.tar.bz2
strongswan-2b547481315c3b641b716023858efdbb2c3e422a.tar.xz
- code cleanup in network and config
- moved packet_t members to private, added getter and setters
Diffstat (limited to 'Source/charon/testcases/socket_test.c')
-rw-r--r--Source/charon/testcases/socket_test.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/charon/testcases/socket_test.c b/Source/charon/testcases/socket_test.c
index 03117c555..af3c1508e 100644
--- a/Source/charon/testcases/socket_test.c
+++ b/Source/charon/testcases/socket_test.c
@@ -38,14 +38,16 @@ void test_socket(tester_t *tester)
socket_t *skt = socket_create(4500);
packet_t *pkt = packet_create(AF_INET);
char *test_string = "Testing functionality of socket_t";
+ chunk_t data;
- pkt->data.ptr = allocator_alloc(strlen(test_string) + 1);
- memcpy(pkt->data.ptr,test_string,strlen(test_string) + 1);
- pkt->data.len = strlen(test_string) + 1;
+ data.ptr = allocator_alloc(strlen(test_string) + 1);
+ memcpy(data.ptr,test_string,strlen(test_string) + 1);
+ data.len = strlen(test_string) + 1;
/* send to previously bound socket */
- pkt->destination = host_create(AF_INET, "127.0.0.1", 4500);
+ pkt->set_destination(pkt, host_create(AF_INET, "127.0.0.1", 4500));
+ pkt->set_data(pkt, data);
/* send packet_count packets */
for (current = 0; current < packet_count; current++)
@@ -61,7 +63,8 @@ void test_socket(tester_t *tester)
for (current = 0; current < packet_count; current++)
{
skt->receive(skt, &pkt);
- tester->assert_false(tester, strcmp(test_string, pkt->data.ptr), "packet exchange");
+ data = pkt->get_data(pkt);
+ tester->assert_false(tester, strcmp(test_string, data.ptr), "packet exchange");
pkt->destroy(pkt);
}