diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-bt-oui.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-btamp.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-btatt.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-btavctp.c | 21 | ||||
-rw-r--r-- | epan/dissectors/packet-btavdtp.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-btavrcp.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-btbnep.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-bthci_acl.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-bthci_cmd.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-bthci_evt.c | 38 | ||||
-rw-r--r-- | epan/dissectors/packet-bthci_sco.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-bthcrp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-bthid.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-btl2cap.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-btmcap.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-btobex.c | 14 | ||||
-rw-r--r-- | epan/dissectors/packet-btrfcomm.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-btsap.c | 62 | ||||
-rw-r--r-- | epan/dissectors/packet-btsmp.c | 84 | ||||
-rw-r--r-- | epan/dissectors/packet-hci_h1.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-hci_h4.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-hci_usb.c | 9 |
22 files changed, 227 insertions, 151 deletions
diff --git a/epan/dissectors/packet-bt-oui.c b/epan/dissectors/packet-bt-oui.c index 369de1bb7c..1cc8ca7017 100644 --- a/epan/dissectors/packet-bt-oui.c +++ b/epan/dissectors/packet-bt-oui.c @@ -54,6 +54,9 @@ static const value_string bluetooth_pid_vals[] = { { 0, NULL } }; +void proto_register_bt_oui(void); +void proto_reg_handoff_bt_oui(void); + /* * NOTE: there's no dissector here, just registration routines to set * up the dissector table for the Bluetooth OUI diff --git a/epan/dissectors/packet-btamp.c b/epan/dissectors/packet-btamp.c index 6f098dc67a..6c404d3fcf 100644 --- a/epan/dissectors/packet-btamp.c +++ b/epan/dissectors/packet-btamp.c @@ -128,6 +128,9 @@ static const value_string disc_status_vals[] = { { 0, NULL } }; +void proto_register_btamp(void); +void proto_reg_handoff_btamp(void); + static int dissect_comrej(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { diff --git a/epan/dissectors/packet-btatt.c b/epan/dissectors/packet-btatt.c index 1577c20f1c..9ccb7139e7 100644 --- a/epan/dissectors/packet-btatt.c +++ b/epan/dissectors/packet-btatt.c @@ -247,6 +247,9 @@ static const value_string flags_vals[] = { {0x0, NULL} }; +void proto_register_btatt(void); +void proto_reg_handoff_btatt(void); + static void dissect_btatt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { diff --git a/epan/dissectors/packet-btavctp.c b/epan/dissectors/packet-btavctp.c index 86d6afd1c9..ca15f5449e 100644 --- a/epan/dissectors/packet-btavctp.c +++ b/epan/dissectors/packet-btavctp.c @@ -29,6 +29,7 @@ #include <epan/packet.h> #include <epan/prefs.h> #include <epan/expert.h> +#include <epan/wmem/wmem.h> #include "packet-btl2cap.h" #include "packet-btsdp.h" @@ -94,6 +95,8 @@ static const value_string ipid_vals[] = { { 0, NULL } }; +void proto_register_btavctp(void); +void proto_reg_handoff_btavctp(void); static void dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) @@ -168,7 +171,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset +=2; } - avctp_data = ep_new(btavctp_data_t); + avctp_data = wmem_new(wmem_packet_scope(), btavctp_data_t); avctp_data->cr = cr; avctp_data->interface_id = l2cap_data->interface_id; avctp_data->adapter_id = l2cap_data->adapter_id; @@ -230,12 +233,12 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (packet_type == PACKET_TYPE_START) { if (!pinfo->fd->flags.visited) { - fragment = se_new(fragment_t); + fragment = wmem_new(wmem_file_scope(), fragment_t); fragment->length = length; - fragment->data = (guint8 *)se_alloc(fragment->length); + fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), fragment->length); tvb_memcpy(tvb, fragment->data, offset, fragment->length); - fragments = se_new(fragments_t); + fragments = wmem_new(wmem_file_scope(), fragments_t); fragments->number_of_packets = number_of_packets; fragments->pid = pid; @@ -270,9 +273,9 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fragments = NULL; if (!pinfo->fd->flags.visited && fragments != NULL) { - fragment = se_new(fragment_t); + fragment = wmem_new(wmem_file_scope(), fragment_t); fragment->length = length; - fragment->data = (guint8 *)se_alloc(fragment->length); + fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), fragment->length); tvb_memcpy(tvb, fragment->data, offset, fragment->length); fragments->count++; @@ -318,9 +321,9 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fragments = NULL; if (!pinfo->fd->flags.visited && fragments != NULL) { - fragment = se_new(fragment_t); + fragment = wmem_new(wmem_file_scope(), fragment_t); fragment->length = length; - fragment->data = (guint8 *)se_alloc(fragment->length); + fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), fragment->length); tvb_memcpy(tvb, fragment->data, offset, fragment->length); fragments->count++; @@ -366,7 +369,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) length += fragment->length; } - reassembled = (guint8 *)se_alloc(length); + reassembled = (guint8 *) wmem_alloc(wmem_file_scope(), length); for (i_frame = 1; i_frame <= fragments->count; ++i_frame) { fragment = (fragment_t *)se_tree_lookup32_le(fragments->fragment, i_frame); diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c index cf35e536a4..134906ca26 100644 --- a/epan/dissectors/packet-btavdtp.c +++ b/epan/dissectors/packet-btavdtp.c @@ -29,6 +29,7 @@ #include <epan/packet.h> #include <epan/expert.h> #include <epan/prefs.h> +#include <epan/wmem/wmem.h> #include "packet-btl2cap.h" #include "packet-btsdp.h" @@ -402,6 +403,12 @@ typedef struct _cid_type_data_t { sep_entry_t *sep; } cid_type_data_t; +void proto_register_btavdtp(void); +void proto_reg_handoff_btavdtp(void); +void proto_register_bta2dp(void); +void proto_reg_handoff_bta2dp(void); +void proto_register_btvdp(void); +void proto_reg_handoff_btvdp(void); static const char * get_sep_type(guint32 frame_number, guint seid) @@ -505,7 +512,7 @@ dissect_sep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset) key[2].key = NULL; if (!pinfo->fd->flags.visited) { - sep_data = se_new(sep_entry_t); + sep_data = wmem_new(wmem_file_scope(), sep_entry_t); sep_data->seid = seid; sep_data->type = type; sep_data->codec = -1; @@ -965,7 +972,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!force_avdtp && !pinfo->fd->flags.visited && (l2cap_data->first_scid_frame == pinfo->fd->num || l2cap_data->first_dcid_frame == pinfo->fd->num)) { - cid_type_data = se_new(cid_type_data_t); + cid_type_data = wmem_new(wmem_file_scope(), cid_type_data_t); cid_type_data->type = STREAM_TYPE_MEDIA; cid_type_data->cid = l2cap_data->cid; cid_type_data->sep = NULL; @@ -2026,7 +2033,7 @@ dissect_bta2dp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) save_private_data = pinfo->private_data; - btavdtp_data = ep_new(btavdtp_data_t); + btavdtp_data = wmem_new(wmem_packet_scope(), btavdtp_data_t); btavdtp_data->codec_dissector = codec_dissector; pinfo->private_data = btavdtp_data; @@ -2139,7 +2146,7 @@ dissect_btvdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) save_private_data = pinfo->private_data; - btavdtp_data = ep_new(btavdtp_data_t); + btavdtp_data = wmem_new(wmem_packet_scope(), btavdtp_data_t); btavdtp_data->codec_dissector = codec_dissector; pinfo->private_data = btavdtp_data; diff --git a/epan/dissectors/packet-btavrcp.c b/epan/dissectors/packet-btavrcp.c index acd6265650..e9e2e8ac47 100644 --- a/epan/dissectors/packet-btavrcp.c +++ b/epan/dissectors/packet-btavrcp.c @@ -30,6 +30,7 @@ #include <epan/prefs.h> #include <epan/expert.h> #include <epan/oui.h> +#include <epan/wmem/wmem.h> #include "packet-wap.h" #include "packet-btl2cap.h" @@ -573,6 +574,9 @@ static const value_string player_subtype_vals[] = { { 0, NULL } }; +void proto_register_btavrcp(void); +void proto_reg_handoff_btavrcp(void); + static gint dissect_attribute_id_list(tvbuff_t *tvb, proto_tree *tree, gint offset, guint count) @@ -1067,7 +1071,7 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, k_op = pdu_id | (company_id << 8); k_frame_number = pinfo->fd->num; - fragment = se_new(fragment_t); + fragment = wmem_new(wmem_file_scope(), fragment_t); fragment->start_frame_number = pinfo->fd->num; fragment->end_frame_number = 0; fragment->state = 0; @@ -1075,9 +1079,9 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, fragment->count = 1; fragment->fragments = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "btavctp fragments"); - data_fragment = se_new(data_fragment_t); + data_fragment = wmem_new(wmem_file_scope(), data_fragment_t); data_fragment->length = length; - data_fragment->data = (guint8 *)se_alloc(data_fragment->length); + data_fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), data_fragment->length); tvb_memcpy(tvb, data_fragment->data, offset, data_fragment->length); se_tree_insert32(fragment->fragments, fragment->count, data_fragment); @@ -1142,9 +1146,9 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, fragment->count += 1; fragment->state = 0; - data_fragment = se_new(data_fragment_t); + data_fragment = wmem_new(wmem_file_scope(), data_fragment_t); data_fragment->length = length; - data_fragment->data = (guint8 *)se_alloc(data_fragment->length); + data_fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), data_fragment->length); tvb_memcpy(tvb, data_fragment->data, offset, data_fragment->length); se_tree_insert32(fragment->fragments, fragment->count, data_fragment); } @@ -1193,9 +1197,9 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, fragment->count += 1; fragment->state = 2; - data_fragment = se_new(data_fragment_t); + data_fragment = wmem_new(wmem_file_scope(), data_fragment_t); data_fragment->length = length; - data_fragment->data = (guint8 *)se_alloc(data_fragment->length); + data_fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), data_fragment->length); tvb_memcpy(tvb, data_fragment->data, offset, data_fragment->length); se_tree_insert32(fragment->fragments, fragment->count, data_fragment); } @@ -1210,7 +1214,7 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, length += data_fragment->length; } - reassembled = (guint8 *)se_alloc(length); + reassembled = (guint8 *) wmem_alloc(wmem_file_scope(), length); for (i_frame = 1; i_frame <= fragment->count; ++i_frame) { data_fragment = (data_fragment_t *)se_tree_lookup32_le(fragment->fragments, i_frame); @@ -2193,7 +2197,7 @@ dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) max_response_time = 100; } - timing_info = se_new(timing_info_t); + timing_info = wmem_new(wmem_file_scope(), timing_info_t); timing_info->command_frame_number = pinfo->fd->num; timing_info->command_timestamp = pinfo->fd->abs_ts; timing_info->response_frame_number = 0; diff --git a/epan/dissectors/packet-btbnep.c b/epan/dissectors/packet-btbnep.c index 10cc138fcc..1fb0a9c6c7 100644 --- a/epan/dissectors/packet-btbnep.c +++ b/epan/dissectors/packet-btbnep.c @@ -137,6 +137,9 @@ static const value_string filter_multi_addr_response_message_vals[] = { { 0, NULL } }; +void proto_register_btbnep(void); +void proto_reg_handoff_btbnep(void); + static int dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) { diff --git a/epan/dissectors/packet-bthci_acl.c b/epan/dissectors/packet-bthci_acl.c index ee1fc0963b..f10d0bb7ae 100644 --- a/epan/dissectors/packet-bthci_acl.c +++ b/epan/dissectors/packet-bthci_acl.c @@ -86,6 +86,8 @@ static const value_string bc_flag_vals[] = { { 0, NULL } }; +void proto_register_bthci_acl(void); +void proto_reg_handoff_bthci_acl(void); /* Code to actually dissect the packets */ static void @@ -132,7 +134,7 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 2; hci_data = (hci_data_t *) pinfo->private_data; - acl_data = ep_new(bthci_acl_data_t); + acl_data = wmem_new(wmem_packet_scope(), bthci_acl_data_t); acl_data->interface_id = hci_data->interface_id; acl_data->adapter_id = hci_data->adapter_id; @@ -349,11 +351,11 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!(pb_flag & 0x01)) { /* first fragment */ if (!pinfo->fd->flags.visited) { - mfp = se_new(multi_fragment_pdu_t); + mfp = (multi_fragment_pdu_t *) wmem_new(wmem_file_scope(), multi_fragment_pdu_t); mfp->first_frame = pinfo->fd->num; mfp->last_frame = 0; mfp->tot_len = l2cap_length + 4; - mfp->reassembled = (char *)se_alloc(mfp->tot_len); + mfp->reassembled = (char *) wmem_alloc(wmem_file_scope(), mfp->tot_len); len = tvb_length_remaining(tvb, offset); if (len <= mfp->tot_len) { tvb_memcpy(tvb, (guint8 *) mfp->reassembled, offset, len); diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c index 9a7882c090..16e77fa214 100644 --- a/epan/dissectors/packet-bthci_cmd.c +++ b/epan/dissectors/packet-bthci_cmd.c @@ -1113,6 +1113,9 @@ static const value_string cmd_le_test_pkt_payload[] = { { 0, NULL } }; +void proto_register_bthci_cmd(void); +void proto_reg_handoff_bthci_cmd(void); + static int dissect_bthci_cmd_bd_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { @@ -1187,26 +1190,26 @@ dissect_bthci_eir_ad_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t } i=0; - while(i<data_size){ - length = tvb_get_guint8(tvb, offset+i); + while (i < data_size) { + length = tvb_get_guint8(tvb, offset + i); if (length != 0) { proto_item *ti_data_struct; proto_tree *ti_data_struct_subtree; - ti_data_struct = proto_tree_add_text(ti_data_subtree, tvb, offset+i, length+1, "%s", ""); + ti_data_struct = proto_tree_add_text(ti_data_subtree, tvb, offset + i, length + 1, "%s", ""); ti_data_struct_subtree = proto_item_add_subtree(ti_data_struct, ett_eir_struct_subtree); - type = tvb_get_guint8(tvb, offset+i+1); + type = tvb_get_guint8(tvb, offset + i + 1); - proto_item_append_text(ti_data_struct,"%s", val_to_str(type, bthci_cmd_eir_data_type_vals, "Unknown")); + proto_item_append_text(ti_data_struct, "%s", val_to_str_const(type, bthci_cmd_eir_data_type_vals, "Unknown")); - proto_tree_add_item(ti_data_struct_subtree,hf_bthci_cmd_eir_struct_length, tvb, offset+i, 1, ENC_LITTLE_ENDIAN); - proto_tree_add_item(ti_data_struct_subtree,hf_bthci_cmd_eir_struct_type, tvb, offset+i+1, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(ti_data_struct_subtree,hf_bthci_cmd_eir_struct_length, tvb, offset + i, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(ti_data_struct_subtree,hf_bthci_cmd_eir_struct_type, tvb, offset + i + 1, 1, ENC_LITTLE_ENDIAN); switch (type) { case 0x01: /* flags */ - if(length-1 > 0) + if (length > 1) { proto_tree_add_item(ti_data_struct_subtree, hf_bthci_cmd_flags_limited_disc_mode, tvb, offset+i+2, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(ti_data_struct_subtree, hf_bthci_cmd_flags_general_disc_mode, tvb, offset+i+2, 1, ENC_LITTLE_ENDIAN); diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c index 00dd5f8b7c..e5bd5aed5d 100644 --- a/epan/dissectors/packet-bthci_evt.c +++ b/epan/dissectors/packet-bthci_evt.c @@ -36,6 +36,7 @@ #include <epan/packet.h> #include <epan/addr_resolv.h> +#include <epan/wmem/wmem.h> #include "packet-bluetooth-hci.h" @@ -850,6 +851,9 @@ static const value_string evt_master_clock_accuray[] = { { 0, NULL } }; +void proto_register_bthci_evt(void); +void proto_reg_handoff_bthci_evt(void); + static int dissect_bthci_evt_bd_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *bdaddr) @@ -964,7 +968,7 @@ dissect_bthci_evt_conn_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, p key[4].length = 0; key[4].key = NULL; - remote_bdaddr = se_alloc(sizeof(remote_bdaddr_t)); + remote_bdaddr = (remote_bdaddr_t *) wmem_new(wmem_file_scope(), remote_bdaddr_t); remote_bdaddr->interface_id = hci_data->interface_id; remote_bdaddr->adapter_id = hci_data->adapter_id; remote_bdaddr->chandle = connection_handle; @@ -1209,10 +1213,10 @@ dissect_bthci_evt_remote_name_req_complete(tvbuff_t *tvb, int offset, packet_inf key[3].length = 0; key[3].key = NULL; - device_name = se_alloc(sizeof(device_name_t)); + device_name = (device_name_t *) wmem_new(wmem_file_scope(), device_name_t); device_name->bd_addr_oui = bd_addr[0] << 16 | bd_addr[1] << 8 | bd_addr[2]; device_name->bd_addr_id = bd_addr[3] << 16 | bd_addr[4] << 8 | bd_addr[5]; - device_name->name = se_strdup(name); + device_name->name = wmem_strdup(wmem_file_scope(), name); se_tree_insert32_array(hci_data->bdaddr_to_name_table, key, device_name); } @@ -1552,26 +1556,26 @@ dissect_bthci_evt_eir_ad_data(tvbuff_t *tvb, int offset, packet_info *pinfo, } i=0; - while(i<size){ + while (i < size) { length = tvb_get_guint8(tvb, offset+i); - if( length != 0 ){ + if (length != 0) { proto_item *ti_eir_struct; proto_tree *ti_eir_struct_subtree; - ti_eir_struct = proto_tree_add_text(ti_eir_subtree, tvb, offset+i, length+1, "%s", ""); + ti_eir_struct = proto_tree_add_text(ti_eir_subtree, tvb, offset + i, length + 1, "%s", ""); ti_eir_struct_subtree = proto_item_add_subtree(ti_eir_struct, ett_eir_struct_subtree); - type = tvb_get_guint8(tvb, offset+i+1); + type = tvb_get_guint8(tvb, offset + i + 1); proto_item_append_text(ti_eir_struct,"%s", val_to_str_ext_const(type, &bthci_cmd_eir_data_type_vals_ext, "Unknown")); - proto_tree_add_item(ti_eir_struct_subtree,hf_bthci_evt_eir_struct_length, tvb, offset+i, 1, ENC_LITTLE_ENDIAN); - proto_tree_add_item(ti_eir_struct_subtree,hf_bthci_evt_eir_struct_type, tvb, offset+i+1, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(ti_eir_struct_subtree,hf_bthci_evt_eir_struct_length, tvb, offset + i, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(ti_eir_struct_subtree,hf_bthci_evt_eir_struct_type, tvb, offset + i + 1, 1, ENC_LITTLE_ENDIAN); switch(type) { case 0x01: /* Flags */ - if(length-1 > 0) + if (length > 1) { proto_tree_add_item(ti_eir_struct_subtree, hf_bthci_evt_flags_limited_disc_mode, tvb, offset+i+2, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(ti_eir_struct_subtree, hf_bthci_evt_flags_general_disc_mode, tvb, offset+i+2, 1, ENC_LITTLE_ENDIAN); @@ -1635,10 +1639,10 @@ dissect_bthci_evt_eir_ad_data(tvbuff_t *tvb, int offset, packet_info *pinfo, key[3].length = 0; key[3].key = NULL; - device_name = se_alloc(sizeof(device_name_t)); + device_name = (device_name_t *) wmem_new(wmem_file_scope(), device_name_t); device_name->bd_addr_oui = bd_addr[0] << 16 | bd_addr[1] << 8 | bd_addr[2]; device_name->bd_addr_id = bd_addr[3] << 16 | bd_addr[4] << 8 | bd_addr[5]; - device_name->name = se_strdup(name); + device_name->name = wmem_strdup(wmem_file_scope(), name); se_tree_insert32_array(hci_data->bdaddr_to_name_table, key, device_name); } @@ -2194,7 +2198,7 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo key[3].length = 0; key[3].key = NULL; - localhost_bdaddr_entry = se_alloc(sizeof(localhost_bdaddr_entry_t)); + localhost_bdaddr_entry = (localhost_bdaddr_entry_t *) wmem_new(wmem_file_scope(), localhost_bdaddr_entry_t); localhost_bdaddr_entry->interface_id = k_interface_id; localhost_bdaddr_entry->adapter_id = k_adapter_id; memcpy(localhost_bdaddr_entry->bd_addr, bd_addr, 6); @@ -2395,10 +2399,10 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo key[3].length = 0; key[3].key = NULL; - localhost_name_entry = se_alloc(sizeof(localhost_name_entry_t)); + localhost_name_entry = (localhost_name_entry_t *) wmem_new(wmem_file_scope(), localhost_name_entry_t); localhost_name_entry->interface_id = k_interface_id; localhost_name_entry->adapter_id = k_adapter_id; - localhost_name_entry->name = se_strdup(name); + localhost_name_entry->name = wmem_strdup(wmem_file_scope(), name); se_tree_insert32_array(hci_data->localhost_name, key, localhost_name_entry); } @@ -3336,7 +3340,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat evt_code = tvb_get_guint8(tvb, offset); proto_tree_add_item(bthci_evt_tree, hf_bthci_evt_code, tvb, offset, 1, ENC_LITTLE_ENDIAN); - proto_item_append_text(bthci_evt_tree, " - %s", val_to_str(evt_code, evt_code_vals, "Unknown 0x%08x")); + proto_item_append_text(bthci_evt_tree, " - %s", val_to_str_const(evt_code, evt_code_vals, "Unknown 0x%08x")); offset++; param_length = tvb_get_guint8(tvb, offset); @@ -3346,7 +3350,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI_EVT"); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str(evt_code, evt_code_vals, "Unknown 0x%08x")); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(evt_code, evt_code_vals, "Unknown 0x%08x")); if (param_length > 0) { switch(evt_code) { diff --git a/epan/dissectors/packet-bthci_sco.c b/epan/dissectors/packet-bthci_sco.c index 2d22feb5ba..908826731f 100644 --- a/epan/dissectors/packet-bthci_sco.c +++ b/epan/dissectors/packet-bthci_sco.c @@ -41,6 +41,8 @@ static int hf_bthci_sco_data = -1; /* Initialize the subtree pointers */ static gint ett_bthci_sco = -1; +void proto_register_bthci_sco(void); +void proto_reg_handoff_bthci_sco(void); /* Code to actually dissect the packets */ static void @@ -55,7 +57,7 @@ dissect_bthci_sco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) proto_tree_add_item(bthci_sco_tree, hf_bthci_sco_chandle, tvb, offset, 2, ENC_LITTLE_ENDIAN); - offset+=2; + offset += 2; proto_tree_add_item(bthci_sco_tree, hf_bthci_sco_length, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset++; @@ -87,7 +89,7 @@ proto_register_bthci_sco(void) /* Setup protocol subtree array */ static gint *ett[] = { - &ett_bthci_sco, + &ett_bthci_sco }; /* Register the protocol name and description */ diff --git a/epan/dissectors/packet-bthcrp.c b/epan/dissectors/packet-bthcrp.c index c311f586c1..85a14bc467 100644 --- a/epan/dissectors/packet-bthcrp.c +++ b/epan/dissectors/packet-bthcrp.c @@ -102,6 +102,8 @@ static const value_string register_vals[] = { { 0, NULL } }; +void proto_register_bthcrp(void); +void proto_reg_handoff_bthcrp(void); static gint dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, diff --git a/epan/dissectors/packet-bthid.c b/epan/dissectors/packet-bthid.c index 2f8f1d155b..115727ccec 100644 --- a/epan/dissectors/packet-bthid.c +++ b/epan/dissectors/packet-bthid.c @@ -398,6 +398,8 @@ static const value_string keycode_vals[] = { value_string_ext keycode_vals_ext = VALUE_STRING_EXT_INIT(keycode_vals); +void proto_register_bthid(void); +void proto_reg_handoff_bthid(void); static gint dissect_hid_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c index d24d1b192a..860f52a010 100644 --- a/epan/dissectors/packet-btl2cap.c +++ b/epan/dissectors/packet-btl2cap.c @@ -32,6 +32,7 @@ #include <epan/packet.h> #include <epan/expert.h> #include <epan/tap.h> +#include <epan/wmem/wmem.h> #include "packet-bluetooth-hci.h" #include "packet-bthci_acl.h" @@ -372,6 +373,8 @@ static const range_string cid_rvals[] = { { 0, 0, NULL } }; +void proto_register_btl2cap(void); +void proto_reg_handoff_btl2cap(void); static int dissect_comrej(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) @@ -495,7 +498,7 @@ dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t k_cid = scid | ((pinfo->p2p_dir == P2P_DIR_RECV) ? 0x80000000 : 0x00000000); k_frame_number = pinfo->fd->num; - psm_data = se_new(psm_data_t); + psm_data = wmem_new(wmem_file_scope(), psm_data_t); psm_data->scid = (scid | ((pinfo->p2p_dir == P2P_DIR_RECV) ? 0x80000000 : 0x00000000)); psm_data->dcid = 0; psm_data->psm = psm; @@ -1408,11 +1411,11 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree } if (!pinfo->fd->flags.visited) { - mfp = se_new(sdu_reassembly_t); + mfp = wmem_new(wmem_file_scope(), sdu_reassembly_t); mfp->first_frame = pinfo->fd->num; mfp->last_frame = 0; mfp->tot_len = sdulen; - mfp->reassembled = (guint8 *)se_alloc(sdulen); + mfp->reassembled = (guint8 *) wmem_alloc(wmem_file_scope(), sdulen); tvb_memcpy(tvb, mfp->reassembled, offset, sdulen); mfp->cur_off = sdulen; se_tree_insert32(config_data->start_fragments, pinfo->fd->num, mfp); @@ -1637,7 +1640,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 2; acl_data = (bthci_acl_data_t *)pinfo->private_data; - l2cap_data = ep_new(btl2cap_data_t); + l2cap_data = wmem_new(wmem_packet_scope(), btl2cap_data_t); l2cap_data->interface_id = (acl_data) ? acl_data->interface_id : HCI_INTERFACE_AMP; l2cap_data->adapter_id = (acl_data) ? acl_data->adapter_id : HCI_ADAPTER_DEFAULT; @@ -1947,7 +1950,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static int btl2cap_sdp_tap_packet(void *arg _U_, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *arg2) { - btsdp_data_t *sdp_data = (btsdp_data_t *) arg2; + const btsdp_data_t *sdp_data = (const btsdp_data_t *) arg2; if (sdp_data->protocol == BTSDP_L2CAP_PROTOCOL_UUID) { psm_service_t *psm_service; @@ -1994,7 +1997,7 @@ btl2cap_sdp_tap_packet(void *arg _U_, packet_info *pinfo _U_, epan_dissect_t *ed psm_service->adapter_id == adapter_id && psm_service->chandle == chandle && psm_service->psm == psm)) { - psm_service = se_new0(psm_service_t); + psm_service = wmem_new(wmem_file_scope(), psm_service_t); psm_service->interface_id = interface_id; psm_service->adapter_id = adapter_id; psm_service->chandle = chandle; @@ -2468,7 +2471,7 @@ proto_register_btl2cap(void) }; /* Register the protocol name and description */ - proto_btl2cap = proto_register_protocol("Bluetooth L2CAP Protocol", "L2CAP", "btl2cap"); + proto_btl2cap = proto_register_protocol("Bluetooth L2CAP Protocol", "BT L2CAP", "btl2cap"); register_dissector("btl2cap", dissect_btl2cap, proto_btl2cap); diff --git a/epan/dissectors/packet-btmcap.c b/epan/dissectors/packet-btmcap.c index 75121ff027..3c0cc88d1f 100644 --- a/epan/dissectors/packet-btmcap.c +++ b/epan/dissectors/packet-btmcap.c @@ -91,6 +91,9 @@ static const value_string response_code_vals[] = { { 0, NULL } }; +void proto_register_btmcap(void); +void proto_reg_handoff_btmcap(void); + static void dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { diff --git a/epan/dissectors/packet-btobex.c b/epan/dissectors/packet-btobex.c index a2aa907e02..9877b269cd 100644 --- a/epan/dissectors/packet-btobex.c +++ b/epan/dissectors/packet-btobex.c @@ -31,6 +31,7 @@ #include <epan/reassemble.h> #include <epan/tap.h> #include <epan/expert.h> +#include <epan/wmem/wmem.h> #include "packet-btrfcomm.h" #include "packet-btl2cap.h" @@ -545,6 +546,9 @@ static value_string_ext pbap_application_parameters_vals_ext = VALUE_STRING_EXT_ static value_string_ext bpp_application_parameters_vals_ext = VALUE_STRING_EXT_INIT(bpp_application_parameters_vals); static value_string_ext bip_application_parameters_vals_ext = VALUE_STRING_EXT_INIT(bip_application_parameters_vals); +void proto_register_btobex(void); +void proto_reg_handoff_btobex(void); + static void defragment_init(void) { @@ -593,7 +597,7 @@ display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, char **data) * Allocate a buffer for the string; "len" is the length in * bytes, not the length in characters. */ - str = (char *)ep_alloc(len/2); + str = (char *) wmem_alloc(wmem_packet_scope(), len / 2); /* - this assumes the string is just ISO 8859-1 */ charoffset = offset; @@ -1093,7 +1097,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree_add_item(hdr_tree, hf_hdr_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - if ((item_length - 3) > 0) { + if (item_length > 3) { char *str; display_unicode_string(tvb, hdr_tree, offset, &str); @@ -1197,7 +1201,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo, key[5].length = 0; key[5].key = NULL; - obex_profile_data = se_new(obex_profile_data_t); + obex_profile_data = wmem_new(wmem_file_scope(), obex_profile_data_t); obex_profile_data->interface_id = interface_id; obex_profile_data->adapter_id = adapter_id; obex_profile_data->chandle = chandle; @@ -1271,7 +1275,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) save_fragmented = pinfo->fragmented; if (!pinfo->fd->flags.visited && pinfo->layer_names && !g_strrstr(pinfo->layer_names->str, "btrfcomm")) { - se_tree_insert32(obex_over_l2cap, pinfo->fd->num, (void *) "l2cap"); + se_tree_insert32(obex_over_l2cap, pinfo->fd->num, (void *) TRUE); } else { is_obex_over_l2cap = se_tree_lookup32(obex_over_l2cap, pinfo->fd->num) ? TRUE : FALSE; } @@ -1451,7 +1455,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) key[6].length = 0; key[6].key = NULL; - obex_last_opcode_data = se_new(obex_last_opcode_data_t); + obex_last_opcode_data = wmem_new(wmem_file_scope(), obex_last_opcode_data_t); obex_last_opcode_data->interface_id = interface_id; obex_last_opcode_data->adapter_id = adapter_id; obex_last_opcode_data->chandle = chandle; diff --git a/epan/dissectors/packet-btrfcomm.c b/epan/dissectors/packet-btrfcomm.c index 4ab31921f7..0275675209 100644 --- a/epan/dissectors/packet-btrfcomm.c +++ b/epan/dissectors/packet-btrfcomm.c @@ -37,6 +37,7 @@ #include <epan/expert.h> #include <epan/tap.h> #include <epan/uat.h> +#include <epan/wmem/wmem.h> #include "packet-btsdp.h" #include "packet-btl2cap.h" @@ -235,6 +236,13 @@ static const value_string vs_cr[] = { {0, NULL} }; +void proto_register_btrfcomm(void); +void proto_reg_handoff_btrfcomm(void); +void proto_register_btdun(void); +void proto_reg_handoff_btdun(void); +void proto_register_btspp(void); +void proto_reg_handoff_btspp(void); + static dissector_handle_t find_proto_by_channel(guint channel) { guint i_channel; @@ -337,7 +345,7 @@ dissect_ctrl_pn(packet_info *pinfo, proto_tree *t, tvbuff_t *tvb, int offset, in dlci_state = (dlci_state_t *)se_tree_lookup32(dlci_table, token); if (!dlci_state) { - dlci_state = se_new0(dlci_state_t); + dlci_state = wmem_new0(wmem_file_scope(), dlci_state_t); se_tree_insert32(dlci_table, token, dlci_state); } @@ -608,7 +616,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dlci_state = (dlci_state_t *)se_tree_lookup32(dlci_table, token); if (!dlci_state) { - dlci_state = se_new0(dlci_state_t); + dlci_state = wmem_new0(wmem_file_scope(), dlci_state_t); se_tree_insert32(dlci_table, token, dlci_state); } } @@ -977,7 +985,7 @@ proto_register_btrfcomm(void) static int btrfcomm_sdp_tap_packet(void *arg _U_, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *arg2) { - btsdp_data_t *sdp_data = (btsdp_data_t *) arg2; + const btsdp_data_t *sdp_data = (const btsdp_data_t *) arg2; if (sdp_data->protocol == BTSDP_RFCOMM_PROTOCOL_UUID) { guint32 token; @@ -988,7 +996,7 @@ btrfcomm_sdp_tap_packet(void *arg _U_, packet_info *pinfo _U_, epan_dissect_t *e dlci_state = (dlci_state_t *)se_tree_lookup32(dlci_table, token); if (!dlci_state) { - dlci_state = se_new0(dlci_state_t); + dlci_state = wmem_new0(wmem_file_scope(), dlci_state_t); se_tree_insert32(dlci_table, token, dlci_state); } dlci_state->service = sdp_data->service; diff --git a/epan/dissectors/packet-btsap.c b/epan/dissectors/packet-btsap.c index 5595cb2efb..829b64425d 100644 --- a/epan/dissectors/packet-btsap.c +++ b/epan/dissectors/packet-btsap.c @@ -29,6 +29,7 @@ #include <epan/packet.h> #include <epan/prefs.h> #include <epan/expert.h> +#include <epan/wmem/wmem.h> #include "packet-btl2cap.h" #include "packet-btsdp.h" @@ -36,7 +37,7 @@ enum { TOP_DISSECT_OFF = 0, TOP_DISSECT_INTERNAL = 1, - TOP_DISSECT_TOP = 2, + TOP_DISSECT_TOP = 2 }; enum { @@ -76,11 +77,11 @@ static int hf_btsap_parameter_card_reader_status_card_powered = -1; static int hf_btsap_data = -1; -static int top_dissect = TOP_DISSECT_INTERNAL; - static gint ett_btsap = -1; static gint ett_btsap_parameter = -1; +static gint top_dissect = TOP_DISSECT_INTERNAL; + static dissector_handle_t gsm_sim_cmd_handle; static dissector_handle_t gsm_sim_resp_handle; static dissector_handle_t iso7816_atr_handle; @@ -169,24 +170,28 @@ static const enum_val_t pref_top_dissect[] = { { NULL, NULL, 0 } }; -static unsigned int -dissect_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, proto_tree *tree, unsigned int offset, guint8 *parameter, unsigned int *parameter_offset) +void proto_register_btsap(void); +void proto_reg_handoff_btsap(void); + +static gint +dissect_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, + proto_tree *tree, gint offset, guint8 *parameter, gint *parameter_offset) { - unsigned int parameter_id; - unsigned int parameter_length; - unsigned int parameter_padding_length; - unsigned int padding_length; - unsigned int length; + proto_item *parameter_item; + proto_item *pitem; + proto_tree *ptree; + tvbuff_t *next_tvb; + guint parameter_id; + guint parameter_length; + guint parameter_padding_length; + guint padding_length; + guint length; guint16 max_msg_size; guint8 connection_status; guint8 result_code; guint8 disconnection_type; guint8 status_change; guint8 transport_protocol; - proto_item *parameter_item = NULL; - proto_item *pitem = NULL; - proto_tree *ptree = NULL; - tvbuff_t *next_tvb; parameter_id = tvb_get_guint8(tvb, offset); parameter_length = tvb_get_ntohs(tvb, offset + 2); @@ -372,22 +377,21 @@ dissect_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, proto return offset; } -/* Code to actually dissect the packets */ static void dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; - proto_tree *btsap_tree; - unsigned int offset = 0; - unsigned int msg_id; - unsigned int number_of_parameters; - unsigned int i_parameter; - guint8 *parameters; - unsigned int *parameter_offsets; - unsigned int parameters_check = 0; - unsigned int required_parameters = 0; - unsigned int i_next_parameter; - proto_item *pitem; + proto_item *ti; + proto_tree *btsap_tree; + guint offset = 0; + guint msg_id; + guint number_of_parameters; + guint8 *parameters; + gint *parameter_offsets; + guint parameters_check = 0; + guint required_parameters = 0; + guint i_parameter; + guint i_next_parameter; + proto_item *pitem; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SAP"); @@ -428,8 +432,8 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(btsap_tree, hf_btsap_header_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - parameters = ep_alloc(number_of_parameters * sizeof(guint8)); - parameter_offsets = ep_alloc(number_of_parameters * sizeof(unsigned int)); + parameters = (guint8 *) wmem_alloc(wmem_packet_scope(), number_of_parameters * sizeof(guint8)); + parameter_offsets = (gint *) wmem_alloc0(wmem_packet_scope(), number_of_parameters * sizeof(guint)); for (i_parameter = 0; i_parameter < number_of_parameters; ++i_parameter) { offset = dissect_parameter(tvb, pinfo, tree, btsap_tree, offset, ¶meters[i_parameter], ¶meter_offsets[i_parameter]); diff --git a/epan/dissectors/packet-btsmp.c b/epan/dissectors/packet-btsmp.c index b2ff355102..40c6b60a26 100644 --- a/epan/dissectors/packet-btsmp.c +++ b/epan/dissectors/packet-btsmp.c @@ -113,6 +113,9 @@ static const value_string reason_vals[] = { {0x0, NULL} }; +void proto_register_btsmp(void); +void proto_reg_handoff_btsmp(void); + static int dissect_btsmp_auth_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { @@ -121,16 +124,16 @@ dissect_btsmp_auth_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree guint8 param; param = tvb_get_guint8(tvb, offset); - ti_param=proto_tree_add_text(tree, tvb, offset, 1, "AuthReq: "); - st_param=proto_item_add_subtree(ti_param, ett_btsmp_auth_req); + ti_param = proto_tree_add_text(tree, tvb, offset, 1, "AuthReq: "); + st_param = proto_item_add_subtree(ti_param, ett_btsmp_auth_req); proto_tree_add_item(st_param, hf_btsmp_bonding_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti_param, "%s, ", val_to_str(param&0x03, bonding_flag_vals, "<unknown>")); + proto_item_append_text(ti_param, "%s, ", val_to_str_const(param & 0x03, bonding_flag_vals, "<unknown>")); proto_tree_add_item(st_param, hf_btsmp_mitm_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti_param, "%s", (param&0x04)?"MITM":"No MITM"); + proto_item_append_text(ti_param, "%s", (param & 0x04) ? "MITM" : "No MITM"); - col_append_fstr(pinfo->cinfo, COL_INFO, "%s, %s", val_to_str(param&0x03, bonding_flag_vals, "<unknown>"), (param&0x04)?"MITM":"No MITM"); + col_append_fstr(pinfo->cinfo, COL_INFO, "%s, %s", val_to_str_const(param & 0x03, bonding_flag_vals, "<unknown>"), (param & 0x04) ? "MITM" : "No MITM"); - return offset+1; + return offset + 1; } static int @@ -139,35 +142,35 @@ dissect_btsmp_key_dist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree proto_item *ti_param; proto_tree *st_param; guint8 param; - + param = tvb_get_guint8(tvb, offset); - if(initiator) { + if (initiator) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Initiator Key(s): "); - ti_param=proto_tree_add_text(tree, tvb, offset, 1, "Initiator Key Distribution: "); + ti_param = proto_tree_add_text(tree, tvb, offset, 1, "Initiator Key Distribution: "); } else { col_append_fstr(pinfo->cinfo, COL_INFO, ", Responder Key(s): "); - ti_param=proto_tree_add_text(tree, tvb, offset, 1, "Responder Key Distribution: "); + ti_param = proto_tree_add_text(tree, tvb, offset, 1, "Responder Key Distribution: "); } - - st_param=proto_item_add_subtree(ti_param, ett_btsmp_key_dist); + + st_param = proto_item_add_subtree(ti_param, ett_btsmp_key_dist); proto_tree_add_item(st_param, hf_btsmp_key_dist_enc, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(st_param, hf_btsmp_key_dist_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(st_param, hf_btsmp_key_dist_sign, tvb, offset, 1, ENC_LITTLE_ENDIAN); - if( param & 0x01 ) { + if (param & 0x01) { proto_item_append_text(ti_param, "LTK "); col_append_fstr(pinfo->cinfo, COL_INFO, "LTK "); } - if( param & 0x02 ) { + if (param & 0x02) { proto_item_append_text(ti_param, "IRK "); col_append_fstr(pinfo->cinfo, COL_INFO, "IRK "); } - if( param & 0x04 ) { + if (param & 0x04) { proto_item_append_text(ti_param, "CSRK "); col_append_fstr(pinfo->cinfo, COL_INFO, "CSRK "); } - return offset+1; + return offset + 1; } static void @@ -179,7 +182,7 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 opcode; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMP"); - + switch (pinfo->p2p_dir) { case P2P_DIR_SENT: @@ -209,21 +212,21 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) opcode = tvb_get_guint8(tvb, 0); offset++; - col_append_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(opcode, opcode_vals, "<unknown>")); + col_append_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(opcode, opcode_vals, "<unknown>")); switch (opcode) { case 0x01: /* Pairing Request */ case 0x02: /* Pairing Response */ { col_append_fstr(pinfo->cinfo, COL_INFO, ": "); - + proto_tree_add_item(st, hf_btsmp_io_capabilities, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset++; proto_tree_add_item(st, hf_btsmp_oob_data_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset++; offset = dissect_btsmp_auth_req(tvb, offset, pinfo, st); - + proto_tree_add_item(st, hf_btsmp_max_enc_key_size, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset++; @@ -241,10 +244,10 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(st, hf_btsmp_random, tvb, offset, 16, ENC_NA); offset += 16; break; - + case 0x05: /* Pairing Failed */ proto_tree_add_item(st, hf_btsmp_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN); - col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str(tvb_get_guint8(tvb, offset), reason_vals, "<unknown>")); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_const(tvb_get_guint8(tvb, offset), reason_vals, "<unknown>")); offset++; break; @@ -274,7 +277,7 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, ": "); offset = dissect_btsmp_auth_req(tvb, offset, pinfo, st); break; - + default: break; } @@ -282,86 +285,86 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_register_btsmp(void) -{ +{ static hf_register_info hf[] = { {&hf_btsmp_opcode, {"Opcode", "btsmp.opcode", - FT_UINT8, BASE_HEX, VALS(opcode_vals), 0x0, + FT_UINT8, BASE_HEX, VALS(opcode_vals), 0x0, NULL, HFILL} }, {&hf_btsmp_reason, {"Reason", "btsmp.reason", - FT_UINT8, BASE_HEX, VALS(reason_vals), 0x0, + FT_UINT8, BASE_HEX, VALS(reason_vals), 0x0, NULL, HFILL} }, {&hf_btsmp_io_capabilities, {"IO Capability", "btsmp.io_capability", - FT_UINT8, BASE_HEX, VALS(io_capability_vals), 0x0, + FT_UINT8, BASE_HEX, VALS(io_capability_vals), 0x0, NULL, HFILL} }, {&hf_btsmp_oob_data_flags, {"OOB Data Flags", "btsmp.oob_data_flags", - FT_UINT8, BASE_HEX, VALS(oob_data_flag_vals), 0x0, + FT_UINT8, BASE_HEX, VALS(oob_data_flag_vals), 0x0, NULL, HFILL} }, {&hf_btsmp_cfm_value, {"Confirm Value", "btsmp.cfm_value", - FT_BYTES, BASE_NONE, NULL, 0x0, + FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, {&hf_btsmp_random, {"Random Value", "btsmp.random_value", - FT_BYTES, BASE_NONE, NULL, 0x0, + FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, {&hf_btsmp_long_term_key, {"Long Term Key", "btsmp.long_term_key", - FT_BYTES, BASE_NONE, NULL, 0x0, + FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, {&hf_btsmp_id_resolving_key, {"Identity Resolving Key", "btsmp.id_resolving_key", - FT_BYTES, BASE_NONE, NULL, 0x0, + FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, {&hf_btsmp_signature_key, {"Signature Key", "btsmp.signature_key", - FT_BYTES, BASE_NONE, NULL, 0x0, + FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, {&hf_btsmp_bonding_flags, {"Bonding Flags", "btsmp.bonding_flags", - FT_UINT8, BASE_HEX, VALS(bonding_flag_vals), 0x03, + FT_UINT8, BASE_HEX, VALS(bonding_flag_vals), 0x03, NULL, HFILL} }, {&hf_btsmp_mitm_flag, {"MITM Flag", "btsmp.mitm_flag", - FT_UINT8, BASE_DEC, NULL, 0x04, + FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL} }, {&hf_btsmp_max_enc_key_size, {"Max Encryption Key Size", "btsmp.max_enc_key_size", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL} }, {&hf_btsmp_key_dist_enc, {"Encryption Key (LTK)", "btsmp.key_dist_enc", - FT_UINT8, BASE_DEC, NULL, 0x01, + FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL} }, {&hf_btsmp_key_dist_id, {"Id Key (IRK)", "btsmp.key_dist_id", - FT_UINT8, BASE_DEC, NULL, 0x02, + FT_UINT8, BASE_DEC, NULL, 0x02, NULL, HFILL} }, {&hf_btsmp_key_dist_sign, {"Signature Key (CSRK)", "btsmp.key_dist_sign", - FT_UINT8, BASE_DEC, NULL, 0x04, + FT_UINT8, BASE_DEC, NULL, 0x04, NULL, HFILL} }, {&hf_btsmp_ediv, {"Encrypted Diversifier (EDIV)", "btsmp.ediv", - FT_UINT16, BASE_HEX, NULL, 0x00, + FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL} } }; @@ -405,4 +408,3 @@ proto_reg_handoff_btsmp(void) * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */ - diff --git a/epan/dissectors/packet-hci_h1.c b/epan/dissectors/packet-hci_h1.c index 0539ada1f4..d5f9dc1239 100644 --- a/epan/dissectors/packet-hci_h1.c +++ b/epan/dissectors/packet-hci_h1.c @@ -25,6 +25,7 @@ #include "config.h" #include <epan/packet.h> +#include <epan/wmem/wmem.h> #include "packet-bluetooth-hci.h" @@ -56,12 +57,15 @@ static const value_string hci_h1_direction_vals[] = { {0, NULL} }; +void proto_register_hci_h1(void); +void proto_reg_handoff_hci_h1(void); + static void dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 type; tvbuff_t *next_tvb; - proto_item *ti=NULL; + proto_item *ti = NULL; proto_tree *hci_h1_tree = NULL; void *pd_save; hci_data_t *hci_data; @@ -72,7 +76,7 @@ dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) type = pinfo->pseudo_header->bthci.channel; - if(tree){ + if (tree) { ti = proto_tree_add_item(tree, proto_hci_h1, tvb, 0, 0, ENC_NA); hci_h1_tree = proto_item_add_subtree(ti, ett_hci_h1); @@ -106,7 +110,7 @@ dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } pd_save = pinfo->private_data; - hci_data = ep_alloc(sizeof(hci_data_t)); + hci_data = wmem_new(wmem_packet_scope(),hci_data_t); hci_data->interface_id = HCI_INTERFACE_H4; hci_data->adapter_id = HCI_ADAPTER_DEFAULT; hci_data->chandle_to_bdaddr_table = chandle_to_bdaddr_table; @@ -115,11 +119,11 @@ dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hci_data->localhost_name = localhost_name; pinfo->private_data = hci_data; - ti=proto_tree_add_int(hci_h1_tree, hf_hci_h1_direction, tvb, 0, 0, pinfo->p2p_dir); + ti = proto_tree_add_int(hci_h1_tree, hf_hci_h1_direction, tvb, 0, 0, pinfo->p2p_dir); PROTO_ITEM_SET_GENERATED(ti); next_tvb = tvb_new_subset_remaining(tvb, 0); - if(!dissector_try_uint(hci_h1_table, type, next_tvb, pinfo, tree)) { + if (!dissector_try_uint(hci_h1_table, type, next_tvb, pinfo, tree)) { call_dissector(data_handle, next_tvb, pinfo, tree); } @@ -149,7 +153,7 @@ proto_register_hci_h1(void) &ett_hci_h1, }; - proto_hci_h1 = proto_register_protocol("Bluetooth HCI", + proto_hci_h1 = proto_register_protocol("Bluetooth HCI H1", "HCI_H1", "hci_h1"); register_dissector("hci_h1", dissect_hci_h1, proto_hci_h1); diff --git a/epan/dissectors/packet-hci_h4.c b/epan/dissectors/packet-hci_h4.c index 418ff945bf..748504d199 100644 --- a/epan/dissectors/packet-hci_h4.c +++ b/epan/dissectors/packet-hci_h4.c @@ -31,6 +31,7 @@ #include "config.h" #include <epan/packet.h> +#include <epan/wmem/wmem.h> #include "packet-bluetooth-hci.h" @@ -62,6 +63,9 @@ static const value_string hci_h4_direction_vals[] = { {0, NULL} }; +void proto_register_hci_h4(void); +void proto_reg_handoff_hci_h4(void); + static void dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -94,13 +98,13 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) type = tvb_get_guint8(tvb, 0); - if(tree){ + if (tree) { ti = proto_tree_add_item(tree, proto_hci_h4, tvb, 0, 1, ENC_NA); hci_h4_tree = proto_item_add_subtree(ti, ett_hci_h4); } pd_save = pinfo->private_data; - hci_data = ep_alloc(sizeof(hci_data_t)); + hci_data = (hci_data_t *) wmem_new(wmem_packet_scope(), hci_data_t); hci_data->interface_id = HCI_INTERFACE_H4; hci_data->adapter_id = HCI_ADAPTER_DEFAULT; hci_data->chandle_to_bdaddr_table = chandle_to_bdaddr_table; @@ -109,7 +113,7 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hci_data->localhost_name = localhost_name; pinfo->private_data = hci_data; - ti=proto_tree_add_uint(hci_h4_tree, hf_hci_h4_direction, tvb, 0, 0, pinfo->p2p_dir); + ti = proto_tree_add_uint(hci_h4_tree, hf_hci_h4_direction, tvb, 0, 0, pinfo->p2p_dir); PROTO_ITEM_SET_GENERATED(ti); proto_tree_add_item(hci_h4_tree, hf_hci_h4_type, @@ -118,7 +122,7 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) val_to_str(type, hci_h4_type_vals, "Unknown HCI packet type 0x%02x")); next_tvb = tvb_new_subset_remaining(tvb, 1); - if(!dissector_try_uint(hci_h4_table, type, next_tvb, pinfo, tree)) { + if (!dissector_try_uint(hci_h4_table, type, next_tvb, pinfo, tree)) { call_dissector(data_handle, next_tvb, pinfo, tree); } diff --git a/epan/dissectors/packet-hci_usb.c b/epan/dissectors/packet-hci_usb.c index 111472c37a..cc833fe552 100644 --- a/epan/dissectors/packet-hci_usb.c +++ b/epan/dissectors/packet-hci_usb.c @@ -29,6 +29,7 @@ #include <epan/packet.h> #include <epan/prefs.h> #include <epan/reassemble.h> +#include <epan/wmem/wmem.h> #include "packet-usb.h" #include "packet-bluetooth-hci.h" @@ -88,6 +89,8 @@ static const fragment_items hci_usb_msg_frag_items = { "Message fragments" }; +void proto_register_hci_usb(void); +void proto_reg_handoff_hci_usb(void); static int dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) @@ -138,7 +141,7 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data session_id = usb_data->bus_id << 16 | usb_data->device_address << 8 | ((pinfo->p2p_dir == P2P_DIR_RECV) ? 1 : 0 ) << 7 | usb_data->endpoint; - hci_data = ep_alloc(sizeof(hci_data_t)); + hci_data = (hci_data_t *) wmem_new(wmem_packet_scope(), hci_data_t); hci_data->interface_id = HCI_INTERFACE_USB; hci_data->adapter_id = usb_data->bus_id << 8 | usb_data->device_address; hci_data->chandle_to_bdaddr_table = chandle_to_bdaddr_table; @@ -151,9 +154,9 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data if (!pinfo->fd->flags.visited && usb_data->endpoint <= 0x02) { fragment_info_t *fragment_info; - fragment_info = se_tree_lookup32(fragment_info_table, session_id); + fragment_info = (fragment_info_t *) se_tree_lookup32(fragment_info_table, session_id); if (fragment_info == NULL) { - fragment_info = se_alloc(sizeof(fragment_info_t)); + fragment_info = (fragment_info_t *) wmem_new(wmem_file_scope(), fragment_info_t); fragment_info->fragment_id = 0; fragment_info->remaining_length = 0; |