aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_bluetooth.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-12-12 13:07:28 +0000
committerBart Polot <bart@net.in.tum.de>2013-12-12 13:07:28 +0000
commit7c80255561ecb8fae2906cb123dde10abfbaa6bb (patch)
treef78531ec170e65e32e126cde4704c85a2b45d7aa /src/transport/plugin_transport_bluetooth.c
parent2ef2006807bff52d2dfbf3d6fba58b9985163bc1 (diff)
downloadgnunet-7c80255561ecb8fae2906cb123dde10abfbaa6bb.tar.gz
gnunet-7c80255561ecb8fae2906cb123dde10abfbaa6bb.zip
- new plugin API functions
Diffstat (limited to 'src/transport/plugin_transport_bluetooth.c')
-rw-r--r--src/transport/plugin_transport_bluetooth.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c
index 5ea439310..87130feec 100644
--- a/src/transport/plugin_transport_bluetooth.c
+++ b/src/transport/plugin_transport_bluetooth.c
@@ -887,7 +887,7 @@ fragmentmessage_timeout (void *cls,
887static void 887static void
888send_with_fragmentation (struct MacEndpoint *endpoint, 888send_with_fragmentation (struct MacEndpoint *endpoint,
889 struct GNUNET_TIME_Relative timeout, 889 struct GNUNET_TIME_Relative timeout,
890 const struct GNUNET_PeerIdentity *target, 890 const struct GNUNET_PeerIdentity *target,
891 const struct GNUNET_MessageHeader *msg, 891 const struct GNUNET_MessageHeader *msg,
892 size_t payload_size, 892 size_t payload_size,
893 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 893 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
@@ -1085,7 +1085,7 @@ bluetooth_plugin_get_session (void *cls,
1085 * @param target peer from which to disconnect 1085 * @param target peer from which to disconnect
1086 */ 1086 */
1087static void 1087static void
1088bluetooth_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) 1088bluetooth_plugin_disconnect_peer (void *cls, const struct GNUNET_PeerIdentity *target)
1089{ 1089{
1090 struct Plugin *plugin = cls; 1090 struct Plugin *plugin = cls;
1091 struct Session *session; 1091 struct Session *session;
@@ -1094,15 +1094,32 @@ bluetooth_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target
1094 for (endpoint = plugin->mac_head; NULL != endpoint; endpoint = endpoint->next) 1094 for (endpoint = plugin->mac_head; NULL != endpoint; endpoint = endpoint->next)
1095 for (session = endpoint->sessions_head; NULL != session; session = session->next) 1095 for (session = endpoint->sessions_head; NULL != session; session = session->next)
1096 if (0 == memcmp (target, &session->target, 1096 if (0 == memcmp (target, &session->target,
1097 sizeof (struct GNUNET_PeerIdentity))) 1097 sizeof (struct GNUNET_PeerIdentity)))
1098 { 1098 {
1099 free_session (session); 1099 free_session (session);
1100 break; /* inner-loop only (in case peer has another MAC as well!) */ 1100 break; /* inner-loop only (in case peer has another MAC as well!) */
1101 } 1101 }
1102} 1102}
1103 1103
1104 1104
1105/** 1105/**
1106 * Function that can be used to force the plugin to disconnect
1107 * from the given peer and cancel all previous transmissions
1108 * (and their continuation).
1109 *
1110 * @param cls closure
1111 * @param session session to disconnect
1112 */
1113static int
1114bluetooth_plugin_disconnect_session (void *cls,
1115 struct Session *session)
1116{
1117 free_session (session);
1118 return GNUNET_OK;
1119}
1120
1121
1122/**
1106 * Function that can be used by the transport service to transmit 1123 * Function that can be used by the transport service to transmit
1107 * a message using the plugin. Note that in the case of a 1124 * a message using the plugin. Note that in the case of a
1108 * peer disconnecting, the continuation MUST be called 1125 * peer disconnecting, the continuation MUST be called
@@ -1893,7 +1910,8 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
1893 api->cls = plugin; 1910 api->cls = plugin;
1894 api->send = &bluetooth_plugin_send; 1911 api->send = &bluetooth_plugin_send;
1895 api->get_session = &bluetooth_plugin_get_session; 1912 api->get_session = &bluetooth_plugin_get_session;
1896 api->disconnect = &bluetooth_plugin_disconnect; 1913 api->disconnect_peer = &bluetooth_plugin_disconnect_peer;
1914 api->disconnect_session = &bluetooth_plugin_disconnect_session;
1897 api->address_pretty_printer = &bluetooth_plugin_address_pretty_printer; 1915 api->address_pretty_printer = &bluetooth_plugin_address_pretty_printer;
1898 api->check_address = &bluetooth_plugin_address_suggested; 1916 api->check_address = &bluetooth_plugin_address_suggested;
1899 api->address_to_string = &bluetooth_plugin_address_to_string;; 1917 api->address_to_string = &bluetooth_plugin_address_to_string;;