summaryrefslogtreecommitdiff
path: root/pcap-bt-linux.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2015-03-08 21:39:43 +0100
committerFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2015-03-08 21:39:43 +0100
commitf0b11471594801ed0bfbf7af9bba164ccc134ac5 (patch)
treebd0caea5176d636bfa3f2f3617bdd2360266a62a /pcap-bt-linux.c
parenta08c110ec191fd877d16ac4d6ce0a0575ce5205f (diff)
downloadlibpcap-f0b11471594801ed0bfbf7af9bba164ccc134ac5.tar.gz
Delete trailing spaces/tabs
Diffstat (limited to 'pcap-bt-linux.c')
-rw-r--r--pcap-bt-linux.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c
index a32691d3..5bb627a8 100644
--- a/pcap-bt-linux.c
+++ b/pcap-bt-linux.c
@@ -11,8 +11,8 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior written
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -31,7 +31,7 @@
* By Paolo Abeni <paolo.abeni@email.it>
*
*/
-
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -73,7 +73,7 @@ struct pcap_bt {
int dev_id; /* device ID of device we're bound to */
};
-int
+int
bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
{
struct hci_dev_list_req *dev_list;
@@ -84,7 +84,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
sock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (sock < 0)
{
- /* if bluetooth is not supported this this is not fatal*/
+ /* if bluetooth is not supported this this is not fatal*/
if (errno == EAFNOSUPPORT)
return 0;
snprintf(err_str, PCAP_ERRBUF_SIZE,
@@ -93,7 +93,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
}
dev_list = malloc(HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
- if (!dev_list)
+ if (!dev_list)
{
snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't allocate %zu bytes for Bluetooth device list",
HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
@@ -103,7 +103,7 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
dev_list->dev_num = HCI_MAX_DEV;
- if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0)
+ if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0)
{
snprintf(err_str, PCAP_ERRBUF_SIZE,
"Can't get Bluetooth device list via ioctl: %s",
@@ -115,11 +115,11 @@ bt_findalldevs(pcap_if_t **alldevsp, char *err_str)
dev_req = dev_list->dev_req;
for (i = 0; i < dev_list->dev_num; i++, dev_req++) {
char dev_name[20], dev_descr[30];
-
+
snprintf(dev_name, 20, BT_IFACE"%d", dev_req->dev_id);
snprintf(dev_descr, 30, "Bluetooth adapter number %d", i);
-
- if (pcap_add_if(alldevsp, dev_name, 0,
+
+ if (pcap_add_if(alldevsp, dev_name, 0,
dev_descr, err_str) < 0)
{
ret = -1;
@@ -193,7 +193,7 @@ bt_activate(pcap_t* handle)
if (sscanf(handle->opt.source, BT_IFACE"%d", &dev_id) != 1)
{
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
- "Can't get Bluetooth device index from %s",
+ "Can't get Bluetooth device index from %s",
handle->opt.source);
return PCAP_ERROR;
}
@@ -212,7 +212,7 @@ bt_activate(pcap_t* handle)
handle->setnonblock_op = pcap_setnonblock_fd;
handle->stats_op = bt_stats_linux;
handlep->dev_id = dev_id;
-
+
/* Create HCI socket */
handle->fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
if (handle->fd < 0) {
@@ -242,10 +242,10 @@ bt_activate(pcap_t* handle)
goto close_fail;
}
- /* Setup filter, do not call hci function to avoid dependence on
+ /* Setup filter, do not call hci function to avoid dependence on
* external libs */
memset(&flt, 0, sizeof(flt));
- memset((void *) &flt.type_mask, 0xff, sizeof(flt.type_mask));
+ memset((void *) &flt.type_mask, 0xff, sizeof(flt.type_mask));
memset((void *) &flt.event_mask, 0xff, sizeof(flt.event_mask));
if (setsockopt(handle->fd, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
@@ -309,7 +309,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us
bthdr = (pcap_bluetooth_h4_header*) &handle->buffer[handle->offset];
iv.iov_base = &handle->buffer[handle->offset+sizeof(pcap_bluetooth_h4_header)];
iv.iov_len = handle->snapshot;
-
+
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iv;
msg.msg_iovlen = 1;
@@ -334,7 +334,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us
pkth.caplen = ret;
- /* get direction and timestamp*/
+ /* get direction and timestamp*/
cmsg = CMSG_FIRSTHDR(&msg);
int in=0;
while (cmsg) {
@@ -349,7 +349,7 @@ bt_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *us
}
cmsg = CMSG_NXTHDR(&msg, cmsg);
}
- if ((in && (handle->direction == PCAP_D_OUT)) ||
+ if ((in && (handle->direction == PCAP_D_OUT)) ||
((!in) && (handle->direction == PCAP_D_IN)))
return 0;
@@ -371,10 +371,10 @@ bt_inject_linux(pcap_t *handle, const void *buf, size_t size)
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on "
"bluetooth devices");
return (-1);
-}
+}
-static int
+static int
bt_stats_linux(pcap_t *handle, struct pcap_stat *stats)
{
struct pcap_bt *handlep = handle->priv;
@@ -382,28 +382,28 @@ bt_stats_linux(pcap_t *handle, struct pcap_stat *stats)
struct hci_dev_info dev_info;
struct hci_dev_stats * s = &dev_info.stat;
dev_info.dev_id = handlep->dev_id;
-
+
/* ignore eintr */
do {
ret = ioctl(handle->fd, HCIGETDEVINFO, (void *)&dev_info);
} while ((ret == -1) && (errno == EINTR));
-
+
if (ret < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"Can't get stats via ioctl: %s", strerror(errno));
return (-1);
-
+
}
- /* we receive both rx and tx frames, so comulate all stats */
- stats->ps_recv = s->evt_rx + s->acl_rx + s->sco_rx + s->cmd_tx +
+ /* we receive both rx and tx frames, so comulate all stats */
+ stats->ps_recv = s->evt_rx + s->acl_rx + s->sco_rx + s->cmd_tx +
s->acl_tx +s->sco_tx;
stats->ps_drop = s->err_rx + s->err_tx;
stats->ps_ifdrop = 0;
return 0;
}
-static int
+static int
bt_setdirection_linux(pcap_t *p, pcap_direction_t d)
{
p->direction = d;