aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport.h')
-rw-r--r--src/transport/plugin_transport.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/transport/plugin_transport.h b/src/transport/plugin_transport.h
index 0291f9bb4..2b7017036 100644
--- a/src/transport/plugin_transport.h
+++ b/src/transport/plugin_transport.h
@@ -36,6 +36,33 @@
36#include "gnunet_statistics_service.h" 36#include "gnunet_statistics_service.h"
37#include "gnunet_transport_service.h" 37#include "gnunet_transport_service.h"
38 38
39/**
40 * Opaque pointer that plugins can use to distinguish specific
41 * connections to a given peer. Typically used by stateful plugins to
42 * allow the service to refer to specific streams instead of a more
43 * general notion of "some connection" to the given peer. This is
44 * useful since sometimes (i.e. for inbound TCP connections) a
45 * connection may not have an address that can be used for meaningful
46 * distinction between sessions to the same peer.
47 */
48struct Session;
49
50
51/**
52 * Function that will be called whenever the plugin internally
53 * cleans up a session pointer and hence the service needs to
54 * discard all of those sessions as well. Plugins that do not
55 * use sessions can simply omit calling this function and always
56 * use NULL wherever a session pointer is needed.
57 *
58 * @param cls closure
59 * @param peer which peer was the session for
60 * @param session which session is being destoyed
61 */
62typedef void (*GNUNET_TRANSPORT_SessionEnd) (void *cls,
63 const struct GNUNET_PeerIdentity *peer,
64 struct Session *session);
65
39 66
40/** 67/**
41 * Function called by the transport for each received message. 68 * Function called by the transport for each received message.
@@ -47,6 +74,7 @@
47 * @param message the message, NULL if we only care about 74 * @param message the message, NULL if we only care about
48 * learning about the delay until we should receive again -- FIXME! 75 * learning about the delay until we should receive again -- FIXME!
49 * @param distance in overlay hops; use 1 unless DV (or 0 if message == NULL) 76 * @param distance in overlay hops; use 1 unless DV (or 0 if message == NULL)
77 * @param session identifier used for this session (can be NULL)
50 * @param sender_address binary address of the sender (if observed) 78 * @param sender_address binary address of the sender (if observed)
51 * @param sender_address_len number of bytes in sender_address 79 * @param sender_address_len number of bytes in sender_address
52 * @return how long the plugin should wait until receiving more data 80 * @return how long the plugin should wait until receiving more data
@@ -60,6 +88,7 @@ typedef struct GNUNET_TIME_Relative (*GNUNET_TRANSPORT_PluginReceiveCallback) (v
60 GNUNET_MessageHeader * 88 GNUNET_MessageHeader *
61 message, 89 message,
62 uint32_t distance, 90 uint32_t distance,
91 struct Session *session,
63 const char *sender_address, 92 const char *sender_address,
64 size_t sender_address_len); 93 size_t sender_address_len);
65 94
@@ -157,6 +186,12 @@ struct GNUNET_TRANSPORT_PluginEnvironment
157 GNUNET_TRANSPORT_TrafficReport traffic_report; 186 GNUNET_TRANSPORT_TrafficReport traffic_report;
158 187
159 /** 188 /**
189 * Function that must be called by the plugin when a non-NULL
190 * session handle stops being valid (is destroyed).
191 */
192 GNUNET_TRANSPORT_SessionEnd session_end;
193
194 /**
160 * What is the maximum number of connections that this transport 195 * What is the maximum number of connections that this transport
161 * should allow? Transports that do not have sessions (such as 196 * should allow? Transports that do not have sessions (such as
162 * UDP) can ignore this value. 197 * UDP) can ignore this value.
@@ -201,6 +236,7 @@ typedef void
201 * require plugins to discard the message after the timeout, 236 * require plugins to discard the message after the timeout,
202 * just advisory for the desired delay; most plugins will ignore 237 * just advisory for the desired delay; most plugins will ignore
203 * this as well) 238 * this as well)
239 * @param session which session must be used (or NULL for "any")
204 * @param addr the address to use (can be NULL if the plugin 240 * @param addr the address to use (can be NULL if the plugin
205 * is "on its own" (i.e. re-use existing TCP connection)) 241 * is "on its own" (i.e. re-use existing TCP connection))
206 * @param addrlen length of the address in bytes 242 * @param addrlen length of the address in bytes
@@ -226,6 +262,7 @@ typedef ssize_t
226 size_t msgbuf_size, 262 size_t msgbuf_size,
227 uint32_t priority, 263 uint32_t priority,
228 struct GNUNET_TIME_Relative timeout, 264 struct GNUNET_TIME_Relative timeout,
265 struct Session *session,
229 const void *addr, 266 const void *addr,
230 size_t addrlen, 267 size_t addrlen,
231 int force_address, 268 int force_address,
@@ -323,7 +360,7 @@ struct GNUNET_TRANSPORT_PluginFunctions
323 360
324 /** 361 /**
325 * Function that the transport service will use to transmit data to 362 * Function that the transport service will use to transmit data to
326 * another peer. May be null for plugins that only support 363 * another peer. May be NULL for plugins that only support
327 * receiving data. After this call, the plugin call the specified 364 * receiving data. After this call, the plugin call the specified
328 * continuation with success or error before notifying us about the 365 * continuation with success or error before notifying us about the
329 * target having disconnected. 366 * target having disconnected.