From 8eb1ef58280f0a3fe50c366cdb3ad5c86f4dd905 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 8 Jan 2006 01:38:46 +0000 Subject: [PATCH] hcidump: Add skeleton for the PPP parser --- tools/hcidump.1 | 10 +++++++--- tools/hcidump.c | 9 ++++++++- tools/parser/parser.h | 2 ++ tools/parser/ppp.c | 45 +++++++++++++++++++++++++++++++++++++++++++ tools/parser/rfcomm.c | 8 ++++++++ 5 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 tools/parser/ppp.c diff --git a/tools/hcidump.1 b/tools/hcidump.1 index 17a9f142f..3f8a01f34 100644 --- a/tools/hcidump.1 +++ b/tools/hcidump.1 @@ -86,7 +86,10 @@ Sets the PSM value for the CAPI Message Transport Protocol. Sets the PSM value for the Hardcopy Control Channel. .TP .BR -O ", " "\-\^\-obex=" "" -Sets the RFCOMM channel value for the Object Exchange protocol. +Sets the RFCOMM channel value for the Object Exchange Protocol. +.TP +.BR -P ", " "\-\^\-ppp=" "" +Sets the RFCOMM channel value for the Point-to-Point Protocol. .TP .BR -A ", " "\-\^\-audio=" "" Extract SCO audio data. @@ -115,9 +118,10 @@ is a space-separated list of packet categories: available categories are .IR hcrp , .IR avdtp , .IR avctp , -.IR obex +.IR obex , +.IR capi and -.IR capi . +.IR ppp . If filters are used, only packets belonging to the specified categories are dumped. By default, all packets are dumped. .SH AUTHORS diff --git a/tools/hcidump.c b/tools/hcidump.c index 15e63b3eb..362e0e958 100644 --- a/tools/hcidump.c +++ b/tools/hcidump.c @@ -606,6 +606,7 @@ static struct { { "avctp", FILT_AVCTP }, { "obex", FILT_OBEX }, { "capi", FILT_CAPI }, + { "ppp", FILT_PPP }, { "csr", FILT_CSR }, { "dga", FILT_DGA }, { 0 } @@ -645,6 +646,7 @@ static void usage(void) " -C, --cmtp=psm PSM for CMTP\n" " -H, --hcrp=psm PSM for HCRP\n" " -O, --obex=channel Channel for OBEX\n" + " -P, --ppp=channel Channel for PPP\n" " -A, --audio=file Extract SCO audio data\n" " -B, --btsnoop Use BTSnoop file format\n" " -V, --verbose Verbose decoding\n" @@ -671,6 +673,7 @@ static struct option main_options[] = { { "cmtp", 1, 0, 'C' }, { "hcrp", 1, 0, 'H' }, { "obex", 1, 0, 'O' }, + { "ppp", 1, 0, 'P' }, { "audio", 1, 0, 'A' }, { "btsnoop", 0, 0, 'B' }, { "verbose", 0, 0, 'V' }, @@ -688,7 +691,7 @@ int main(int argc, char *argv[]) printf("HCI sniffer - Bluetooth packet analyzer ver %s\n", VERSION); - while ((opt=getopt_long(argc, argv, "i:l:p:m:w:r:s:n:taxXRC:H:O:A:BVYZh", main_options, NULL)) != -1) { + while ((opt=getopt_long(argc, argv, "i:l:p:m:w:r:s:n:taxXRC:H:O:P:A:BVYZh", main_options, NULL)) != -1) { switch(opt) { case 'i': if (strcasecmp(optarg, "none") && strcasecmp(optarg, "system")) @@ -777,6 +780,10 @@ int main(int argc, char *argv[]) set_proto(0, 0, atoi(optarg), SDP_UUID_OBEX); break; + case 'P': + set_proto(0, 0, atoi(optarg), SDP_UUID_LAN_ACCESS_PPP); + break; + case 'A': audio_file = strdup(optarg); break; diff --git a/tools/parser/parser.h b/tools/parser/parser.h index 740acf3ef..264771c20 100644 --- a/tools/parser/parser.h +++ b/tools/parser/parser.h @@ -78,6 +78,7 @@ struct frame { #define FILT_OBEX 0x00010000 #define FILT_CAPI 0x00020000 +#define FILT_PPP 0x00040000 #define FILT_CSR 0x1000000a #define FILT_DGA 0x1000000c @@ -208,6 +209,7 @@ void avctp_dump(int level, struct frame *frm); void obex_dump(int level, struct frame *frm); void capi_dump(int level, struct frame *frm); +void ppp_dump(int level, struct frame *frm); void csr_dump(int level, struct frame *frm); void bpa_dump(int level, struct frame *frm); diff --git a/tools/parser/ppp.c b/tools/parser/ppp.c new file mode 100644 index 000000000..f311ac19b --- /dev/null +++ b/tools/parser/ppp.c @@ -0,0 +1,45 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2004-2006 Marcel Holtmann + * + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include "parser.h" + +void ppp_dump(int level, struct frame *frm) +{ + p_indent(level, frm); + printf("PPP:\n"); + + raw_dump(level, frm); +} diff --git a/tools/parser/rfcomm.c b/tools/parser/rfcomm.c index 5bb82aa0d..d576342a3 100644 --- a/tools/parser/rfcomm.c +++ b/tools/parser/rfcomm.c @@ -280,6 +280,14 @@ static inline void uih_frame(int level, struct frame *frm, long_frame_head *head raw_dump(level, frm); break; + case SDP_UUID_LAN_ACCESS_PPP: + case SDP_UUID_DIALUP_NETWORKING: + if (!p_filter(FILT_PPP)) + ppp_dump(level + 1, frm); + else + raw_dump(level, frm); + break; + default: if (p_filter(FILT_RFCOMM)) break; -- 2.47.3