diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-21 20:09:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-21 20:09:42 +0000 |
commit | c669897781ee561d3d8aed70fb5ee447505556d9 (patch) | |
tree | 02c35b3e5c55154ffbf853fa4f0d843a8638d989 /src/transport/test_plugin_transport.c | |
parent | 071fd478e813a715fea48309eefde0683a42af64 (diff) | |
download | gnunet-c669897781ee561d3d8aed70fb5ee447505556d9.tar.gz gnunet-c669897781ee561d3d8aed70fb5ee447505556d9.zip |
fixing compilation issues
Diffstat (limited to 'src/transport/test_plugin_transport.c')
-rw-r--r-- | src/transport/test_plugin_transport.c | 67 |
1 files changed, 16 insertions, 51 deletions
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 407150d3a..2248f007e 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c | |||
@@ -94,10 +94,11 @@ static int ok; | |||
94 | */ | 94 | */ |
95 | static void | 95 | static void |
96 | receive (void *cls, | 96 | receive (void *cls, |
97 | struct GNUNET_TIME_Relative | ||
98 | latency, | ||
99 | const struct GNUNET_PeerIdentity | 97 | const struct GNUNET_PeerIdentity |
100 | *peer, const struct GNUNET_MessageHeader *message) | 98 | *peer, const struct GNUNET_MessageHeader *message, |
99 | uint32_t distance, | ||
100 | const char *sender_address, | ||
101 | size_t sender_address_len) | ||
101 | { | 102 | { |
102 | /* do nothing */ | 103 | /* do nothing */ |
103 | } | 104 | } |
@@ -137,43 +138,6 @@ unload_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
137 | } | 138 | } |
138 | 139 | ||
139 | 140 | ||
140 | static GNUNET_SCHEDULER_TaskIdentifier validation_timeout_task; | ||
141 | |||
142 | |||
143 | static void | ||
144 | validation_notification (void *cls, | ||
145 | const char *name, | ||
146 | const struct GNUNET_PeerIdentity *peer, | ||
147 | uint32_t challenge, const char *sender_addr) | ||
148 | { | ||
149 | if (validation_timeout_task != GNUNET_SCHEDULER_NO_TASK) | ||
150 | { | ||
151 | GNUNET_SCHEDULER_cancel (sched, validation_timeout_task); | ||
152 | validation_timeout_task = GNUNET_SCHEDULER_NO_TASK; | ||
153 | } | ||
154 | |||
155 | GNUNET_assert (challenge == 42); | ||
156 | |||
157 | ok = 0; /* if the last test succeeded, report success */ | ||
158 | GNUNET_SCHEDULER_add_continuation (sched, | ||
159 | &unload_task, | ||
160 | (void *) cfg, | ||
161 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
162 | } | ||
163 | |||
164 | |||
165 | static void | ||
166 | validation_failed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
167 | { | ||
168 | validation_timeout_task = GNUNET_SCHEDULER_NO_TASK; | ||
169 | GNUNET_break (0); /* output error */ | ||
170 | /* the "validation_notification" was not called | ||
171 | in a timely fashion; we should set an error | ||
172 | code for main and shut down */ | ||
173 | unload_plugins (NULL, cfg); | ||
174 | } | ||
175 | |||
176 | |||
177 | /** | 141 | /** |
178 | * Simple example test that invokes | 142 | * Simple example test that invokes |
179 | * the "validate" function of the plugin | 143 | * the "validate" function of the plugin |
@@ -185,9 +149,10 @@ validation_failed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
185 | * work for other plugins; we should ask | 149 | * work for other plugins; we should ask |
186 | * the plugin about its address instead...). | 150 | * the plugin about its address instead...). |
187 | */ | 151 | */ |
188 | /* FIXME: won't work on IPv6 enabled systems where IPv4 mapping | 152 | /* FIXME: this is TCP/UDP-specific and won't work |
189 | * isn't enabled (eg. FreeBSD > 4) | 153 | for HTTP/SMTP/DV; we should instead use an |
190 | */ | 154 | address that we get from the plugin itself |
155 | (if it is willing/able to give us one...) */ | ||
191 | static void | 156 | static void |
192 | test_validation () | 157 | test_validation () |
193 | { | 158 | { |
@@ -200,11 +165,14 @@ test_validation () | |||
200 | soaddr.sin_family = AF_INET; | 165 | soaddr.sin_family = AF_INET; |
201 | soaddr.sin_port = htons (2368 /* FIXME: get from config! */ ); | 166 | soaddr.sin_port = htons (2368 /* FIXME: get from config! */ ); |
202 | soaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); | 167 | soaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); |
203 | api->validate (api->cls, | 168 | GNUNET_assert (GNUNET_OK == |
204 | &my_identity, 42, TIMEOUT, &soaddr, sizeof (soaddr)); | 169 | api->check_address (api->cls, |
205 | /* add job to catch failure (timeout) */ | 170 | &soaddr, sizeof (soaddr))); |
206 | validation_timeout_task = | 171 | ok = 0; |
207 | GNUNET_SCHEDULER_add_delayed (sched, TIMEOUT, &validation_failed, NULL); | 172 | GNUNET_SCHEDULER_add_continuation (sched, |
173 | &unload_task, | ||
174 | (void *) cfg, | ||
175 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
208 | } | 176 | } |
209 | 177 | ||
210 | 178 | ||
@@ -213,13 +181,10 @@ setup_plugin_environment () | |||
213 | { | 181 | { |
214 | env.cfg = cfg; | 182 | env.cfg = cfg; |
215 | env.sched = sched; | 183 | env.sched = sched; |
216 | env.my_public_key = &my_public_key; | ||
217 | env.my_private_key = my_private_key; | ||
218 | env.my_identity = &my_identity; | 184 | env.my_identity = &my_identity; |
219 | env.cls = &env; | 185 | env.cls = &env; |
220 | env.receive = &receive; | 186 | env.receive = &receive; |
221 | env.notify_address = ¬ify_address; | 187 | env.notify_address = ¬ify_address; |
222 | env.notify_validation = &validation_notification; | ||
223 | env.max_connections = max_connect_per_transport; | 188 | env.max_connections = max_connect_per_transport; |
224 | } | 189 | } |
225 | 190 | ||