Diff between 08399254f9683b86013837ed443f96140fcacedf and 40d6be7e9ad24eff26445fc1f55fb5c7f4cc224b

Changed Files

File Additions Deletions Status
tools/hcidump.1 +5 -1 modified
tools/hcidump.c +7 -0 modified
tools/parser/obex.c +44 -0 added
tools/parser/parser.h +2 -0 modified
tools/parser/rfcomm.c +7 -0 modified

Full Patch

diff --git a/tools/hcidump.1 b/tools/hcidump.1
index d241b43..0519642 100644
--- a/tools/hcidump.1
+++ b/tools/hcidump.1
@@ -76,6 +76,9 @@ Sets the PSM value for the CAPI Message Transport Protocol
 .TP
 .BR -H ", " "\-\^\-hcrp"
 Sets the PSM value for the Hardcopy Control Channel
+.TP
+.BR -O ", " "\-\^\-obex"
+Sets the RFCOMM channel value for the Object Exchange protocol
 .SH FILTERS
 .B
 filter
@@ -89,7 +92,8 @@ is a space-separated list of packet categories: available categories are
 .IR cmtp ,
 .IR hidp ,
 .IR hcrp ,
-.IR avdtp
+.IR avdtp ,
+.IR obex
 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 bcf213f..4f11efe 100644
--- a/tools/hcidump.c
+++ b/tools/hcidump.c
@@ -308,6 +308,7 @@ static struct {
 	{ "hidp",	FILT_HIDP	},
 	{ "hcrp",	FILT_HCRP	},
 	{ "avdtp",	FILT_AVDTP	},
+	{ "obex",	FILT_OBEX	},
 	{ "capi",	FILT_CAPI	},
 	{ 0 }
 };
@@ -343,6 +344,7 @@ static void usage(void)
 	"  -R, --raw                  Raw mode\n"
 	"  -C, --cmtp=psm             PSM for CMTP\n"
 	"  -H, --hcrp=psm             PSM for HCRP\n"
+	"  -O, --obex=channel         Channel for OBEX\n"
 	"  -?, --help                 Give this help list\n"
 	"      --usage                Give a short usage message\n"
 	);
@@ -362,6 +364,7 @@ static struct option main_options[] = {
 	{ "raw",		0, 0, 'R' },
 	{ "cmtp",		1, 0, 'C' },
 	{ "hcrp",		1, 0, 'H' },
+	{ "obex",		1, 0, 'O' },
 	{ "help",		0, 0, 'h' },
 	{ 0 }
 };
@@ -428,6 +431,10 @@ int main(int argc, char *argv[])
 			set_proto(0, atoi(optarg), 0, SDP_UUID_HARDCOPY_CONTROL_CHANNEL);
 			break;
 
+		case 'O':
+			set_proto(0, 0, atoi(optarg), SDP_UUID_OBEX);
+			break;
+
 		case 'h':
 		default:
 			usage();
diff --git a/tools/parser/obex.c b/tools/parser/obex.c
new file mode 100644
index 0000000..9e4aae3
--- /dev/null
+++ b/tools/parser/obex.c
@@ -0,0 +1,44 @@
+/*
+ *
+ *  Bluetooth packet analyzer - OBEX 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"
+
+void obex_dump(int level, struct frame *frm)
+{
+	p_indent(level, frm);
+
+	printf("OBEX: \n");
+
+	raw_dump(level, frm);
+}
diff --git a/tools/parser/parser.h b/tools/parser/parser.h
index 3237b16..d2e864d 100644
--- a/tools/parser/parser.h
+++ b/tools/parser/parser.h
@@ -64,6 +64,7 @@ struct frame {
 #define FILT_HCRP	0x0100
 #define FILT_AVDTP	0x0200
 
+#define FILT_OBEX	0x00010000
 #define FILT_CAPI	0x00020000
 #define FILT_CSR	0x1000000f
 
@@ -176,6 +177,7 @@ 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 obex_dump(int level, struct frame *frm);
 void capi_dump(int level, struct frame *frm);
 void csr_dump(int level, struct frame *frm);
 
diff --git a/tools/parser/rfcomm.c b/tools/parser/rfcomm.c
index f0ea8c1..6f37cf2 100644
--- a/tools/parser/rfcomm.c
+++ b/tools/parser/rfcomm.c
@@ -269,6 +269,13 @@ static inline void uih_frame(int level, struct frame *frm, long_frame_head *head
 		proto = get_proto(frm->handle, 0, frm->channel);
 
 		switch (proto) {
+		case SDP_UUID_OBEX:
+			if (!p_filter(FILT_OBEX))
+				obex_dump(level + 1, frm);
+			else
+				raw_dump(level, frm);
+			break;
+
 		default:
 			if (p_filter(FILT_RFCOMM))
 				break;