diff options
author | salo <salo@pkgsrc.org> | 2006-07-25 16:28:47 +0000 |
---|---|---|
committer | salo <salo@pkgsrc.org> | 2006-07-25 16:28:47 +0000 |
commit | 5d435ece85c214d3605659a56c00ea58beccc238 (patch) | |
tree | 198b6a31e76b2747017059256474c4f6f7618376 /sysutils/hcidump | |
parent | af66f920c9542f22b862c37a15657b6bffa37ffa (diff) | |
download | pkgsrc-5d435ece85c214d3605659a56c00ea58beccc238.tar.gz |
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 (limited to 'sysutils/hcidump')
-rw-r--r-- | sysutils/hcidump/DESCR | 4 | ||||
-rw-r--r-- | sysutils/hcidump/Makefile | 17 | ||||
-rw-r--r-- | sysutils/hcidump/PLIST | 6 | ||||
-rw-r--r-- | sysutils/hcidump/distinfo | 18 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-aa | 19 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-ab | 166 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-ac | 13 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-ad | 23 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-ae | 14 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-af | 20 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-ag | 175 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-ah | 14 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-ai | 293 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-aj | 68 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-ak | 18 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-al | 50 | ||||
-rw-r--r-- | sysutils/hcidump/patches/patch-am | 23 |
17 files changed, 941 insertions, 0 deletions
diff --git a/sysutils/hcidump/DESCR b/sysutils/hcidump/DESCR new file mode 100644 index 00000000000..600556479e6 --- /dev/null +++ b/sysutils/hcidump/DESCR @@ -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 --git a/sysutils/hcidump/Makefile b/sysutils/hcidump/Makefile new file mode 100644 index 00000000000..d4b7ed3992a --- /dev/null +++ b/sysutils/hcidump/Makefile @@ -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 +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 --git a/sysutils/hcidump/PLIST b/sysutils/hcidump/PLIST new file mode 100644 index 00000000000..43b29c79dae --- /dev/null +++ b/sysutils/hcidump/PLIST @@ -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 --git a/sysutils/hcidump/distinfo b/sysutils/hcidump/distinfo new file mode 100644 index 00000000000..79c0daa1c28 --- /dev/null +++ b/sysutils/hcidump/distinfo @@ -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 --git a/sysutils/hcidump/patches/patch-aa b/sysutils/hcidump/patches/patch-aa new file mode 100644 index 00000000000..0426a4585cd --- /dev/null +++ b/sysutils/hcidump/patches/patch-aa @@ -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 --git a/sysutils/hcidump/patches/patch-ab b/sysutils/hcidump/patches/patch-ab new file mode 100644 index 00000000000..f10792dbb8d --- /dev/null +++ b/sysutils/hcidump/patches/patch-ab @@ -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 --git a/sysutils/hcidump/patches/patch-ac b/sysutils/hcidump/patches/patch-ac new file mode 100644 index 00000000000..24accea613f --- /dev/null +++ b/sysutils/hcidump/patches/patch-ac @@ -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 --git a/sysutils/hcidump/patches/patch-ad b/sysutils/hcidump/patches/patch-ad new file mode 100644 index 00000000000..87d14f41a9f --- /dev/null +++ b/sysutils/hcidump/patches/patch-ad @@ -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 --git a/sysutils/hcidump/patches/patch-ae b/sysutils/hcidump/patches/patch-ae new file mode 100644 index 00000000000..7a63102b151 --- /dev/null +++ b/sysutils/hcidump/patches/patch-ae @@ -0,0 +1,14 @@ +$NetBSD: patch-ae,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $ + +add necessary header file + +--- parser/bnep.c.orig 2003-09-13 00:38:11.000000000 +0100 ++++ parser/bnep.c +@@ -30,6 +30,7 @@ + */ + + #include <sys/types.h> ++#include <sys/time.h> + #include <stdio.h> + + #include "parser.h" diff --git a/sysutils/hcidump/patches/patch-af b/sysutils/hcidump/patches/patch-af new file mode 100644 index 00000000000..4806532d6ef --- /dev/null +++ b/sysutils/hcidump/patches/patch-af @@ -0,0 +1,20 @@ +$NetBSD: patch-af,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $ + +add necessary header file, and function prototype to kill compiler warnings + +--- parser/cmtp.c.orig 2003-09-13 00:38:11.000000000 +0100 ++++ parser/cmtp.c +@@ -30,10 +30,13 @@ + */ + + #include <sys/types.h> ++#include <sys/time.h> + #include <stdio.h> + + #include "parser.h" + ++char *bst2str(uint8_t); ++ + char *bst2str(uint8_t bst) + { + switch (bst) { diff --git a/sysutils/hcidump/patches/patch-ag b/sysutils/hcidump/patches/patch-ag new file mode 100644 index 00000000000..eef87aa89d5 --- /dev/null +++ b/sysutils/hcidump/patches/patch-ag @@ -0,0 +1,175 @@ +$NetBSD: patch-ag,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $ + +NetBSD compatibility changes + +--- parser/hci.c.orig 2003-09-13 00:38:11.000000000 +0100 ++++ parser/hci.c +@@ -25,9 +25,13 @@ + */ + + #include <sys/types.h> ++#include <sys/time.h> + #include <sys/endian.h> +-#include <netgraph/bluetooth/include/ng_hci.h> + #include <stdio.h> ++#include <string.h> ++ ++#include <netbt/bluetooth.h> ++#include <netbt/hci.h> + + #include "parser.h" + +@@ -215,56 +219,56 @@ char *cmd_status_map[] = { + + static void command_dump(int level, struct frame *frm) + { +- ng_hci_cmd_pkt_t *hdr = frm->ptr; ++ hci_cmd_hdr_t *hdr = (hci_cmd_hdr_t *)frm->ptr; + uint16_t opcode = le16toh(hdr->opcode); +- uint16_t ogf = NG_HCI_OGF(opcode); +- uint16_t ocf = NG_HCI_OCF(opcode); ++ uint16_t ogf = HCI_OGF(opcode); ++ uint16_t ocf = HCI_OCF(opcode); + char *cmd; + + if (p_filter(FILT_HCI)) + return; + + switch (ogf) { +- case NG_HCI_OGF_INFO: ++ case HCI_OGF_INFO: + if (ocf <= CMD_INFO_NUM) + cmd = cmd_info_map[ocf]; + else + cmd = "Unknown"; + break; + +- case NG_HCI_OGF_HC_BASEBAND: ++ case HCI_OGF_HC_BASEBAND: + if (ocf <= CMD_HOSTCTL_NUM) + cmd = cmd_hostctl_map[ocf]; + else + cmd = "Unknown"; + break; + +- case NG_HCI_OGF_LINK_CONTROL: ++ case HCI_OGF_LINK_CONTROL: + if (ocf <= CMD_LINKCTL_NUM) + cmd = cmd_linkctl_map[ocf]; + else + cmd = "Unknown"; + break; + +- case NG_HCI_OGF_LINK_POLICY: ++ case HCI_OGF_LINK_POLICY: + if (ocf <= CMD_LINKPOL_NUM) + cmd = cmd_linkpol_map[ocf]; + else + cmd = "Unknown"; + break; + +- case NG_HCI_OGF_STATUS: ++ case HCI_OGF_STATUS: + if (ocf <= CMD_STATUS_NUM) + cmd = cmd_status_map[ocf]; + else + cmd = "Unknown"; + break; + +- case NG_HCI_OGF_BT_LOGO: ++ case HCI_OGF_BT_LOGO: + cmd = "Testing"; + break; + +- case NG_HCI_OGF_VENDOR: ++ case HCI_OGF_VENDOR: + cmd = "Vendor"; + break; + +@@ -286,7 +290,7 @@ static void command_dump(int level, stru + + static void event_dump(int level, struct frame *frm) + { +- ng_hci_event_pkt_t *hdr = frm->ptr; ++ hci_event_hdr_t *hdr = (hci_event_hdr_t *)frm->ptr; + + if (p_filter(FILT_HCI)) + return; +@@ -296,9 +300,9 @@ static void event_dump(int level, struct + if (hdr->event <= EVENT_NUM) + printf("HCI Event: %s(0x%2.2x) plen %d\n", + event_map[hdr->event], hdr->event, hdr->length); +- else if (hdr->event == NG_HCI_EVENT_BT_LOGO) ++ else if (hdr->event == HCI_EVENT_BT_LOGO) + printf("HCI Event: Testing(0x%2.2x) plen %d\n", hdr->event, hdr->length); +- else if (hdr->event == NG_HCI_EVENT_VENDOR) ++ else if (hdr->event == HCI_EVENT_VENDOR) + printf("HCI Event: Vendor(0x%2.2x) plen %d\n", hdr->event, hdr->length); + else + printf("HCI Event: code 0x%2.2x plen %d\n", hdr->event, hdr->length); +@@ -311,7 +315,7 @@ static void event_dump(int level, struct + + static void acl_dump(int level, struct frame *frm) + { +- ng_hci_acldata_pkt_t *hdr = (void *) frm->ptr; ++ hci_acldata_hdr_t *hdr = (void *) frm->ptr; + uint16_t handle = le16toh(hdr->con_handle); + uint16_t dlen = le16toh(hdr->length); + uint8_t flags = (handle >> 12); /* flags */ +@@ -319,14 +323,14 @@ static void acl_dump(int level, struct f + if (!p_filter(FILT_HCI)) { + p_indent(level, frm); + printf("ACL data: handle 0x%4.4x flags 0x%2.2x dlen %d\n", +- NG_HCI_CON_HANDLE(handle), flags, dlen); ++ HCI_CON_HANDLE(handle), flags, dlen); + level++; + } + + frm->ptr += sizeof(*hdr); + frm->len -= sizeof(*hdr); + frm->flags = flags; +- frm->handle = NG_HCI_CON_HANDLE(handle); ++ frm->handle = HCI_CON_HANDLE(handle); + + if (parser.filter & ~FILT_HCI) + l2cap_dump(level, frm); +@@ -336,13 +340,13 @@ static void acl_dump(int level, struct f + + static void sco_dump(int level, struct frame *frm) + { +- ng_hci_scodata_pkt_t *hdr = (void *) frm->ptr; ++ hci_scodata_hdr_t *hdr = (void *) frm->ptr; + uint16_t handle = le16toh(hdr->con_handle); + + if (!p_filter(FILT_SCO)) { + p_indent(level, frm); + printf("SCO data: handle 0x%4.4x dlen %d\n", +- NG_HCI_CON_HANDLE(handle), hdr->length); ++ HCI_CON_HANDLE(handle), hdr->length); + level++; + + frm->ptr += sizeof(*hdr); +@@ -356,19 +360,19 @@ void hci_dump(int level, struct frame *f + uint8_t type = *(uint8_t *)frm->ptr; + + switch (type) { +- case NG_HCI_CMD_PKT: ++ case HCI_CMD_PKT: + command_dump(level, frm); + break; + +- case NG_HCI_EVENT_PKT: ++ case HCI_EVENT_PKT: + event_dump(level, frm); + break; + +- case NG_HCI_ACL_DATA_PKT: ++ case HCI_ACL_DATA_PKT: + acl_dump(level, frm); + break; + +- case NG_HCI_SCO_DATA_PKT: ++ case HCI_SCO_DATA_PKT: + sco_dump(level, frm); + break; + diff --git a/sysutils/hcidump/patches/patch-ah b/sysutils/hcidump/patches/patch-ah new file mode 100644 index 00000000000..bceff21861f --- /dev/null +++ b/sysutils/hcidump/patches/patch-ah @@ -0,0 +1,14 @@ +$NetBSD: patch-ah,v 1.1.1.1 2006/07/25 16:28:47 salo Exp $ + +insert needed header file + +--- parser/hidp.c.orig 2004-02-17 22:33:10.000000000 +0000 ++++ parser/hidp.c +@@ -30,6 +30,7 @@ + */ + + #include <sys/types.h> ++#include <sys/time.h> + #include <stdio.h> + + #include "parser.h" diff --git a/sysutils/hcidump/patches/patch-ai b/sysutils/hcidump/patches/patch-ai new file mode 100644 index 00000000000..5dda539186c --- /dev/null +++ b/sysutils/hcidump/patches/patch-ai @@ -0,0 +1,293 @@ +$NetBSD: patch-ai,v 1.1.1.1 2006/07/25 16:28:48 salo Exp $ + +lots of compatibility changes for NetBSD + +--- parser/l2cap.c.orig 2003-09-13 01:38:11.000000000 +0200 ++++ parser/l2cap.c +@@ -25,13 +25,16 @@ + */ + + #include <sys/types.h> ++#include <sys/time.h> + #include <sys/endian.h> +-#include <netgraph/bluetooth/include/ng_hci.h> +-#include <netgraph/bluetooth/include/ng_l2cap.h> + #include <stdio.h> + #include <string.h> + #include <stdlib.h> + ++#include <netbt/bluetooth.h> ++#include <netbt/hci.h> ++#include <netbt/l2cap.h> ++ + #include "parser.h" + + typedef struct { +@@ -123,7 +126,7 @@ static uint16_t get_psm(int in, uint16_t + + static void command_rej(int level, struct frame *frm) + { +- ng_l2cap_cmd_rej_cp *h = frm->ptr; ++ l2cap_cmd_rej_cp *h = (void *)frm->ptr; + + printf("Command rej: reason %d\n", + le16toh(h->reason)); +@@ -131,7 +134,7 @@ static void command_rej(int level, struc + + static void conn_req(int level, struct frame *frm) + { +- ng_l2cap_con_req_cp *h = frm->ptr; ++ l2cap_con_req_cp *h = (void *)frm->ptr; + + add_cid(frm->in, le16toh(h->scid), le16toh(h->psm)); + +@@ -144,7 +147,7 @@ static void conn_req(int level, struct f + + static void conn_rsp(int level, struct frame *frm) + { +- ng_l2cap_con_rsp_cp *h = frm->ptr; ++ l2cap_con_rsp_cp *h = (void *)frm->ptr; + uint16_t psm; + + if ((psm = get_psm(!frm->in, le16toh(h->scid)))) +@@ -177,16 +180,16 @@ static void conf_opt(int level, void *pt + { + p_indent(level, 0); + while (len > 0) { +- ng_l2cap_cfg_opt_t *h = ptr; +- +- ptr += sizeof(*h) + h->length; ++ l2cap_cfg_opt_t *h = ptr; ++ ++ ptr = (void *)( (u_int8_t *)ptr + sizeof(l2cap_cfg_opt_t) + h->length); + len -= sizeof(*h) + h->length; + + switch (h->type) { +- case NG_L2CAP_OPT_MTU: ++ case L2CAP_OPT_MTU: + printf("MTU %d ", conf_opt_val((uint8_t *)(h + 1), h->length)); + break; +- case NG_L2CAP_OPT_FLUSH_TIMO: ++ case L2CAP_OPT_FLUSH_TIMO: + printf("FlushTO %d ", conf_opt_val((uint8_t *)(h + 1), h->length)); + break; + default: +@@ -197,9 +200,9 @@ static void conf_opt(int level, void *pt + printf("\n"); + } + +-static void conf_req(int level, ng_l2cap_cmd_hdr_t *cmd, struct frame *frm) ++static void conf_req(int level, l2cap_cmd_hdr_t *cmd, struct frame *frm) + { +- ng_l2cap_cfg_req_cp *h = frm->ptr; ++ l2cap_cfg_req_cp *h = (void *)frm->ptr; + int clen = le16toh(cmd->length) - sizeof(*h); + + if (p_filter(FILT_L2CAP)) +@@ -211,9 +214,9 @@ static void conf_req(int level, ng_l2cap + conf_opt(level, (void *)(h + 1), clen); + } + +-static void conf_rsp(int level, ng_l2cap_cmd_hdr_t *cmd, struct frame *frm) ++static void conf_rsp(int level, l2cap_cmd_hdr_t *cmd, struct frame *frm) + { +- ng_l2cap_cfg_rsp_cp *h = frm->ptr; ++ l2cap_cfg_rsp_cp *h = (void *)frm->ptr; + int clen = le16toh(cmd->length) - sizeof(*h); + + if (p_filter(FILT_L2CAP)) +@@ -227,7 +230,7 @@ static void conf_rsp(int level, ng_l2cap + + static void disconn_req(int level, struct frame *frm) + { +- ng_l2cap_discon_req_cp *h = frm->ptr; ++ l2cap_discon_req_cp *h = (void *)frm->ptr; + + if (p_filter(FILT_L2CAP)) + return; +@@ -238,7 +241,7 @@ static void disconn_req(int level, struc + + static void disconn_rsp(int level, struct frame *frm) + { +- ng_l2cap_discon_rsp_cp *h = frm->ptr; ++ l2cap_discon_rsp_cp *h = (void *)frm->ptr; + del_cid(frm->in, le16toh(h->dcid), le16toh(h->scid)); + + if (p_filter(FILT_L2CAP)) +@@ -248,7 +251,7 @@ static void disconn_rsp(int level, struc + le16toh(h->dcid), le16toh(h->scid)); + } + +-static void echo_req(int level, ng_l2cap_cmd_hdr_t *cmd, struct frame *frm) ++static void echo_req(int level, l2cap_cmd_hdr_t *cmd, struct frame *frm) + { + if (p_filter(FILT_L2CAP)) + return; +@@ -258,7 +261,7 @@ static void echo_req(int level, ng_l2cap + raw_dump(level, frm); + } + +-static void echo_rsp(int level, ng_l2cap_cmd_hdr_t *cmd, struct frame *frm) ++static void echo_rsp(int level, l2cap_cmd_hdr_t *cmd, struct frame *frm) + { + if (p_filter(FILT_L2CAP)) + return; +@@ -268,7 +271,7 @@ static void echo_rsp(int level, ng_l2cap + raw_dump(level, frm); + } + +-static void info_req(int level, ng_l2cap_cmd_hdr_t *cmd, struct frame *frm) ++static void info_req(int level, l2cap_cmd_hdr_t *cmd, struct frame *frm) + { + if (p_filter(FILT_L2CAP)) + return; +@@ -278,7 +281,7 @@ static void info_req(int level, ng_l2cap + raw_dump(level, frm); + } + +-static void info_rsp(int level, ng_l2cap_cmd_hdr_t *cmd, struct frame *frm) ++static void info_rsp(int level, l2cap_cmd_hdr_t *cmd, struct frame *frm) + { + if (p_filter(FILT_L2CAP)) + return; +@@ -290,7 +293,7 @@ static void info_rsp(int level, ng_l2cap + + static void l2cap_parse(int level, struct frame *frm) + { +- ng_l2cap_hdr_t *hdr = (void *)frm->ptr; ++ l2cap_hdr_t *hdr = (void *)frm->ptr; + uint16_t dlen = le16toh(hdr->length); + uint16_t cid = le16toh(hdr->dcid); + uint16_t psm; +@@ -301,71 +304,71 @@ static void l2cap_parse(int level, struc + if (cid == 0x1) { + /* Signaling channel */ + +- while (frm->len >= sizeof(ng_l2cap_cmd_hdr_t)) { +- ng_l2cap_cmd_hdr_t *hdr = frm->ptr; ++ while (frm->len >= sizeof(l2cap_cmd_hdr_t)) { ++ l2cap_cmd_hdr_t *hdr0 = (void *)frm->ptr; + +- frm->ptr += sizeof(*hdr); +- frm->len -= sizeof(*hdr); ++ frm->ptr += sizeof(*hdr0); ++ frm->len -= sizeof(*hdr0); + + if (!p_filter(FILT_L2CAP)) { + p_indent(level, frm); + printf("L2CAP(s): "); + } + +- switch (hdr->code) { +- case NG_L2CAP_CMD_REJ: ++ switch (hdr0->code) { ++ case L2CAP_COMMAND_REJ: + command_rej(level, frm); + break; + +- case NG_L2CAP_CON_REQ: ++ case L2CAP_CONNECT_REQ: + conn_req(level, frm); + break; + +- case NG_L2CAP_CON_RSP: ++ case L2CAP_CONNECT_RSP: + conn_rsp(level, frm); + break; + +- case NG_L2CAP_CFG_REQ: +- conf_req(level, hdr, frm); ++ case L2CAP_CONFIG_REQ: ++ conf_req(level, hdr0, frm); + break; + +- case NG_L2CAP_CFG_RSP: +- conf_rsp(level, hdr, frm); ++ case L2CAP_CONFIG_RSP: ++ conf_rsp(level, hdr0, frm); + break; + +- case NG_L2CAP_DISCON_REQ: ++ case L2CAP_DISCONNECT_REQ: + disconn_req(level, frm); + break; + +- case NG_L2CAP_DISCON_RSP: ++ case L2CAP_DISCONNECT_RSP: + disconn_rsp(level, frm); + break; + +- case NG_L2CAP_ECHO_REQ: +- echo_req(level, hdr, frm); ++ case L2CAP_ECHO_REQ: ++ echo_req(level, hdr0, frm); + break; + +- case NG_L2CAP_ECHO_RSP: +- echo_rsp(level, hdr, frm); ++ case L2CAP_ECHO_RSP: ++ echo_rsp(level, hdr0, frm); + break; + +- case NG_L2CAP_INFO_REQ: +- info_req(level, hdr, frm); ++ case L2CAP_INFO_REQ: ++ info_req(level, hdr0, frm); + break; + +- case NG_L2CAP_INFO_RSP: +- info_rsp(level, hdr, frm); ++ case L2CAP_INFO_RSP: ++ info_rsp(level, hdr0, frm); + break; + + default: + if (p_filter(FILT_L2CAP)) + break; + printf("code 0x%2.2x ident %d len %d\n", +- hdr->code, hdr->ident, le16toh(hdr->length)); ++ hdr0->code, hdr0->ident, le16toh(hdr0->length)); + raw_dump(level, frm); + } +- frm->ptr += le16toh(hdr->length); +- frm->len -= le16toh(hdr->length); ++ frm->ptr += le16toh(hdr0->length); ++ frm->len -= le16toh(hdr0->length); + } + } else if (cid == 0x2) { + /* Connectionless channel */ +@@ -381,16 +384,16 @@ static void l2cap_parse(int level, struc + raw_dump(level, frm); + } else { + /* Connection oriented channel */ +- uint16_t psm = get_psm(!frm->in, cid); ++ uint16_t psm0 = get_psm(!frm->in, cid); + + if (!p_filter(FILT_L2CAP)) { + p_indent(level, frm); + printf("L2CAP(d): cid 0x%x len %d [psm %d]\n", +- cid, dlen, psm); ++ cid, dlen, psm0); + level++; + } + +- switch (psm) { ++ switch (psm0) { + case 0x01: + if (!p_filter(FILT_SDP)) + sdp_dump(level+1, frm); +@@ -440,11 +443,11 @@ static void l2cap_parse(int level, struc + void l2cap_dump(int level, struct frame *frm) + { + struct frame *fr; +- ng_l2cap_hdr_t *hdr; ++ l2cap_hdr_t *hdr; + uint16_t dlen; + +- if (frm->flags & NG_HCI_PACKET_START) { +- hdr = frm->ptr; ++ if (frm->flags & HCI_PACKET_START) { ++ hdr = (void *)frm->ptr; + dlen = le16toh(hdr->length); + + if (frm->len == (dlen + sizeof(*hdr))) { diff --git a/sysutils/hcidump/patches/patch-aj b/sysutils/hcidump/patches/patch-aj new file mode 100644 index 00000000000..8fa50200dae --- /dev/null +++ b/sysutils/hcidump/patches/patch-aj @@ -0,0 +1,68 @@ +$NetBSD: patch-aj,v 1.1.1.1 2006/07/25 16:28:48 salo Exp $ + +kill all the compiler warnings + +--- parser/parser.c.orig 2003-09-13 00:38:11.000000000 +0100 ++++ parser/parser.c +@@ -25,6 +25,7 @@ + */ + + #include <sys/types.h> ++#include <sys/time.h> + #include <netinet/in.h> + #include <ctype.h> + #include <stdio.h> +@@ -79,7 +80,7 @@ void p_indent(int level, struct frame *f + + uint8_t get_u8(struct frame *frm) + { +- uint8_t *u8_ptr = frm->ptr; ++ uint8_t *u8_ptr = (void *)frm->ptr; + frm->ptr += 1; + frm->len -= 1; + return *u8_ptr; +@@ -87,7 +88,7 @@ uint8_t get_u8(struct frame *frm) + + uint16_t get_u16(struct frame *frm) + { +- uint16_t *u16_ptr = frm->ptr; ++ uint16_t *u16_ptr = (void *)frm->ptr; + frm->ptr += 2; + frm->len -= 2; + return ntohs(get_unaligned(u16_ptr)); +@@ -95,7 +96,7 @@ uint16_t get_u16(struct frame *frm) + + uint32_t get_u32(struct frame *frm) + { +- uint32_t *u32_ptr = frm->ptr; ++ uint32_t *u32_ptr = (void *)frm->ptr; + frm->ptr += 4; + frm->len -= 4; + return ntohl(get_unaligned(u32_ptr)); +@@ -103,7 +104,7 @@ uint32_t get_u32(struct frame *frm) + + uint64_t get_u64(struct frame *frm) + { +- uint64_t *u64_ptr = frm->ptr; ++ uint64_t *u64_ptr = (void *)frm->ptr; + uint64_t u64 = get_unaligned(u64_ptr), tmp; + frm->ptr += 8; + frm->len -= 8; +@@ -120,7 +121,7 @@ void get_u128(struct frame *frm, uint64_ + + static void hex_dump(int level, struct frame *frm, int num) + { +- unsigned char *buf = frm->ptr; ++ unsigned char *buf = (void *)frm->ptr; + register int i,n; + + if ((num < 0) || (num > frm->len)) +@@ -141,7 +142,7 @@ static void hex_dump(int level, struct f + + static void ascii_dump(int level, struct frame *frm, int num) + { +- unsigned char *buf = frm->ptr; ++ unsigned char *buf = (void *)frm->ptr; + register int i,n; + + if ((num < 0) || (num > frm->len)) diff --git a/sysutils/hcidump/patches/patch-ak b/sysutils/hcidump/patches/patch-ak new file mode 100644 index 00000000000..eab02c8fd8d --- /dev/null +++ b/sysutils/hcidump/patches/patch-ak @@ -0,0 +1,18 @@ +$NetBSD: patch-ak,v 1.1.1.1 2006/07/25 16:28:48 salo Exp $ + +proper typing on structure + +--- parser/parser.h.orig 2003-09-13 00:38:11.000000000 +0100 ++++ parser/parser.h +@@ -25,9 +25,9 @@ + */ + + struct frame { +- void *data; ++ uint8_t *data; + int data_len; +- void *ptr; ++ uint8_t *ptr; + int len; + int in; + int handle; diff --git a/sysutils/hcidump/patches/patch-al b/sysutils/hcidump/patches/patch-al new file mode 100644 index 00000000000..c079fad99d7 --- /dev/null +++ b/sysutils/hcidump/patches/patch-al @@ -0,0 +1,50 @@ +$NetBSD: patch-al,v 1.1.1.1 2006/07/25 16:28:48 salo Exp $ + +prototyping to get past compiler warnings + +--- parser/rfcomm.c.orig 2003-09-13 01:38:11.000000000 +0200 ++++ parser/rfcomm.c +@@ -30,6 +30,7 @@ + */ + + #include <sys/types.h> ++#include <sys/time.h> + #include <sys/endian.h> + #include <stdio.h> + +@@ -44,6 +45,8 @@ static char *cr_str[] = { + #define CR_STR(mcc_head) cr_str[mcc_head->type.cr] + #define GET_DLCI(addr) ((addr.server_chn << 1) | (addr.d & 1)) + ++void print_rfcomm_hdr(long_frame_head *, uint8_t *, int); ++ + void print_rfcomm_hdr(long_frame_head* head, uint8_t *ptr, int len) + { + address_field addr = head->addr; +@@ -59,6 +62,8 @@ void print_rfcomm_hdr(long_frame_head* h + printf("cr %d dlci %d pf %d ilen %d fcs 0x%x ", addr.cr, dlci, pf, ilen, fcs); + } + ++void print_mcc(mcc_long_frame_head *); ++ + void print_mcc(mcc_long_frame_head* mcc_head) + { + printf("mcc_len %d\n", mcc_head->length.bits.len); +@@ -145,7 +150,7 @@ static void mcc_rpn(int level, uint8_t * + rpn->rpn_val.rtr_input, rpn->rpn_val.rtr_output, + rpn->rpn_val.rtc_input, rpn->rpn_val.rtc_output, + rpn->rpn_val.xon, rpn->rpn_val.xoff, +- le16toh(*(uint16_t *)&(rpn->rpn_val.pm))); ++ le16toh(*((uint16_t *)(void *)&rpn->rpn_val.pm))); + } + + static void mcc_rls(int level, uint8_t *ptr, int len, +@@ -196,7 +201,7 @@ static void mcc_nsc(int level, uint8_t * + + static void mcc_frame(int level, struct frame *frm, long_frame_head *head) + { +- mcc_short_frame_head *mcc_short_head_p = frm->ptr; ++ mcc_short_frame_head *mcc_short_head_p = (void *)frm->ptr; + mcc_long_frame_head mcc_head; + uint8_t hdr_size; + diff --git a/sysutils/hcidump/patches/patch-am b/sysutils/hcidump/patches/patch-am new file mode 100644 index 00000000000..ab5ac5e3f69 --- /dev/null +++ b/sysutils/hcidump/patches/patch-am @@ -0,0 +1,23 @@ +$NetBSD: patch-am,v 1.1.1.1 2006/07/25 16:28:48 salo Exp $ + +add needed header file for NetBSD, plus fix compiler warning + +--- parser/sdp.c.orig 2004-12-14 18:45:45.000000000 +0000 ++++ parser/sdp.c +@@ -30,6 +30,7 @@ + */ + + #include <sys/types.h> ++#include <sys/time.h> + #include <netinet/in.h> + #include <inttypes.h> + #include <stdio.h> +@@ -527,7 +528,7 @@ static void ssa_rsp(int level, uint16_t + + void sdp_dump(int level, struct frame *frm) + { +- sdp_pdu_hdr *hdr = frm->ptr; ++ sdp_pdu_hdr *hdr = (void *)frm->ptr; + uint16_t tid = ntohs(hdr->tid); + uint16_t len = ntohs(hdr->len); + |