diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-03-11 12:45:52 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-03-11 12:45:52 +0000 |
commit | 9c923d1ef6752f40535124439fed299ee4150795 (patch) | |
tree | e912eb27f4d0c0a94e55a7bb61d52b82af09dc38 /src/dv/plugin_transport_dv.c | |
parent | 566fa39ac965c18fe9392ec607cbed99f0860eb9 (diff) | |
download | gnunet-9c923d1ef6752f40535124439fed299ee4150795.tar.gz gnunet-9c923d1ef6752f40535124439fed299ee4150795.zip |
dv config files and fixes
Diffstat (limited to 'src/dv/plugin_transport_dv.c')
-rw-r--r-- | src/dv/plugin_transport_dv.c | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index aa25c97e6..2c9881d30 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -146,12 +146,12 @@ struct Plugin | |||
146 | /** | 146 | /** |
147 | * Our server. | 147 | * Our server. |
148 | */ | 148 | */ |
149 | struct GNUNET_SERVER_Handle *server; | 149 | //struct GNUNET_SERVER_Handle *server; |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * Handle to the running service. | 152 | * Handle to the running service. |
153 | */ | 153 | */ |
154 | struct GNUNET_SERVICE_Context *service; | 154 | //struct GNUNET_SERVICE_Context *service; |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * Copy of the handler array where the closures are | 157 | * Copy of the handler array where the closures are |
@@ -268,7 +268,7 @@ dv_plugin_disconnect (void *cls, | |||
268 | const struct GNUNET_PeerIdentity *target) | 268 | const struct GNUNET_PeerIdentity *target) |
269 | { | 269 | { |
270 | // struct Plugin *plugin = cls; | 270 | // struct Plugin *plugin = cls; |
271 | // FIXME | 271 | // TODO: Add message type to send to dv service to "disconnect" a peer |
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
@@ -288,13 +288,13 @@ dv_plugin_disconnect (void *cls, | |||
288 | */ | 288 | */ |
289 | static void | 289 | static void |
290 | dv_plugin_address_pretty_printer (void *cls, | 290 | dv_plugin_address_pretty_printer (void *cls, |
291 | const char *type, | 291 | const char *type, |
292 | const void *addr, | 292 | const void *addr, |
293 | size_t addrlen, | 293 | size_t addrlen, |
294 | int numeric, | 294 | int numeric, |
295 | struct GNUNET_TIME_Relative timeout, | 295 | struct GNUNET_TIME_Relative timeout, |
296 | GNUNET_TRANSPORT_AddressStringCallback | 296 | GNUNET_TRANSPORT_AddressStringCallback |
297 | asc, void *asc_cls) | 297 | asc, void *asc_cls) |
298 | { | 298 | { |
299 | asc (asc_cls, NULL); | 299 | asc (asc_cls, NULL); |
300 | } | 300 | } |
@@ -323,7 +323,7 @@ dv_plugin_address_suggested (void *cls, | |||
323 | 323 | ||
324 | /* check if the address is plausible; if so, | 324 | /* check if the address is plausible; if so, |
325 | add it to our list! */ | 325 | add it to our list! */ |
326 | return GNUNET_OK; | 326 | return GNUNET_NO; |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
@@ -331,14 +331,17 @@ dv_plugin_address_suggested (void *cls, | |||
331 | * Entry point for the plugin. | 331 | * Entry point for the plugin. |
332 | */ | 332 | */ |
333 | void * | 333 | void * |
334 | gnunet_plugin_transport_dv_init (void *cls) | 334 | libgnunet_plugin_transport_dv_init (void *cls) |
335 | { | 335 | { |
336 | struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; | 336 | struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; |
337 | struct GNUNET_TRANSPORT_PluginFunctions *api; | 337 | struct GNUNET_TRANSPORT_PluginFunctions *api; |
338 | struct Plugin *plugin; | 338 | struct Plugin *plugin; |
339 | unsigned long long port; | ||
340 | struct GNUNET_SERVICE_Context *service; | 339 | struct GNUNET_SERVICE_Context *service; |
341 | 340 | ||
341 | /** | ||
342 | * Do we not even need a service for this thing? That's peculiar. | ||
343 | */ | ||
344 | /* | ||
342 | service = GNUNET_SERVICE_start ("transport-dv", env->sched, env->cfg); | 345 | service = GNUNET_SERVICE_start ("transport-dv", env->sched, env->cfg); |
343 | if (service == NULL) | 346 | if (service == NULL) |
344 | { | 347 | { |
@@ -349,7 +352,13 @@ gnunet_plugin_transport_dv_init (void *cls) | |||
349 | "dv"); | 352 | "dv"); |
350 | return NULL; | 353 | return NULL; |
351 | } | 354 | } |
352 | 355 | */ | |
356 | /** | ||
357 | * I don't think we need a port, the only way we get stuff is being directly | ||
358 | * called by service transport or by responses from the dv-service via our | ||
359 | * client handle | ||
360 | */ | ||
361 | /* | ||
353 | if ((GNUNET_OK != | 362 | if ((GNUNET_OK != |
354 | GNUNET_CONFIGURATION_get_value_number (env->cfg, | 363 | GNUNET_CONFIGURATION_get_value_number (env->cfg, |
355 | "transport-dv", | 364 | "transport-dv", |
@@ -364,15 +373,22 @@ gnunet_plugin_transport_dv_init (void *cls) | |||
364 | GNUNET_SERVICE_stop (service); | 373 | GNUNET_SERVICE_stop (service); |
365 | return NULL; | 374 | return NULL; |
366 | } | 375 | } |
376 | */ | ||
367 | 377 | ||
368 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 378 | plugin = GNUNET_malloc (sizeof (struct Plugin)); |
369 | plugin->env = env; | 379 | plugin->env = env; |
370 | plugin->statistics = NULL; | 380 | plugin->statistics = NULL; |
371 | plugin->service = service; | 381 | //plugin->service = service; |
372 | plugin->server = GNUNET_SERVICE_get_server (service); | 382 | //plugin->server = GNUNET_SERVICE_get_server (service); |
373 | 383 | ||
374 | plugin->dv_handle = GNUNET_DV_connect(env->sched, env->cfg, &handle_dv_message_received, plugin); | 384 | plugin->dv_handle = GNUNET_DV_connect(env->sched, env->cfg, &handle_dv_message_received, plugin); |
375 | 385 | ||
386 | if (plugin->dv_handle == NULL) | ||
387 | { | ||
388 | GNUNET_free(plugin); | ||
389 | return NULL; | ||
390 | } | ||
391 | |||
376 | api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); | 392 | api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); |
377 | api->cls = plugin; | 393 | api->cls = plugin; |
378 | api->send = &dv_plugin_send; | 394 | api->send = &dv_plugin_send; |
@@ -387,7 +403,7 @@ gnunet_plugin_transport_dv_init (void *cls) | |||
387 | * Exit point from the plugin. | 403 | * Exit point from the plugin. |
388 | */ | 404 | */ |
389 | void * | 405 | void * |
390 | gnunet_plugin_transport_dv_done (void *cls) | 406 | libgnunet_plugin_transport_dv_done (void *cls) |
391 | { | 407 | { |
392 | struct GNUNET_TRANSPORT_PluginFunctions *api = cls; | 408 | struct GNUNET_TRANSPORT_PluginFunctions *api = cls; |
393 | struct Plugin *plugin = api->cls; | 409 | struct Plugin *plugin = api->cls; |