summaryrefslogtreecommitdiff
path: root/tools/parser
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-06-16 09:57:43 +0000
committerMarcel Holtmann <marcel@holtmann.org>2012-12-17 23:52:45 +0100
commit073282583f0860a4b20042ea1932c879ca389260 (patch)
tree21853745af50142c8e32ecff1a6f08ff45d1013f /tools/parser
parent13cb68651497f1fb4f56134239b5c08c61686a9d (diff)
downloadbluez-073282583f0860a4b20042ea1932c879ca389260.tar.gz
hcidump: Whitespace cleanups
Diffstat (limited to 'tools/parser')
-rw-r--r--tools/parser/avdtp.c1
-rw-r--r--tools/parser/bnep.c20
-rw-r--r--tools/parser/capi.c1
-rw-r--r--tools/parser/cmtp.c1
-rw-r--r--tools/parser/hci.c9
-rw-r--r--tools/parser/hcrp.c1
-rw-r--r--tools/parser/hidp.c1
-rw-r--r--tools/parser/l2cap.c1
-rw-r--r--tools/parser/parser.c1
-rw-r--r--tools/parser/parser.h2
-rw-r--r--tools/parser/rfcomm.c1
-rw-r--r--tools/parser/rfcomm.h30
-rw-r--r--tools/parser/sdp.c5
13 files changed, 42 insertions, 32 deletions
diff --git a/tools/parser/avdtp.c b/tools/parser/avdtp.c
index 96f7049bd..c68785f57 100644
--- a/tools/parser/avdtp.c
+++ b/tools/parser/avdtp.c
@@ -34,7 +34,6 @@
#include "parser.h"
-
static char *si2str(uint8_t si)
{
switch (si & 0x7f) {
diff --git a/tools/parser/bnep.c b/tools/parser/bnep.c
index 2f977a124..869530a8c 100644
--- a/tools/parser/bnep.c
+++ b/tools/parser/bnep.c
@@ -43,7 +43,6 @@
#define PAYLOAD_RAW_DUMP
-
/* BNEP Type */
#define BNEP_GENERAL_ETHERNET 0x00
#define BNEP_CONTROL 0x01
@@ -88,6 +87,7 @@ static void bnep_control(int level, struct frame *frm, int header_length)
case BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD:
printf("Not Understood(0x%02x) type 0x%02x\n", type, get_u8(frm));
break;
+
case BNEP_SETUP_CONNECTION_REQUEST_MSG:
uuid_size = get_u8(frm);
printf("Setup Req(0x%02x) size 0x%02x ", type, uuid_size);
@@ -135,9 +135,11 @@ static void bnep_control(int level, struct frame *frm, int header_length)
break;
}
break;
+
case BNEP_SETUP_CONNECTION_RESPONSE_MSG:
printf("Setup Rsp(0x%02x) res 0x%04x\n", type, get_u16(frm));
break;
+
case BNEP_FILTER_NET_TYPE_SET_MSG:
length = get_u16(frm);
printf("Filter NetType Set(0x%02x) len 0x%04x\n", type, length);
@@ -147,9 +149,11 @@ static void bnep_control(int level, struct frame *frm, int header_length)
printf("0x%04x\n", get_u16(frm));
}
break;
+
case BNEP_FILTER_NET_TYPE_RESPONSE_MSG:
printf("Filter NetType Rsp(0x%02x) res 0x%04x\n", type, get_u16(frm));
break;
+
case BNEP_FILTER_MULT_ADDR_SET_MSG:
length = get_u16(frm);
printf("Filter MultAddr Set(0x%02x) len 0x%04x\n", type, length);
@@ -159,9 +163,11 @@ static void bnep_control(int level, struct frame *frm, int header_length)
printf("%s\n", get_macaddr(frm));
}
break;
+
case BNEP_FILTER_MULT_ADDR_RESPONSE_MSG:
printf("Filter MultAddr Rsp(0x%02x) res 0x%04x\n", type, get_u16(frm));
break;
+
default:
printf("Unknown control type(0x%02x)\n", type);
raw_ndump(level + 1, frm, header_length - 1);
@@ -183,6 +189,7 @@ static void bnep_eval_extension(int level, struct frame *frm)
printf("Ext Control(0x%02x|%s) len 0x%02x\n", type & 0x7f, extension ? "1" : "0", length);
bnep_control(level, frm, length);
break;
+
default:
printf("Ext Unknown(0x%02x|%s) len 0x%02x\n", type & 0x7f, extension ? "1" : "0", length);
raw_ndump(level + 1, frm, length);
@@ -233,14 +240,17 @@ static void ip_dump(int level, struct frame *frm)
printf("TCP:\n");
raw_dump(level, frm);
break;
+
case IPPROTO_UDP:
printf("UDP:\n");
raw_dump(level, frm);
break;
+
case IPPROTO_ICMP:
printf("ICMP:\n");
raw_dump(level, frm);
break;
+
default:
printf("Unknown Protocol: 0x%02x\n", ip->ip_p);
raw_dump(level, frm);
@@ -262,12 +272,14 @@ void bnep_dump(int level, struct frame *frm)
printf("BNEP: Control(0x%02x|%s)\n", type & 0x7f, extension ? "1" : "0");
bnep_control(level, frm, -1);
break;
+
case BNEP_COMPRESSED_ETHERNET:
printf("BNEP: Compressed(0x%02x|%s)\n", type & 0x7f, extension ? "1" : "0");
p_indent(++level, frm);
proto = get_u16(frm);
printf("[proto 0x%04x]\n", proto);
break;
+
case BNEP_GENERAL_ETHERNET:
printf("BNEP: General ethernet(0x%02x|%s)\n", type & 0x7f, extension ? "1" : "0");
p_indent(++level, frm);
@@ -276,6 +288,7 @@ void bnep_dump(int level, struct frame *frm)
proto = get_u16(frm);
printf("[proto 0x%04x]\n", proto);
break;
+
case BNEP_COMPRESSED_ETHERNET_DEST_ONLY:
printf("BNEP: Compressed DestOnly(0x%02x|%s)\n", type & 0x7f, extension ? "1" : "0");
p_indent(++level, frm);
@@ -283,6 +296,7 @@ void bnep_dump(int level, struct frame *frm)
proto = get_u16(frm);
printf("[proto 0x%04x]\n", proto);
break;
+
case BNEP_COMPRESSED_ETHERNET_SOURCE_ONLY:
printf("BNEP: Compressed SrcOnly(0x%02x|%s)\n", type & 0x7f, extension ? "1" : "0");
p_indent(++level, frm);
@@ -290,6 +304,7 @@ void bnep_dump(int level, struct frame *frm)
proto = get_u16(frm);
printf("[proto 0x%04x]\n", proto);
break;
+
default:
printf("(Unknown packet type)\n");
return;
@@ -319,16 +334,19 @@ void bnep_dump(int level, struct frame *frm)
printf("ARP: ");
arp_dump(level, frm);
break;
+
case ETHERTYPE_REVARP:
p_indent(++level, frm);
printf("RARP: ");
arp_dump(level, frm);
break;
+
case ETHERTYPE_IP:
p_indent(++level, frm);
printf("IP: ");
ip_dump(level, frm);
break;
+
default:
raw_dump(level, frm);
}
diff --git a/tools/parser/capi.c b/tools/parser/capi.c
index aa02981dd..9b59f2340 100644
--- a/tools/parser/capi.c
+++ b/tools/parser/capi.c
@@ -41,7 +41,6 @@
#define CAPI_U16(frm) (htobs(htons(get_u16(frm))))
#define CAPI_U32(frm) (htobl(htonl(get_u32(frm))))
-
static char *cmd2str(uint8_t cmd)
{
switch (cmd) {
diff --git a/tools/parser/cmtp.c b/tools/parser/cmtp.c
index 571c1a131..efa5c2770 100644
--- a/tools/parser/cmtp.c
+++ b/tools/parser/cmtp.c
@@ -34,7 +34,6 @@
#include "parser.h"
-
#define TABLE_SIZE 10
static struct {
diff --git a/tools/parser/hci.c b/tools/parser/hci.c
index 984eacc37..9fcb6e68f 100644
--- a/tools/parser/hci.c
+++ b/tools/parser/hci.c
@@ -39,7 +39,6 @@
#include "parser.h"
-
static char *event_map[] = {
"Unknown",
"Inquiry Complete",
@@ -324,7 +323,7 @@ static inline void command_dump(int level, struct frame *frm)
p_indent(level, frm);
- printf("HCI Command: %s(0x%2.2x|0x%4.4x) plen %d\n",
+ printf("HCI Command: %s (0x%2.2x|0x%4.4x) plen %d\n",
cmd, ogf, ocf, hdr->plen);
frm->ptr += HCI_COMMAND_HDR_SIZE;
@@ -343,12 +342,12 @@ static inline void event_dump(int level, struct frame *frm)
p_indent(level, frm);
if (hdr->evt <= EVENT_NUM)
- printf("HCI Event: %s(0x%2.2x) plen %d\n",
+ printf("HCI Event: %s (0x%2.2x) plen %d\n",
event_map[hdr->evt], hdr->evt, hdr->plen);
else if (hdr->evt == EVT_TESTING)
- printf("HCI Event: Testing(0x%2.2x) plen %d\n", hdr->evt, hdr->plen);
+ printf("HCI Event: Testing (0x%2.2x) plen %d\n", hdr->evt, hdr->plen);
else if (hdr->evt == EVT_VENDOR)
- printf("HCI Event: Vendor(0x%2.2x) plen %d\n", hdr->evt, hdr->plen);
+ printf("HCI Event: Vendor (0x%2.2x) plen %d\n", hdr->evt, hdr->plen);
else
printf("HCI Event: code 0x%2.2x plen %d\n", hdr->evt, hdr->plen);
diff --git a/tools/parser/hcrp.c b/tools/parser/hcrp.c
index 6fb17abdf..1fc6a3d8a 100644
--- a/tools/parser/hcrp.c
+++ b/tools/parser/hcrp.c
@@ -34,7 +34,6 @@
#include "parser.h"
-
static char *pid2str(uint16_t pid)
{
switch (pid) {
diff --git a/tools/parser/hidp.c b/tools/parser/hidp.c
index feeb33fc9..b1c8e289e 100644
--- a/tools/parser/hidp.c
+++ b/tools/parser/hidp.c
@@ -34,7 +34,6 @@
#include "parser.h"
-
static char *type2str(uint8_t head)
{
switch (head & 0xf0) {
diff --git a/tools/parser/l2cap.c b/tools/parser/l2cap.c
index bae306a37..7c90e5b91 100644
--- a/tools/parser/l2cap.c
+++ b/tools/parser/l2cap.c
@@ -41,7 +41,6 @@
#include "parser.h"
#include "sdp.h"
-
typedef struct {
uint16_t handle;
struct frame frm;
diff --git a/tools/parser/parser.c b/tools/parser/parser.c
index 26260ffb9..008b8b58e 100644
--- a/tools/parser/parser.c
+++ b/tools/parser/parser.c
@@ -36,7 +36,6 @@
#include "parser.h"
-
struct parser_t parser;
void init_parser(unsigned long flags, unsigned long filter, unsigned int defpsm)
diff --git a/tools/parser/parser.h b/tools/parser/parser.h
index 49f2d2b2b..a79dc4e12 100644
--- a/tools/parser/parser.h
+++ b/tools/parser/parser.h
@@ -91,7 +91,7 @@ static inline void p_indent(int level, struct frame *f)
parser.state = 0;
return;
}
-
+
if (!parser.state) {
if (parser.flags & DUMP_TSTAMP)
printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec);
diff --git a/tools/parser/rfcomm.c b/tools/parser/rfcomm.c
index 287081c6b..2a99f9702 100644
--- a/tools/parser/rfcomm.c
+++ b/tools/parser/rfcomm.c
@@ -40,7 +40,6 @@
#include "parser.h"
#include "rfcomm.h"
-
static char *cr_str[] = {
"RSP",
"CMD"
diff --git a/tools/parser/rfcomm.h b/tools/parser/rfcomm.h
index f3af024b2..e5535e917 100644
--- a/tools/parser/rfcomm.h
+++ b/tools/parser/rfcomm.h
@@ -38,34 +38,36 @@
#define GET_BIT(pos,bitfield) ((bitfield[(pos)/32]) & (1 << ((pos) % 32)))
#define SET_BIT(pos,bitfield) ((bitfield[(pos)/32]) |= (1 << ((pos) % 32)))
#define CLR_BIT(pos,bitfield) ((bitfield[(pos)/32]) &= ((1 << ((pos) % 32)) ^ (~0)))
-#define SET_PF(ctr) ((ctr) | (1 << 4))
+
+
/* Sets the P/F-bit in the control field */
+#define SET_PF(ctr) ((ctr) | (1 << 4))
+/* Clears the P/F-bit in the control field */
#define CLR_PF(ctr) ((ctr) & 0xef)
-/* clears the P/F-bit in the control field */
+/* Returns the P/F-bit */
#define GET_PF(ctr) (((ctr) >> 4) & 0x1)
-/* Returns the P/F bit */
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-/* endian-swapping macros for structs */
+/* Endian-swapping macros for structs */
#define swap_long_frame(x) ((x)->h.length.val = le16_to_cpu((x)->h.length.val))
#define swap_mcc_long_frame(x) (swap_long_frame(x))
+/* Used for UIH packets */
#define SHORT_CRC_CHECK 2
-/* Used for uih packets */
+/* Used for all packet exepts for the UIH packets */
#define LONG_CRC_CHECK 3
-/* Used for all packet exepts for the uih packets */
+/* Short header for short UIH packets */
#define SHORT_HDR 2
-/* Short header for short uih packets */
+/* Long header for long UIH packets */
#define LONG_HDR 3
-/* and long header for long uih packets */
-/* FIXME: Should thsi one be define here? */
+/* FIXME: Should this one be defined here? */
#define SHORT_PAYLOAD_SIZE 127
+/* Used for setting the EA field in different packets, really neccessary? */
#define EA 1
-/* Used for setting the EA field in different packets, really neccessary? */
-#define FCS_SIZE 1
/* Yes the FCS size is only one byte */
+#define FCS_SIZE 1
#define RFCOMM_MAX_HDR_SIZE 5
@@ -198,8 +200,8 @@ typedef struct rpn_values{
#endif
/* 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 */
+ * further description of the structures please se the bluetooth core
+ * specification part F:1 and the ETSI TS 07.10 specification */
#ifdef __LITTLE_ENDIAN_BITFIELD
diff --git a/tools/parser/sdp.c b/tools/parser/sdp.c
index ce14597fb..a03188c4a 100644
--- a/tools/parser/sdp.c
+++ b/tools/parser/sdp.c
@@ -36,7 +36,6 @@
#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 */
@@ -125,8 +124,8 @@ static sdp_attr_id_nam_lookup_table_t sdp_attr_id_nam_lookup_table[] = {
{ SDP_ATTR_ID_SERVICE_DATABASE_STATE, "SrvDBState" },
{ SDP_ATTR_ID_SERVICE_VERSION, "SrvVersion" },
{ SDP_ATTR_ID_SECURITY_DESCRIPTION, "SecurityDescription"}, /* PAN */
- { SDP_ATTR_ID_SUPPORTED_DATA_STORES_LIST, "SuppDataStoresList" }, /* Synchronization */
- { SDP_ATTR_ID_SUPPORTED_FORMATS_LIST, "SuppFormatsList" }, /* OBEX Object Push */
+ { SDP_ATTR_ID_SUPPORTED_DATA_STORES_LIST, "SuppDataStoresList" }, /* Synchronization */
+ { SDP_ATTR_ID_SUPPORTED_FORMATS_LIST, "SuppFormatsList" }, /* OBEX Object Push */
{ SDP_ATTR_ID_NET_ACCESS_TYPE, "NetAccessType" }, /* PAN */
{ SDP_ATTR_ID_MAX_NET_ACCESS_RATE, "MaxNetAccessRate" }, /* PAN */
{ SDP_ATTR_ID_IPV4_SUBNET, "IPv4Subnet" }, /* PAN */