diff options
Diffstat (limited to '')
-rw-r--r-- | epan/dissectors/packet-hci_usb.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/epan/dissectors/packet-hci_usb.c b/epan/dissectors/packet-hci_usb.c index e36ad35a..c410187e 100644 --- a/epan/dissectors/packet-hci_usb.c +++ b/epan/dissectors/packet-hci_usb.c @@ -19,32 +19,32 @@ #include "packet-bluetooth.h" #include "packet-usb.h" -static int proto_hci_usb = -1; -static int hf_bthci_usb_data = -1; -static int hf_bthci_usb_packet_fragment = -1; -static int hf_bthci_usb_packet_complete = -1; -static int hf_bthci_usb_packet_unknown_fragment = -1; -static int hf_bthci_usb_setup_request = -1; -static int hf_bthci_usb_setup_value = -1; -static int hf_bthci_usb_setup_adapter_id = -1; -static int hf_bthci_usb_setup_length = -1; - -static gint ett_hci_usb = -1; -static gint ett_hci_usb_msg_fragment = -1; -static gint ett_hci_usb_msg_fragments = -1; - -static int hf_msg_fragments = -1; -static int hf_msg_fragment = -1; -static int hf_msg_fragment_overlap = -1; -static int hf_msg_fragment_overlap_conflicts = -1; -static int hf_msg_fragment_multiple_tails = -1; -static int hf_msg_fragment_too_long_fragment = -1; -static int hf_msg_fragment_error = -1; -static int hf_msg_fragment_count = -1; -static int hf_msg_reassembled_in = -1; -static int hf_msg_reassembled_length = -1; - -static wmem_tree_t *fragment_info_table = NULL; +static int proto_hci_usb; +static int hf_bthci_usb_data; +static int hf_bthci_usb_packet_fragment; +static int hf_bthci_usb_packet_complete; +static int hf_bthci_usb_packet_unknown_fragment; +static int hf_bthci_usb_setup_request; +static int hf_bthci_usb_setup_value; +static int hf_bthci_usb_setup_adapter_id; +static int hf_bthci_usb_setup_length; + +static int ett_hci_usb; +static int ett_hci_usb_msg_fragment; +static int ett_hci_usb_msg_fragments; + +static int hf_msg_fragments; +static int hf_msg_fragment; +static int hf_msg_fragment_overlap; +static int hf_msg_fragment_overlap_conflicts; +static int hf_msg_fragment_multiple_tails; +static int hf_msg_fragment_too_long_fragment; +static int hf_msg_fragment_error; +static int hf_msg_fragment_count; +static int hf_msg_reassembled_in; +static int hf_msg_reassembled_length; + +static wmem_tree_t *fragment_info_table; static reassembly_table hci_usb_reassembly_table; @@ -55,8 +55,8 @@ static dissector_handle_t bthci_acl_handle; static dissector_handle_t bthci_sco_handle; typedef struct _fragment_info_t { - gint remaining_length; - gint fragment_id; + int remaining_length; + int fragment_id; } fragment_info_t; static const fragment_items hci_usb_msg_frag_items = { @@ -94,18 +94,18 @@ static value_string_ext(request_vals_ext) = VALUE_STRING_EXT_INIT(request_vals); void proto_register_hci_usb(void); void proto_reg_handoff_hci_usb(void); -static gint +static int dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { proto_item *ttree = NULL; proto_tree *titem = NULL; proto_item *pitem = NULL; - gint offset = 0; - usb_conv_info_t *usb_conv_info; + int offset = 0; + urb_info_t *urb; tvbuff_t *next_tvb = NULL; bluetooth_data_t *bluetooth_data; - gint p2p_dir_save; - guint32 session_id; + int p2p_dir_save; + uint32_t session_id; fragment_head *reassembled; bluetooth_data = (bluetooth_data_t *) data; @@ -114,8 +114,8 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) if (data == NULL) return 0; - DISSECTOR_ASSERT(bluetooth_data->previous_protocol_data_type == BT_PD_USB_CONV_INFO); - usb_conv_info = bluetooth_data->previous_protocol_data.usb_conv_info; + DISSECTOR_ASSERT(bluetooth_data->previous_protocol_data_type == BT_PD_URB_INFO); + urb = bluetooth_data->previous_protocol_data.urb; titem = proto_tree_add_item(tree, proto_hci_usb, tvb, offset, -1, ENC_NA); ttree = proto_item_add_subtree(titem, ett_hci_usb); @@ -123,7 +123,7 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI_USB"); p2p_dir_save = pinfo->p2p_dir; - pinfo->p2p_dir = (usb_conv_info->is_request) ? P2P_DIR_SENT : P2P_DIR_RECV; + pinfo->p2p_dir = (urb->is_request) ? P2P_DIR_SENT : P2P_DIR_RECV; switch (pinfo->p2p_dir) { @@ -140,7 +140,7 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) break; } - if (usb_conv_info->is_setup) { + if (urb->is_setup) { proto_tree_add_item(ttree, hf_bthci_usb_setup_request, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; @@ -154,14 +154,14 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) offset += 2; } - session_id = usb_conv_info->bus_id << 16 | usb_conv_info->device_address << 8 | ((pinfo->p2p_dir == P2P_DIR_RECV) ? 1 : 0 ) << 7 | usb_conv_info->endpoint; + session_id = urb->bus_id << 16 | urb->device_address << 8 | ((pinfo->p2p_dir == P2P_DIR_RECV) ? 1 : 0 ) << 7 | urb->endpoint; - bluetooth_data->adapter_id = usb_conv_info->bus_id << 8 | usb_conv_info->device_address; + bluetooth_data->adapter_id = urb->bus_id << 8 | urb->device_address; /* TODO: adapter disconnect on some USB action, for now do not support adapter disconnection */ bluetooth_data->adapter_disconnect_in_frame = &bluetooth_max_disconnect_in_frame; next_tvb = tvb_new_subset_remaining(tvb, offset); - if (!pinfo->fd->visited && usb_conv_info->transfer_type != URB_ISOCHRONOUS && + if (!pinfo->fd->visited && urb->transfer_type != URB_ISOCHRONOUS && tvb_captured_length(tvb) == tvb_reported_length(tvb)) { fragment_info_t *fragment_info; @@ -175,13 +175,13 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) } if (fragment_info->fragment_id == 0) { - switch(usb_conv_info->transfer_type) + switch(urb->transfer_type) { case URB_CONTROL: - fragment_info->remaining_length = tvb_get_guint8(tvb, offset + 2) + 3; + fragment_info->remaining_length = tvb_get_uint8(tvb, offset + 2) + 3; break; case URB_INTERRUPT: - fragment_info->remaining_length = tvb_get_guint8(tvb, offset + 1) + 2; + fragment_info->remaining_length = tvb_get_uint8(tvb, offset + 1) + 2; break; case URB_BULK: fragment_info->remaining_length = tvb_get_letohs(tvb, offset + 2) + 4; @@ -193,7 +193,7 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) fragment_add_seq_check(&hci_usb_reassembly_table, tvb, offset, pinfo, session_id, NULL, - fragment_info->fragment_id, tvb_reported_length_remaining(tvb, offset), (fragment_info->remaining_length == 0) ? FALSE : TRUE); + fragment_info->fragment_id, tvb_reported_length_remaining(tvb, offset), (fragment_info->remaining_length == 0) ? false : true); if (fragment_info->remaining_length > 0) fragment_info->fragment_id += 1; else @@ -210,14 +210,14 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) pitem = proto_tree_add_item(ttree, hf_bthci_usb_packet_complete, tvb, offset, -1, ENC_NA); proto_item_set_generated(pitem); - if (reassembled->len > (guint) tvb_reported_length_remaining(tvb, offset)) { + if (reassembled->len > (unsigned) tvb_reported_length_remaining(tvb, offset)) { next_tvb = process_reassembled_data(tvb, 0, pinfo, "Reassembled HCI_USB", reassembled, &hci_usb_msg_frag_items, NULL, ttree); } - switch(usb_conv_info->transfer_type) + switch(urb->transfer_type) { case URB_CONTROL: call_dissector_with_data(bthci_cmd_handle, next_tvb, pinfo, tree, bluetooth_data); @@ -234,9 +234,9 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_item_set_generated(pitem); } - if (usb_conv_info->transfer_type == URB_ISOCHRONOUS) { + if (urb->transfer_type == URB_ISOCHRONOUS) { call_dissector_with_data(bthci_sco_handle, next_tvb, pinfo, tree, bluetooth_data); - } else if (usb_conv_info->transfer_type == URB_UNKNOWN) { + } else if (urb->transfer_type == URB_UNKNOWN) { proto_tree_add_item(ttree, hf_bthci_usb_data, tvb, offset, -1, ENC_NA); } @@ -344,7 +344,7 @@ proto_register_hci_usb(void) } }; - static gint *ett[] = { + static int *ett[] = { &ett_hci_usb, &ett_hci_usb_msg_fragment, &ett_hci_usb_msg_fragments, |