aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-01-16 20:44:56 +0000
committerChristian Grothoff <christian@grothoff.org>2010-01-16 20:44:56 +0000
commitdfb4dfbde04e233b5ab0c489aa3aacacd8a696ba (patch)
treeb4dba023560e47650355e28993961646aae85f26 /src
parentd6f386ca51514316d7fd06b26a02fb3833379983 (diff)
downloadgnunet-dfb4dfbde04e233b5ab0c489aa3aacacd8a696ba.tar.gz
gnunet-dfb4dfbde04e233b5ab0c489aa3aacacd8a696ba.zip
further simplify transport API
Diffstat (limited to 'src')
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_peer1.conf2
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_peer2.conf2
-rw-r--r--src/transport/gnunet-service-transport.c60
-rw-r--r--src/transport/plugin_transport.h64
-rw-r--r--src/transport/plugin_transport_tcp.c30
-rw-r--r--src/transport/plugin_transport_template.c17
-rw-r--r--src/transport/test_plugin_transport.c6
7 files changed, 52 insertions, 129 deletions
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf b/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf
index 9b47c7681..844e1ded5 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf
+++ b/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf
@@ -27,7 +27,7 @@ PORT = 12969
27[core] 27[core]
28PORT = 12970 28PORT = 12970
29DEBUG = YES 29DEBUG = YES
30#PREFIX = xterm -e xterm -e valgrind --tool=memcheck 30PREFIX = valgrind --tool=memcheck
31 31
32[testing] 32[testing]
33WEAKRANDOM = YES 33WEAKRANDOM = YES
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf b/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf
index 167d3acbd..dd5a599b8 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf
+++ b/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf
@@ -27,7 +27,7 @@ PORT = 22969
27[core] 27[core]
28PORT = 22970 28PORT = 22970
29DEBUG = YES 29DEBUG = YES
30#PREFIX = xterm -e xterm -e valgrind --tool=memcheck 30PREFIX = valgrind --tool=memcheck
31 31
32[testing] 32[testing]
33WEAKRANDOM = YES 33WEAKRANDOM = YES
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 6f3bc6e94..8196dd45a 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -850,11 +850,11 @@ try_transmission_to_peer (struct NeighbourList *neighbour);
850 */ 850 */
851static void 851static void
852transmit_send_continuation (void *cls, 852transmit_send_continuation (void *cls,
853 struct ReadyList *rl,
854 const struct GNUNET_PeerIdentity *target, 853 const struct GNUNET_PeerIdentity *target,
855 int result) 854 int result)
856{ 855{
857 struct MessageQueue *mq = cls; 856 struct MessageQueue *mq = cls;
857 struct ReadyList *rl;
858 struct SendOkMessage send_ok_msg; 858 struct SendOkMessage send_ok_msg;
859 struct NeighbourList *n; 859 struct NeighbourList *n;
860 860
@@ -864,13 +864,10 @@ transmit_send_continuation (void *cls,
864 GNUNET_assert (0 == 864 GNUNET_assert (0 ==
865 memcmp (&n->id, target, 865 memcmp (&n->id, target,
866 sizeof (struct GNUNET_PeerIdentity))); 866 sizeof (struct GNUNET_PeerIdentity)));
867 if (rl == NULL) 867 rl = n->plugins;
868 { 868 while ((rl != NULL) && (rl->plugin != mq->plugin))
869 rl = n->plugins; 869 rl = rl->next;
870 while ((rl != NULL) && (rl->plugin != mq->plugin)) 870 GNUNET_assert (rl != NULL);
871 rl = rl->next;
872 GNUNET_assert (rl != NULL);
873 }
874 if (result == GNUNET_OK) 871 if (result == GNUNET_OK)
875 { 872 {
876 rl->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 873 rl->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
@@ -980,7 +977,6 @@ try_transmission_to_peer (struct NeighbourList *neighbour)
980 GNUNET_i2s (&neighbour->id), rl->plugin->short_name); 977 GNUNET_i2s (&neighbour->id), rl->plugin->short_name);
981#endif 978#endif
982 rl->plugin->api->send (rl->plugin->api->cls, 979 rl->plugin->api->send (rl->plugin->api->cls,
983 rl,
984 &neighbour->id, 980 &neighbour->id,
985 mq->priority, 981 mq->priority,
986 mq->message, 982 mq->message,
@@ -1859,9 +1855,8 @@ disconnect_neighbour (struct NeighbourList *n,
1859 n->plugins = rpos->next; 1855 n->plugins = rpos->next;
1860 GNUNET_assert (rpos->neighbour == n); 1856 GNUNET_assert (rpos->neighbour == n);
1861 if (GNUNET_YES == rpos->connected) 1857 if (GNUNET_YES == rpos->connected)
1862 rpos->plugin->api->cancel (rpos->plugin->api->cls, 1858 rpos->plugin->api->disconnect (rpos->plugin->api->cls,
1863 rpos, 1859 &n->id);
1864 &n->id);
1865 GNUNET_free (rpos); 1860 GNUNET_free (rpos);
1866 } 1861 }
1867 1862
@@ -1974,9 +1969,6 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer)
1974 * and generally forward to our receive callback. 1969 * and generally forward to our receive callback.
1975 * 1970 *
1976 * @param cls the "struct TransportPlugin *" we gave to the plugin 1971 * @param cls the "struct TransportPlugin *" we gave to the plugin
1977 * @param service_context value passed to the transport-service
1978 * to identify the neighbour; will be NULL on the first
1979 * call for a given peer
1980 * @param latency estimated latency for communicating with the 1972 * @param latency estimated latency for communicating with the
1981 * given peer 1973 * given peer
1982 * @param peer (claimed) identity of the other peer 1974 * @param peer (claimed) identity of the other peer
@@ -1985,9 +1977,8 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer)
1985 * for future receive calls for messages from this 1977 * for future receive calls for messages from this
1986 * particular peer 1978 * particular peer
1987 */ 1979 */
1988static struct ReadyList * 1980static void
1989plugin_env_receive (void *cls, 1981plugin_env_receive (void *cls,
1990 struct ReadyList *service_context,
1991 struct GNUNET_TIME_Relative latency, 1982 struct GNUNET_TIME_Relative latency,
1992 const struct GNUNET_PeerIdentity *peer, 1983 const struct GNUNET_PeerIdentity *peer,
1993 const struct GNUNET_MessageHeader *message) 1984 const struct GNUNET_MessageHeader *message)
@@ -1996,32 +1987,26 @@ plugin_env_receive (void *cls,
1996 htons (sizeof (struct GNUNET_MessageHeader)), 1987 htons (sizeof (struct GNUNET_MessageHeader)),
1997 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ACK) 1988 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ACK)
1998 }; 1989 };
1990 struct ReadyList *service_context;
1999 struct TransportPlugin *plugin = cls; 1991 struct TransportPlugin *plugin = cls;
2000 struct TransportClient *cpos; 1992 struct TransportClient *cpos;
2001 struct InboundMessage *im; 1993 struct InboundMessage *im;
2002 uint16_t msize; 1994 uint16_t msize;
2003 struct NeighbourList *n; 1995 struct NeighbourList *n;
2004 1996
2005 if (service_context != NULL) 1997 n = find_neighbour (peer);
2006 { 1998 if (n == NULL)
2007 n = service_context->neighbour;
2008 GNUNET_assert (n != NULL);
2009 }
2010 else
2011 { 1999 {
2012 n = find_neighbour (peer); 2000 if (message == NULL)
2013 if (n == NULL) 2001 return; /* disconnect of peer already marked down */
2014 { 2002 n = setup_new_neighbour (peer);
2015 if (message == NULL)
2016 return NULL; /* disconnect of peer already marked down */
2017 n = setup_new_neighbour (peer);
2018 }
2019 service_context = n->plugins;
2020 while ((service_context != NULL) && (plugin != service_context->plugin))
2021 service_context = service_context->next;
2022 GNUNET_assert ((plugin->api->send == NULL) ||
2023 (service_context != NULL));
2024 } 2003 }
2004 service_context = n->plugins;
2005 while ( (service_context != NULL) &&
2006 (plugin != service_context->plugin) )
2007 service_context = service_context->next;
2008 GNUNET_assert ((plugin->api->send == NULL) ||
2009 (service_context != NULL));
2025 if (message == NULL) 2010 if (message == NULL)
2026 { 2011 {
2027#if DEBUG_TRANSPORT 2012#if DEBUG_TRANSPORT
@@ -2033,7 +2018,7 @@ plugin_env_receive (void *cls,
2033 if (service_context != NULL) 2018 if (service_context != NULL)
2034 service_context->connected = GNUNET_NO; 2019 service_context->connected = GNUNET_NO;
2035 disconnect_neighbour (n, GNUNET_YES); 2020 disconnect_neighbour (n, GNUNET_YES);
2036 return NULL; 2021 return;
2037 } 2022 }
2038#if DEBUG_TRANSPORT 2023#if DEBUG_TRANSPORT
2039 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 2024 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
@@ -2073,7 +2058,7 @@ plugin_env_receive (void *cls,
2073 /* TODO: call stats */ 2058 /* TODO: call stats */
2074 GNUNET_assert ( (service_context == NULL) || 2059 GNUNET_assert ( (service_context == NULL) ||
2075 (NULL != service_context->neighbour) ); 2060 (NULL != service_context->neighbour) );
2076 return service_context; 2061 return;
2077 } 2062 }
2078 switch (ntohs (message->type)) 2063 switch (ntohs (message->type))
2079 { 2064 {
@@ -2119,7 +2104,6 @@ plugin_env_receive (void *cls,
2119 } 2104 }
2120 GNUNET_assert ( (service_context == NULL) || 2105 GNUNET_assert ( (service_context == NULL) ||
2121 (NULL != service_context->neighbour) ); 2106 (NULL != service_context->neighbour) );
2122 return service_context;
2123} 2107}
2124 2108
2125 2109
diff --git a/src/transport/plugin_transport.h b/src/transport/plugin_transport.h
index 93564f8e2..4cbf5e2e6 100644
--- a/src/transport/plugin_transport.h
+++ b/src/transport/plugin_transport.h
@@ -44,23 +44,11 @@
44#include "gnunet_transport_service.h" 44#include "gnunet_transport_service.h"
45 45
46/** 46/**
47 * Opaque internal context for a particular peer of the transport
48 * service. Plugins will be given a pointer to this type and, if
49 * cheaply possible, should pass this pointer back to the transport
50 * service whenever additional messages from the same peer are
51 * received.
52 */
53struct ReadyList;
54
55/**
56 * Function called by the transport for each received message. 47 * Function called by the transport for each received message.
57 * This function should also be called with "NULL" for the 48 * This function should also be called with "NULL" for the
58 * message to signal that the other peer disconnected. 49 * message to signal that the other peer disconnected.
59 * 50 *
60 * @param cls closure 51 * @param cls closure
61 * @param service_context value passed to the transport-service
62 * to identify the neighbour; will be NULL on the first
63 * call for a given peer
64 * @param latency estimated latency for communicating with the 52 * @param latency estimated latency for communicating with the
65 * given peer; should be set to GNUNET_TIME_UNIT_FOREVER_REL 53 * given peer; should be set to GNUNET_TIME_UNIT_FOREVER_REL
66 * until the transport has seen messages transmitted in 54 * until the transport has seen messages transmitted in
@@ -70,20 +58,14 @@ struct ReadyList;
70 * using this one plugin actually works 58 * using this one plugin actually works
71 * @param peer (claimed) identity of the other peer 59 * @param peer (claimed) identity of the other peer
72 * @param message the message, NULL if peer was disconnected 60 * @param message the message, NULL if peer was disconnected
73 * @return the new service_context that the plugin should use
74 * for future receive calls for messages from this
75 * particular peer
76 */ 61 */
77typedef struct ReadyList * 62typedef void (*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls,
78 (*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls, 63 struct GNUNET_TIME_Relative
79 struct ReadyList * 64 latency,
80 service_context, 65 const struct GNUNET_PeerIdentity
81 struct GNUNET_TIME_Relative 66 * peer,
82 latency, 67 const struct GNUNET_MessageHeader
83 const struct GNUNET_PeerIdentity 68 * message);
84 * peer,
85 const struct GNUNET_MessageHeader
86 * message);
87 69
88 70
89/** 71/**
@@ -247,8 +229,6 @@ typedef int
247 * upon "completion". 229 * upon "completion".
248 * 230 *
249 * @param cls closure 231 * @param cls closure
250 * @param service_context value passed to the transport-service
251 * to identify the neighbour
252 * @param target who was the recipient of the message? 232 * @param target who was the recipient of the message?
253 * @param result GNUNET_OK on success 233 * @param result GNUNET_OK on success
254 * GNUNET_SYSERR if the target disconnected; 234 * GNUNET_SYSERR if the target disconnected;
@@ -257,11 +237,10 @@ typedef int
257 */ 237 */
258typedef void 238typedef void
259 (*GNUNET_TRANSPORT_TransmitContinuation) (void *cls, 239 (*GNUNET_TRANSPORT_TransmitContinuation) (void *cls,
260 struct ReadyList *
261 service_context,
262 const struct GNUNET_PeerIdentity * 240 const struct GNUNET_PeerIdentity *
263 target, int result); 241 target, int result);
264 242
243
265/** 244/**
266 * Function that can be used by the transport service to transmit 245 * Function that can be used by the transport service to transmit
267 * a message using the plugin. Note that in the case of a 246 * a message using the plugin. Note that in the case of a
@@ -271,11 +250,6 @@ typedef void
271 * a fresh connection to another peer. 250 * a fresh connection to another peer.
272 * 251 *
273 * @param cls closure 252 * @param cls closure
274 * @param service_context value passed to the transport-service
275 * to identify the neighbour; NULL is used to indicate
276 * an urgent message. If the urgent message can not be
277 * scheduled for immediate transmission, the plugin is to
278 * call the continuation with failure immediately
279 * @param target who should receive this message 253 * @param target who should receive this message
280 * @param priority how important is the message? 254 * @param priority how important is the message?
281 * @param msg the message to transmit 255 * @param msg the message to transmit
@@ -288,7 +262,6 @@ typedef void
288 */ 262 */
289typedef void 263typedef void
290 (*GNUNET_TRANSPORT_TransmitFunction) (void *cls, 264 (*GNUNET_TRANSPORT_TransmitFunction) (void *cls,
291 struct ReadyList * service_context,
292 const struct GNUNET_PeerIdentity * 265 const struct GNUNET_PeerIdentity *
293 target, 266 target,
294 unsigned int priority, 267 unsigned int priority,
@@ -312,18 +285,13 @@ typedef void
312 * closed after a getting this call. 285 * closed after a getting this call.
313 * 286 *
314 * @param cls closure 287 * @param cls closure
315 * @param service_context must correspond to the service context
316 * of the corresponding Transmit call; the plugin should
317 * not cancel a send call made with a different service
318 * context pointer! Never NULL.
319 * @param target peer for which the last transmission is 288 * @param target peer for which the last transmission is
320 * to be cancelled 289 * to be cancelled
321 */ 290 */
322typedef void 291typedef void
323 (*GNUNET_TRANSPORT_CancelFunction) (void *cls, 292 (*GNUNET_TRANSPORT_DisconnectFunction) (void *cls,
324 struct ReadyList * service_context, 293 const struct GNUNET_PeerIdentity *
325 const struct GNUNET_PeerIdentity * 294 target);
326 target);
327 295
328 296
329/** 297/**
@@ -423,11 +391,13 @@ struct GNUNET_TRANSPORT_PluginFunctions
423 GNUNET_TRANSPORT_TransmitFunction send; 391 GNUNET_TRANSPORT_TransmitFunction send;
424 392
425 /** 393 /**
426 * Function that can be used to force the plugin to disconnect 394 * Function that can be used to force the plugin to disconnect from
427 * from the given peer and cancel all previous transmissions 395 * the given peer and cancel all previous transmissions (and their
428 * (and their continuationc). 396 * continuations). Note that if the transport does not have
397 * sessions / persistent connections (for example, UDP), this
398 * function may very well do nothing.
429 */ 399 */
430 GNUNET_TRANSPORT_CancelFunction cancel; 400 GNUNET_TRANSPORT_DisconnectFunction disconnect;
431 401
432 /** 402 /**
433 * Function to pretty-print addresses. NOTE: this function is not 403 * Function to pretty-print addresses. NOTE: this function is not
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 9fc33cbfa..8c5f79fd3 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -264,11 +264,6 @@ struct Session
264 struct GNUNET_SERVER_Client *client; 264 struct GNUNET_SERVER_Client *client;
265 265
266 /** 266 /**
267 * gnunet-service-transport context for this connection.
268 */
269 struct ReadyList *service_context;
270
271 /**
272 * Messages currently pending for transmission 267 * Messages currently pending for transmission
273 * to this peer, if any. 268 * to this peer, if any.
274 */ 269 */
@@ -560,7 +555,6 @@ do_transmit (void *cls, size_t size, void *buf)
560#endif 555#endif
561 if (pm->transmit_cont != NULL) 556 if (pm->transmit_cont != NULL)
562 pm->transmit_cont (pm->transmit_cont_cls, 557 pm->transmit_cont (pm->transmit_cont_cls,
563 session->service_context,
564 &session->target, GNUNET_SYSERR); 558 &session->target, GNUNET_SYSERR);
565 GNUNET_free (pm); 559 GNUNET_free (pm);
566 } 560 }
@@ -600,7 +594,6 @@ do_transmit (void *cls, size_t size, void *buf)
600 session->pending_messages = pm->next; 594 session->pending_messages = pm->next;
601 if (pm->transmit_cont != NULL) 595 if (pm->transmit_cont != NULL)
602 pm->transmit_cont (pm->transmit_cont_cls, 596 pm->transmit_cont (pm->transmit_cont_cls,
603 session->service_context,
604 &session->target, GNUNET_OK); 597 &session->target, GNUNET_OK);
605 GNUNET_free (pm); 598 GNUNET_free (pm);
606 session->gen_time[session->out_msg_counter % ACK_LOG_SIZE] 599 session->gen_time[session->out_msg_counter % ACK_LOG_SIZE]
@@ -829,7 +822,6 @@ disconnect_session (struct Session *session)
829 session->pending_messages = pm->next; 822 session->pending_messages = pm->next;
830 if (NULL != pm->transmit_cont) 823 if (NULL != pm->transmit_cont)
831 pm->transmit_cont (pm->transmit_cont_cls, 824 pm->transmit_cont (pm->transmit_cont_cls,
832 session->service_context,
833 &session->target, GNUNET_SYSERR); 825 &session->target, GNUNET_SYSERR);
834 GNUNET_free (pm); 826 GNUNET_free (pm);
835 } 827 }
@@ -846,7 +838,6 @@ disconnect_session (struct Session *session)
846 know about this one, so we need to 838 know about this one, so we need to
847 notify transport service about disconnect */ 839 notify transport service about disconnect */
848 session->plugin->env->receive (session->plugin->env->cls, 840 session->plugin->env->receive (session->plugin->env->cls,
849 session->service_context,
850 GNUNET_TIME_UNIT_ZERO, 841 GNUNET_TIME_UNIT_ZERO,
851 &session->target, NULL); 842 &session->target, NULL);
852 } 843 }
@@ -1081,7 +1072,6 @@ session_try_connect (void *cls,
1081 */ 1072 */
1082static void 1073static void
1083tcp_plugin_send (void *cls, 1074tcp_plugin_send (void *cls,
1084 struct ReadyList *service_context,
1085 const struct GNUNET_PeerIdentity *target, 1075 const struct GNUNET_PeerIdentity *target,
1086 unsigned int priority, 1076 unsigned int priority,
1087 const struct GNUNET_MessageHeader *msg, 1077 const struct GNUNET_MessageHeader *msg,
@@ -1117,7 +1107,6 @@ tcp_plugin_send (void *cls,
1117 session->quota_in = plugin->env->default_quota_in; 1107 session->quota_in = plugin->env->default_quota_in;
1118 session->expecting_welcome = GNUNET_YES; 1108 session->expecting_welcome = GNUNET_YES;
1119 session->pending_messages = pm; 1109 session->pending_messages = pm;
1120 session->service_context = service_context;
1121 session->ic = GNUNET_PEERINFO_iterate (plugin->env->cfg, 1110 session->ic = GNUNET_PEERINFO_iterate (plugin->env->cfg,
1122 plugin->env->sched, 1111 plugin->env->sched,
1123 target, 1112 target,
@@ -1126,7 +1115,6 @@ tcp_plugin_send (void *cls,
1126 } 1115 }
1127 GNUNET_assert (session != NULL); 1116 GNUNET_assert (session != NULL);
1128 GNUNET_assert (session->client != NULL); 1117 GNUNET_assert (session->client != NULL);
1129 session->service_context = service_context;
1130 /* append pm to pending_messages list */ 1118 /* append pm to pending_messages list */
1131 pme = session->pending_messages; 1119 pme = session->pending_messages;
1132 if (pme == NULL) 1120 if (pme == NULL)
@@ -1161,17 +1149,12 @@ tcp_plugin_send (void *cls,
1161 * closed after a getting this call. 1149 * closed after a getting this call.
1162 * 1150 *
1163 * @param cls closure 1151 * @param cls closure
1164 * @param service_context must correspond to the service context
1165 * of the corresponding Transmit call; the plugin should
1166 * not cancel a send call made with a different service
1167 * context pointer! Never NULL.
1168 * @param target peer for which the last transmission is 1152 * @param target peer for which the last transmission is
1169 * to be cancelled 1153 * to be cancelled
1170 */ 1154 */
1171static void 1155static void
1172tcp_plugin_cancel (void *cls, 1156tcp_plugin_disconnect (void *cls,
1173 struct ReadyList *service_context, 1157 const struct GNUNET_PeerIdentity *target)
1174 const struct GNUNET_PeerIdentity *target)
1175{ 1158{
1176 struct Plugin *plugin = cls; 1159 struct Plugin *plugin = cls;
1177 struct Session *session; 1160 struct Session *session;
@@ -1196,7 +1179,6 @@ tcp_plugin_cancel (void *cls,
1196 pm->transmit_cont_cls = NULL; 1179 pm->transmit_cont_cls = NULL;
1197 pm = pm->next; 1180 pm = pm->next;
1198 } 1181 }
1199 session->service_context = NULL;
1200 if (session->client != NULL) 1182 if (session->client != NULL)
1201 { 1183 {
1202 GNUNET_SERVER_client_drop (session->client); 1184 GNUNET_SERVER_client_drop (session->client);
@@ -1866,10 +1848,8 @@ handle_tcp_data (void *cls,
1866 "Forwarding data of type %u to transport service.\n", 1848 "Forwarding data of type %u to transport service.\n",
1867 ntohs (msg->type)); 1849 ntohs (msg->type));
1868#endif 1850#endif
1869 session->service_context 1851 plugin->env->receive (plugin->env->cls,
1870 = plugin->env->receive (plugin->env->cls, 1852 latency, &session->target, msg);
1871 session->service_context,
1872 latency, &session->target, msg);
1873 /* update bandwidth used */ 1853 /* update bandwidth used */
1874 session->last_received += msize; 1854 session->last_received += msize;
1875 update_quota (session, GNUNET_NO); 1855 update_quota (session, GNUNET_NO);
@@ -2062,7 +2042,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2062 api->cls = plugin; 2042 api->cls = plugin;
2063 api->validate = &tcp_plugin_validate; 2043 api->validate = &tcp_plugin_validate;
2064 api->send = &tcp_plugin_send; 2044 api->send = &tcp_plugin_send;
2065 api->cancel = &tcp_plugin_cancel; 2045 api->disconnect = &tcp_plugin_disconnect;
2066 api->address_pretty_printer = &tcp_plugin_address_pretty_printer; 2046 api->address_pretty_printer = &tcp_plugin_address_pretty_printer;
2067 api->set_receive_quota = &tcp_plugin_set_receive_quota; 2047 api->set_receive_quota = &tcp_plugin_set_receive_quota;
2068 api->address_suggested = &tcp_plugin_address_suggested; 2048 api->address_suggested = &tcp_plugin_address_suggested;
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c
index 1d949f345..69c27b923 100644
--- a/src/transport/plugin_transport_template.c
+++ b/src/transport/plugin_transport_template.c
@@ -163,8 +163,6 @@ template_plugin_validate (void *cls,
163 * a message using the plugin. 163 * a message using the plugin.
164 * 164 *
165 * @param cls closure 165 * @param cls closure
166 * @param service_context value passed to the transport-service
167 * to identify the neighbour
168 * @param target who should receive this message 166 * @param target who should receive this message
169 * @param priority how important is the message 167 * @param priority how important is the message
170 * @param msg the message to transmit 168 * @param msg the message to transmit
@@ -177,7 +175,6 @@ template_plugin_validate (void *cls,
177 */ 175 */
178static void 176static void
179template_plugin_send (void *cls, 177template_plugin_send (void *cls,
180 struct ReadyList *service_context,
181 const struct GNUNET_PeerIdentity *target, 178 const struct GNUNET_PeerIdentity *target,
182 unsigned int priority, 179 unsigned int priority,
183 const struct GNUNET_MessageHeader *msg, 180 const struct GNUNET_MessageHeader *msg,
@@ -196,17 +193,11 @@ template_plugin_send (void *cls,
196 * (and their continuationc). 193 * (and their continuationc).
197 * 194 *
198 * @param cls closure 195 * @param cls closure
199 * @param service_context must correspond to the service context 196 * @param target peer from which to disconnect
200 * of the corresponding Transmit call; the plugin should
201 * not cancel a send call made with a different service
202 * context pointer! Never NULL.
203 * @param target peer for which the last transmission is
204 * to be cancelled
205 */ 197 */
206static void 198static void
207template_plugin_cancel (void *cls, 199template_plugin_disconnect (void *cls,
208 struct ReadyList *service_context, 200 const struct GNUNET_PeerIdentity *target)
209 const struct GNUNET_PeerIdentity *target)
210{ 201{
211 // struct Plugin *plugin = cls; 202 // struct Plugin *plugin = cls;
212 // FIXME 203 // FIXME
@@ -301,7 +292,7 @@ gnunet_plugin_transport_template_init (void *cls)
301 api->cls = plugin; 292 api->cls = plugin;
302 api->validate = &template_plugin_validate; 293 api->validate = &template_plugin_validate;
303 api->send = &template_plugin_send; 294 api->send = &template_plugin_send;
304 api->cancel = &template_plugin_cancel; 295 api->disconnect = &template_plugin_disconnect;
305 api->address_pretty_printer = &template_plugin_address_pretty_printer; 296 api->address_pretty_printer = &template_plugin_address_pretty_printer;
306 api->set_receive_quota = &template_plugin_set_receive_quota; 297 api->set_receive_quota = &template_plugin_set_receive_quota;
307 api->address_suggested = &template_plugin_address_suggested; 298 api->address_suggested = &template_plugin_address_suggested;
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c
index 283312bfe..d4183fc27 100644
--- a/src/transport/test_plugin_transport.c
+++ b/src/transport/test_plugin_transport.c
@@ -92,10 +92,8 @@ static int ok;
92/** 92/**
93 * Initialize Environment for this plugin 93 * Initialize Environment for this plugin
94 */ 94 */
95struct ReadyList * 95static void
96receive(void *cls, 96receive(void *cls,
97 struct ReadyList *
98 service_context,
99 struct GNUNET_TIME_Relative 97 struct GNUNET_TIME_Relative
100 latency, 98 latency,
101 const struct GNUNET_PeerIdentity 99 const struct GNUNET_PeerIdentity
@@ -103,7 +101,7 @@ receive(void *cls,
103 const struct GNUNET_MessageHeader 101 const struct GNUNET_MessageHeader
104 * message) 102 * message)
105{ 103{
106 return NULL; 104 /* do nothing */
107} 105}
108 106
109void notify_address(void *cls, 107void notify_address(void *cls,