From cbda60f7f5aabcccacc0005399bb2e1e86a1e884 Mon Sep 17 00:00:00 2001 From: Michal Labedzki Date: Wed, 16 Dec 2015 18:19:55 +0100 Subject: [PATCH] Bluetooth: GATT: Add support for OTS/OTP OTS/OTP is the newset "profile" announced by Bluetooth SIG. It name describe what it doing: Object Transfer Service/Profile, so it is something like OPP. While we are at this move some HID attributes to get right order in switch-case. Change-Id: I460963a422c7292b2cabf7e88f32dbd6e8d7051f Reviewed-on: https://code.wireshark.org/review/13735 Petri-Dish: Michal Labedzki Tested-by: Petri Dish Buildbot Reviewed-by: Michal Labedzki --- debian/libwireshark0.symbols | 2 + epan/dissectors/packet-btatt.c | 757 ++++++++++++++++++++++++++++-- epan/dissectors/packet-icq.c | 2 - epan/dissectors/packet-zbee-zcl.c | 4 - epan/tfs.c | 2 + epan/tfs.h | 2 + 6 files changed, 729 insertions(+), 40 deletions(-) diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index 3f482aef29..32df3dda32 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -1334,6 +1334,7 @@ libwireshark.so.0 libwireshark0 #MINVER# tfs_asynchronous_synchronous@Base 1.99.1 tfs_available_not_available@Base 1.9.1 tfs_capable_not_capable@Base 1.9.1 + tfs_client_server@Base 2.1.0 tfs_command_response@Base 1.9.1 tfs_complete_incomplete@Base 1.12.0~rc1 tfs_confirmed_unconfirmed@Base 1.12.0~rc1 @@ -1373,6 +1374,7 @@ libwireshark.so.0 libwireshark0 #MINVER# tfs_required_not_required@Base 1.99.0 tfs_response_request@Base 1.99.8 tfs_restricted_allowed@Base 1.9.1 + tfs_server_client@Base 2.1.0 tfs_set_notset@Base 1.9.1 tfs_shared_independent@Base 1.9.1 tfs_success_fail@Base 1.9.1 diff --git a/epan/dissectors/packet-btatt.c b/epan/dissectors/packet-btatt.c index c4b7c2b8b4..b12a65671d 100644 --- a/epan/dissectors/packet-btatt.c +++ b/epan/dissectors/packet-btatt.c @@ -843,6 +843,62 @@ static int hf_btatt_tds_opcode = -1; static int hf_btatt_tds_result_code = -1; static int hf_btatt_tds_organization_id = -1; static int hf_btatt_tds_data = -1; +static int hf_btatt_ots_feature_oacp = -1; +static int hf_btatt_ots_feature_oacp_reserved = -1; +static int hf_btatt_ots_feature_oacp_abort = -1; +static int hf_btatt_ots_feature_oacp_patching_of_object = -1; +static int hf_btatt_ots_feature_oacp_truncation_of_objects = -1; +static int hf_btatt_ots_feature_oacp_appending_additional_data_to_object = -1; +static int hf_btatt_ots_feature_oacp_write = -1; +static int hf_btatt_ots_feature_oacp_read = -1; +static int hf_btatt_ots_feature_oacp_execute = -1; +static int hf_btatt_ots_feature_oacp_calculate_checksum = -1; +static int hf_btatt_ots_feature_oacp_delete = -1; +static int hf_btatt_ots_feature_oacp_create = -1; +static int hf_btatt_ots_feature_olcp = -1; +static int hf_btatt_ots_feature_olcp_reserved = -1; +static int hf_btatt_ots_feature_olcp_clear_marking = -1; +static int hf_btatt_ots_feature_olcp_request_number_of_objects = -1; +static int hf_btatt_ots_feature_olcp_order = -1; +static int hf_btatt_ots_feature_olcp_go_to = -1; +static int hf_btatt_ots_object_name = -1; +static int hf_btatt_ots_current_size = -1; +static int hf_btatt_ots_allocated_size = -1; +static int hf_btatt_ots_object_id = -1; +static int hf_btatt_ots_properties = -1; +static int hf_btatt_ots_properties_reserved = -1; +static int hf_btatt_ots_properties_mark = -1; +static int hf_btatt_ots_properties_patch = -1; +static int hf_btatt_ots_properties_truncate = -1; +static int hf_btatt_ots_properties_append = -1; +static int hf_btatt_ots_properties_write = -1; +static int hf_btatt_ots_properties_read = -1; +static int hf_btatt_ots_properties_execute = -1; +static int hf_btatt_ots_properties_delete = -1; +static int hf_btatt_ots_flags = -1; +static int hf_btatt_ots_flags_reserved = -1; +static int hf_btatt_ots_flags_object_deletion = -1; +static int hf_btatt_ots_flags_object_creation = -1; +static int hf_btatt_ots_flags_change_occured_to_the_object_metadata = -1; +static int hf_btatt_ots_flags_change_occured_to_the_object_contents = -1; +static int hf_btatt_ots_flags_source_of_change = -1; +static int hf_btatt_ots_action_opcode = -1; +static int hf_btatt_ots_size = -1; +static int hf_btatt_ots_offset = -1; +static int hf_btatt_ots_length = -1; +static int hf_btatt_ots_execute_data = -1; +static int hf_btatt_ots_action_response_opcode = -1; +static int hf_btatt_ots_action_result_code = -1; +static int hf_btatt_ots_checksum = -1; +static int hf_btatt_ots_list_opcode = -1; +static int hf_btatt_ots_list_order = -1; +static int hf_btatt_ots_list_response_opcode = -1; +static int hf_btatt_ots_list_result_code = -1; +static int hf_btatt_ots_list_total_number_of_objects = -1; +static int hf_btatt_ots_filter = -1; +static int hf_btatt_ots_name_string = -1; +static int hf_btatt_ots_size_from = -1; +static int hf_btatt_ots_size_to = -1; static int hf_gatt_nordic_uart_tx = -1; static int hf_gatt_nordic_uart_rx = -1; static int hf_gatt_nordic_dfu_packet = -1; @@ -1511,6 +1567,54 @@ static const int *hfx_btatt_http_data_status[] = { NULL }; +static const int *hfx_btatt_ots_feature_oacp[] = { + &hf_btatt_ots_feature_oacp_reserved, + &hf_btatt_ots_feature_oacp_abort, + &hf_btatt_ots_feature_oacp_patching_of_object, + &hf_btatt_ots_feature_oacp_truncation_of_objects, + &hf_btatt_ots_feature_oacp_appending_additional_data_to_object, + &hf_btatt_ots_feature_oacp_write, + &hf_btatt_ots_feature_oacp_read, + &hf_btatt_ots_feature_oacp_execute, + &hf_btatt_ots_feature_oacp_calculate_checksum, + &hf_btatt_ots_feature_oacp_delete, + &hf_btatt_ots_feature_oacp_create, + NULL +}; + +static const int *hfx_btatt_ots_feature_olcp[] = { + &hf_btatt_ots_feature_olcp_reserved, + &hf_btatt_ots_feature_olcp_clear_marking, + &hf_btatt_ots_feature_olcp_request_number_of_objects, + &hf_btatt_ots_feature_olcp_order, + &hf_btatt_ots_feature_olcp_go_to, + NULL +}; + +static const int *hfx_btatt_ots_properties[] = { + &hf_btatt_ots_properties_reserved, + &hf_btatt_ots_properties_mark, + &hf_btatt_ots_properties_patch, + &hf_btatt_ots_properties_truncate, + &hf_btatt_ots_properties_append, + &hf_btatt_ots_properties_write, + &hf_btatt_ots_properties_read, + &hf_btatt_ots_properties_execute, + &hf_btatt_ots_properties_delete, + NULL +}; + + +static const int *hfx_btatt_ots_flags[] = { + &hf_btatt_ots_flags_reserved, + &hf_btatt_ots_flags_object_deletion, + &hf_btatt_ots_flags_object_creation, + &hf_btatt_ots_flags_change_occured_to_the_object_metadata, + &hf_btatt_ots_flags_change_occured_to_the_object_contents, + &hf_btatt_ots_flags_source_of_change, + NULL +}; + /* Initialize the subtree pointers */ static gint ett_btatt = -1; static gint ett_btatt_list = -1; @@ -1529,6 +1633,7 @@ static expert_field ei_btatt_cgm_size_too_small = EI_INIT; static expert_field ei_btatt_opcode_invalid_request = EI_INIT; static expert_field ei_btatt_opcode_invalid_response = EI_INIT; static expert_field ei_btatt_invalid_usage = EI_INIT; +static expert_field ei_btatt_bad_data = EI_INIT; static expert_field ei_btatt_unexpected_data = EI_INIT; static expert_field ei_btatt_undecoded = EI_INIT; @@ -2925,6 +3030,92 @@ static const value_string tds_result_code_vals[] = { {0, NULL } }; +static const value_string ots_action_opcode_vals[] = { + { 0x00, "Reserved" }, + { 0x01, "Create" }, + { 0x02, "Delete" }, + { 0x03, "Calculate Checksum" }, + { 0x04, "Execute" }, + { 0x05, "Read" }, + { 0x06, "Write" }, + { 0x07, "Abort" }, + { 0x60, "Response Code" }, + {0, NULL } +}; + +static const value_string ots_action_result_code_vals[] = { + { 0x00, "Reserved" }, + { 0x01, "Success" }, + { 0x02, "Opcode not Supported" }, + { 0x03, "Invalid Parameter" }, + { 0x04, "Insufficient Resources" }, + { 0x05, "Invalid Object" }, + { 0x06, "Channel Unavailable" }, + { 0x07, "Unsupported Type" }, + { 0x08, "Procedure not Permitted" }, + { 0x09, "Object Locked" }, + { 0x0A, "Operation Failed" }, + {0, NULL } +}; + +static const value_string ots_list_opcode_vals[] = { + { 0x00, "Reserved" }, + { 0x01, "First" }, + { 0x02, "Last" }, + { 0x03, "Previous" }, + { 0x04, "Next" }, + { 0x05, "Go To" }, + { 0x06, "Order" }, + { 0x07, "Request Number of Objects" }, + { 0x08, "Clear Marking" }, + { 0x70, "Response Code" }, + {0, NULL } +}; + +static const value_string ots_list_order_vals[] = { + { 0x00, "Reserved" }, + { 0x01, "Name, Ascending" }, + { 0x02, "Type, Ascending" }, + { 0x03, "Current Size Ascending" }, + { 0x04, "First-created Timestamp, Ascending" }, + { 0x05, "Last-modified Timestamp, Ascending" }, + { 0x11, "Name, Descending" }, + { 0x12, "Type, Descending" }, + { 0x13, "Current Size Descending" }, + { 0x14, "First-created Timestamp, Descending" }, + { 0x15, "Last-modified Timestamp, Descending" }, + {0, NULL } +}; + +static const value_string ots_list_result_code_vals[] = { + { 0x00, "Reserved" }, + { 0x01, "Success" }, + { 0x02, "Opcode not Supported" }, + { 0x03, "Invalid Parameter" }, + { 0x04, "Operation Failed" }, + { 0x05, "Out of Bounds" }, + { 0x06, "Too Many Objects" }, + { 0x07, "No Object" }, + { 0x08, "Object ID not Found" }, + {0, NULL } +}; + +static const value_string ots_filter_vals[] = { + { 0x00, "No Filter" }, + { 0x01, "Name Starts With" }, + { 0x02, "Name Ends With" }, + { 0x03, "Name Contains" }, + { 0x04, "Name is Exactly" }, + { 0x05, "Object Type" }, + { 0x06, "Created Between" }, + { 0x07, "Modified Between" }, + { 0x08, "Current Size Between" }, + { 0x09, "Allocated Size Between" }, + { 0x0A, "Marked Objects" }, + {0, NULL } +}; + + static const true_false_string control_point_mask_value_tfs = { "Leave as Default", "Turn Off" }; @@ -3349,6 +3540,29 @@ static void col_append_info_by_handle(packet_info *pinfo, guint16 handle, blueto } } +static gint dissect_gatt_uuid(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset) +{ + proto_item *sub_item; + bluetooth_uuid_t sub_uuid; + + if (tvb_reported_length_remaining(tvb, offset) == 2) { + proto_tree_add_item(tree, hf_btatt_uuid16, tvb, offset, 2, ENC_LITTLE_ENDIAN); + sub_uuid = get_uuid(tvb, offset, 2); + offset += 2; + } else if (tvb_reported_length_remaining(tvb, offset) == 16) { + sub_item = proto_tree_add_item(tree, hf_btatt_uuid128, tvb, offset, 16, ENC_NA); + sub_uuid = get_uuid(tvb, offset, 16); + proto_item_append_text(sub_item, " (%s)", print_uuid(&sub_uuid)); + offset += 16; + } else { + sub_item = proto_tree_add_item(tree, hf_btatt_value, tvb, offset, -1, ENC_NA); + expert_add_info(pinfo, sub_item, &ei_btatt_bad_data); + offset = tvb_captured_length(tvb); + } + + return offset; +} + static int dissect_handle_uint(proto_tree *tree, packet_info *pinfo, gint hf, tvbuff_t *tvb, gint offset, bluetooth_data_t *bluetooth_data, @@ -3497,7 +3711,8 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * save_handle(pinfo, sub_uuid, handle, ATTRIBUTE_TYPE_SERVICE, bluetooth_data); } else { - proto_tree_add_item(tree, hf_btatt_value, tvb, offset, -1, ENC_NA); + sub_item = proto_tree_add_item(tree, hf_btatt_value, tvb, offset, -1, ENC_NA); + expert_add_info(pinfo, sub_item, &ei_btatt_bad_data); offset = tvb_captured_length(tvb); } @@ -3697,27 +3912,6 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * } break; - case 0x2A4A: /* HOGP: HID Information */ - proto_tree_add_item(tree, hf_btatt_hogp_bcd_hid, tvb, offset, 2, ENC_LITTLE_ENDIAN); - offset += 2; - - proto_tree_add_item(tree, hf_btatt_hogp_b_country_code, tvb, offset, 1, ENC_NA); - offset += 1; - - proto_tree_add_bitmask(tree, tvb, offset, hf_btatt_hogp_flags, ett_btatt_value, hfx_btatt_hogp_flags, ENC_NA); - offset += 1; - - break; - case 0x2A4B: /* HOGP: Report Map */ - offset = dissect_usb_hid_get_report_descriptor(pinfo, tree, tvb, offset, NULL); - - break; - case 0x2A4E: /* HOGP: Protocol Mode */ - proto_tree_add_item(tree, hf_btatt_hogp_protocol_mode, tvb, offset, 1, ENC_NA); - offset += 1; - - break; - case 0x2A00: /* Device Name */ proto_tree_add_item(tree, hf_btatt_device_name, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA | ENC_UTF_8); offset += tvb_captured_length_remaining(tvb, offset); @@ -4344,11 +4538,31 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * proto_tree_add_bitmask(tree, tvb, offset, hf_btatt_blood_pressure_feature, ett_btatt_value, hfx_btatt_blood_pressure_feature, ENC_LITTLE_ENDIAN); offset += 2; + break; + case 0x2A4A: /* HOGP: HID Information */ + proto_tree_add_item(tree, hf_btatt_hogp_bcd_hid, tvb, offset, 2, ENC_LITTLE_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_btatt_hogp_b_country_code, tvb, offset, 1, ENC_NA); + offset += 1; + + proto_tree_add_bitmask(tree, tvb, offset, hf_btatt_hogp_flags, ett_btatt_value, hfx_btatt_hogp_flags, ENC_NA); + offset += 1; + + break; + case 0x2A4B: /* HOGP: Report Map */ + offset = dissect_usb_hid_get_report_descriptor(pinfo, tree, tvb, offset, NULL); + break; case 0x2A4C: /* HID Control Point */ proto_tree_add_item(tree, hf_btatt_hogp_hid_control_point_command, tvb, offset, 1, ENC_NA); offset += 1; + break; + case 0x2A4E: /* HOGP: Protocol Mode */ + proto_tree_add_item(tree, hf_btatt_hogp_protocol_mode, tvb, offset, 1, ENC_NA); + offset += 1; + break; case 0x2A4F: /* Scan Interval Window */ proto_tree_add_item(tree, hf_btatt_le_scan_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -6003,21 +6217,214 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * } break; - - case 0x2ABD: /* OTS Feature */ + proto_tree_add_bitmask(tree, tvb, offset, hf_btatt_ots_feature_oacp, ett_btatt_value, hfx_btatt_ots_feature_oacp, ENC_LITTLE_ENDIAN); + offset += 4; + + proto_tree_add_bitmask(tree, tvb, offset, hf_btatt_ots_feature_olcp, ett_btatt_value, hfx_btatt_ots_feature_olcp, ENC_LITTLE_ENDIAN); + offset += 4; + + break; case 0x2ABE: /* Object Name */ + proto_tree_add_item(tree, hf_btatt_ots_object_name, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA | ENC_UTF_8); + offset += tvb_captured_length_remaining(tvb, offset); + + break; case 0x2ABF: /* Object Type */ + offset = dissect_gatt_uuid(tree, pinfo, tvb, offset); + + break; case 0x2AC0: /* Object Size */ + proto_tree_add_item(tree, hf_btatt_ots_current_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + proto_tree_add_item(tree, hf_btatt_ots_allocated_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + break; case 0x2AC1: /* Object First-Created */ case 0x2AC2: /* Object Last-Modified */ + call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset(tvb, offset, 7, 7), pinfo, tree, NULL); + offset += 7; + + break; case 0x2AC3: /* Object ID */ + proto_tree_add_item(tree, hf_btatt_ots_object_id, tvb, offset, 6, ENC_LITTLE_ENDIAN); + offset += 6; + + break; case 0x2AC4: /* Object Properties */ + proto_tree_add_bitmask(tree, tvb, offset, hf_btatt_ots_properties, ett_btatt_value, hfx_btatt_ots_properties, ENC_LITTLE_ENDIAN); + offset += 4; + + break; case 0x2AC5: /* Object Action Control Point */ + proto_tree_add_item(tree, hf_btatt_ots_action_opcode, tvb, offset, 1, ENC_NA); + opcode = tvb_get_guint8(tvb, offset); + offset += 1; + + switch (opcode) { + case 0x01: /* Create */ + proto_tree_add_item(tree, hf_btatt_ots_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + offset = dissect_gatt_uuid(tree, pinfo, tvb, offset); + + break; + case 0x02: /* Delete */ + case 0x07: /* Abort */ + /* none */ + + break; + case 0x03: /* Calculate Checksum */ + case 0x05: /* Read */ + case 0x06: /* Write */ + proto_tree_add_item(tree, hf_btatt_ots_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + proto_tree_add_item(tree, hf_btatt_ots_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + break; + case 0x04: /* Execute */ + if (tvb_reported_length_remaining(tvb, offset) > 0) { + proto_tree_add_item(tree, hf_btatt_ots_execute_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA | ENC_UTF_8); + offset += tvb_reported_length_remaining(tvb, offset); + } + + break; + case 0x60: /* Response Code */ + proto_tree_add_item(tree, hf_btatt_ots_action_response_opcode, tvb, offset, 1, ENC_NA); + offset += 1; + + proto_tree_add_item(tree, hf_btatt_ots_action_result_code, tvb, offset, 1, ENC_NA); + offset += 1; + + switch (tvb_get_guint8(tvb, offset)) { + case 0x01: /* Create */ + case 0x02: /* Delete */ + case 0x05: /* Read */ + case 0x06: /* Write */ + case 0x07: /* Abort */ + case 0x60: /* Response Code */ + /* none */ + + break; + case 0x03: /* Calculate Checksum */ + proto_tree_add_item(tree, hf_btatt_ots_checksum, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + break; + case 0x04: /* Execute */ + if (tvb_reported_length_remaining(tvb, offset) > 0) { + proto_tree_add_item(tree, hf_btatt_ots_execute_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA | ENC_UTF_8); + offset += tvb_reported_length_remaining(tvb, offset); + } + + break; + } + } + break; case 0x2AC6: /* Object List Control Point */ + proto_tree_add_item(tree, hf_btatt_ots_list_opcode, tvb, offset, 1, ENC_NA); + opcode = tvb_get_guint8(tvb, offset); + offset += 1; + + switch (opcode) { + case 0x01: /* First */ + case 0x02: /* Last */ + case 0x03: /* Previous */ + case 0x04: /* Next */ + case 0x07: /* Request Number of Object */ + case 0x08: /* Clear Marking */ + /* none */ + break; + case 0x05: /* Go To */ + proto_tree_add_item(tree, hf_btatt_ots_object_id, tvb, offset, 6, ENC_LITTLE_ENDIAN); + offset += 6; + + break; + case 0x06: /* Order */ + proto_tree_add_item(tree, hf_btatt_ots_list_order, tvb, offset, 1, ENC_NA); + offset += 1; + + break; + case 0x70: /* Response Code */ + proto_tree_add_item(tree, hf_btatt_ots_list_response_opcode, tvb, offset, 1, ENC_NA); + offset += 1; + + proto_tree_add_item(tree, hf_btatt_ots_list_result_code, tvb, offset, 1, ENC_NA); + offset += 1; + + switch (opcode) { + case 0x01: /* First */ + case 0x02: /* Last */ + case 0x03: /* Previous */ + case 0x04: /* Next */ + case 0x05: /* Go To */ + case 0x06: /* Order */ + case 0x08: /* Clear Marking */ + case 0x70: /* Response Code */ + /* none */ + break; + case 0x07: /* Request Number of Object */ + proto_tree_add_item(tree, hf_btatt_ots_list_total_number_of_objects, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + } + } + + break; case 0x2AC7: /* Object List Filter */ + proto_tree_add_item(tree, hf_btatt_ots_filter, tvb, offset, 1, ENC_NA); + offset += 1; + switch (tvb_get_guint8(tvb, offset - 1)) { + case 0x00: /* No Filter */ + case 0x0A: /* Marked Objects */ + /* none */ + break; + case 0x01: /* Name Starts With */ + case 0x02: /* Name Ends With */ + case 0x03: /* Name Contains*/ + case 0x04: /* Name is Exactly */ + proto_tree_add_item(tree, hf_btatt_ots_name_string, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA | ENC_UTF_8); + offset += tvb_reported_length_remaining(tvb, offset); + + break; + case 0x05: /* Object Type */ + offset = dissect_gatt_uuid(tree, pinfo, tvb, offset); + + break; + case 0x06: /* Created Between */ + case 0x07: /* Modified Between */ + call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset(tvb, offset, 7, 7), pinfo, tree, NULL); + offset += 7; + + call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset(tvb, offset, 7, 7), pinfo, tree, NULL); + offset += 7; + + break; + case 0x08: /* Current Size Between */ + case 0x09: /* Allocated Size Between */ + proto_tree_add_item(tree, hf_btatt_ots_size_from, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + proto_tree_add_item(tree, hf_btatt_ots_size_to, tvb, offset, 4, ENC_LITTLE_ENDIAN); + offset += 4; + + break; + } + + break; case 0x2AC8: /* Object Changed */ -/* TODO: Implement */ + proto_tree_add_bitmask(tree, tvb, offset, hf_btatt_ots_flags, ett_btatt_value, hfx_btatt_ots_flags, ENC_NA); + offset += 1; + + proto_tree_add_item(tree, hf_btatt_ots_object_id, tvb, offset, 6, ENC_LITTLE_ENDIAN); + offset += 6; + + break; + + case 0x2906: /* Valid Range */ case 0x2A2A: /* IEEE 11073-20601 Regulatory Certification Data List */ case 0x2A4D: /* Report */ @@ -6081,6 +6488,7 @@ is_long_attribute_value(bluetooth_uuid_t uuid) case 0x2AB6: /* URI */ case 0x2AB7: /* HTTP Headers */ case 0x2AB9: /* HTTP Entity Body */ + case 0x2ABE: /* Object Name */ return TRUE; } @@ -10946,6 +11354,286 @@ proto_register_btatt(void) FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, + {&hf_btatt_ots_feature_oacp, + {"OACP Features", "btatt.ots.oacp", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_reserved, + {"Reserved", "btatt.ots.oacp.reserved", + FT_BOOLEAN, 32, NULL, 0xFFFFFC00, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_abort, + {"Abort", "btatt.ots.oacp.abort", + FT_BOOLEAN, 32, NULL, 0x00000200, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_patching_of_object, + {"Patching of Object", "btatt.ots.oacp.patching_of_object", + FT_BOOLEAN, 32, NULL, 0x00000100, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_truncation_of_objects, + {"Truncation of Objects", "btatt.ots.oacp.truncation_of_objects", + FT_BOOLEAN, 32, NULL, 0x00000080, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_appending_additional_data_to_object, + {"Appending Additional Data to Object", "btatt.ots.oacp.appending_additional_data_to_object", + FT_BOOLEAN, 32, NULL, 0x00000040, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_write, + {"Write", "btatt.ots.oacp.write", + FT_BOOLEAN, 32, NULL, 0x00000020, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_read, + {"Read", "btatt.ots.oacp.read", + FT_BOOLEAN, 32, NULL, 0x00000010, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_execute, + {"Execute", "btatt.ots.oacp.execute", + FT_BOOLEAN, 32, NULL, 0x00000008, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_calculate_checksum, + {"Calculate Checksum", "btatt.ots.oacp.calculate_checksum", + FT_BOOLEAN, 32, NULL, 0x00000004, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_delete, + {"Delete", "btatt.ots.oacp.delete", + FT_BOOLEAN, 32, NULL, 0x00000002, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_oacp_create, + {"Create", "btatt.ots.oacp.create", + FT_BOOLEAN, 32, NULL, 0x00000001, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_olcp, + {"OLCP Features", "btatt.ots.olcp", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_olcp_reserved, + {"Reserved", "btatt.ots.olcp.reserved", + FT_BOOLEAN, 32, NULL, 0xFFFFFFF0, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_olcp_clear_marking, + {"Clear Marking", "btatt.ots.olcp.clear_marking", + FT_BOOLEAN, 32, NULL, 0x00000008, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_olcp_request_number_of_objects, + {"Request Number of Objects", "btatt.ots.olcp.request_number_of_objects", + FT_BOOLEAN, 32, NULL, 0x00000004, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_olcp_order, + {"Order", "btatt.ots.olcp.order", + FT_BOOLEAN, 32, NULL, 0x00000002, + NULL, HFILL} + }, + {&hf_btatt_ots_feature_olcp_go_to, + {"Go To", "btatt.ots.olcp.go_to", + FT_BOOLEAN, 32, NULL, 0x00000001, + NULL, HFILL} + }, + {&hf_btatt_ots_object_name, + {"Object Name", "btatt.ots.object_name", + FT_STRING, STR_UNICODE, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_current_size, + {"Current Size", "btatt.ots.current_size", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_allocated_size, + {"Allocated Size", "btatt.ots.allocated_size", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_object_id, + {"Object ID", "btatt.ots.object_id", + FT_UINT48, BASE_HEX, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_properties, + {"Properties", "btatt.ots.properties", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_reserved, + {"Reserved", "btatt.ots.properties.reserved", + FT_BOOLEAN, 32, NULL, 0xFFFFFF00, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_mark, + {"Mark", "btatt.ots.properties.mark", + FT_BOOLEAN, 32, NULL, 0x00000080, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_patch, + {"Patch", "btatt.ots.properties.patch", + FT_BOOLEAN, 32, NULL, 0x00000040, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_truncate, + {"Truncate", "btatt.ots.properties.truncate", + FT_BOOLEAN, 32, NULL, 0x00000020, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_append, + {"Append", "btatt.ots.properties.append", + FT_BOOLEAN, 32, NULL, 0x00000010, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_write, + {"Write", "btatt.ots.properties.write", + FT_BOOLEAN, 32, NULL, 0x00000008, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_read, + {"Read", "btatt.ots.properties.read", + FT_BOOLEAN, 32, NULL, 0x00000004, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_execute, + {"Execute", "btatt.ots.properties.execute", + FT_BOOLEAN, 32, NULL, 0x00000002, + NULL, HFILL} + }, + {&hf_btatt_ots_properties_delete, + {"Delete", "btatt.ots.properties.delete", + FT_BOOLEAN, 32, NULL, 0x00000001, + NULL, HFILL} + }, + {&hf_btatt_ots_flags, + {"Properties", "btatt.ots.flags", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_flags_reserved, + {"Reserved", "btatt.ots.flags.reserved", + FT_BOOLEAN, 8, NULL, 0xE0, + NULL, HFILL} + }, + {&hf_btatt_ots_flags_object_deletion, + {"Object Deletion", "btatt.ots.flags.object_deletion", + FT_BOOLEAN, 8, NULL, 0x10, + NULL, HFILL} + }, + {&hf_btatt_ots_flags_object_creation, + {"Object Creation", "btatt.ots.flags.object_creation", + FT_BOOLEAN, 8, NULL, 0x08, + NULL, HFILL} + }, + {&hf_btatt_ots_flags_change_occured_to_the_object_metadata, + {"Change Occured to the Object Metadata", "btatt.ots.flags.change_occured_to_the_object_metadata", + FT_BOOLEAN, 8, NULL, 0x04, + NULL, HFILL} + }, + {&hf_btatt_ots_flags_change_occured_to_the_object_contents, + {"Change Occured to the Object Contents", "btatt.ots.flags.change_occured_to_the_object_contents", + FT_BOOLEAN, 8, NULL, 0x02, + NULL, HFILL} + }, + {&hf_btatt_ots_flags_source_of_change, + {"Source of Change", "btatt.ots.flags.source_of_change", + FT_BOOLEAN, 8, TFS(&tfs_client_server), 0x01, + NULL, HFILL} + }, + {&hf_btatt_ots_action_opcode, + {"Opcode", "btatt.ots.action.opcode", + FT_UINT8, BASE_HEX, VALS(ots_action_opcode_vals), 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_size, + {"Size", "btatt.ots.size", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_offset, + {"Offset", "btatt.ots.offset", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_length, + {"Length", "btatt.ots.length", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_execute_data, + {"Execute Data", "btatt.ots.execute_data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_action_response_opcode, + {"Response Opcode", "btatt.ots.action.response_opcode", + FT_UINT8, BASE_HEX, VALS(ots_action_opcode_vals), 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_action_result_code, + {"Result Code", "btatt.ots.action.result_code", + FT_UINT8, BASE_HEX, VALS(ots_action_result_code_vals), 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_checksum, + {"Checksum", "btatt.ots.checksum", + FT_UINT32, BASE_DEC_HEX, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_list_opcode, + {"Opcode", "btatt.ots.list.opcode", + FT_UINT8, BASE_HEX, VALS(ots_list_opcode_vals), 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_list_order, + {"Order", "btatt.ots.list.order", + FT_UINT8, BASE_HEX, VALS(ots_list_order_vals), 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_list_response_opcode, + {"Response Opcode", "btatt.ots.list.response_opcode", + FT_UINT8, BASE_HEX, VALS(ots_list_opcode_vals), 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_list_result_code, + {"Result Code", "btatt.ots.list.result_code", + FT_UINT8, BASE_HEX, VALS(ots_list_result_code_vals), 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_list_total_number_of_objects, + {"Total Number of Objects", "btatt.ots.list.total_number_of_objects", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_filter, + {"Filter", "btatt.ots.filter", + FT_UINT8, BASE_HEX, VALS(ots_filter_vals), 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_size_from, + {"Size From", "btatt.ots.size_from", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_size_to, + {"Size To", "btatt.ots.size_to", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_btatt_ots_name_string, + {"Name String", "btatt.ots.name_string", + FT_STRING, STR_UNICODE, NULL, 0x0, + NULL, HFILL} + }, {&hf_request_in_frame, {"Request in Frame", "btatt.request_in_frame", FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0, @@ -10969,16 +11657,17 @@ proto_register_btatt(void) }; static ei_register_info ei[] = { - { &ei_btatt_uuid_format_unknown, { "btatt.uuid_format.unknown", PI_PROTOCOL, PI_WARN, "Unknown format", EXPFILL }}, - { &ei_btatt_handle_too_few, { "btatt.handle.too_few", PI_PROTOCOL, PI_WARN, "Too few handles, should be 2 or more", EXPFILL }}, - { &ei_btatt_mtu_exceeded, { "btatt.mtu.exceeded", PI_PROTOCOL, PI_WARN, "Packet size exceed current ATT_MTU", EXPFILL }}, - { &ei_btatt_mtu_full, { "btatt.mtu.full", PI_PROTOCOL, PI_NOTE, "Reached ATT_MTU. Attribute value may be longer.", EXPFILL }}, - { &ei_btatt_consent_out_of_bounds, { "btatt.consent.out_of_bounds", PI_PROTOCOL, PI_WARN, "Consent Code is out of bounds (0 to 9999)", EXPFILL }}, - { &ei_btatt_cgm_size_too_small, { "btatt.cgm_measurement.size.too_small", PI_PROTOCOL, PI_WARN, "Size too small (6 or geater)", EXPFILL }}, - { &ei_btatt_opcode_invalid_request, { "btatt.opcode.invalid_request" , PI_PROTOCOL, PI_WARN, "Invalid request", EXPFILL }}, - { &ei_btatt_opcode_invalid_response,{ "btatt.opcode.invalid_response", PI_PROTOCOL, PI_WARN, "Invalid response", EXPFILL }}, + { &ei_btatt_uuid_format_unknown, { "btatt.uuid_format.unknown", PI_PROTOCOL, PI_WARN, "Unknown format", EXPFILL }}, + { &ei_btatt_handle_too_few, { "btatt.handle.too_few", PI_PROTOCOL, PI_WARN, "Too few handles, should be 2 or more", EXPFILL }}, + { &ei_btatt_mtu_exceeded, { "btatt.mtu.exceeded", PI_PROTOCOL, PI_WARN, "Packet size exceed current ATT_MTU", EXPFILL }}, + { &ei_btatt_mtu_full, { "btatt.mtu.full", PI_PROTOCOL, PI_NOTE, "Reached ATT_MTU. Attribute value may be longer.", EXPFILL }}, + { &ei_btatt_consent_out_of_bounds, { "btatt.consent.out_of_bounds", PI_PROTOCOL, PI_WARN, "Consent Code is out of bounds (0 to 9999)", EXPFILL }}, + { &ei_btatt_cgm_size_too_small, { "btatt.cgm_measurement.size.too_small", PI_PROTOCOL, PI_WARN, "Size too small (6 or geater)", EXPFILL }}, + { &ei_btatt_opcode_invalid_request, { "btatt.opcode.invalid_request" , PI_PROTOCOL, PI_WARN, "Invalid request", EXPFILL }}, + { &ei_btatt_opcode_invalid_response,{ "btatt.opcode.invalid_response", PI_PROTOCOL, PI_WARN, "Invalid response", EXPFILL }}, { &ei_btatt_invalid_usage, { "btatt.invalid_usage", PI_PROTOCOL, PI_WARN, "Invalid usage of this characteristic with this opcode", EXPFILL }}, - { &ei_btatt_unexpected_data, { "btatt.unexpected_data", PI_PROTOCOL, PI_WARN, "Unexpected Data", EXPFILL }}, + { &ei_btatt_bad_data, { "btatt.bad_data", PI_PROTOCOL, PI_WARN, "Bad Data", EXPFILL }}, + { &ei_btatt_unexpected_data, { "btatt.unexpected_data", PI_PROTOCOL, PI_WARN, "Unexpected Data", EXPFILL }}, { &ei_btatt_undecoded, { "btatt.undecoded", PI_UNDECODED, PI_NOTE, "Undecoded", EXPFILL }}, }; diff --git a/epan/dissectors/packet-icq.c b/epan/dissectors/packet-icq.c index 4736f7f9c8..fa659c69d8 100644 --- a/epan/dissectors/packet-icq.c +++ b/epan/dissectors/packet-icq.c @@ -126,8 +126,6 @@ static expert_field ei_icq_unknown_command = EI_INIT; #define ICQ5_SERVER 0 #define ICQ5_CLIENT 1 -const true_false_string tfs_client_server = { "Client", "Server" }; - static void dissect_icqv5Server(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int pktsize); diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c index 90778b9b9f..3dc926bc1c 100644 --- a/epan/dissectors/packet-zbee-zcl.c +++ b/epan/dissectors/packet-zbee-zcl.c @@ -1995,10 +1995,6 @@ void decode_zcl_time_in_minutes(gchar *s, guint16 value) void proto_register_zbee_zcl(void) { guint i, j; - static const true_false_string tfs_client_server = { - "To Client", - "To Server" - }; static hf_register_info hf[] = { { &hf_zbee_zcl_fcf_frame_type, diff --git a/epan/tfs.c b/epan/tfs.c index f2f4594b31..a7f4b734c4 100644 --- a/epan/tfs.c +++ b/epan/tfs.c @@ -88,4 +88,6 @@ const true_false_string tfs_acknowledged_not_acknowledged = { "Acknowledged", "N const true_false_string tfs_response_request = { "Response", "Request" }; const true_false_string tfs_defined_not_defined = { "Defined", "Not defined" }; const true_false_string tfs_constructed_primitive = { "Constructed", "Primitive" }; +const true_false_string tfs_client_server = { "Client", "Server" }; +const true_false_string tfs_server_client = { "Server", "Client" }; diff --git a/epan/tfs.h b/epan/tfs.h index 38efb5407b..6b4816da11 100644 --- a/epan/tfs.h +++ b/epan/tfs.h @@ -103,6 +103,8 @@ WS_DLL_PUBLIC const true_false_string tfs_acknowledged_not_acknowledged; WS_DLL_PUBLIC const true_false_string tfs_response_request; WS_DLL_PUBLIC const true_false_string tfs_defined_not_defined; WS_DLL_PUBLIC const true_false_string tfs_constructed_primitive; +WS_DLL_PUBLIC const true_false_string tfs_client_server; +WS_DLL_PUBLIC const true_false_string tfs_server_client; #ifdef __cplusplus }