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 | |
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')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 39 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_plugins.c | 3 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_plugins.h | 2 |
3 files changed, 44 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); |
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c index 36d030980..688f701ad 100644 --- a/src/transport/gnunet-service-transport_plugins.c +++ b/src/transport/gnunet-service-transport_plugins.c | |||
@@ -87,6 +87,7 @@ static struct TransportPlugin *plugins_tail; | |||
87 | * | 87 | * |
88 | * @param recv_cb function to call when data is received | 88 | * @param recv_cb function to call when data is received |
89 | * @param address_cb function to call when our public addresses changed | 89 | * @param address_cb function to call when our public addresses changed |
90 | * @param session_start_cb function to call when a session was created | ||
90 | * @param session_end_cb function to call when a session was terminated | 91 | * @param session_end_cb function to call when a session was terminated |
91 | * @param address_type_cb function to call when a address type is requested | 92 | * @param address_type_cb function to call when a address type is requested |
92 | * @param metric_update_cb function to call when address metrics change | 93 | * @param metric_update_cb function to call when address metrics change |
@@ -94,6 +95,7 @@ static struct TransportPlugin *plugins_tail; | |||
94 | void | 95 | void |
95 | GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, | 96 | GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, |
96 | GNUNET_TRANSPORT_AddressNotification address_cb, | 97 | GNUNET_TRANSPORT_AddressNotification address_cb, |
98 | GNUNET_TRANSPORT_SessionStart session_start_cb, | ||
97 | GNUNET_TRANSPORT_SessionEnd session_end_cb, | 99 | GNUNET_TRANSPORT_SessionEnd session_end_cb, |
98 | GNUNET_TRANSPORT_AddressToType address_type_cb, | 100 | GNUNET_TRANSPORT_AddressToType address_type_cb, |
99 | GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb) | 101 | GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb) |
@@ -133,6 +135,7 @@ GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, | |||
133 | plug->env.cls = plug->short_name; | 135 | plug->env.cls = plug->short_name; |
134 | plug->env.receive = recv_cb; | 136 | plug->env.receive = recv_cb; |
135 | plug->env.notify_address = address_cb; | 137 | plug->env.notify_address = address_cb; |
138 | plug->env.session_start = session_start_cb; | ||
136 | plug->env.session_end = session_end_cb; | 139 | plug->env.session_end = session_end_cb; |
137 | plug->env.get_address_type = address_type_cb; | 140 | plug->env.get_address_type = address_type_cb; |
138 | plug->env.update_address_metrics = metric_update_cb; | 141 | plug->env.update_address_metrics = metric_update_cb; |
diff --git a/src/transport/gnunet-service-transport_plugins.h b/src/transport/gnunet-service-transport_plugins.h index ef20e4539..2dc91de73 100644 --- a/src/transport/gnunet-service-transport_plugins.h +++ b/src/transport/gnunet-service-transport_plugins.h | |||
@@ -41,6 +41,7 @@ | |||
41 | * | 41 | * |
42 | * @param recv_cb function to call when data is received | 42 | * @param recv_cb function to call when data is received |
43 | * @param address_cb function to call when our public addresses changed | 43 | * @param address_cb function to call when our public addresses changed |
44 | * @param session_start_cb function to call when a session was created | ||
44 | * @param session_end_cb function to call when a session was terminated | 45 | * @param session_end_cb function to call when a session was terminated |
45 | * @param address_type_cb function to call when a address type is requested | 46 | * @param address_type_cb function to call when a address type is requested |
46 | * @param metric_update_cb function to call when address metrics change | 47 | * @param metric_update_cb function to call when address metrics change |
@@ -48,6 +49,7 @@ | |||
48 | void | 49 | void |
49 | GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, | 50 | GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, |
50 | GNUNET_TRANSPORT_AddressNotification address_cb, | 51 | GNUNET_TRANSPORT_AddressNotification address_cb, |
52 | GNUNET_TRANSPORT_SessionStart session_start_cb, | ||
51 | GNUNET_TRANSPORT_SessionEnd session_end_cb, | 53 | GNUNET_TRANSPORT_SessionEnd session_end_cb, |
52 | GNUNET_TRANSPORT_AddressToType address_type_cb, | 54 | GNUNET_TRANSPORT_AddressToType address_type_cb, |
53 | GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb); | 55 | GNUNET_TRANSPORT_UpdateAddressMetrics metric_update_cb); |