aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-03-03 01:48:14 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-03-03 01:48:14 +0000
commite918e1383e6e80ba4e4808404999521f984f0b5c (patch)
tree85fe02e972cb43c6f6670958139bc55e79a045fa
parenta187c6aa0accc4a9d21ad0e680ffd926b098f2e6 (diff)
downloadhcidump-e918e1383e6e80ba4e4808404999521f984f0b5c.tar.gz
Update copyright information
-rw-r--r--parser/Makefile.am2
-rw-r--r--parser/bnep.c86
-rw-r--r--parser/bnep.h53
-rw-r--r--parser/capi.c49
-rw-r--r--parser/cmtp.c52
-rw-r--r--parser/hci.c74
-rw-r--r--parser/hidp.c84
-rw-r--r--parser/l2cap.c48
-rw-r--r--parser/parser.c51
-rw-r--r--parser/parser.h50
-rw-r--r--parser/rfcomm.c163
-rw-r--r--parser/rfcomm.h67
-rw-r--r--parser/sdp.c58
-rw-r--r--parser/sdp.h51
14 files changed, 398 insertions, 490 deletions
diff --git a/parser/Makefile.am b/parser/Makefile.am
index 9e0c470..4cbb7e6 100644
--- a/parser/Makefile.am
+++ b/parser/Makefile.am
@@ -4,4 +4,4 @@
noinst_LIBRARIES = libparser.a
-libparser_a_SOURCES = parser.c parser.h hci.c l2cap.c rfcomm.c rfcomm.h sdp.c sdp.h bnep.c bnep.h cmtp.c hidp.c capi.c
+libparser_a_SOURCES = parser.c parser.h hci.c l2cap.c rfcomm.c rfcomm.h sdp.c sdp.h bnep.c cmtp.c hidp.c capi.c
diff --git a/parser/bnep.c b/parser/bnep.c
index f478231..2f977a1 100644
--- a/parser/bnep.c
+++ b/parser/bnep.c
@@ -1,58 +1,68 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- BNEP parser.
- Copyright (C) 2002 Takashi Sasai <sasai@sm.sony.co.jp>
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - BNEP parser
+ *
+ * Copyright (C) 2002-2003 Takashi Sasai <sasai@sm.sony.co.jp>
+ * Copyright (C) 2003-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 <errno.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <string.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <netinet/in.h>
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <bluetooth/l2cap.h>
-
-#include "parser.h"
-#include "bnep.h"
-
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/if_ether.h>
#include <arpa/inet.h>
+#include "parser.h"
+
#define PAYLOAD_RAW_DUMP
+
+/* BNEP Type */
+#define BNEP_GENERAL_ETHERNET 0x00
+#define BNEP_CONTROL 0x01
+#define BNEP_COMPRESSED_ETHERNET 0x02
+#define BNEP_COMPRESSED_ETHERNET_SOURCE_ONLY 0x03
+#define BNEP_COMPRESSED_ETHERNET_DEST_ONLY 0x04
+
+/* BNEP Control Packet Type */
+#define BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD 0x00
+#define BNEP_SETUP_CONNECTION_REQUEST_MSG 0x01
+#define BNEP_SETUP_CONNECTION_RESPONSE_MSG 0x02
+#define BNEP_FILTER_NET_TYPE_SET_MSG 0x03
+#define BNEP_FILTER_NET_TYPE_RESPONSE_MSG 0x04
+#define BNEP_FILTER_MULT_ADDR_SET_MSG 0x05
+#define BNEP_FILTER_MULT_ADDR_RESPONSE_MSG 0x06
+
+/* BNEP Extension Type */
+#define BNEP_EXTENSION_CONTROL 0x00
+
static char *get_macaddr(struct frame *frm)
{
static char str[20];
@@ -285,11 +295,11 @@ void bnep_dump(int level, struct frame *frm)
return;
}
- //Extension info
+ /* Extension info */
if (extension)
bnep_eval_extension(++level, frm);
- //Control packet => No payload info
+ /* Control packet => No payload info */
if ((type & 0x7f) == BNEP_CONTROL)
return;
diff --git a/parser/bnep.h b/parser/bnep.h
deleted file mode 100644
index b6722ad..0000000
--- a/parser/bnep.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- BNEP parser.
- Copyright (C) 2002 Takashi Sasai <sasai@sm.sony.co.jp>
-*/
-
-/*
- * $Id$
- */
-
-#ifndef __BNEP_H
-#define __BNEP_H
-
-/* BNEP Type */
-#define BNEP_GENERAL_ETHERNET 0x00
-#define BNEP_CONTROL 0x01
-#define BNEP_COMPRESSED_ETHERNET 0x02
-#define BNEP_COMPRESSED_ETHERNET_SOURCE_ONLY 0x03
-#define BNEP_COMPRESSED_ETHERNET_DEST_ONLY 0x04
-
-/* BNEP Control Packet Type */
-#define BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD 0x00
-#define BNEP_SETUP_CONNECTION_REQUEST_MSG 0x01
-#define BNEP_SETUP_CONNECTION_RESPONSE_MSG 0x02
-#define BNEP_FILTER_NET_TYPE_SET_MSG 0x03
-#define BNEP_FILTER_NET_TYPE_RESPONSE_MSG 0x04
-#define BNEP_FILTER_MULT_ADDR_SET_MSG 0x05
-#define BNEP_FILTER_MULT_ADDR_RESPONSE_MSG 0x06
-
-/* BNEP Extension Type */
-#define BNEP_EXTENSION_CONTROL 0x00
-
-#endif /* __BNEP_H */
diff --git a/parser/capi.c b/parser/capi.c
index 587b9d9..106bbde 100644
--- a/parser/capi.c
+++ b/parser/capi.c
@@ -1,31 +1,26 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- CAPI parser.
- Copyright (C) 2004 Marcel Holtmann <marcel@holtmann.org>
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - CAPI 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>
diff --git a/parser/cmtp.c b/parser/cmtp.c
index 5c8fc15..571c1a1 100644
--- a/parser/cmtp.c
+++ b/parser/cmtp.c
@@ -1,31 +1,26 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- CMTP parser.
- Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - CMTP parser
+ *
+ * Copyright (C) 2002-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>
@@ -35,11 +30,8 @@
#include <string.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <netinet/in.h>
-#include <bluetooth/bluetooth.h>
-
#include "parser.h"
diff --git a/parser/hci.c b/parser/hci.c
index 4b310c2..ce89600 100644
--- a/parser/hci.c
+++ b/parser/hci.c
@@ -1,32 +1,33 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - HCI parser
+ *
+ * Copyright (C) 2000-2002 Maxim Krasnyansky <maxk@qualcomm.com>
+ * Copyright (C) 2003-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 <errno.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <string.h>
#include <sys/types.h>
@@ -38,7 +39,8 @@
#include "parser.h"
-char *event_map[] = {
+
+static char *event_map[] = {
"Unknown",
"Inquiry Complete",
"Inquiry Result",
@@ -73,9 +75,9 @@ char *event_map[] = {
"Page Scan Mode Change",
"Page Scan Repetition Mode Change"
};
-#define EVENT_NUM 32
+#define EVENT_NUM 32
-char *cmd_linkctl_map[] = {
+static char *cmd_linkctl_map[] = {
"Unknown",
"Inquiry",
"Inquiry Cancel",
@@ -109,9 +111,9 @@ char *cmd_linkctl_map[] = {
"Unknown",
"Read Clock offset"
};
-#define CMD_LINKCTL_NUM 31
+#define CMD_LINKCTL_NUM 31
-char *cmd_linkpol_map[] = {
+static char *cmd_linkpol_map[] = {
"Unknown",
"Hold Mode",
"Unknown",
@@ -129,7 +131,7 @@ char *cmd_linkpol_map[] = {
};
#define CMD_LINKPOL_NUM 13
-char *cmd_hostctl_map[] = {
+static char *cmd_hostctl_map[] = {
"Unknown",
"Set Event Mask",
"Unknown",
@@ -196,7 +198,7 @@ char *cmd_hostctl_map[] = {
};
#define CMD_HOSTCTL_NUM 62
-char *cmd_info_map[] = {
+static char *cmd_info_map[] = {
"Unknown",
"Read Local Version Information",
"Unknown",
@@ -210,7 +212,7 @@ char *cmd_info_map[] = {
};
#define CMD_INFO_NUM 9
-char *cmd_status_map[] = {
+static char *cmd_status_map[] = {
"Unknown",
"Read Failed Contact Counter",
"Reset Failed Contact Counter",
@@ -329,9 +331,9 @@ static inline void acl_dump(int level, struct frame *frm)
acl_handle(handle), flags, dlen);
level++;
}
-
- frm->ptr += HCI_ACL_HDR_SIZE;
- frm->len -= HCI_ACL_HDR_SIZE;
+
+ frm->ptr += HCI_ACL_HDR_SIZE;
+ frm->len -= HCI_ACL_HDR_SIZE;
frm->flags = flags;
frm->handle = acl_handle(handle);
@@ -363,7 +365,7 @@ void hci_dump(int level, struct frame *frm)
uint8_t type = *(uint8_t *)frm->ptr;
frm->ptr++; frm->len--;
-
+
switch (type) {
case HCI_COMMAND_PKT:
command_dump(level, frm);
@@ -380,7 +382,7 @@ void hci_dump(int level, struct frame *frm)
case HCI_SCODATA_PKT:
sco_dump(level, frm);
break;
-
+
default:
if (p_filter(FILT_HCI))
break;
diff --git a/parser/hidp.c b/parser/hidp.c
index 2dfbd3f..1dcf43e 100644
--- a/parser/hidp.c
+++ b/parser/hidp.c
@@ -1,31 +1,26 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- HIDP parser.
- Copyright (C) 2003 Marcel Holtmann <marcel@holtmann.org>
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - HIDP parser
+ *
+ * Copyright (C) 2003-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>
@@ -35,14 +30,12 @@
#include <string.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <netinet/in.h>
-#include <bluetooth/bluetooth.h>
-
#include "parser.h"
-char *type2str(uint8_t head)
+
+static char *type2str(uint8_t head)
{
switch (head & 0xf0) {
case 0x00:
@@ -70,7 +63,7 @@ char *type2str(uint8_t head)
}
}
-char *result2str(uint8_t head)
+static char *result2str(uint8_t head)
{
switch (head & 0x0f) {
case 0x00:
@@ -92,7 +85,7 @@ char *result2str(uint8_t head)
}
}
-char *operation2str(uint8_t head)
+static char *operation2str(uint8_t head)
{
switch (head & 0x0f) {
case 0x00:
@@ -112,7 +105,7 @@ char *operation2str(uint8_t head)
}
}
-char *report2str(uint8_t head)
+static char *report2str(uint8_t head)
{
switch (head & 0x03) {
case 0x00:
@@ -128,7 +121,7 @@ char *report2str(uint8_t head)
}
}
-char *protocol2str(uint8_t head)
+static char *protocol2str(uint8_t head)
{
switch (head & 0x01) {
case 0x00:
@@ -142,27 +135,27 @@ char *protocol2str(uint8_t head)
void hidp_dump(int level, struct frame *frm)
{
- uint8_t head;
+ uint8_t hdr;
char *param;
- head = *(uint8_t *)frm->ptr;
+ hdr = get_u8(frm);
- switch (head & 0xf0) {
+ switch (hdr & 0xf0) {
case 0x00:
- param = result2str(head);
+ param = result2str(hdr);
break;
case 0x10:
- param = operation2str(head);
+ param = operation2str(hdr);
break;
case 0x60:
case 0x70:
- param = protocol2str(head);
+ param = protocol2str(hdr);
break;
case 0x40:
case 0x50:
- case 0xa0:
+ case 0xa0:
case 0xb0:
- param = report2str(head);
+ param = report2str(hdr);
break;
default:
param = "";
@@ -171,10 +164,7 @@ void hidp_dump(int level, struct frame *frm)
p_indent(level, frm);
- printf("HIDP: %s: %s\n", type2str(head), param);
-
- frm->ptr++;
- frm->len--;
+ printf("HIDP: %s: %s\n", type2str(hdr), param);
raw_dump(level, frm);
}
diff --git a/parser/l2cap.c b/parser/l2cap.c
index f518baa..94a0d90 100644
--- a/parser/l2cap.c
+++ b/parser/l2cap.c
@@ -1,32 +1,33 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - L2CAP parser
+ *
+ * Copyright (C) 2000-2002 Maxim Krasnyansky <maxk@qualcomm.com>
+ * Copyright (C) 2003-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 <errno.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <string.h>
#include <sys/types.h>
@@ -40,6 +41,7 @@
#include "parser.h"
#include "sdp.h"
+
typedef struct {
uint16_t handle;
struct frame frm;
diff --git a/parser/parser.c b/parser/parser.c
index 4577353..26260ff 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -1,32 +1,33 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - Common parser functions
+ *
+ * Copyright (C) 2000-2002 Maxim Krasnyansky <maxk@qualcomm.com>
+ * Copyright (C) 2003-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 <errno.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <string.h>
#include <ctype.h>
@@ -35,10 +36,10 @@
#include "parser.h"
+
struct parser_t parser;
-void init_parser(unsigned long flags, unsigned long filter,
- unsigned int defpsm)
+void init_parser(unsigned long flags, unsigned long filter, unsigned int defpsm)
{
if ((flags & DUMP_RAW) && !(flags & DUMP_TYPE_MASK))
flags |= DUMP_HEX;
diff --git a/parser/parser.h b/parser/parser.h
index 8619fb8..a5e9638 100644
--- a/parser/parser.h
+++ b/parser/parser.h
@@ -1,28 +1,32 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - Common parser functions
+ *
+ * Copyright (C) 2000-2002 Maxim Krasnyansky <maxk@qualcomm.com>
+ * Copyright (C) 2003-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$
*/
+#ifndef __PARSER_H
+#define __PARSER_H
+
struct frame {
void *data;
int data_len;
@@ -174,3 +178,5 @@ static inline void parse(struct frame *frm)
hci_dump(0, frm);
fflush(stdout);
}
+
+#endif /* __PARSER_H */
diff --git a/parser/rfcomm.c b/parser/rfcomm.c
index 460ed4b..97710a2 100644
--- a/parser/rfcomm.c
+++ b/parser/rfcomm.c
@@ -1,37 +1,33 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- RFCOMM parser.
- Copyright (C) 2001 Wayne Lee <waynelee@qualcomm.com>
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - RFCOMM parser
+ *
+ * Copyright (C) 2001-2002 Wayne Lee <waynelee@qualcomm.com>
+ * Copyright (C) 2003-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 <errno.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <string.h>
#include <sys/types.h>
@@ -44,6 +40,7 @@
#include "parser.h"
#include "rfcomm.h"
+
static char *cr_str[] = {
"RSP",
"CMD"
@@ -52,12 +49,12 @@ 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* head, uint8_t *ptr, int len)
+static void print_rfcomm_hdr(long_frame_head* head, uint8_t *ptr, int len)
{
- address_field addr = head->addr;
- uint8_t ctr = head->control;
- uint16_t ilen = head->length.bits.len;
- uint8_t ctr_type,pf,dlci,fcs;
+ address_field addr = head->addr;
+ uint8_t ctr = head->control;
+ uint16_t ilen = head->length.bits.len;
+ uint8_t ctr_type,pf,dlci,fcs;
dlci = GET_DLCI(addr);
pf = GET_PF(ctr);
@@ -67,67 +64,59 @@ void print_rfcomm_hdr(long_frame_head* head, uint8_t *ptr, int len)
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* mcc_head)
+static void print_mcc(mcc_long_frame_head* mcc_head)
{
printf("mcc_len %d\n", mcc_head->length.bits.len);
}
-static inline void mcc_test(int level, uint8_t *ptr, int len,
- long_frame_head *head,
- mcc_long_frame_head *mcc_head)
+static inline void mcc_test(int level, uint8_t *ptr, int len,
+ long_frame_head *head, mcc_long_frame_head *mcc_head)
{
printf("TEST %s: ", CR_STR(mcc_head));
print_rfcomm_hdr(head, ptr, len);
print_mcc(mcc_head);
}
-static inline void mcc_fcon(int level, uint8_t *ptr, int len,
- long_frame_head *head,
- mcc_long_frame_head *mcc_head)
+static inline void mcc_fcon(int level, uint8_t *ptr, int len,
+ long_frame_head *head, mcc_long_frame_head *mcc_head)
{
printf("FCON %s: ", CR_STR(mcc_head));
print_rfcomm_hdr(head, ptr, len);
print_mcc(mcc_head);
}
-static inline void mcc_fcoff(int level, uint8_t *ptr, int len,
- long_frame_head *head,
- mcc_long_frame_head *mcc_head)
+static inline void mcc_fcoff(int level, uint8_t *ptr, int len,
+ long_frame_head *head, mcc_long_frame_head *mcc_head)
{
printf("FCOFF %s: ", CR_STR(mcc_head));
print_rfcomm_hdr(head, ptr, len);
print_mcc(mcc_head);
}
-static inline void mcc_msc(int level, uint8_t *ptr, int len,
- long_frame_head *head,
- mcc_long_frame_head *mcc_head)
+static inline void mcc_msc(int level, uint8_t *ptr, int len,
+ long_frame_head *head, mcc_long_frame_head *mcc_head)
{
msc_msg *msc = (void*) (ptr - STRUCT_END(msc_msg, mcc_s_head));
printf("MSC %s: ", CR_STR(mcc_head));
print_rfcomm_hdr(head, ptr, len);
print_mcc(mcc_head);
- p_indent(level, 0);
+ p_indent(level, 0);
printf("dlci %d fc %d rtc %d rtr %d ic %d dv %d",
GET_DLCI(msc->dlci), msc->v24_sigs.fc, msc->v24_sigs.rtc,
msc->v24_sigs.rtr, msc->v24_sigs.ic, msc->v24_sigs.dv );
- /* Assuming that break_signals field is _not declared_ in
- struct msc_msg... */
- if (len >
- STRUCT_OFFSET(msc_msg, fcs) - STRUCT_END(msc_msg, v24_sigs)) {
+ /* Assuming that break_signals field is _not declared_ in struct msc_msg... */
+ if (len > STRUCT_OFFSET(msc_msg, fcs) - STRUCT_END(msc_msg, v24_sigs)) {
break_signals *brk = (break_signals *)
(ptr + STRUCT_END(msc_msg, v24_sigs));
- printf(" b1 %d b2 %d b3 %d len %d\n",
+ printf(" b1 %d b2 %d b3 %d len %d\n",
brk->b1, brk->b2, brk->b3, brk->len);
- }
- else
+ } else
printf("\n");
}
static inline void mcc_rpn(int level, uint8_t *ptr, int len,
- long_frame_head *head,
- mcc_long_frame_head *mcc_head)
+ long_frame_head *head, mcc_long_frame_head *mcc_head)
{
rpn_msg *rpn = (void*) (ptr - STRUCT_END(rpn_msg, mcc_s_head));
@@ -137,8 +126,7 @@ static inline void mcc_rpn(int level, uint8_t *ptr, int len,
printf("dlci %d ", GET_DLCI(rpn->dlci));
/* Assuming that rpn_val is _declared_ as a member of rpn_msg... */
- if (len <=
- STRUCT_OFFSET(rpn_msg, rpn_val) - STRUCT_END(rpn_msg, mcc_s_head)) {
+ if (len <= STRUCT_OFFSET(rpn_msg, rpn_val) - STRUCT_END(rpn_msg, mcc_s_head)) {
printf("\n");
return;
}
@@ -148,7 +136,7 @@ static inline void mcc_rpn(int level, uint8_t *ptr, int len,
rpn->rpn_val.stop_bit, rpn->rpn_val.parity,
rpn->rpn_val.parity_type, rpn->rpn_val.xon_input,
rpn->rpn_val.xon_output);
- p_indent(level, 0);
+ p_indent(level, 0);
printf(" rtri: %d rtro: %d rtci: %d rtco: %d xon: %d xoff: %d pm: %04x\n",
rpn->rpn_val.rtr_input, rpn->rpn_val.rtr_output,
rpn->rpn_val.rtc_input, rpn->rpn_val.rtc_output,
@@ -157,8 +145,7 @@ static inline void mcc_rpn(int level, uint8_t *ptr, int len,
}
static inline void mcc_rls(int level, uint8_t *ptr, int len,
- long_frame_head *head,
- mcc_long_frame_head *mcc_head)
+ long_frame_head *head, mcc_long_frame_head *mcc_head)
{
rls_msg* rls = (void*) (ptr - STRUCT_END(rls_msg, mcc_s_head));
@@ -169,8 +156,7 @@ static inline void mcc_rls(int level, uint8_t *ptr, int len,
}
static inline void mcc_pn(int level, uint8_t *ptr, int len,
- long_frame_head *head,
- mcc_long_frame_head *mcc_head)
+ long_frame_head *head, mcc_long_frame_head *mcc_head)
{
pn_msg *pn = (void*) (ptr - STRUCT_END(pn_msg, mcc_s_head));
@@ -178,7 +164,7 @@ static inline void mcc_pn(int level, uint8_t *ptr, int len,
print_rfcomm_hdr(head, ptr, len);
print_mcc(mcc_head);
- p_indent(level, 0);
+ p_indent(level, 0);
printf("dlci %d frame_type %d credit_flow %d pri %d ack_timer %d "
"frame_size %d max_retrans %d credits %d\n",
pn->dlci, pn->frame_type, pn->credit_flow, pn->prior,
@@ -187,8 +173,7 @@ static inline void mcc_pn(int level, uint8_t *ptr, int len,
}
static inline void mcc_nsc(int level, uint8_t *ptr, int len,
- long_frame_head *head,
- mcc_long_frame_head *mcc_head)
+ long_frame_head *head, mcc_long_frame_head *mcc_head)
{
nsc_msg *nsc = (void*) (ptr - STRUCT_END(nsc_msg, mcc_s_head));
@@ -197,31 +182,31 @@ static inline void mcc_nsc(int level, uint8_t *ptr, int len,
print_rfcomm_hdr(head, ptr, len);
print_mcc(mcc_head);
- p_indent(level, 0);
+ p_indent(level, 0);
printf("cr %d, mcc_cmd_type %x\n",
nsc->command_type.cr, nsc->command_type.type );
}
static inline void mcc_frame(int level, struct frame *frm, long_frame_head *head)
{
- mcc_short_frame_head *mcc_short_head_p = frm->ptr;
- mcc_long_frame_head mcc_head;
- uint8_t hdr_size;
-
- if ( mcc_short_head_p->length.ea == EA ) {
- mcc_head.type = mcc_short_head_p->type;
- mcc_head.length.bits.len = mcc_short_head_p->length.len;
- hdr_size = sizeof(mcc_short_frame_head);
- } else {
- mcc_head = *(mcc_long_frame_head *)frm->ptr;
- mcc_head.length.val = btohs(mcc_head.length.val);
- hdr_size = sizeof(mcc_long_frame_head);
- }
-
- frm->ptr += hdr_size;
- frm->len -= hdr_size;
-
- p_indent(level, frm);
+ mcc_short_frame_head *mcc_short_head_p = frm->ptr;
+ mcc_long_frame_head mcc_head;
+ uint8_t hdr_size;
+
+ if ( mcc_short_head_p->length.ea == EA ) {
+ mcc_head.type = mcc_short_head_p->type;
+ mcc_head.length.bits.len = mcc_short_head_p->length.len;
+ hdr_size = sizeof(mcc_short_frame_head);
+ } else {
+ mcc_head = *(mcc_long_frame_head *)frm->ptr;
+ mcc_head.length.val = btohs(mcc_head.length.val);
+ hdr_size = sizeof(mcc_long_frame_head);
+ }
+
+ frm->ptr += hdr_size;
+ frm->len -= hdr_size;
+
+ p_indent(level, frm);
printf("RFCOMM(s): ");
switch (mcc_head.type.type) {
@@ -254,7 +239,7 @@ static inline void mcc_frame(int level, struct frame *frm, long_frame_head *head
printf("MCC message type 0x%02x: ", mcc_head.type.type);
print_rfcomm_hdr(head, frm->ptr, frm->len);
printf("\n");
-
+
frm->len--;
raw_dump(level, frm);
}
@@ -282,8 +267,8 @@ void rfcomm_dump(int level, struct frame *frm)
long_frame_head head;
if (short_head_p->length.ea == EA) {
- head.addr = short_head_p->addr;
- head.control = short_head_p->control;
+ head.addr = short_head_p->addr;
+ head.control = short_head_p->control;
head.length.bits.len = short_head_p->length.len;
hdr_size = sizeof(short_frame_head);
} else {
@@ -298,7 +283,7 @@ void rfcomm_dump(int level, struct frame *frm)
ctr_type = CLR_PF(head.control);
if (ctr_type == UIH) {
- uih_frame(level, frm, &head);
+ uih_frame(level, frm, &head);
} else {
p_indent(level, frm);
printf("RFCOMM(s): ");
diff --git a/parser/rfcomm.h b/parser/rfcomm.h
index c22d57a..f3af024 100644
--- a/parser/rfcomm.h
+++ b/parser/rfcomm.h
@@ -1,37 +1,36 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- RFCOMM parser.
- Copyright (C) 2001 Wayne Lee <waynelee@qualcomm.com>
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - RFCOMM parser
+ *
+ * Copyright (C) 2001-2002 Wayne Lee <waynelee@qualcomm.com>
+ * Copyright (C) 2003-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$
*/
-#define RFCOMM_PSM 3
+#ifndef __RFCOMM_H
+#define __RFCOMM_H
+
+#define RFCOMM_PSM 3
-#define TRUE 1
-#define FALSE 0
+#define TRUE 1
+#define FALSE 0
#define RFCOMM_MAX_CONN 10
#define BT_NBR_DATAPORTS RFCOMM_MAX_CONN
@@ -111,8 +110,6 @@
#define MCC_CMD 1 /* Multiplexer command */
#define MCC_RSP 0 /* Multiplexer response */
-/****************** TYPE DEFINITION SECTION *********************************/
-
#ifdef __LITTLE_ENDIAN_BITFIELD
typedef struct parameter_mask{
@@ -200,10 +197,6 @@ typedef struct rpn_values{
#error Processor endianness unknown!
#endif
-/****************************************************************************/
-
-/****************** TYPE DEFINITION SECTION *********************************/
-
/* Typedefinitions of stuctures used for creating and parsing packets, for a
further description of the structures please se the bluetooth core
specification part F:1 and the ETSI TS 07.10 specification */
@@ -498,4 +491,4 @@ typedef struct nsc_msg {
#error Processor endianness unknown!
#endif /* __XXX_ENDIAN */
-/****************************************************************************/
+#endif /* __RFCOMM_H */
diff --git a/parser/sdp.c b/parser/sdp.c
index dcb9e74..09fc1fd 100644
--- a/parser/sdp.c
+++ b/parser/sdp.c
@@ -1,50 +1,42 @@
-/*
- HCIDump - HCI packet analyzer
- Copyright (C) 2000-2001 Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM,
- OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
- RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- SDP parser.
- Copyright (C) 2001 Ricky Yuen <ryuen@qualcomm.com>
-*/
-
/*
- * $Id$
+ *
+ * Bluetooth packet analyzer - SDP parser
+ *
+ * Copyright (C) 2001-2002 Ricky Yuen <ryuen@qualcomm.com>
+ * Copyright (C) 2003-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 <errno.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <string.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <netinet/in.h>
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <bluetooth/l2cap.h>
-
#include "parser.h"
#include "sdp.h"
+
static sdp_siz_idx_lookup_table_t sdp_siz_idx_lookup_table[] = {
{ 0, 1 }, /* Size index = 0 */
{ 0, 2 }, /* 1 */
diff --git a/parser/sdp.h b/parser/sdp.h
index 62ff12f..d657a4f 100644
--- a/parser/sdp.h
+++ b/parser/sdp.h
@@ -1,33 +1,26 @@
-/*
- BlueZ - Bluetooth protocol stack for Linux
- Copyright (C) 2000-2001 Qualcomm Incorporated
-
- Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation;
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
- CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
- COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
- SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- SDP parser.
- Copyright (C) 2001 Ricky Yuen <ryuen@qualcomm.com>
-*/
-
/*
+ *
+ * Bluetooth packet analyzer - SDP parser
+ *
+ * Copyright (C) 2001-2002 Ricky Yuen <ryuen@qualcomm.com>
+ * Copyright (C) 2003-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$
*/