aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_wlan.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-01-26 15:46:01 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-01-26 15:46:01 +0000
commit1a9d3baf9faeb388b87c7db31e2bb3664b0d208a (patch)
tree42a749508f60a0a48ba6686007fe8af831780770 /src/transport/plugin_transport_wlan.c
parentbb492222a26b665ab24791ee46eac3a3e73e7a05 (diff)
downloadgnunet-1a9d3baf9faeb388b87c7db31e2bb3664b0d208a.tar.gz
gnunet-1a9d3baf9faeb388b87c7db31e2bb3664b0d208a.zip
- changes
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r--src/transport/plugin_transport_wlan.c68
1 files changed, 66 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 60389bd71..cf971ca80 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -2191,6 +2191,68 @@ wlan_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
2191 return GNUNET_SYSERR; 2191 return GNUNET_SYSERR;
2192} 2192}
2193 2193
2194
2195/**
2196 * Creates a new outbound session the transport service will use to send data to the
2197 * peer
2198 *
2199 * @param cls the plugin
2200 * @param address the address
2201 * @return the session or NULL of max connections exceeded
2202 */
2203
2204static struct Session *
2205wlan_plugin_get_session (void *cls,
2206 const struct GNUNET_HELLO_Address *address)
2207{
2208 struct Session * s = NULL;
2209 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "To be implemented\n");
2210 GNUNET_break (0);
2211 return s;
2212}
2213
2214/**
2215 * Function that can be used by the transport service to transmit
2216 * a message using the plugin. Note that in the case of a
2217 * peer disconnecting, the continuation MUST be called
2218 * prior to the disconnect notification itself. This function
2219 * will be called with this peer's HELLO message to initiate
2220 * a fresh connection to another peer.
2221 *
2222 * @param cls closure
2223 * @param session which session must be used
2224 * @param msgbuf the message to transmit
2225 * @param msgbuf_size number of bytes in 'msgbuf'
2226 * @param priority how important is the message (most plugins will
2227 * ignore message priority and just FIFO)
2228 * @param to how long to wait at most for the transmission (does not
2229 * require plugins to discard the message after the timeout,
2230 * just advisory for the desired delay; most plugins will ignore
2231 * this as well)
2232 * @param cont continuation to call once the message has
2233 * been transmitted (or if the transport is ready
2234 * for the next transmission call; or if the
2235 * peer disconnected...); can be NULL
2236 * @param cont_cls closure for cont
2237 * @return number of bytes used (on the physical network, with overheads);
2238 * -1 on hard errors (i.e. address invalid); 0 is a legal value
2239 * and does NOT mean that the message was not transmitted (DV)
2240 */
2241static ssize_t
2242wlan_plugin_send (void *cls,
2243 struct Session *session,
2244 const char *msgbuf, size_t msgbuf_size,
2245 unsigned int priority,
2246 struct GNUNET_TIME_Relative to,
2247 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
2248{
2249 ssize_t sent = -1;
2250 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "To be implemented\n");
2251 GNUNET_break (0);
2252 return sent;
2253}
2254
2255
2194/** 2256/**
2195 * Function that can be used by the transport service to transmit 2257 * Function that can be used by the transport service to transmit
2196 * a message using the plugin. 2258 * a message using the plugin.
@@ -2218,7 +2280,7 @@ wlan_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
2218 * and does NOT mean that the message was not transmitted (DV) 2280 * and does NOT mean that the message was not transmitted (DV)
2219 */ 2281 */
2220static ssize_t 2282static ssize_t
2221wlan_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, 2283wlan_plugin_send_old (void *cls, const struct GNUNET_PeerIdentity *target,
2222 const char *msgbuf, size_t msgbuf_size, unsigned int priority, 2284 const char *msgbuf, size_t msgbuf_size, unsigned int priority,
2223 struct GNUNET_TIME_Relative timeout, struct Session *session, 2285 struct GNUNET_TIME_Relative timeout, struct Session *session,
2224 const void *addr, size_t addrlen, int force_address, 2286 const void *addr, size_t addrlen, int force_address,
@@ -3259,7 +3321,9 @@ libgnunet_plugin_transport_wlan_init (void *cls)
3259 3321
3260 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); 3322 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
3261 api->cls = plugin; 3323 api->cls = plugin;
3262 api->send = &wlan_plugin_send; 3324 api->send = &wlan_plugin_send_old;
3325 api->send_with_session = &wlan_plugin_send;
3326 api->get_session = &wlan_plugin_get_session;
3263 api->disconnect = &wlan_plugin_disconnect; 3327 api->disconnect = &wlan_plugin_disconnect;
3264 api->address_pretty_printer = &wlan_plugin_address_pretty_printer; 3328 api->address_pretty_printer = &wlan_plugin_address_pretty_printer;
3265 api->check_address = &wlan_plugin_address_suggested; 3329 api->check_address = &wlan_plugin_address_suggested;