Qt/USB: Allow USB src/dst addresses to be selected for columns
Make "Prepare a Filter" from the Source and Destination columns work for USB source and destination address, this value must be quoted as well. Change-Id: Ib7a772050c204e716781cc27f9eddbdb7971e547 Reviewed-on: https://code.wireshark.org/review/26096 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
30692e2f3a
commit
61d033645d
|
@ -1746,6 +1746,12 @@ static const char* usb_host_get_filter_type(hostlist_talker_t* host, conv_filter
|
|||
return CONV_FILTER_INVALID;
|
||||
}
|
||||
|
||||
static const char*
|
||||
usb_col_filter_str(const address* addr _U_, gboolean is_src)
|
||||
{
|
||||
return is_src ? "usb.src" : "usb.dst";
|
||||
}
|
||||
|
||||
static hostlist_dissector_info_t usb_host_dissector_info = {&usb_host_get_filter_type};
|
||||
|
||||
static int
|
||||
|
@ -6340,7 +6346,7 @@ proto_register_usb(void)
|
|||
register_decode_as(&usb_product_da);
|
||||
register_decode_as(&usb_device_da);
|
||||
|
||||
usb_address_type = address_type_dissector_register("AT_USB", "USB Address", usb_addr_to_str, usb_addr_str_len, NULL, NULL, NULL, NULL, NULL);
|
||||
usb_address_type = address_type_dissector_register("AT_USB", "USB Address", usb_addr_to_str, usb_addr_str_len, NULL, usb_col_filter_str, NULL, NULL, NULL);
|
||||
|
||||
register_conversation_table(proto_usb, TRUE, usb_conversation_packet, usb_hostlist_packet);
|
||||
}
|
||||
|
|
|
@ -1002,6 +1002,7 @@ QString PacketList::getFilterFromRowAndColumn()
|
|||
*/
|
||||
if (strlen(cap_file_->cinfo.col_expr.col_expr[ctx_column_]) != 0 &&
|
||||
strlen(cap_file_->cinfo.col_expr.col_expr_val[ctx_column_]) != 0) {
|
||||
gboolean is_string_value = FALSE;
|
||||
if (cap_file_->cinfo.columns[ctx_column_].col_fmt == COL_CUSTOM) {
|
||||
header_field_info *hfi = proto_registrar_get_byname(cap_file_->cinfo.columns[ctx_column_].col_custom_fields);
|
||||
if (hfi && hfi->parent == -1) {
|
||||
|
@ -1009,16 +1010,27 @@ QString PacketList::getFilterFromRowAndColumn()
|
|||
filter.append(cap_file_->cinfo.col_expr.col_expr[ctx_column_]);
|
||||
} else if (hfi && hfi->type == FT_STRING) {
|
||||
/* Custom string, add quotes */
|
||||
is_string_value = TRUE;
|
||||
}
|
||||
} else {
|
||||
header_field_info *hfi = proto_registrar_get_byname(cap_file_->cinfo.col_expr.col_expr[ctx_column_]);
|
||||
if (hfi && hfi->type == FT_STRING) {
|
||||
/* Could be an address type such as usb.src which must be quoted. */
|
||||
is_string_value = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (filter.isEmpty()) {
|
||||
if (is_string_value) {
|
||||
filter.append(QString("%1 == \"%2\"")
|
||||
.arg(cap_file_->cinfo.col_expr.col_expr[ctx_column_])
|
||||
.arg(cap_file_->cinfo.col_expr.col_expr_val[ctx_column_]));
|
||||
} else {
|
||||
filter.append(QString("%1 == %2")
|
||||
.arg(cap_file_->cinfo.col_expr.col_expr[ctx_column_])
|
||||
.arg(cap_file_->cinfo.col_expr.col_expr_val[ctx_column_]));
|
||||
}
|
||||
}
|
||||
if (filter.isEmpty()) {
|
||||
filter.append(QString("%1 == %2")
|
||||
.arg(cap_file_->cinfo.col_expr.col_expr[ctx_column_])
|
||||
.arg(cap_file_->cinfo.col_expr.col_expr_val[ctx_column_]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue