* @return string representing the same address
*/
static const char *
-bluetooth_plugin_address_to_string (void *cls, const void *addr, size_t addrlen);
+bluetooth_plugin_address_to_string (void *cls,
+ const void *addr,
+ size_t addrlen);
/**
* Print MAC addresses nicely.
struct PendingMessage *pm;
endpoint->plugin->env->session_end (endpoint->plugin->env->cls,
- &session->target,
+ session->address,
session);
while (NULL != (pm = session->pending_message_head))
{
1, GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"New MAC endpoint `%s'\n",
- bluetooth_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress)));
+ bluetooth_plugin_address_to_string(NULL,
+ addr,
+ sizeof (struct WlanAddress)));
return pos;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Service asked to create session for peer `%s' with MAC `%s'\n",
GNUNET_i2s (&address->peer),
- bluetooth_plugin_address_to_string(NULL, address->address, address->address_length));
- endpoint = create_macendpoint (plugin, (struct WlanAddress *) address->address);
+ bluetooth_plugin_address_to_string(NULL,
+ address->address,
+ address->address_length));
+ endpoint = create_macendpoint (plugin,
+ (struct WlanAddress *) address->address);
return get_session (endpoint, &address->peer);
}
"Processing %u bytes of HELLO from peer `%s' at MAC %s\n",
(unsigned int) msize,
GNUNET_i2s (&tmpsource),
- bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr,
- sizeof (mas->endpoint->addr)));
+ bluetooth_plugin_address_to_string (NULL,
+ &mas->endpoint->addr,
+ sizeof (mas->endpoint->addr)));
GNUNET_STATISTICS_update (plugin->env->stats,
_("# HELLO messages received via Bluetooth"), 1,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Processing %u bytes of FRAGMENT from MAC %s\n",
(unsigned int) msize,
- bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr,
- sizeof (mas->endpoint->addr)));
+ bluetooth_plugin_address_to_string (NULL,
+ &mas->endpoint->addr,
+ sizeof (mas->endpoint->addr)));
GNUNET_STATISTICS_update (plugin->env->stats,
- _("# fragments received via Bluetooth"), 1, GNUNET_NO);
+ _("# fragments received via Bluetooth"),
+ 1,
+ GNUNET_NO);
(void) GNUNET_DEFRAGMENT_process_fragment (mas->endpoint->defrag,
hdr);
break;
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got last ACK, finished message transmission to `%s' (%p)\n",
- bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr,
- sizeof (mas->endpoint->addr)),
+ bluetooth_plugin_address_to_string (NULL,
+ &mas->endpoint->addr,
+ sizeof (mas->endpoint->addr)),
fm);
mas->endpoint->timeout = GNUNET_TIME_relative_to_absolute (MACENDPOINT_TIMEOUT);
if (NULL != fm->cont)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got an ACK, message transmission to `%s' not yet finished\n",
- bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr,
- sizeof (mas->endpoint->addr)));
+ bluetooth_plugin_address_to_string (NULL,
+ &mas->endpoint->addr,
+ sizeof (mas->endpoint->addr)));
break;
}
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
"ACK not matched against any active fragmentation with MAC `%s'\n",
- bluetooth_plugin_address_to_string (NULL, &mas->endpoint->addr,
- sizeof (mas->endpoint->addr)));
+ bluetooth_plugin_address_to_string (NULL,
+ &mas->endpoint->addr,
+ sizeof (mas->endpoint->addr)));
break;
case GNUNET_MESSAGE_TYPE_WLAN_DATA:
if (NULL == mas->endpoint)
* @return string representing the same address
*/
static const char *
-bluetooth_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
+bluetooth_plugin_address_to_string (void *cls,
+ const void *addr,
+ size_t addrlen)
{
const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac;
static char macstr[36];
return NULL;
}
mac = &((struct WlanAddress *) addr)->mac;
- GNUNET_snprintf (macstr, sizeof (macstr), "%s.%u.%s",
- PLUGIN_NAME, ntohl (((struct WlanAddress *) addr)->options),
- mac_to_string (mac));
+ GNUNET_snprintf (macstr,
+ sizeof (macstr),
+ "%s.%u.%s",
+ PLUGIN_NAME,
+ ntohl (((struct WlanAddress *) addr)->options),
+ mac_to_string (mac));
return macstr;
}
* @param numeric should (IP) addresses be displayed in numeric form?
* @param timeout after how long should we give up?
* @param asc function to call on each string
- * @param asc_cls closure for asc
+ * @param asc_cls closure for @a asc
*/
static void
bluetooth_plugin_address_pretty_printer (void *cls, const char *type,
GNUNET_TRANSPORT_AddressStringCallback asc,
void *asc_cls)
{
- char *ret;
+ const char *ret;
- if (sizeof (struct WlanAddress) != addrlen)
- {
- /* invalid address */
- LOG (GNUNET_ERROR_TYPE_WARNING,
- _("Bluetooth address with invalid size encountered\n"));
- asc (asc_cls, NULL);
- return;
- }
- ret = GNUNET_strdup (bluetooth_plugin_address_to_string(NULL, addr, addrlen));
- asc (asc_cls, ret);
- GNUNET_free (ret);
- asc (asc_cls, NULL);
+ if (sizeof (struct WlanAddress) == addrlen)
+ ret = bluetooth_plugin_address_to_string(NULL, addr, addrlen);
+ else
+ ret = NULL;
+ asc (asc_cls,
+ ret,
+ (NULL == ret) ? GNUNET_SYSERR : GNUNET_OK);
+ asc (asc_cls, NULL, GNUNET_OK);
}
0, GNUNET_NO);
GNUNET_STATISTICS_set (plugin->env->stats, _("# Bluetooth MAC endpoints allocated"),
0, 0);
- GNUNET_BANDWIDTH_tracker_init (&plugin->tracker,
+ GNUNET_BANDWIDTH_tracker_init (&plugin->tracker, NULL, NULL,
GNUNET_BANDWIDTH_value_init (100 * 1024 *
1024 / 8), 100);
plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);