aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_template.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-07-12 15:31:11 +0000
committerChristian Grothoff <christian@grothoff.org>2009-07-12 15:31:11 +0000
commit868126cd639e63cd6f4db19a19e49778fc67e0ad (patch)
tree05bbcc2c6cef1c3a9eec7e799d265f138cf9685c /src/transport/plugin_transport_template.c
parent0700c60ef320c8ccbd417833441697c64d6c525c (diff)
downloadgnunet-868126cd639e63cd6f4db19a19e49778fc67e0ad.tar.gz
gnunet-868126cd639e63cd6f4db19a19e49778fc67e0ad.zip
improving HELLO validation by transports
Diffstat (limited to 'src/transport/plugin_transport_template.c')
-rw-r--r--src/transport/plugin_transport_template.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c
index 496e2cf78..bce4bbc52 100644
--- a/src/transport/plugin_transport_template.c
+++ b/src/transport/plugin_transport_template.c
@@ -132,33 +132,29 @@ struct Plugin
132 132
133 133
134/** 134/**
135 * Function that can be used by the transport service to transmit 135 * Function that can be used by the transport service to validate that
136 * a message using the plugin using a fresh connection (even if 136 * another peer is reachable at a particular address (even if we
137 * we already have a connection to this peer, this function is 137 * already have a connection to this peer, this function is required
138 * required to establish a new one). 138 * to establish a new one).
139 * 139 *
140 * @param cls closure 140 * @param cls closure
141 * @param target who should receive this message 141 * @param target who should receive this message
142 * @param priority how important is the message 142 * @param challenge challenge code to use
143 * @param msg1 first message to transmit
144 * @param msg2 second message to transmit (can be NULL)
145 * @param timeout how long until we give up?
146 * @param addr the address
147 * @param addrlen length of the address 143 * @param addrlen length of the address
148 * @return non-null session if the transmission has been scheduled 144 * @param addr the address
149 * NULL if the address format is invalid 145 * @param timeout how long should we try to transmit these?
146 * @return GNUNET_OK if the transmission has been scheduled
150 */ 147 */
151static void * 148static int
152template_plugin_send_to (void *cls, 149template_plugin_validate (void *cls,
153 const struct GNUNET_PeerIdentity *target, 150 const struct GNUNET_PeerIdentity *target,
154 unsigned int priority, 151 uint32_t challenge,
155 const struct GNUNET_MessageHeader *msg1, 152 struct GNUNET_TIME_Relative timeout,
156 const struct GNUNET_MessageHeader *msg2, 153 const void *addr,
157 struct GNUNET_TIME_Relative timeout, 154 size_t addrlen)
158 const void *addr, size_t addrlen)
159{ 155{
160 // FIXME 156 // FIXME
161 return NULL; 157 return GNUNET_SYSERR;
162} 158}
163 159
164 160
@@ -311,7 +307,7 @@ gnunet_plugin_transport_template_init (void *cls)
311 plugin->statistics = NULL; 307 plugin->statistics = NULL;
312 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); 308 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
313 api->cls = plugin; 309 api->cls = plugin;
314 api->send_to = &template_plugin_send_to; 310 api->validate = &template_plugin_validate;
315 api->send = &template_plugin_send; 311 api->send = &template_plugin_send;
316 api->cancel = &template_plugin_cancel; 312 api->cancel = &template_plugin_cancel;
317 api->address_pretty_printer = &template_plugin_address_pretty_printer; 313 api->address_pretty_printer = &template_plugin_address_pretty_printer;