diff -urN hcidump/hcidump.c hcidump-mh/hcidump.c --- hcidump/hcidump.c Mon Nov 25 19:51:58 2002 +++ hcidump-mh/hcidump.c Sat Dec 7 16:43:52 2002 @@ -23,21 +23,21 @@ * $Id: hcidump.c,v 1.27 2002/11/25 17:59:26 maxk Exp $ */ -#include -#include -#include -#include -#include +#include #include #include -#include #include +#include + #include -#include -#include +#include #include - -#include +#include +#include +#include +#include +#include +#include #include #include diff -urN hcidump/hcidump.h hcidump-mh/hcidump.h --- hcidump/hcidump.h Thu Feb 7 05:47:36 2002 +++ hcidump-mh/hcidump.h Sat Dec 7 16:43:52 2002 @@ -1,4 +1,4 @@ -/* +/* HCIDump - HCI packet analyzer Copyright (C) 2000-2001 Maxim Krasnyansky @@ -31,11 +31,11 @@ }; struct dump_hdr { - __u16 len; - __u8 in; - __u8 pad; - __u32 ts_sec; - __u32 ts_usec; + uint16_t len; + uint8_t in; + uint8_t pad; + uint32_t ts_sec; + uint32_t ts_usec; } __attribute__ ((packed)); #define DUMP_HDR_SIZE (sizeof(struct dump_hdr)) diff -urN hcidump/parser/bnep.c hcidump-mh/parser/bnep.c --- hcidump/parser/bnep.c Sat Aug 31 05:12:18 2002 +++ hcidump-mh/parser/bnep.c Sat Dec 7 16:43:52 2002 @@ -28,15 +28,15 @@ * $Id: bnep.c,v 1.3 2002/08/31 03:12:18 sasai Exp $ */ +#include +#include +#include + +#include #include #include -#include -#include #include - -#include -#include -#include +#include #include #include @@ -45,12 +45,6 @@ #include "parser.h" #include "bnep.h" -#include -#include -#include -#include -#include - #define PAYLOAD_RAW_DUMP static char *get_macaddr(struct frame *frm) @@ -67,11 +61,11 @@ static void bnep_control(int level, struct frame *frm, int header_length) { - __u8 uuid_size; + uint8_t uuid_size; int i, length; char *s; - __u32 uuid = 0; - __u8 type = get_u8(frm); + uint32_t uuid = 0; + uint8_t type = get_u8(frm); p_indent(++level, frm); switch (type) { @@ -163,9 +157,9 @@ static void bnep_eval_extension(int level, struct frame *frm) { - __u8 type = get_u8(frm); + uint8_t type = get_u8(frm); int extension = type & 0x80; - __u8 length = get_u8(frm); + uint8_t length = get_u8(frm); p_indent(level, frm); switch (type & 0x7f) { @@ -241,8 +235,8 @@ void bnep_dump(int level, struct frame *frm) { - __u8 type = get_u8(frm); - __u16 proto = 0x0000; + uint8_t type = get_u8(frm); + uint16_t proto = 0x0000; int extension = type & 0x80; p_indent(level, frm); diff -urN hcidump/parser/cmtp.c hcidump-mh/parser/cmtp.c --- hcidump/parser/cmtp.c Sat Aug 31 23:40:51 2002 +++ hcidump-mh/parser/cmtp.c Sat Dec 7 16:43:52 2002 @@ -28,22 +28,22 @@ * $Id: cmtp.c,v 1.1 2002/08/31 21:40:51 holtmann Exp $ */ +#include +#include +#include + +#include #include #include -#include -#include #include - -#include -#include -#include +#include #include #include "parser.h" -char *bst2str(__u8 bst) +char *bst2str(uint8_t bst) { switch (bst) { case 0x00: @@ -61,14 +61,14 @@ void cmtp_dump(int level, struct frame *frm) { - __u8 hdr_size; - __u8 head; - __u8 bst, bid, nlb; - __u16 len; + uint8_t hdr_size; + uint8_t head; + uint8_t bst, bid, nlb; + uint16_t len; while (frm->len > 0) { - head = *(__u8 *)frm->ptr; + head = *(uint8_t *)frm->ptr; bst = (head & 0x03); bid = (head & 0x3c) >> 2; @@ -83,11 +83,11 @@ break; case 0x01: hdr_size = 2; - len = *(__u8 *)(frm->ptr + 1); + len = *(uint8_t *)(frm->ptr + 1); break; case 0x02: hdr_size = 3; - len = *(__u8 *)(frm->ptr + 1) + (*(__u8 *)(frm->ptr + 2) * 256); + len = *(uint8_t *)(frm->ptr + 1) + (*(uint8_t *)(frm->ptr + 2) * 256); break; } diff -urN hcidump/parser/hci.c hcidump-mh/parser/hci.c --- hcidump/parser/hci.c Tue Mar 12 19:47:34 2002 +++ hcidump-mh/parser/hci.c Sat Dec 7 16:43:52 2002 @@ -23,15 +23,15 @@ * $Id: hci.c,v 1.12 2002/03/12 18:47:34 maxk Exp $ */ +#include +#include +#include + +#include #include #include -#include -#include #include - -#include -#include -#include +#include #include #include @@ -223,9 +223,9 @@ static inline void command_dump(int level, struct frame *frm) { hci_command_hdr *hdr = frm->ptr; - __u16 opcode = btohs(hdr->opcode); - __u16 ogf = cmd_opcode_ogf(opcode); - __u16 ocf = cmd_opcode_ocf(opcode); + uint16_t opcode = btohs(hdr->opcode); + uint16_t ogf = cmd_opcode_ogf(opcode); + uint16_t ocf = cmd_opcode_ocf(opcode); char *cmd; if (p_filter(FILT_HCI)) @@ -307,9 +307,9 @@ static inline void acl_dump(int level, struct frame *frm) { hci_acl_hdr *hdr = (void *) frm->ptr; - __u16 handle = btohs(hdr->handle); - __u16 dlen = btohs(hdr->dlen); - __u8 flags = acl_flags(handle); + uint16_t handle = btohs(hdr->handle); + uint16_t dlen = btohs(hdr->dlen); + uint8_t flags = acl_flags(handle); if (!p_filter(FILT_HCI)) { p_indent(level, frm); @@ -332,7 +332,7 @@ static inline void sco_dump(int level, struct frame *frm) { hci_sco_hdr *hdr = (void *) frm->ptr; - __u16 handle = btohs(hdr->handle); + uint16_t handle = btohs(hdr->handle); if (!p_filter(FILT_SCO)) { p_indent(level, frm); @@ -348,7 +348,7 @@ void hci_dump(int level, struct frame *frm) { - __u8 type = *(__u8 *)frm->ptr; + uint8_t type = *(uint8_t *)frm->ptr; frm->ptr++; frm->len--; diff -urN hcidump/parser/l2cap.c hcidump-mh/parser/l2cap.c --- hcidump/parser/l2cap.c Sat Aug 31 23:40:51 2002 +++ hcidump-mh/parser/l2cap.c Sat Dec 7 16:43:52 2002 @@ -23,15 +23,15 @@ * $Id: l2cap.c,v 1.17 2002/08/31 21:40:51 holtmann Exp $ */ +#include +#include +#include + +#include #include #include -#include -#include #include - -#include -#include -#include +#include #include #include @@ -40,7 +40,7 @@ #include "parser.h" typedef struct { - __u16 handle; + uint16_t handle; struct frame frm; } handle_info; #define HANDLE_TABLE_SIZE 10 @@ -48,8 +48,8 @@ static handle_info handle_table[HANDLE_TABLE_SIZE]; typedef struct { - __u16 cid; - __u16 psm; + uint16_t cid; + uint16_t psm; } cid_info; #define CID_TABLE_SIZE 20 @@ -58,7 +58,7 @@ #define SCID cid_table[0] #define DCID cid_table[1] -static struct frame * add_handle(__u16 handle) +static struct frame * add_handle(uint16_t handle) { register handle_info *t = handle_table; register int i; @@ -71,7 +71,7 @@ return NULL; } -static struct frame * get_frame(__u16 handle) +static struct frame * get_frame(uint16_t handle) { register handle_info *t = handle_table; register int i; @@ -83,7 +83,7 @@ return add_handle(handle); } -static void add_cid(int in, __u16 cid, __u16 psm) +static void add_cid(int in, uint16_t cid, uint16_t psm) { register cid_info *table = cid_table[in]; register int i; @@ -96,10 +96,10 @@ } } -static void del_cid(int in, __u16 dcid, __u16 scid) +static void del_cid(int in, uint16_t dcid, uint16_t scid) { register int t, i; - __u16 cid[2]; + uint16_t cid[2]; if (!in) { cid[0] = dcid; @@ -118,7 +118,7 @@ } } -static __u16 get_psm(int in, __u16 cid) +static uint16_t get_psm(int in, uint16_t cid) { register cid_info *table = cid_table[in]; register int i; @@ -153,7 +153,7 @@ static inline void conn_rsp(int level, struct frame *frm) { l2cap_conn_rsp *h = frm->ptr; - __u16 psm; + uint16_t psm; if ((psm = get_psm(!frm->in, btohs(h->scid)))) add_cid(frm->in, btohs(h->dcid), psm); @@ -166,17 +166,17 @@ btohs(h->result), btohs(h->status)); } -static __u32 conf_opt_val(__u8 *ptr, __u8 len) +static uint32_t conf_opt_val(uint8_t *ptr, uint8_t len) { switch (len) { case 1: return *ptr; case 2: - return btohs(*(__u16 *)ptr); + return btohs(*(uint16_t *)ptr); case 4: - return btohl(*(__u32 *)ptr); + return btohl(*(uint32_t *)ptr); } return 0; } @@ -299,9 +299,9 @@ static void l2cap_parse(int level, struct frame *frm) { l2cap_hdr *hdr = (void *)frm->ptr; - __u16 dlen = btohs(hdr->len); - __u16 cid = btohs(hdr->cid); - __u16 psm; + uint16_t dlen = btohs(hdr->len); + uint16_t cid = btohs(hdr->cid); + uint16_t psm; frm->ptr += L2CAP_HDR_SIZE; frm->len -= L2CAP_HDR_SIZE; @@ -372,8 +372,8 @@ hdr->code, hdr->ident, btohs(hdr->len)); raw_dump(level, frm); } - frm->ptr += hdr->len; - frm->len -= hdr->len; + frm->ptr += btohs(hdr->len); + frm->len -= btohs(hdr->len); } } else if (cid == 0x2) { /* Connectionless channel */ @@ -381,7 +381,7 @@ if (p_filter(FILT_L2CAP)) return; - psm = btohs(*(__u16*)frm->ptr); + psm = btohs(*(uint16_t*)frm->ptr); frm->len -= 2; p_indent(level, frm); @@ -389,7 +389,7 @@ raw_dump(level, frm); } else { /* Connection oriented channel */ - __u16 psm = get_psm(!frm->in, cid); + uint16_t psm = get_psm(!frm->in, cid); if (!p_filter(FILT_L2CAP)) { p_indent(level, frm); @@ -441,7 +441,7 @@ { struct frame *fr; l2cap_hdr *hdr; - __u16 dlen; + uint16_t dlen; if (frm->flags & ACL_START) { hdr = frm->ptr; diff -urN hcidump/parser/parser.c hcidump-mh/parser/parser.c --- hcidump/parser/parser.c Sat Aug 31 23:40:51 2002 +++ hcidump-mh/parser/parser.c Sat Dec 7 16:43:52 2002 @@ -23,15 +23,15 @@ * $Id: parser.c,v 1.13 2002/08/31 21:40:51 holtmann Exp $ */ +#include +#include + +#include +#include #include #include -#include -#include #include -#include - -#include -#include +#include #include "parser.h" diff -urN hcidump/parser/parser.h hcidump-mh/parser/parser.h --- hcidump/parser/parser.h Mon Sep 23 15:40:42 2002 +++ hcidump-mh/parser/parser.h Sat Dec 7 16:43:52 2002 @@ -23,14 +23,6 @@ * $Id: parser.h,v 1.19 2002/09/23 13:40:42 jscrane Exp $ */ -#include - -#include -#include -#include - -#include - struct frame { void *data; int data_len; @@ -104,34 +96,38 @@ /* get_uXX functions do byte swaping */ -static inline __u8 get_u8(struct frame *frm) +/* use memmove to prevent gcc from using builtin memcpy */ +#define get_unaligned(p) \ + ({ __typeof__(*(p)) t; memmove(&t, (p), sizeof(t)); t; }) + +static inline uint8_t get_u8(struct frame *frm) { - __u8 *u8_ptr = frm->ptr; + uint8_t *u8_ptr = frm->ptr; frm->ptr += 1; frm->len -= 1; return *u8_ptr; } -static inline __u16 get_u16(struct frame *frm) +static inline uint16_t get_u16(struct frame *frm) { - __u16 *u16_ptr = frm->ptr; + uint16_t *u16_ptr = frm->ptr; frm->ptr += 2; frm->len -= 2; return ntohs(get_unaligned(u16_ptr)); } -static inline __u32 get_u32(struct frame *frm) +static inline uint32_t get_u32(struct frame *frm) { - __u32 *u32_ptr = frm->ptr; + uint32_t *u32_ptr = frm->ptr; frm->ptr += 4; frm->len -= 4; return ntohl(get_unaligned(u32_ptr)); } -static inline __u64 get_u64(struct frame *frm) +static inline uint64_t get_u64(struct frame *frm) { - __u64 *u64_ptr = frm->ptr; - __u64 u64 = get_unaligned(u64_ptr), tmp; + uint64_t *u64_ptr = frm->ptr; + uint64_t u64 = get_unaligned(u64_ptr), tmp; frm->ptr += 8; frm->len -= 8; tmp = ntohl(u64 & 0xffffffff); @@ -139,7 +135,7 @@ return u64; } -static inline void get_u128(struct frame *frm, __u64 *l, __u64 *h) +static inline void get_u128(struct frame *frm, uint64_t *l, uint64_t *h) { *h = get_u64(frm); *l = get_u64(frm); diff -urN hcidump/parser/rfcomm.c hcidump-mh/parser/rfcomm.c --- hcidump/parser/rfcomm.c Sat Oct 12 20:07:10 2002 +++ hcidump-mh/parser/rfcomm.c Sat Dec 7 16:43:52 2002 @@ -28,15 +28,16 @@ * $Id: rfcomm.c,v 1.5 2002/10/12 18:07:10 holtmann Exp $ */ +#include + +#include +#include + +#include #include #include -#include -#include #include - -#include -#include -#include +#include #include @@ -51,12 +52,12 @@ #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, __u8 *ptr, int len) +void print_rfcomm_hdr(long_frame_head* head, uint8_t *ptr, int len) { address_field addr = head->addr; - __u8 ctr = head->control; - __u16 ilen = head->length.bits.len; - __u8 ctr_type,pf,dlci,fcs; + 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); @@ -71,7 +72,7 @@ printf("mcc_len %d\n", mcc_head->length.bits.len); } -static inline void mcc_test(int level, __u8 *ptr, int len, +static inline void mcc_test(int level, uint8_t *ptr, int len, long_frame_head *head, mcc_long_frame_head *mcc_head) { @@ -79,7 +80,7 @@ print_rfcomm_hdr(head, ptr, len); print_mcc(mcc_head); } -static inline void mcc_fcon(int level, __u8 *ptr, int len, +static inline void mcc_fcon(int level, uint8_t *ptr, int len, long_frame_head *head, mcc_long_frame_head *mcc_head) { @@ -88,7 +89,7 @@ print_mcc(mcc_head); } -static inline void mcc_fcoff(int level, __u8 *ptr, int len, +static inline void mcc_fcoff(int level, uint8_t *ptr, int len, long_frame_head *head, mcc_long_frame_head *mcc_head) { @@ -97,7 +98,7 @@ print_mcc(mcc_head); } -static inline void mcc_msc(int level, __u8 *ptr, int len, +static inline void mcc_msc(int level, uint8_t *ptr, int len, long_frame_head *head, mcc_long_frame_head *mcc_head) { @@ -124,7 +125,7 @@ printf("\n"); } -static inline void mcc_rpn(int level, __u8 *ptr, int len, +static inline void mcc_rpn(int level, uint8_t *ptr, int len, long_frame_head *head, mcc_long_frame_head *mcc_head) { @@ -152,10 +153,10 @@ rpn->rpn_val.rtr_input, rpn->rpn_val.rtr_output, rpn->rpn_val.rtc_input, rpn->rpn_val.rtc_output, rpn->rpn_val.xon, rpn->rpn_val.xoff, - btohs(*(__u16 *)&(rpn->rpn_val.pm))); + btohs(*(uint16_t *)&(rpn->rpn_val.pm))); } -static inline void mcc_rls(int level, __u8 *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) { @@ -167,7 +168,7 @@ printf("dlci %d error: %d", GET_DLCI(rls->dlci), rls->error); } -static inline void mcc_pn(int level, __u8 *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) { @@ -185,7 +186,7 @@ pn->credits); } -static inline void mcc_nsc(int level, __u8 *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) { @@ -205,7 +206,7 @@ { mcc_short_frame_head *mcc_short_head_p = frm->ptr; mcc_long_frame_head mcc_head; - __u8 hdr_size; + uint8_t hdr_size; if ( mcc_short_head_p->length.ea == EA ) { mcc_head.type = mcc_short_head_p->type; @@ -276,7 +277,7 @@ void rfcomm_dump(int level, struct frame *frm) { - __u8 hdr_size, ctr_type; + uint8_t hdr_size, ctr_type; short_frame_head *short_head_p = (void *) frm->ptr; long_frame_head head; diff -urN hcidump/parser/rfcomm.h hcidump-mh/parser/rfcomm.h --- hcidump/parser/rfcomm.h Mon Apr 22 23:47:07 2002 +++ hcidump-mh/parser/rfcomm.h Sat Dec 7 16:43:52 2002 @@ -28,8 +28,6 @@ * $Id: rfcomm.h,v 1.2 2002/04/22 21:47:07 maxk Exp $ */ -#include - #define RFCOMM_PSM 3 #define TRUE 1 @@ -118,83 +116,83 @@ #ifdef __LITTLE_ENDIAN_BITFIELD typedef struct parameter_mask{ - __u8 bit_rate:1; - __u8 data_bits:1; - __u8 stop_bit:1; - __u8 parity:1; - __u8 parity_type:1; - __u8 xon:1; - __u8 xoff:1; - __u8 res1:1; - __u8 xon_input:1; - __u8 xon_output:1; - __u8 rtr_input:1; - __u8 rtr_output:1; - __u8 rtc_input:1; - __u8 rtc_output:1; - __u8 res2:2; + uint8_t bit_rate:1; + uint8_t data_bits:1; + uint8_t stop_bit:1; + uint8_t parity:1; + uint8_t parity_type:1; + uint8_t xon:1; + uint8_t xoff:1; + uint8_t res1:1; + uint8_t xon_input:1; + uint8_t xon_output:1; + uint8_t rtr_input:1; + uint8_t rtr_output:1; + uint8_t rtc_input:1; + uint8_t rtc_output:1; + uint8_t res2:2; } __attribute__ ((packed)) parameter_mask; typedef struct rpn_values{ - __u8 bit_rate; - __u8 data_bits:2; - __u8 stop_bit:1; - __u8 parity:1; - __u8 parity_type:2; - __u8 res1:2; - __u8 xon_input:1; - __u8 xon_output:1; - __u8 rtr_input:1; - __u8 rtr_output:1; - __u8 rtc_input:1; - __u8 rtc_output:1; - __u8 res2:2; - __u8 xon; - __u8 xoff; + uint8_t bit_rate; + uint8_t data_bits:2; + uint8_t stop_bit:1; + uint8_t parity:1; + uint8_t parity_type:2; + uint8_t res1:2; + uint8_t xon_input:1; + uint8_t xon_output:1; + uint8_t rtr_input:1; + uint8_t rtr_output:1; + uint8_t rtc_input:1; + uint8_t rtc_output:1; + uint8_t res2:2; + uint8_t xon; + uint8_t xoff; parameter_mask pm; } __attribute__ ((packed)) rpn_values; #elif defined(__BIG_ENDIAN_BITFIELD) typedef struct parameter_mask{ - __u8 res1:1; - __u8 xoff:1; - __u8 xon:1; - __u8 parity_type:1; - __u8 parity:1; - __u8 stop_bit:1; - __u8 data_bits:1; - __u8 bit_rate:1; - - __u8 res2:2; - __u8 rtc_output:1; - __u8 rtc_input:1; - __u8 rtr_output:1; - __u8 rtr_input:1; - __u8 xon_output:1; - __u8 xon_input:1; + uint8_t res1:1; + uint8_t xoff:1; + uint8_t xon:1; + uint8_t parity_type:1; + uint8_t parity:1; + uint8_t stop_bit:1; + uint8_t data_bits:1; + uint8_t bit_rate:1; + + uint8_t res2:2; + uint8_t rtc_output:1; + uint8_t rtc_input:1; + uint8_t rtr_output:1; + uint8_t rtr_input:1; + uint8_t xon_output:1; + uint8_t xon_input:1; } __attribute__ ((packed)) parameter_mask; typedef struct rpn_values{ - __u8 bit_rate; + uint8_t bit_rate; - __u8 res1:2; - __u8 parity_type:2; - __u8 parity:1; - __u8 stop_bit:1; - __u8 data_bits:2; - - __u8 res2:2; - __u8 rtc_output:1; - __u8 rtc_input:1; - __u8 rtr_output:1; - __u8 rtr_input:1; - __u8 xon_output:1; - __u8 xon_input:1; + uint8_t res1:2; + uint8_t parity_type:2; + uint8_t parity:1; + uint8_t stop_bit:1; + uint8_t data_bits:2; + + uint8_t res2:2; + uint8_t rtc_output:1; + uint8_t rtc_input:1; + uint8_t rtr_output:1; + uint8_t rtr_input:1; + uint8_t xon_output:1; + uint8_t xon_input:1; - __u8 xon; - __u8 xoff; + uint8_t xon; + uint8_t xoff; parameter_mask pm; } __attribute__ ((packed)) rpn_values; @@ -213,94 +211,94 @@ #ifdef __LITTLE_ENDIAN_BITFIELD typedef struct address_field { - __u8 ea:1; - __u8 cr:1; - __u8 d:1; - __u8 server_chn:5; + uint8_t ea:1; + uint8_t cr:1; + uint8_t d:1; + uint8_t server_chn:5; } __attribute__ ((packed)) address_field; typedef struct short_length { - __u8 ea:1; - __u8 len:7; + uint8_t ea:1; + uint8_t len:7; } __attribute__ ((packed)) short_length; typedef union long_length { struct bits { - __u8 ea:1; + uint8_t ea:1; unsigned short len:15; } __attribute__ ((packed)) bits ; - __u16 val ; + uint16_t val ; } __attribute__ ((packed)) long_length; typedef struct short_frame_head { address_field addr; - __u8 control; + uint8_t control; short_length length; } __attribute__ ((packed)) short_frame_head; typedef struct short_frame { short_frame_head h; - __u8 data[0]; + uint8_t data[0]; } __attribute__ ((packed)) short_frame; typedef struct long_frame_head { address_field addr; - __u8 control; + uint8_t control; long_length length; - __u8 data[0]; + uint8_t data[0]; } __attribute__ ((packed)) long_frame_head; typedef struct long_frame { long_frame_head h; - __u8 data[0]; + uint8_t data[0]; } __attribute__ ((packed)) long_frame; /* Typedefinitions for structures used for the multiplexer commands */ typedef struct mcc_type { - __u8 ea:1; - __u8 cr:1; - __u8 type:6; + uint8_t ea:1; + uint8_t cr:1; + uint8_t type:6; } __attribute__ ((packed)) mcc_type; typedef struct mcc_short_frame_head { mcc_type type; short_length length; - __u8 value[0]; + uint8_t value[0]; } __attribute__ ((packed)) mcc_short_frame_head; typedef struct mcc_short_frame { mcc_short_frame_head h; - __u8 value[0]; + uint8_t value[0]; } __attribute__ ((packed)) mcc_short_frame; typedef struct mcc_long_frame_head { mcc_type type; long_length length; - __u8 value[0]; + uint8_t value[0]; } __attribute__ ((packed)) mcc_long_frame_head; typedef struct mcc_long_frame { mcc_long_frame_head h; - __u8 value[0]; + uint8_t value[0]; } __attribute__ ((packed)) mcc_long_frame; /* MSC-command */ typedef struct v24_signals { - __u8 ea:1; - __u8 fc:1; - __u8 rtc:1; - __u8 rtr:1; - __u8 reserved:2; - __u8 ic:1; - __u8 dv:1; + uint8_t ea:1; + uint8_t fc:1; + uint8_t rtc:1; + uint8_t rtr:1; + uint8_t reserved:2; + uint8_t ic:1; + uint8_t dv:1; } __attribute__ ((packed)) v24_signals; typedef struct break_signals { - __u8 ea:1; - __u8 b1:1; - __u8 b2:1; - __u8 b3:1; - __u8 len:4; + uint8_t ea:1; + uint8_t b1:1; + uint8_t b2:1; + uint8_t b3:1; + uint8_t len:4; } __attribute__ ((packed)) break_signals; typedef struct msc_msg { @@ -309,7 +307,7 @@ address_field dlci; v24_signals v24_sigs; //break_signals break_sigs; - __u8 fcs; + uint8_t fcs; } __attribute__ ((packed)) msc_msg; typedef struct rpn_msg { @@ -317,7 +315,7 @@ mcc_short_frame_head mcc_s_head; address_field dlci; rpn_values rpn_val; - __u8 fcs; + uint8_t fcs; } __attribute__ ((packed)) rpn_msg; /* RLS-command */ @@ -325,9 +323,9 @@ short_frame_head s_head; mcc_short_frame_head mcc_s_head; address_field dlci; - __u8 error:4; - __u8 res:4; - __u8 fcs; + uint8_t error:4; + uint8_t res:4; + uint8_t fcs; } __attribute__ ((packed)) rls_msg; /* PN-command */ @@ -335,17 +333,17 @@ short_frame_head s_head; mcc_short_frame_head mcc_s_head; /* The res1, res2 and res3 values have to be set to 0 by the sender */ - __u8 dlci:6; - __u8 res1:2; - __u8 frame_type:4; - __u8 credit_flow:4; - __u8 prior:6; - __u8 res2:2; - __u8 ack_timer; - __u16 frame_size:16; - __u8 max_nbrof_retrans; - __u8 credits; - __u8 fcs; + uint8_t dlci:6; + uint8_t res1:2; + uint8_t frame_type:4; + uint8_t credit_flow:4; + uint8_t prior:6; + uint8_t res2:2; + uint8_t ack_timer; + uint16_t frame_size:16; + uint8_t max_nbrof_retrans; + uint8_t credits; + uint8_t fcs; } __attribute__ ((packed)) pn_msg; /* NSC-command */ @@ -353,98 +351,98 @@ short_frame_head s_head; mcc_short_frame_head mcc_s_head; mcc_type command_type; - __u8 fcs; + uint8_t fcs; } __attribute__ ((packed)) nsc_msg; #elif defined(__BIG_ENDIAN_BITFIELD) typedef struct address_field { - __u8 server_chn:5; - __u8 d:1; - __u8 cr:1; - __u8 ea:1; + uint8_t server_chn:5; + uint8_t d:1; + uint8_t cr:1; + uint8_t ea:1; } __attribute__ ((packed)) address_field; typedef struct short_length { - __u8 len:7; - __u8 ea:1; + uint8_t len:7; + uint8_t ea:1; } __attribute__ ((packed)) short_length; typedef union long_length { struct bits { unsigned short len:15; - __u8 ea:1; + uint8_t ea:1; } __attribute__ ((packed)) bits; - __u16 val; + uint16_t val; } __attribute__ ((packed)) long_length; typedef struct short_frame_head { address_field addr; - __u8 control; + uint8_t control; short_length length; } __attribute__ ((packed)) short_frame_head; typedef struct short_frame { short_frame_head h; - __u8 data[0]; + uint8_t data[0]; } __attribute__ ((packed)) short_frame; typedef struct long_frame_head { address_field addr; - __u8 control; + uint8_t control; long_length length; - __u8 data[0]; + uint8_t data[0]; } __attribute__ ((packed)) long_frame_head; typedef struct long_frame { long_frame_head h; - __u8 data[0]; + uint8_t data[0]; } __attribute__ ((packed)) long_frame; typedef struct mcc_type { - __u8 type:6; - __u8 cr:1; - __u8 ea:1; + uint8_t type:6; + uint8_t cr:1; + uint8_t ea:1; } __attribute__ ((packed)) mcc_type; typedef struct mcc_short_frame_head { mcc_type type; short_length length; - __u8 value[0]; + uint8_t value[0]; } __attribute__ ((packed)) mcc_short_frame_head; typedef struct mcc_short_frame { mcc_short_frame_head h; - __u8 value[0]; + uint8_t value[0]; } __attribute__ ((packed)) mcc_short_frame; typedef struct mcc_long_frame_head { mcc_type type; long_length length; - __u8 value[0]; + uint8_t value[0]; } __attribute__ ((packed)) mcc_long_frame_head; typedef struct mcc_long_frame { mcc_long_frame_head h; - __u8 value[0]; + uint8_t value[0]; } __attribute__ ((packed)) mcc_long_frame; typedef struct v24_signals { - __u8 dv:1; - __u8 ic:1; - __u8 reserved:2; - __u8 rtr:1; - __u8 rtc:1; - __u8 fc:1; - __u8 ea:1; + uint8_t dv:1; + uint8_t ic:1; + uint8_t reserved:2; + uint8_t rtr:1; + uint8_t rtc:1; + uint8_t fc:1; + uint8_t ea:1; } __attribute__ ((packed)) v24_signals; typedef struct break_signals { - __u8 len:4; - __u8 b3:1; - __u8 b2:1; - __u8 b1:1; - __u8 ea:1; + uint8_t len:4; + uint8_t b3:1; + uint8_t b2:1; + uint8_t b1:1; + uint8_t ea:1; } __attribute__ ((packed)) break_signals; typedef struct msc_msg { @@ -453,7 +451,7 @@ address_field dlci; v24_signals v24_sigs; //break_signals break_sigs; - __u8 fcs; + uint8_t fcs; } __attribute__ ((packed)) msc_msg; typedef struct rpn_msg { @@ -461,39 +459,39 @@ mcc_short_frame_head mcc_s_head; address_field dlci; rpn_values rpn_val; - __u8 fcs; + uint8_t fcs; } __attribute__ ((packed)) rpn_msg; typedef struct rls_msg { short_frame_head s_head; mcc_short_frame_head mcc_s_head; address_field dlci; - __u8 res:4; - __u8 error:4; - __u8 fcs; + uint8_t res:4; + uint8_t error:4; + uint8_t fcs; } __attribute__ ((packed)) rls_msg; typedef struct pn_msg { short_frame_head s_head; mcc_short_frame_head mcc_s_head; - __u8 res1:2; - __u8 dlci:6; - __u8 credit_flow:4; - __u8 frame_type:4; - __u8 res2:2; - __u8 prior:6; - __u8 ack_timer; - __u16 frame_size:16; - __u8 max_nbrof_retrans; - __u8 credits; - __u8 fcs; + uint8_t res1:2; + uint8_t dlci:6; + uint8_t credit_flow:4; + uint8_t frame_type:4; + uint8_t res2:2; + uint8_t prior:6; + uint8_t ack_timer; + uint16_t frame_size:16; + uint8_t max_nbrof_retrans; + uint8_t credits; + uint8_t fcs; } __attribute__ ((packed)) pn_msg; typedef struct nsc_msg { short_frame_head s_head; mcc_short_frame_head mcc_s_head; mcc_type command_type; - __u8 fcs; + uint8_t fcs; } __attribute__ ((packed)) nsc_msg; #else /* __XXX_ENDIAN */ diff -urN hcidump/parser/sdp.c hcidump-mh/parser/sdp.c --- hcidump/parser/sdp.c Thu Nov 7 00:13:16 2002 +++ hcidump-mh/parser/sdp.c Sat Dec 7 16:43:52 2002 @@ -28,16 +28,15 @@ * $Id: sdp.c,v 1.14 2002/11/06 23:10:55 holtmann Exp $ */ +#include +#include +#include + +#include #include #include -#include -#include #include - -#include -#include -#include -#include +#include #include #include @@ -150,11 +149,11 @@ return 0; } -static inline __u8 parse_de_hdr(struct frame *frm, int* n) +static inline uint8_t parse_de_hdr(struct frame *frm, int* n) { - __u8 de_hdr = get_u8(frm); - __u8 de_type = de_hdr >> 3; - __u8 siz_idx = de_hdr & 0x07; + uint8_t de_hdr = get_u8(frm); + uint8_t de_type = de_hdr >> 3; + uint8_t siz_idx = de_hdr & 0x07; /* Get the number of bytes */ if (sdp_siz_idx_lookup_table[siz_idx].addl_bits) { @@ -175,9 +174,9 @@ return de_type; } -static inline void print_int(__u8 de_type, int level, int n, struct frame *frm) +static inline void print_int(uint8_t de_type, int level, int n, struct frame *frm) { - __u64 val, val2; + uint64_t val, val2; switch(de_type) { case SDP_DE_UINT: @@ -223,7 +222,7 @@ static inline void print_uuid(int n, struct frame *frm) { - __u32 uuid = 0; + uint32_t uuid = 0; char* s; switch(n) { @@ -270,7 +269,7 @@ frm->len -= n; } -static inline void print_des(__u8 de_type, int level, int n, struct frame *frm, int *split) +static inline void print_des(uint8_t de_type, int level, int n, struct frame *frm, int *split) { int len = frm->len; while (len - frm->len < n ) @@ -280,7 +279,7 @@ static inline void print_de(int level, struct frame *frm, int *split) { int n; - __u8 de_type = parse_de_hdr(frm, &n); + uint8_t de_type = parse_de_hdr(frm, &n); switch(de_type) { case SDP_DE_NULL: @@ -342,8 +341,8 @@ static inline void print_attr_id_list(int level, struct frame *frm) { - __u16 attr_id; - __u32 attr_id_range; + uint16_t attr_id; + uint32_t attr_id_range; int len = frm->len; int n1, n2; @@ -380,7 +379,7 @@ static inline void print_attr_list(int level, struct frame *frm) { - __u16 attr_id; + uint16_t attr_id; int n1, n2, split; int len = frm->len; @@ -439,7 +438,7 @@ } -static inline void err_rsp(int level, __u16 tid, __u16 len, struct frame *frm) +static inline void err_rsp(int level, uint16_t tid, uint16_t len, struct frame *frm) { printf("SDP Error Rsp: tid 0x%x len 0x%x\n", tid, len); @@ -453,7 +452,7 @@ } -static inline void ss_req(int level, __u16 tid, __u16 len, struct frame *frm) +static inline void ss_req(int level, uint16_t tid, uint16_t len, struct frame *frm) { printf("SDP SS Req: tid 0x%x len 0x%x\n", tid, len); @@ -465,11 +464,11 @@ printf("max 0x%x\n", get_u16(frm)); } -static inline void ss_rsp(int level, __u16 tid, __u16 len, struct frame *frm) +static inline void ss_rsp(int level, uint16_t tid, uint16_t len, struct frame *frm) { register int i; - __u16 cur_srv_rec_cnt = get_u16(frm); /* Parse CurrentServiceRecordCount */ - __u16 tot_srv_rec_cnt = get_u16(frm); /* Parse TotalServiceRecordCount */ + uint16_t cur_srv_rec_cnt = get_u16(frm); /* Parse CurrentServiceRecordCount */ + uint16_t tot_srv_rec_cnt = get_u16(frm); /* Parse TotalServiceRecordCount */ printf("SDP SS Rsp: tid 0x%x len 0x%x\n", tid, len); @@ -486,7 +485,7 @@ printf("\n"); } -static inline void sa_req(int level, __u16 tid, __u16 len, struct frame *frm) +static inline void sa_req(int level, uint16_t tid, uint16_t len, struct frame *frm) { printf("SDP SA Req: tid 0x%x len 0x%x\n", tid, len); @@ -502,7 +501,7 @@ print_attr_id_list(level, frm); } -static inline void sa_rsp(int level, __u16 tid, __u16 len, struct frame *frm) +static inline void sa_rsp(int level, uint16_t tid, uint16_t len, struct frame *frm) { printf("SDP SA Rsp: tid 0x%x len 0x%x\n", tid, len); @@ -514,7 +513,7 @@ print_attr_list(level, frm); } -static inline void ssa_req(int level, __u16 tid, __u16 len, struct frame *frm) +static inline void ssa_req(int level, uint16_t tid, uint16_t len, struct frame *frm) { printf("SDP SSA Req: tid 0x%x len 0x%x\n", tid, len); @@ -529,7 +528,7 @@ print_attr_id_list(level, frm); } -static inline void ssa_rsp(int level, __u16 tid, __u16 len, struct frame *frm) +static inline void ssa_rsp(int level, uint16_t tid, uint16_t len, struct frame *frm) { int cnt; printf("SDP SSA Rsp: tid 0x%x len 0x%x\n", tid, len); @@ -546,8 +545,8 @@ void sdp_dump(int level, struct frame *frm) { sdp_pdu_hdr *hdr = frm->ptr; - __u16 tid = ntohs(hdr->tid); - __u16 len = ntohs(hdr->len); + uint16_t tid = ntohs(hdr->tid); + uint16_t len = ntohs(hdr->len); frm->ptr += SDP_PDU_HDR_SIZE; frm->len -= SDP_PDU_HDR_SIZE; diff -urN hcidump/parser/sdp.h hcidump-mh/parser/sdp.h --- hcidump/parser/sdp.h Thu Nov 7 00:02:14 2002 +++ hcidump-mh/parser/sdp.h Sat Dec 7 16:43:52 2002 @@ -135,9 +135,9 @@ /* SDP structures */ typedef struct { - __u8 pid; - __u16 tid; - __u16 len; + uint8_t pid; + uint16_t tid; + uint16_t len; } __attribute__ ((packed)) sdp_pdu_hdr; #define SDP_PDU_HDR_SIZE 5