gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r31304 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r31304 - gnunet/src/transport
Date: Thu, 12 Dec 2013 14:07:28 +0100

Author: bartpolot
Date: 2013-12-12 14:07:28 +0100 (Thu, 12 Dec 2013)
New Revision: 31304

Modified:
   gnunet/src/transport/plugin_transport_bluetooth.c
Log:
- new plugin API functions


Modified: gnunet/src/transport/plugin_transport_bluetooth.c
===================================================================
--- gnunet/src/transport/plugin_transport_bluetooth.c   2013-12-12 12:24:11 UTC 
(rev 31303)
+++ gnunet/src/transport/plugin_transport_bluetooth.c   2013-12-12 13:07:28 UTC 
(rev 31304)
@@ -887,7 +887,7 @@
 static void
 send_with_fragmentation (struct MacEndpoint *endpoint,
                         struct GNUNET_TIME_Relative timeout,
-                        const struct GNUNET_PeerIdentity *target,              
        
+                        const struct GNUNET_PeerIdentity *target,
                         const struct GNUNET_MessageHeader *msg,
                         size_t payload_size,
                         GNUNET_TRANSPORT_TransmitContinuation cont, void 
*cont_cls)
@@ -1085,7 +1085,7 @@
  * @param target peer from which to disconnect
  */
 static void
-bluetooth_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity 
*target)
+bluetooth_plugin_disconnect_peer (void *cls, const struct GNUNET_PeerIdentity 
*target)
 {
   struct Plugin *plugin = cls;
   struct Session *session;
@@ -1094,15 +1094,32 @@
   for (endpoint = plugin->mac_head; NULL != endpoint; endpoint = 
endpoint->next)
     for (session = endpoint->sessions_head; NULL != session; session = 
session->next)
       if (0 == memcmp (target, &session->target,
-                      sizeof (struct GNUNET_PeerIdentity)))
+        sizeof (struct GNUNET_PeerIdentity)))
       {
         free_session (session);
-       break; /* inner-loop only (in case peer has another MAC as well!) */
+        break; /* inner-loop only (in case peer has another MAC as well!) */
       }
 }
 
 
 /**
+ * Function that can be used to force the plugin to disconnect
+ * from the given peer and cancel all previous transmissions
+ * (and their continuation).
+ *
+ * @param cls closure
+ * @param session session to disconnect
+ */
+static int
+bluetooth_plugin_disconnect_session (void *cls,
+                                     struct Session *session)
+{
+  free_session (session);
+  return GNUNET_OK;
+}
+
+
+/**
  * Function that can be used by the transport service to transmit
  * a message using the plugin.   Note that in the case of a
  * peer disconnecting, the continuation MUST be called
@@ -1893,7 +1910,8 @@
   api->cls = plugin;
   api->send = &bluetooth_plugin_send;
   api->get_session = &bluetooth_plugin_get_session;
-  api->disconnect = &bluetooth_plugin_disconnect;
+  api->disconnect_peer = &bluetooth_plugin_disconnect_peer;
+  api->disconnect_session = &bluetooth_plugin_disconnect_session;
   api->address_pretty_printer = &bluetooth_plugin_address_pretty_printer;
   api->check_address = &bluetooth_plugin_address_suggested;
   api->address_to_string = &bluetooth_plugin_address_to_string;;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]