aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/gnunet-service-transport.c9
-rw-r--r--src/transport/gnunet-service-transport.h31
-rw-r--r--src/transport/transport.h28
3 files changed, 65 insertions, 3 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 9f60d03d7..e64cbfbfe 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -37,6 +37,7 @@
37#include "gnunet-service-transport_neighbours.h" 37#include "gnunet-service-transport_neighbours.h"
38#include "gnunet-service-transport_plugins.h" 38#include "gnunet-service-transport_plugins.h"
39#include "gnunet-service-transport_validation.h" 39#include "gnunet-service-transport_validation.h"
40#include "gnunet-service-transport_manipulation.h"
40#include "transport.h" 41#include "transport.h"
41 42
42/* globals */ 43/* globals */
@@ -229,8 +230,8 @@ process_payload (const struct GNUNET_PeerIdentity *peer,
229 * @return how long the plugin should wait until receiving more data 230 * @return how long the plugin should wait until receiving more data
230 * (plugins that do not support this, can ignore the return value) 231 * (plugins that do not support this, can ignore the return value)
231 */ 232 */
232static struct GNUNET_TIME_Relative 233struct GNUNET_TIME_Relative
233plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, 234GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
234 const struct GNUNET_MessageHeader *message, 235 const struct GNUNET_MessageHeader *message,
235 const struct GNUNET_ATS_Information *ats, 236 const struct GNUNET_ATS_Information *ats,
236 uint32_t ats_count, struct Session *session, 237 uint32_t ats_count, struct Session *session,
@@ -568,6 +569,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
568 GST_clients_stop (); 569 GST_clients_stop ();
569 GST_blacklist_stop (); 570 GST_blacklist_stop ();
570 GST_hello_stop (); 571 GST_hello_stop ();
572 GST_manipulation_stop ();
571 573
572 if (NULL != GST_peerinfo) 574 if (NULL != GST_peerinfo)
573 { 575 {
@@ -677,7 +679,8 @@ key_generation_cb (void *cls,
677 GST_blacklist_start (GST_server); 679 GST_blacklist_start (GST_server);
678 GST_ats = 680 GST_ats =
679 GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change, NULL); 681 GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change, NULL);
680 GST_plugins_load (&plugin_env_receive_callback, 682 GST_manipulation_init ();
683 GST_plugins_load (&GST_manipulation_recv,
681 &plugin_env_address_change_notification, 684 &plugin_env_address_change_notification,
682 &plugin_env_session_end, 685 &plugin_env_session_end,
683 &plugin_env_address_to_type); 686 &plugin_env_address_to_type);
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h
index adc28ba6d..abc473e21 100644
--- a/src/transport/gnunet-service-transport.h
+++ b/src/transport/gnunet-service-transport.h
@@ -67,6 +67,37 @@ extern struct GNUNET_CRYPTO_RsaPrivateKey *GST_my_private_key;
67 */ 67 */
68extern struct GNUNET_ATS_SchedulingHandle *GST_ats; 68extern struct GNUNET_ATS_SchedulingHandle *GST_ats;
69 69
70/**
71 * Function called by the transport for each received message.
72 * This function should also be called with "NULL" for the
73 * message to signal that the other peer disconnected.
74 *
75 * @param cls closure, const char* with the name of the plugin we received the message from
76 * @param peer (claimed) identity of the other peer
77 * @param message the message, NULL if we only care about
78 * learning about the delay until we should receive again -- FIXME!
79 * @param ats performance information
80 * @param ats_count number of records in ats
81 * @param session identifier used for this session (NULL for plugins
82 * that do not offer bi-directional communication to the sender
83 * using the same "connection")
84 * @param sender_address binary address of the sender (if we established the
85 * connection or are otherwise sure of it; should be NULL
86 * for inbound TCP/UDP connections since it it not clear
87 * that we could establish ourselves a connection to that
88 * IP address and get the same system)
89 * @param sender_address_len number of bytes in sender_address
90 * @return how long the plugin should wait until receiving more data
91 * (plugins that do not support this, can ignore the return value)
92 */
93struct GNUNET_TIME_Relative
94GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
95 const struct GNUNET_MessageHeader *message,
96 const struct GNUNET_ATS_Information *ats,
97 uint32_t ats_count, struct Session *session,
98 const char *sender_address,
99 uint16_t sender_address_len);
100
70 101
71#endif 102#endif
72/* end of file gnunet-service-transport_plugins.h */ 103/* end of file gnunet-service-transport_plugins.h */
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 2e7bd8372..be31f0ad6 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -415,6 +415,34 @@ struct AddressIterateMessage
415 415
416 416
417/** 417/**
418 * Message from the library to the transport service
419 * asking for binary addresses known for a peer.
420 */
421struct TrafficMetricMessage
422{
423 /**
424 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC
425 */
426 struct GNUNET_MessageHeader header;
427
428 /**
429 * SEND, RECEIVE or BOTH?
430 */
431 uint16_t direction;
432
433 /**
434 * Traffic metrics count
435 */
436 uint16_t ats_count;
437
438 /**
439 * The identity of the peer to look up.
440 */
441 struct GNUNET_PeerIdentity peer;
442};
443
444
445/**
418 * Message from the transport service to the library 446 * Message from the transport service to the library
419 * containing binary addresses known for a peer. 447 * containing binary addresses known for a peer.
420 * Memory layout: 448 * Memory layout: