From 4069c01fe278f8496a6bedee36d6dc80911b74ae Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 6 Feb 2005 14:54:54 +0000 Subject: [PATCH] hcidump: Fix the declaration of the internal data structures --- tools/parser/sdp.c | 50 +++++++++++++++++++++++++++++++++++++++++++ tools/parser/sdp.h | 53 ---------------------------------------------- 2 files changed, 50 insertions(+), 53 deletions(-) diff --git a/tools/parser/sdp.c b/tools/parser/sdp.c index bb813016d..323240253 100644 --- a/tools/parser/sdp.c +++ b/tools/parser/sdp.c @@ -36,6 +36,38 @@ #include "parser.h" #include "sdp.h" +#define SDP_ERROR_RSP 0x01 +#define SDP_SERVICE_SEARCH_REQ 0x02 +#define SDP_SERVICE_SEARCH_RSP 0x03 +#define SDP_SERVICE_ATTR_REQ 0x04 +#define SDP_SERVICE_ATTR_RSP 0x05 +#define SDP_SERVICE_SEARCH_ATTR_REQ 0x06 +#define SDP_SERVICE_SEARCH_ATTR_RSP 0x07 + +typedef struct { + uint8_t pid; + uint16_t tid; + uint16_t len; +} __attribute__ ((packed)) sdp_pdu_hdr; +#define SDP_PDU_HDR_SIZE 5 + +/* Data element type descriptor */ +#define SDP_DE_NULL 0 +#define SDP_DE_UINT 1 +#define SDP_DE_INT 2 +#define SDP_DE_UUID 3 +#define SDP_DE_STRING 4 +#define SDP_DE_BOOL 5 +#define SDP_DE_SEQ 6 +#define SDP_DE_ALT 7 +#define SDP_DE_URL 8 + +/* Data element size index lookup table */ +typedef struct { + int addl_bits; + int num_bytes; +} sdp_siz_idx_lookup_table_t; + static sdp_siz_idx_lookup_table_t sdp_siz_idx_lookup_table[] = { { 0, 1 }, /* Size index = 0 */ { 0, 2 }, /* 1 */ @@ -47,6 +79,12 @@ static sdp_siz_idx_lookup_table_t sdp_siz_idx_lookup_table[] = { { 1, 4 }, /* 7 */ }; +/* UUID name lookup table */ +typedef struct { + int uuid; + char* name; +} sdp_uuid_nam_lookup_table_t; + static sdp_uuid_nam_lookup_table_t sdp_uuid_nam_lookup_table[] = { { SDP_UUID_SDP, "SDP" }, { SDP_UUID_UDP, "UDP" }, @@ -106,6 +144,15 @@ static sdp_uuid_nam_lookup_table_t sdp_uuid_nam_lookup_table[] = { { SDP_UUID_VIDEO_SINK, "VideoSink" } /* VDP */ }; +#define SDP_UUID_NAM_LOOKUP_TABLE_SIZE \ + (sizeof(sdp_uuid_nam_lookup_table)/sizeof(sdp_uuid_nam_lookup_table_t)) + +/* AttrID name lookup table */ +typedef struct { + int attr_id; + char* name; +} sdp_attr_id_nam_lookup_table_t; + static sdp_attr_id_nam_lookup_table_t sdp_attr_id_nam_lookup_table[] = { { SDP_ATTR_ID_SERVICE_RECORD_HANDLE, "SrvRecHndl" }, { SDP_ATTR_ID_SERVICE_CLASS_ID_LIST, "SrvClassIDList" }, @@ -137,6 +184,9 @@ static sdp_attr_id_nam_lookup_table_t sdp_attr_id_nam_lookup_table[] = { { SDP_ATTR_ID_IPV6_SUBNET, "IPv6Subnet" } /* PAN */ }; +#define SDP_ATTR_ID_NAM_LOOKUP_TABLE_SIZE \ + (sizeof(sdp_attr_id_nam_lookup_table)/sizeof(sdp_attr_id_nam_lookup_table_t)) + char* get_uuid_name(int uuid) { int i; diff --git a/tools/parser/sdp.h b/tools/parser/sdp.h index 4c68a66ca..681753d7d 100644 --- a/tools/parser/sdp.h +++ b/tools/parser/sdp.h @@ -27,14 +27,6 @@ #ifndef __SDP_H #define __SDP_H -#define SDP_ERROR_RSP 0x01 -#define SDP_SERVICE_SEARCH_REQ 0x02 -#define SDP_SERVICE_SEARCH_RSP 0x03 -#define SDP_SERVICE_ATTR_REQ 0x04 -#define SDP_SERVICE_ATTR_RSP 0x05 -#define SDP_SERVICE_SEARCH_ATTR_REQ 0x06 -#define SDP_SERVICE_SEARCH_ATTR_RSP 0x07 - /* Bluetooth assigned UUIDs for protocols */ #define SDP_UUID_SDP 0x0001 #define SDP_UUID_UDP 0x0002 @@ -137,49 +129,4 @@ #define SDP_ATTR_ID_IPV4_SUBNET 0x030d /* PAN */ #define SDP_ATTR_ID_IPV6_SUBNET 0x030e /* PAN */ -/* Data element type descriptor */ -#define SDP_DE_NULL 0 -#define SDP_DE_UINT 1 -#define SDP_DE_INT 2 -#define SDP_DE_UUID 3 -#define SDP_DE_STRING 4 -#define SDP_DE_BOOL 5 -#define SDP_DE_SEQ 6 -#define SDP_DE_ALT 7 -#define SDP_DE_URL 8 - -/* SDP structures */ - -typedef struct { - uint8_t pid; - uint16_t tid; - uint16_t len; -} __attribute__ ((packed)) sdp_pdu_hdr; -#define SDP_PDU_HDR_SIZE 5 - -/* Data element size index lookup table */ -typedef struct { - int addl_bits; - int num_bytes; -} sdp_siz_idx_lookup_table_t; -extern sdp_siz_idx_lookup_table_t sdp_siz_idx_lookup_table[]; - -/* UUID name lookup table */ -typedef struct { - int uuid; - char* name; -} sdp_uuid_nam_lookup_table_t; -extern sdp_uuid_nam_lookup_table_t sdp_uuid_nam_lookup_table[]; -#define SDP_UUID_NAM_LOOKUP_TABLE_SIZE \ - (sizeof(sdp_uuid_nam_lookup_table)/sizeof(sdp_uuid_nam_lookup_table_t)) - -/* AttrID name lookup table */ -typedef struct { - int attr_id; - char* name; -} sdp_attr_id_nam_lookup_table_t; -extern sdp_attr_id_nam_lookup_table_t sdp_attr_id_nam_lookup_table[]; -#define SDP_ATTR_ID_NAM_LOOKUP_TABLE_SIZE \ - (sizeof(sdp_attr_id_nam_lookup_table)/sizeof(sdp_attr_id_nam_lookup_table_t)) - #endif /* __SDP_H */ -- 2.47.3