diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-09 12:40:15 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-09 12:40:15 +0000 |
commit | c89d8a68bd97261f491927ebd32269d82eb9e581 (patch) | |
tree | 23fa964f5c4daaabc6038666174b218ef51cb2db /src/transport/gnunet-service-transport.c | |
parent | c57f5000a2a3996f025af403e5ea5e124ffa6cb1 (diff) | |
download | gnunet-c89d8a68bd97261f491927ebd32269d82eb9e581.tar.gz gnunet-c89d8a68bd97261f491927ebd32269d82eb9e581.zip |
new function for plugins to signal inbound session,
have to extend plugins
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 924c7d9b3..1e2e7bc44 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -449,6 +449,44 @@ plugin_env_update_metrics (void *cls, | |||
449 | GST_update_ats_metrics (peer, &haddress, session, ats, ats_count); | 449 | GST_update_ats_metrics (peer, &haddress, session, ats, ats_count); |
450 | } | 450 | } |
451 | 451 | ||
452 | static void | ||
453 | plugin_env_session_start (void *cls, | ||
454 | const struct GNUNET_PeerIdentity *peer, | ||
455 | const char *plugin, | ||
456 | const void *address, | ||
457 | uint16_t address_len, | ||
458 | struct Session *session, | ||
459 | const struct GNUNET_ATS_Information *ats, | ||
460 | uint32_t ats_count) | ||
461 | { | ||
462 | if (NULL == peer) | ||
463 | { | ||
464 | GNUNET_break (0); | ||
465 | return; | ||
466 | } | ||
467 | if (NULL == plugin) | ||
468 | { | ||
469 | GNUNET_break (0); | ||
470 | return; | ||
471 | } | ||
472 | if (NULL == address) | ||
473 | { | ||
474 | GNUNET_break (0); | ||
475 | return; | ||
476 | } | ||
477 | if (NULL == session) | ||
478 | { | ||
479 | GNUNET_break (0); | ||
480 | return; | ||
481 | } | ||
482 | |||
483 | struct GNUNET_HELLO_Address *addr; | ||
484 | addr = GNUNET_HELLO_address_allocate (peer, plugin, address, address_len); | ||
485 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding peer `%s' address %s session %p\n", | ||
486 | GNUNET_i2s (peer), GST_plugins_a2s(addr), session); | ||
487 | GNUNET_ATS_address_add (GST_ats, addr, session, ats, ats_count); | ||
488 | GNUNET_free (addr); | ||
489 | } | ||
452 | 490 | ||
453 | /** | 491 | /** |
454 | * Function called by ATS to notify the callee that the | 492 | * Function called by ATS to notify the callee that the |
@@ -707,6 +745,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
707 | GST_manipulation_init (GST_cfg); | 745 | GST_manipulation_init (GST_cfg); |
708 | GST_plugins_load (&GST_manipulation_recv, | 746 | GST_plugins_load (&GST_manipulation_recv, |
709 | &plugin_env_address_change_notification, | 747 | &plugin_env_address_change_notification, |
748 | &plugin_env_session_start, | ||
710 | &plugin_env_session_end, | 749 | &plugin_env_session_end, |
711 | &plugin_env_address_to_type, | 750 | &plugin_env_address_to_type, |
712 | &plugin_env_update_metrics); | 751 | &plugin_env_update_metrics); |