summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/hcidump.13
-rw-r--r--tools/hcidump.c1
-rw-r--r--tools/parser/avdtp.c113
-rw-r--r--tools/parser/l2cap.c7
-rw-r--r--tools/parser/parser.h2
5 files changed, 125 insertions, 1 deletions
diff --git a/tools/hcidump.1 b/tools/hcidump.1
index 181d311a5..fcb0e3558 100644
--- a/tools/hcidump.1
+++ b/tools/hcidump.1
@@ -81,7 +81,8 @@ is a space-separated list of packet categories: available categories are
.IR bnep ,
.IR cmtp ,
.IR hidp ,
-.IR hcrp
+.IR hcrp ,
+.IR avdtp
and
.IR capi .
If filters are used, only packets belonging to the specified categories are
diff --git a/tools/hcidump.c b/tools/hcidump.c
index b8e351e68..1b3f4a021 100644
--- a/tools/hcidump.c
+++ b/tools/hcidump.c
@@ -302,6 +302,7 @@ static struct {
{ "cmtp", FILT_CMTP },
{ "hidp", FILT_HIDP },
{ "hcrp", FILT_HCRP },
+ { "avdtp", FILT_AVDTP },
{ "capi", FILT_CAPI },
{ 0 }
};
diff --git a/tools/parser/avdtp.c b/tools/parser/avdtp.c
new file mode 100644
index 000000000..96f7049bd
--- /dev/null
+++ b/tools/parser/avdtp.c
@@ -0,0 +1,113 @@
+/*
+ *
+ * Bluetooth packet analyzer - AVDTP parser
+ *
+ * Copyright (C) 2004 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#include "parser.h"
+
+
+static char *si2str(uint8_t si)
+{
+ switch (si & 0x7f) {
+ case 0x01:
+ return "Discover";
+ case 0x02:
+ return "Capabilities";
+ case 0x03:
+ return "Set config";
+ case 0x04:
+ return "Get config";
+ case 0x05:
+ return "Reconfigure";
+ case 0x06:
+ return "Open";
+ case 0x07:
+ return "Start";
+ case 0x08:
+ return "Close";
+ case 0x09:
+ return "Suspend";
+ case 0x0a:
+ return "Abort";
+ case 0x0b:
+ return "Security";
+ default:
+ return "Unknown";
+ }
+}
+
+static char *pt2str(uint8_t hdr)
+{
+ switch (hdr & 0x0c) {
+ case 0x00:
+ return "Single";
+ case 0x04:
+ return "Start";
+ case 0x08:
+ return "Cont";
+ case 0x0c:
+ return "End";
+ default:
+ return "Unk";
+ }
+}
+
+static char *mt2str(uint8_t hdr)
+{
+ switch (hdr & 0x03) {
+ case 0x00:
+ return "cmd";
+ case 0x08:
+ return "rsp";
+ case 0x0c:
+ return "rej";
+ default:
+ return "rfa";
+ }
+}
+
+void avdtp_dump(int level, struct frame *frm)
+{
+ uint8_t hdr, sid = 0xff, nsp;
+
+ hdr = get_u8(frm);
+
+ nsp = (hdr & 0x0c) == 0x04 ? get_u8(frm) : 0;
+ sid = hdr & 0x08 ? 0x00 : get_u8(frm);
+
+ p_indent(level, frm);
+
+ printf("AVDTP(s): %s %s: transaction %d\n",
+ sid & 0x08 ? pt2str(hdr) : si2str(sid), mt2str(hdr), hdr >> 8);
+
+ raw_dump(level, frm);
+}
diff --git a/tools/parser/l2cap.c b/tools/parser/l2cap.c
index 8b8e5fb11..2a86ba6a2 100644
--- a/tools/parser/l2cap.c
+++ b/tools/parser/l2cap.c
@@ -427,6 +427,13 @@ static void l2cap_parse(int level, struct frame *frm)
raw_dump(level + 1, frm);
break;
+ case 0x19:
+ if (!p_filter(FILT_AVDTP))
+ avdtp_dump(level, frm);
+ else
+ raw_dump(level + 1, frm);
+ break;
+
default:
proto = get_proto(frm->handle, psm);
diff --git a/tools/parser/parser.h b/tools/parser/parser.h
index cfdf39f2e..49f2d2b2b 100644
--- a/tools/parser/parser.h
+++ b/tools/parser/parser.h
@@ -58,6 +58,7 @@ struct frame {
#define FILT_CMTP 0x0040
#define FILT_HIDP 0x0080
#define FILT_HCRP 0x0100
+#define FILT_AVDTP 0x0200
#define FILT_CAPI 0x00010000
@@ -168,6 +169,7 @@ void bnep_dump(int level, struct frame *frm);
void cmtp_dump(int level, struct frame *frm);
void hidp_dump(int level, struct frame *frm);
void hcrp_dump(int level, struct frame *frm);
+void avdtp_dump(int level, struct frame *frm);
void capi_dump(int level, struct frame *frm);