aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadeT.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/test_cadeT.c')
-rw-r--r--src/cadet/test_cadeT.c48
1 files changed, 35 insertions, 13 deletions
diff --git a/src/cadet/test_cadeT.c b/src/cadet/test_cadeT.c
index 5e92084a6..97f315167 100644
--- a/src/cadet/test_cadeT.c
+++ b/src/cadet/test_cadeT.c
@@ -45,7 +45,6 @@
45 * - GNUNET_TESTBED_underlay_configure_link not implemented 45 * - GNUNET_TESTBED_underlay_configure_link not implemented
46 * - GNUNET_TESTBED_underlaylinkmodel_set_link not usable 46 * - GNUNET_TESTBED_underlaylinkmodel_set_link not usable
47 * - GNUNET_TESTBED_peer_stop evokes standard service disconnect 47 * - GNUNET_TESTBED_peer_stop evokes standard service disconnect
48 * - GNUNET_TESTBED_peer_destroy and GNUNET_TESTBED_peer_create
49 * - how can we test the sublayers of CADET, e.g. connection, tunnel, channel? 48 * - how can we test the sublayers of CADET, e.g. connection, tunnel, channel?
50 * 49 *
51 * Development 50 * Development
@@ -63,29 +62,50 @@
63/****************************** TEST LOGIC ********************************/ 62/****************************** TEST LOGIC ********************************/
64 63
65static int kx_initiator; 64static int kx_initiator;
66 65static struct GNUNET_TESTBED_UnderlayLinkModel *model;
67void
68handle_message (void *cls,
69 const struct GNUNET_MessageHeader *msg)
70{
71 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
72}
73 66
74static void 67static void
75send_message () 68send_message ()
76{ 69{
77 struct GNUNET_MQ_Envelope *envelope; 70 struct GNUNET_MQ_Envelope *envelope;
78 struct GNUNET_MessageHeader *msg; 71 struct GNUNET_MessageHeader *msg;
72 int *data;
79 73
80 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__); 74 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
81 75
82 envelope = GNUNET_MQ_msg (msg, 76 envelope = GNUNET_MQ_msg_extra (msg, 10000,
83 GNUNET_MESSAGE_TYPE_DUMMY); 77 GNUNET_MESSAGE_TYPE_DUMMY);
78 data = (int *) &msg[1];
79 *data = 1000;
84 80
85 GNUNET_MQ_send (GNUNET_CADET_get_mq (test_peers[0].channel), 81 GNUNET_MQ_send (GNUNET_CADET_get_mq (test_peers[0].channel),
86 envelope); 82 envelope);
87} 83}
88 84
85int
86check_message (void *cls,
87 const struct GNUNET_MessageHeader *message)
88{
89 return GNUNET_OK; /* all is well-formed */
90}
91
92void
93handle_message (void *cls,
94 const struct GNUNET_MessageHeader *msg)
95{
96 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s\n", __func__);
97
98/*
99 model = GNUNET_TESTBED_underlaylinkmodel_create (test_peers[1].testbed_peer,
100 GNUNET_TESTBED_UNDERLAYLINKMODELTYPE_BLACKLIST);
101 GNUNET_TESTBED_underlaylinkmodel_set_link (model,
102 test_peers[0].testbed_peer,
103 0, 100, 0);
104 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%s: Modified link model.\n", __func__);
105*/
106 send_message();
107}
108
89/** 109/**
90 * This function is called after all testbed management is done and the 110 * This function is called after all testbed management is done and the
91 * testbed peers are ready for the actual test logic. 111 * testbed peers are ready for the actual test logic.
@@ -99,10 +119,12 @@ run_test ()
99 kx_initiator = (0 < GNUNET_memcmp (&test_peers[0].id, &test_peers[1].id)) ? 1 : 0; 119 kx_initiator = (0 < GNUNET_memcmp (&test_peers[0].id, &test_peers[1].id)) ? 1 : 0;
100 120
101 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 121 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
102 "KX initiator is peer %s\n", 122 "KX initiator is peer %s (idx:%i)\n",
103 GNUNET_i2s (&test_peers[kx_initiator].id)); 123 GNUNET_i2s (&test_peers[kx_initiator].id),
124 kx_initiator);
104 125
105 send_message(); 126 for (int i=0; i<10; i++)
127 send_message();
106} 128}
107 129
108 130