pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/hcidump Initial import of hcidump-1.5.1: Blue...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ac0955617e68
branches:  trunk
changeset: 516678:ac0955617e68
user:      salo <salo%pkgsrc.org@localhost>
date:      Tue Jul 25 16:28:47 2006 +0000

description:
Initial import of hcidump-1.5.1: Bluetooth traffic dumper, similar to tcpdump

hcidump reads raw HCI data coming from and going to a Bluetooth device
and prints to screen commands, events and data in a human-readable form.
Optionally, the dump can be written to a file rather than parsed, and
the dump file can be parsed in a subsequent moment.

NetBSD support added and packaged by Iain D. Hibbert, via pkgsrc-wip.

diffstat:

 sysutils/hcidump/DESCR            |    4 +
 sysutils/hcidump/Makefile         |   17 ++
 sysutils/hcidump/PLIST            |    6 +
 sysutils/hcidump/distinfo         |   18 ++
 sysutils/hcidump/patches/patch-aa |   19 ++
 sysutils/hcidump/patches/patch-ab |  166 +++++++++++++++++++++
 sysutils/hcidump/patches/patch-ac |   13 +
 sysutils/hcidump/patches/patch-ad |   23 ++
 sysutils/hcidump/patches/patch-ae |   14 +
 sysutils/hcidump/patches/patch-af |   20 ++
 sysutils/hcidump/patches/patch-ag |  175 ++++++++++++++++++++++
 sysutils/hcidump/patches/patch-ah |   14 +
 sysutils/hcidump/patches/patch-ai |  293 ++++++++++++++++++++++++++++++++++++++
 sysutils/hcidump/patches/patch-aj |   68 ++++++++
 sysutils/hcidump/patches/patch-ak |   18 ++
 sysutils/hcidump/patches/patch-al |   50 ++++++
 sysutils/hcidump/patches/patch-am |   23 ++
 17 files changed, 941 insertions(+), 0 deletions(-)

diffs (truncated from 1009 to 300 lines):

diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hcidump/DESCR    Tue Jul 25 16:28:47 2006 +0000
@@ -0,0 +1,4 @@
+hcidump reads raw HCI data coming from and going to a Bluetooth device
+and prints to screen commands, events and data in a human-readable form.
+Optionally, the dump can be written to a file rather than parsed, and
+the dump file can be parsed in a subsequent moment.
diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hcidump/Makefile Tue Jul 25 16:28:47 2006 +0000
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $
+
+DISTNAME=              hcidump-1.5.1
+CATEGORIES=            sysutils
+MASTER_SITES=          http://www.geocities.com/m_evmenkin/
+
+MAINTAINER=            plunky%rya-online.net@localhost
+COMMENT=               Bluetooth traffic dumper, similar to tcpdump
+
+ONLY_FOR_PLATFORM=     NetBSD-[4-9].*-*        \
+                       NetBSD-3.99.[2-9][0-9]-*
+
+WRKSRC=                        ${WRKDIR}/hcidump
+
+INSTALLATION_DIRS=     ${PKGMANDIR}/man1
+
+.include "../../mk/bsd.pkg.mk"
diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hcidump/PLIST    Tue Jul 25 16:28:47 2006 +0000
@@ -0,0 +1,6 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $
+bin/hcidump
+lib/libparser.a
+lib/libparser_pic.a
+man/cat1/hcidump.0
+man/man1/hcidump.1
diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hcidump/distinfo Tue Jul 25 16:28:47 2006 +0000
@@ -0,0 +1,18 @@
+$NetBSD: distinfo,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $
+
+SHA1 (hcidump-1.5.1.tar.gz) = add1995a26860b76bda570c4cc3582d98eafb604
+RMD160 (hcidump-1.5.1.tar.gz) = 7f95aa8b78732a6fb963f6993827eaea631f0c19
+Size (hcidump-1.5.1.tar.gz) = 32480 bytes
+SHA1 (patch-aa) = 1047b68affd7c8aae24795430aa576c751ddec01
+SHA1 (patch-ab) = d5a1c5efd331abe01604b2f1ee5827f8cf8d3054
+SHA1 (patch-ac) = 08f981f5c93fbe5f7ab1371279cb5ebf5fd87afb
+SHA1 (patch-ad) = 52c9523944eb6bfcc3022bd558545623baef4b51
+SHA1 (patch-ae) = d2b1aa6766d6ef03d015e7512bf9863451a81e3a
+SHA1 (patch-af) = 9019b5eda8cabe6616c2649f6413b19f6dc7119b
+SHA1 (patch-ag) = c4350bf9ea0101e66487d050b29fb61dd49b2bf6
+SHA1 (patch-ah) = e375a5bab3421453773fc82253fa744f21ff5341
+SHA1 (patch-ai) = 344235d3b1a9b4c3f210c90ebc8f912a234d145b
+SHA1 (patch-aj) = 08b1882377eff4d8c008e781d1c6d59a62da8167
+SHA1 (patch-ak) = dd45db8c92e6546ceffa4129721ab85655110734
+SHA1 (patch-al) = bd438b6c41c7e34ea97ce69e3a9d2cdea4e94862
+SHA1 (patch-am) = f946c943004c8c71354b858041fe5f3ec2564f98
diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hcidump/patches/patch-aa Tue Jul 25 16:28:47 2006 +0000
@@ -0,0 +1,19 @@
+$NetBSD: patch-aa,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $
+
+fix up Makefile for NetBSD
+
+--- hcidump/Makefile.orig      2004-03-12 22:16:58.000000000 +0000
++++ hcidump/Makefile
+@@ -2,10 +2,10 @@
+ # $FreeBSD$
+ 
+ PROG=         hcidump
+-BINDIR=               /usr/local/bin
+-MANDIR=               /usr/local/man/man
+ MAN1=         hcidump.1
+ SRCS=         hcidump.c
++BINDIR=               ${PREFIX}/bin
++MANDIR=               ${PREFIX}/man
+ WARNS?=               2
+ DEBUG_FLAGS=  -g
+ CFLAGS=               -O2 -I../parser
diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hcidump/patches/patch-ab Tue Jul 25 16:28:47 2006 +0000
@@ -0,0 +1,166 @@
+$NetBSD: patch-ab,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $
+
+fix NetBSD compiler warnings, and convert to NetBSD
+bluetooth compatibility
+
+--- hcidump/hcidump.c.orig     2004-03-03 19:52:10.000000000 +0100
++++ hcidump/hcidump.c
+@@ -34,12 +34,13 @@
+ #include <getopt.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <sys/ioctl.h>
+ #include <string.h>
+ #include <unistd.h>
+ 
+-#include <netgraph/bluetooth/include/ng_hci.h>
+-#include <netgraph/bluetooth/include/ng_l2cap.h>
+-#include <netgraph/bluetooth/include/ng_btsocket.h>
++#include <netbt/bluetooth.h>
++#include <netbt/hci.h>
++#include <netbt/l2cap.h>
+ 
+ #include "parser.h"
+ #include "hcidump.h"
+@@ -104,7 +105,7 @@ static void process_frames(char *dev, in
+               exit(1);
+       }
+       dh = (void *) buf;
+-      frm.data = buf + DUMP_HDR_SIZE;
++      frm.data = (uint8_t *)(buf + DUMP_HDR_SIZE);
+       
+       if (!(ctrl = malloc(100))) {
+               perror("Can't allocate control buffer");
+@@ -139,8 +140,8 @@ static void process_frames(char *dev, in
+               frm.in = 0;
+               cmsg = CMSG_FIRSTHDR(&msg);
+               while (cmsg) {
+-                      if (cmsg->cmsg_level == SOL_HCI_RAW &&
+-                          cmsg->cmsg_type == SCM_HCI_RAW_DIRECTION)
++                      if (cmsg->cmsg_level == BTPROTO_HCI &&
++                          cmsg->cmsg_type == SCM_HCI_DIRECTION)
+                               memcpy(&frm.in,CMSG_DATA(cmsg),sizeof(frm.in));
+ 
+                       if (cmsg->cmsg_level == SOL_SOCKET &&
+@@ -192,7 +193,7 @@ static void read_dump(int file)
+               
+               frm.data_len = le16toh(dh.len);
+ 
+-              if ((err = read_n(file, frm.data, frm.data_len)) < 0)
++              if ((err = read_n(file, (char *)frm.data, frm.data_len)) < 0)
+                       goto failed;
+               if (!err) return;
+ 
+@@ -210,16 +211,16 @@ failed:
+       exit(1);
+ }
+ 
+-static int open_file(char *file, int mode)
++static int open_file(char *file, int m)
+ {
+-      int f, flags;
++      int f, fl;
+ 
+-      if (mode == WRITE)
+-              flags = O_WRONLY | O_CREAT | O_APPEND;
++      if (m == WRITE)
++              fl = O_WRONLY | O_CREAT | O_APPEND;
+       else
+-              flags = O_RDONLY;
++              fl = O_RDONLY;
+ 
+-      if ((f = open(file, flags, 0600)) < 0) {
++      if ((f = open(file, fl, 0600)) < 0) {
+               perror("Can't open output file");
+               exit(1);
+       }
+@@ -228,12 +229,12 @@ static int open_file(char *file, int mod
+ 
+ static int open_socket(char *dev)
+ {
+-      struct sockaddr_hci addr;
+-      struct ng_btsocket_hci_raw_filter flt;
++      struct sockaddr_bt addr;
++      struct hci_filter flt;
+       int s, opt;
+ 
+       /* Create HCI socket */
+-      if ((s=socket(AF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI)) < 0) {
++      if ((s=socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI)) < 0) {
+               perror("Can't create HCI socket");
+               exit(1);
+       }
+@@ -245,37 +246,60 @@ static int open_socket(char *dev)
+       }
+ 
+       opt = 1;
+-      if (setsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_DIRECTION, &opt, sizeof(opt)) < 0) {
+-              perror("Can't enable data direction info");
++      if (setsockopt(s, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) {
++              perror("Can't enable time stamp");
+               exit(1);
+       }
+ 
+       opt = 1;
+-      if (setsockopt(s, SOL_SOCKET, SO_TIMESTAMP, &opt, sizeof(opt)) < 0) {
+-              perror("Can't enable time stamp");
++      if (setsockopt(s, BTPROTO_HCI, SO_HCI_DIRECTION, &opt, sizeof(opt)) < 0) {
++              perror("Can't enable data direction info");
++              exit(1);
++      }
++
++      /* Setup filters */
++      memset(&flt, 0xff, sizeof(flt));
++      if (setsockopt(s, BTPROTO_HCI, SO_HCI_EVT_FILTER, (void const *) &flt, sizeof(flt)) < 0) {
++              perror("Can't set HCI Event filter");
+               exit(1);
+       }
+ 
+-      /* Setup filter */
+       memset(&flt, 0xff, sizeof(flt));
+-      if (setsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_FILTER, (void const *) &flt, sizeof(flt)) < 0) {
+-              perror("Can't set HCI filter");
++      if (setsockopt(s, BTPROTO_HCI, SO_HCI_PKT_FILTER, (void const *) &flt, sizeof(flt)) < 0) {
++              perror("Can't set HCI Packet filter");
+               exit(1);
+       }
+ 
+       /* Bind socket to the HCI device */
+       memset(&addr, 0, sizeof(addr));
+-      addr.hci_len = sizeof(addr);
+-      addr.hci_family = AF_BLUETOOTH;
++      addr.bt_len = sizeof(addr);
++      addr.bt_family = AF_BLUETOOTH;
+       if (dev != NULL) {
+-              strncpy(addr.hci_node, dev, sizeof(addr.hci_node));
++              struct btreq btr;
+ 
+-              if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+-                      printf("Can't attach to device %s. %s(%d)\n", 
+-                                      dev, strerror(errno), errno);
++              memset(&btr, 0, sizeof(btr));
++              strlcpy(btr.btr_name, dev, HCI_DEVNAME_SIZE);
++
++              if (ioctl(s, SIOCGBTINFO, &btr) < 0) {
++                      printf("Can't get device info for '%s': %s(%d)\n",
++                              dev, strerror(errno), errno);
+                       exit(1);
+               }
++
++              if ((btr.btr_flags & (BTF_UP|BTF_RUNNING)) != (BTF_UP|BTF_RUNNING)) {
++                      printf("Can't get BDADDR for '%s' (not running).\n", dev);
++                      exit(1);
++              }
++
++              bdaddr_copy(&addr.bt_bdaddr, &btr.btr_bdaddr);
+       }
++
++      if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
++              printf("Can't bind to device %s. %s(%d)\n", 
++                      dev, strerror(errno), errno);
++              exit(1);
++      }
++
+       return s;
+ }
+ 
diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hcidump/patches/patch-ac Tue Jul 25 16:28:47 2006 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-ac,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $
+
+NetBSD compatibility
+
+--- hcidump/hcidump.h.orig     2003-09-13 00:38:06.000000000 +0100
++++ hcidump/hcidump.h
+@@ -41,5 +41,5 @@ struct dump_hdr {
+ } __attribute__ ((packed));
+ #define DUMP_HDR_SIZE (sizeof(struct dump_hdr))
+ 
+-#define SNAP_LEN NG_HCI_ACL_PKT_SIZE
++#define SNAP_LEN HCI_ACL_PKT_SIZE
+ 
diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hcidump/patches/patch-ad Tue Jul 25 16:28:47 2006 +0000
@@ -0,0 +1,23 @@
+$NetBSD: patch-ad,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $
+
+lint complains so get rid of it, and fix
+path for LIBDIR to work in pkgsrc
+
+--- parser/Makefile.orig       2004-03-12 22:16:59.000000000 +0000
++++ parser/Makefile
+@@ -2,13 +2,13 @@
+ # $FreeBSD$
+ 
+ LIB=          parser
+-DESTDIR=
+-LIBDIR=               .
++LIBDIR=               ${PREFIX}/lib
+ MAN=
+ SRCS=         bnep.c cmtp.c hidp.c l2cap.c rfcomm.c hci.c parser.c sdp.c
+ WARNS?=               2
+ DEBUG_FLAGS=  -g
+ CFLAGS=               -O2
++NOLINT=               1
+ 
+ NOPROFILE=    1
+ 
diff -r e7b5c540d92b -r ac0955617e68 sysutils/hcidump/patches/patch-ae
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000



Home | Main Index | Thread Index | Old Index