Have register_decode_as_next_proto create dissector table.

For protocols that have don't have a unique identifier for their
payload, have register_decode_as_next_proto be a one stop shop to
create Decode As functionality and a dissector table of type FT_NONE.

Change-Id: Ic1f2e9ed0aee0554a4eb8f232630b99c0604dfc0
Reviewed-on: https://code.wireshark.org/review/22575
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2017-07-09 13:47:59 -04:00
parent d992e85fe8
commit 7d65b573f2
17 changed files with 52 additions and 108 deletions

View File

@ -69,17 +69,14 @@ static build_valid_func next_proto_values[] = { next_proto_value };
static decode_as_value_t next_proto_da_values =
{ next_proto_prompt, 1, next_proto_values };
void register_decode_as_next_proto(
const char *name, const gchar *title, const gchar *table_name, build_label_func* label_func)
dissector_table_t register_decode_as_next_proto(int proto, const gchar *title, const gchar *table_name, const gchar *ui_name, build_label_func* label_func)
{
decode_as_t *da;
dissector_table_t dt;
dt = find_dissector_table(table_name);
g_assert(IS_FT_UINT(dissector_table_get_type(dt)));
dissector_table_t dt = register_dissector_table(table_name, ui_name, proto, FT_NONE, BASE_NONE);
da = wmem_new0(wmem_epan_scope(), decode_as_t);
da->name = wmem_strdup(wmem_epan_scope(), name);
da->name = wmem_strdup(wmem_epan_scope(), proto_get_protocol_filter_name(proto));
da->title = wmem_strdup(wmem_epan_scope(), title);
da->table_name = wmem_strdup(wmem_epan_scope(), table_name);
da->num_items = 1;
@ -99,6 +96,7 @@ void register_decode_as_next_proto(
da->change_value = decode_as_default_change;
register_decode_as(da);
return dt;
}
struct decode_as_default_populate

View File

@ -85,19 +85,24 @@ typedef struct decode_as_s {
/** register a "Decode As". A copy of the decode_as_t will be maintained by the decode_as module */
WS_DLL_PUBLIC void register_decode_as(decode_as_t* reg);
/* Forward declaration to prevent requiring packet.h */
struct dissector_table;
/** Register a "Decode As" entry for the special case where there is no
* indication for the next protocol (such as port number etc.).
* For now, this will use a uint32 dissector table internally and
* assign all registered protocols to 0. The framework to do this can
* be kept internal to epan.
*
* @param name The table name in which this dissector is found.
* @param proto The protocol ID to create the dissector table.
* @param title The table name in which this dissector is found.
* @param table_name The table name in which this dissector is found.
* @param ui_name UI name for created dissector table.
* @param label_func Optional prompt text for dissector. If NULL, "Next level protocol as" is used.
*
* @return Created dissector table with Decode As support
*/
WS_DLL_PUBLIC void register_decode_as_next_proto(
const char *name, const gchar *title, const gchar *table_name, build_label_func* label_func);
WS_DLL_PUBLIC struct dissector_table* register_decode_as_next_proto(int proto, const gchar *title, const gchar *table_name, const gchar *ui_name, build_label_func* label_func);
/* Walk though the dissector table and provide dissector_handle_t for each item in the table */
WS_DLL_PUBLIC void decode_as_default_populate_list(const gchar *table_name, decode_as_add_to_list_func add_to_list, gpointer ui_element);

View File

@ -205,11 +205,7 @@ dissect_aruba_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
{
int offset = 0;
/*
* Implement "Decode As", as Aruba ERM doesn't
* have a unique identifier to determine subdissector
*/
if (!dissector_try_uint(aruba_erm_subdissector_table, 0, tvb, pinfo, tree)) {
if (!dissector_try_payload(aruba_erm_subdissector_table, tvb, pinfo, tree)) {
dissect_aruba_erm_common(tvb, pinfo, tree, &offset);
/* Add Expert info how decode...*/
@ -432,11 +428,9 @@ proto_register_aruba_erm(void)
expert_register_field_array(expert_aruba_erm, ei, array_length(ei));
register_dissector("aruba_erm", dissect_aruba_erm, proto_aruba_erm);
aruba_erm_subdissector_table = register_dissector_table(
"aruba_erm.type", "Aruba ERM Type", proto_aruba_erm,
FT_UINT32, BASE_DEC);
register_decode_as_next_proto("aruba_erm", "Aruba ERM Type", "aruba_erm.type", (build_label_func*)&aruba_erm_prompt);
aruba_erm_subdissector_table = register_decode_as_next_proto(proto_aruba_erm, "Aruba ERM Type", "aruba_erm.type",
"Aruba ERM Type", (build_label_func*)&aruba_erm_prompt);
}
void

View File

@ -4664,7 +4664,7 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
if (ogf == HCI_OGF_VENDOR_SPECIFIC) {
col_append_fstr(pinfo->cinfo, COL_INFO, "Vendor Command 0x%04X (opcode 0x%04X)", ocf, opcode);
if (!dissector_try_uint_new(vendor_dissector_table, HCI_VENDOR_DEFAULT, tvb, pinfo, tree, TRUE, bluetooth_data)) {
if (!dissector_try_payload_new(vendor_dissector_table, tvb, pinfo, tree, TRUE, bluetooth_data)) {
if (bluetooth_data) {
hci_vendor_data_t *hci_vendor_data;
@ -7125,14 +7125,13 @@ proto_register_bthci_cmd(void)
bthci_cmds = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
vendor_dissector_table = register_dissector_table("bthci_cmd.vendor", "BT HCI Vendor", proto_bthci_cmd, FT_UINT16, BASE_HEX);
module = prefs_register_protocol(proto_bthci_cmd, NULL);
prefs_register_static_text_preference(module, "hci_cmd.version",
"Bluetooth HCI version: 4.0 (Core)",
"Version of protocol supported by this dissector.");
register_decode_as_next_proto("bthci_evt", "Vendor", "bthci_cmd.vendor", (build_label_func*)&bthci_cmd_vendor_prompt);
vendor_dissector_table = register_decode_as_next_proto(proto_bthci_cmd, "Vendor", "bthci_cmd.vendor",
"BT HCI Vendor", (build_label_func*)&bthci_cmd_vendor_prompt);
}

View File

@ -2444,9 +2444,7 @@ dissect_cpf(enip_request_key_t *request_key, int command, tvbuff_t *tvb,
}
else
{
/* Functionality for choosing subdissector is controlled through Decode As as EtherNet/IP doesn't
have a unique identifier to determine subdissector */
if (!dissector_try_uint(subdissector_io_table, 0, next_tvb, pinfo, dissector_tree))
if (!dissector_try_payload(subdissector_io_table, next_tvb, pinfo, dissector_tree))
{
proto_tree_add_item(item_tree, hf_enip_connection_transport_data, tvb, offset+6, item_length, ENC_NA);
}
@ -4502,8 +4500,6 @@ proto_register_enip(void)
subdissector_srrd_table = register_dissector_table("enip.srrd.iface",
"ENIP SendRequestReplyData.Interface Handle", proto_enip, FT_UINT32, BASE_HEX);
subdissector_io_table = register_dissector_table("enip.io", "ENIP IO Payload", proto_enip, FT_UINT32, BASE_DEC);
enip_request_hashtable = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), enip_request_hash, enip_request_equal);
enip_conn_hashtable = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), enip_conn_hash, enip_conn_equal);
@ -4517,7 +4513,7 @@ proto_register_enip(void)
register_conversation_filter("enip", "ENIP IO", enip_io_conv_valid, enip_io_conv_filter);
register_conversation_filter("enip", "ENIP Explicit", enip_exp_conv_valid, enip_exp_conv_filter);
register_decode_as_next_proto("enip", "ENIP I/O", "enip.io", (build_label_func*)&enip_prompt);
subdissector_io_table = register_decode_as_next_proto(proto_enip, "ENIP I/O", "enip.io", "ENIP IO Payload", (build_label_func*)&enip_prompt);
} /* end of proto_register_enip() */

View File

@ -239,7 +239,7 @@ dissect_flexray(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
next_tvb = tvb_new_subset_length(tvb, 7, flexray_current_payload_length);
if (call_subdissector) {
if (!dissector_try_uint_new(subdissector_table, 0, next_tvb, pinfo, tree, FALSE, &flexray_id))
if (!dissector_try_payload_new(subdissector_table, next_tvb, pinfo, tree, FALSE, &flexray_id))
{
call_data_dissector(next_tvb, pinfo, tree);
}
@ -442,11 +442,7 @@ proto_register_flexray(void)
register_dissector("flexray", dissect_flexray, proto_flexray);
subdissector_table = register_dissector_table("flexray.subdissector",
"FLEXRAY next level dissector", proto_flexray, FT_UINT32, BASE_HEX);
register_decode_as_next_proto("flexray", "Network", "flexray.subdissector", NULL);
subdissector_table = register_decode_as_next_proto(proto_flexray, "Network", "flexray.subdissector", "FLEXRAY next level dissector", NULL);
}
void

View File

@ -370,9 +370,7 @@ dissect_flip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
payload_tvb = tvb_new_subset_length(flip_tvb, offset, payload_len);
/* Functionality for choosing subdissector is controlled through Decode As as FLIP doesn't
have a unique identifier to determine subdissector */
data_len = dissector_try_uint(subdissector_table, 0, payload_tvb, pinfo, tree);
data_len = dissector_try_payload(subdissector_table, payload_tvb, pinfo, tree);
if (data_len <= 0)
{
data_len = call_data_dissector(payload_tvb, pinfo, tree);
@ -455,8 +453,6 @@ proto_register_flip(void)
proto_register_field_array(proto_flip, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
subdissector_table = register_dissector_table("flip.payload", "FLIP payload", proto_flip, FT_UINT32, BASE_HEX);
flip_module = prefs_register_protocol(proto_flip, NULL);
/* Register preferences - now obsolete because of Decode As*/
@ -467,7 +463,7 @@ proto_register_flip(void)
prefs_register_obsolete_preference(flip_module, "forced_protocol");
prefs_register_obsolete_preference(flip_module, "forced_decode");
register_decode_as_next_proto("flip", "FLIP Payload", "flip.payload", (build_label_func*)&flip_prompt);
subdissector_table = register_decode_as_next_proto(proto_flip, "FLIP Payload", "flip.payload", "FLIP payload", (build_label_func*)&flip_prompt);
} /* proto_register_flip() */

View File

@ -212,9 +212,7 @@ dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
addr, "0x%02x%s", addr, addr ? "" : " (General Call)");
proto_tree_add_uint(i2c_tree, hf_i2c_flags, tvb, 0, 0, flags);
/* Functionality for choosing subdissector is controlled through Decode As as I2C doesn't
have a unique identifier to determine subdissector */
if (!dissector_try_uint(subdissector_table, 0, tvb, pinfo, tree))
if (!dissector_try_payload(subdissector_table, tvb, pinfo, tree))
{
call_data_dissector(tvb, pinfo, tree);
}
@ -244,12 +242,10 @@ proto_register_i2c(void)
proto_i2c_event = proto_register_protocol_in_name_only("I2C Events", "I2C Events", "i2c_event", proto_i2c, FT_PROTOCOL);
proto_i2c_data = proto_register_protocol_in_name_only("I2C Data", "I2C Data", "i2c_data", proto_i2c, FT_PROTOCOL);
subdissector_table = register_dissector_table("i2c.message", "I2C messages dissector", proto_i2c, FT_UINT32, BASE_DEC);
m = prefs_register_protocol(proto_i2c, NULL);
prefs_register_obsolete_preference(m, "type");
register_decode_as_next_proto("i2c", "I2C Message", "i2c.message", (build_label_func*)&i2c_prompt);
subdissector_table = register_decode_as_next_proto(proto_i2c, "I2C Message", "i2c.message", "I2C messages dissector", (build_label_func*)&i2c_prompt);
}
void

View File

@ -2626,9 +2626,7 @@ static void parse_PAYLOAD(proto_tree *parentTree,
if (dissector_found == FALSE)
{
/* Functionality for choosing subdissector is controlled through Decode As as there
isn't a unique identifier to determine subdissector */
if (dissector_try_uint_new(subdissector_table, 0, next_tvb, pinfo, top_tree, TRUE, info))
if (dissector_try_payload_new(subdissector_table, next_tvb, pinfo, top_tree, TRUE, info))
{
dissector_found = TRUE;
}
@ -8414,7 +8412,6 @@ void proto_register_infiniband(void)
/* register the subdissector tables */
heur_dissectors_payload = register_heur_dissector_list("infiniband.payload", proto_infiniband);
heur_dissectors_cm_private = register_heur_dissector_list("infiniband.mad.cm.private", proto_infiniband);
subdissector_table = register_dissector_table("infiniband", "Infiniband Payload", proto_infiniband, FT_UINT16, BASE_DEC);
/* register dissection preferences */
infiniband_module = prefs_register_protocol(proto_infiniband, proto_reg_handoff_infiniband);
@ -8443,7 +8440,8 @@ void proto_register_infiniband(void)
CM_context_table = g_hash_table_new_full(g_int64_hash, g_int64_equal,
table_destroy_notify, table_destroy_notify);
register_decode_as_next_proto("infiniband", "Network", "infiniband", (build_label_func*)&infiniband_payload_prompt);
subdissector_table = register_decode_as_next_proto(proto_infiniband, "Network", "infiniband", "Infiniband Payload",
(build_label_func*)&infiniband_payload_prompt);
register_shutdown_routine(infiniband_shutdown);
}

View File

@ -355,9 +355,7 @@ dissect_iso15765(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
if (next_tvb) {
/* Functionality for choosing subdissector is controlled through Decode As as ISO15765 doesn't
have a unique identifier to determine subdissector */
if (!complete || !dissector_try_uint_new(subdissector_table, 0, next_tvb, pinfo, tree, TRUE, NULL)) {
if (!complete || !dissector_try_payload_new(subdissector_table, next_tvb, pinfo, tree, TRUE, NULL)) {
call_data_dissector(next_tvb, pinfo, tree);
}
}
@ -560,10 +558,6 @@ proto_register_iso15765(void)
expert_register_field_array(expert_iso15765, ei, array_length(ei));
subdissector_table = register_dissector_table("iso15765.subdissector",
"ISO15765 next level dissector", proto_iso15765,
FT_UINT32, BASE_HEX);
iso15765_module = prefs_register_protocol(proto_iso15765, NULL);
prefs_register_enum_preference(iso15765_module, "addressing",
@ -582,7 +576,7 @@ proto_register_iso15765(void)
reassembly_table_register(&iso15765_reassembly_table,
&addresses_reassembly_table_functions);
register_decode_as_next_proto("iso15765", "Transport", "iso15765.subdissector", NULL);
subdissector_table = register_decode_as_next_proto(proto_iso15765, "Transport", "iso15765.subdissector", "ISO15765 next level dissector", NULL);
}
void

View File

@ -118,7 +118,7 @@ dissect_moldudp_msgblk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Functionality for choosing subdissector is controlled through Decode As as MoldUDP doesn't
have a unique identifier to determine subdissector */
next_tvb = tvb_new_subset_length(tvb, offset, real_msglen);
if (!dissector_try_uint_new(moldudp_payload_table, 0, next_tvb, pinfo, tree, FALSE, NULL))
if (!dissector_try_payload_new(moldudp_payload_table, next_tvb, pinfo, tree, FALSE, NULL))
{
proto_tree_add_item(blk_tree, hf_moldudp_msgdata,
tvb, offset, real_msglen, ENC_NA);
@ -247,15 +247,13 @@ proto_register_moldudp(void)
/* Register the protocol name and description */
proto_moldudp = proto_register_protocol("MoldUDP", "MoldUDP", "moldudp");
moldudp_payload_table = register_dissector_table("moldudp.payload", "MoldUDP Payload", proto_moldudp, FT_UINT32, BASE_DEC);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_moldudp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_moldudp = expert_register_protocol(proto_moldudp);
expert_register_field_array(expert_moldudp, ei, array_length(ei));
register_decode_as_next_proto("moldudp", "MoldUDP Payload", "moldudp.payload", (build_label_func*)&moldudp_prompt);
moldudp_payload_table = register_decode_as_next_proto(proto_moldudp, "MoldUDP Payload", "moldudp.payload", "MoldUDP Payload", (build_label_func*)&moldudp_prompt);
}

View File

@ -114,10 +114,8 @@ dissect_moldudp64_msgblk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += MOLDUDP64_MSGLEN_LEN;
/* Functionality for choosing subdissector is controlled through Decode As as CAN doesn't
have a unique identifier to determine subdissector */
next_tvb = tvb_new_subset_length(tvb, offset, real_msglen);
if (!dissector_try_uint_new(moldudp64_payload_table, 0, next_tvb, pinfo, tree, FALSE, NULL))
if (!dissector_try_payload_new(moldudp64_payload_table, next_tvb, pinfo, tree, FALSE, NULL))
{
proto_tree_add_item(blk_tree, hf_moldudp64_msgdata, tvb, offset, real_msglen, ENC_NA);
}
@ -262,15 +260,14 @@ proto_register_moldudp64(void)
proto_moldudp64 = proto_register_protocol("MoldUDP64",
"MoldUDP64", "moldudp64");
moldudp64_payload_table = register_dissector_table("moldudp64.payload", "MoldUDP64 Payload", proto_moldudp64, FT_UINT32, BASE_DEC);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_moldudp64, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_moldudp64 = expert_register_protocol(proto_moldudp64);
expert_register_field_array(expert_moldudp64, ei, array_length(ei));
register_decode_as_next_proto("moldudp64", "MoldUDP64 Payload", "moldudp64.payload", (build_label_func*)&moldudp64_prompt);
moldudp64_payload_table = register_decode_as_next_proto(proto_moldudp64, "MoldUDP64 Payload", "moldudp64.payload",
"MoldUDP64 Payload", (build_label_func*)&moldudp64_prompt);
}

View File

@ -2241,10 +2241,8 @@ dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
if (!hidden) {
tvbuff_t *fh_tvb;
/* Functionality for choosing subdissector is controlled through Decode As as NFS doesn't
have a unique identifier to determine subdissector */
fh_tvb = tvb_new_subset_length_caplen(tvb, offset, fhlen, fhlen);
if (!dissector_try_uint(nfs_fhandle_table, 0, fh_tvb, pinfo, tree))
if (!dissector_try_payload(nfs_fhandle_table, fh_tvb, pinfo, tree))
dissect_fhandle_data_unknown(fh_tvb, pinfo, tree, NULL);
}
}
@ -14044,9 +14042,6 @@ proto_register_nfs(void)
" in the info column. Others (like GETFH, PUTFH, etc) are not displayed",
&display_major_nfs4_ops);
nfs_fhandle_table = register_dissector_table("nfs_fhandle.type",
"NFS Filehandle types", proto_nfs, FT_UINT8, BASE_HEX);
prefs_register_obsolete_preference(nfs_module, "default_fhandle_type");
nfs_name_snoop_known = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
@ -14055,7 +14050,8 @@ proto_register_nfs(void)
register_init_routine(nfs_name_snoop_init);
register_cleanup_routine(nfs_name_snoop_cleanup);
register_decode_as_next_proto("nfs", "NFS File Handle", "nfs_fhandle.type", (build_label_func*)&nfs_prompt);
nfs_fhandle_table = register_decode_as_next_proto(proto_nfs, "NFS File Handle", "nfs_fhandle.type",
"NFS Filehandle types", (build_label_func*)&nfs_prompt);
}

View File

@ -135,11 +135,7 @@ dissect_pcli_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
next_tvb = tvb_new_subset_remaining(tvb, offset);
/*
* Implement "Decode As", as PCLI doesn't
* have a unique identifier to determine subdissector
*/
if (!dissector_try_uint(pcli_subdissector_table, 0, next_tvb, pinfo, tree)) {
if (!dissector_try_payload(pcli_subdissector_table, next_tvb, pinfo, tree)) {
call_data_dissector(next_tvb, pinfo, tree);
}
}
@ -249,11 +245,8 @@ proto_register_pcli(void)
"Whether the PCLI summary line should be shown in the protocol tree",
&pcli_summary_in_tree);
pcli_subdissector_table = register_dissector_table(
"pcli.payload", "PCLI payload dissector",
proto_pcli, FT_UINT32, BASE_DEC);
register_decode_as_next_proto("pcli", "PCLI payload", "pcli.payload", (build_label_func*)&pcli_prompt);
pcli_subdissector_table = register_decode_as_next_proto(proto_pcli, "PCLI payload", "pcli.payload",
"PCLI payload dissector", (build_label_func*)&pcli_prompt);
}
/* The registration hand-off routing */

View File

@ -207,9 +207,8 @@ dissect_rtacser_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tvb_reported_length_remaining(tvb, offset) > 0) {
payload_tvb = tvb_new_subset_remaining(tvb, RTACSER_HEADER_LEN);
/* Functionality for choosing subdissector is controlled through Decode As as CAN doesn't
have a unique identifier to determine subdissector */
if (!dissector_try_uint(subdissector_table, 0, payload_tvb, pinfo, tree)){
if (!dissector_try_payload(subdissector_table, payload_tvb, pinfo, tree)){
call_data_dissector(payload_tvb, pinfo, tree);
}
}
@ -282,8 +281,6 @@ proto_register_rtacser(void)
/* Registering protocol to be called by another dissector */
rtacser_handle = register_dissector("rtacser", dissect_rtacser, proto_rtacser);
subdissector_table = register_dissector_table("rtacser.data", "RTAC Serial Data Subdissector", proto_rtacser, FT_UINT32, BASE_HEX);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_rtacser, rtacser_hf, array_length(rtacser_hf));
proto_register_subtree_array(ett, array_length(ett));
@ -294,7 +291,8 @@ proto_register_rtacser(void)
/* RTAC Serial Preference - Payload Protocol in use */
prefs_register_obsolete_preference(rtacser_module, "rtacserial_payload_proto");
register_decode_as_next_proto("rtacser", "RTAC Serial", "rtacser.data", (build_label_func*)&rtacser_ppi_prompt);
subdissector_table = register_decode_as_next_proto(proto_rtacser, "RTAC Serial", "rtacser.data",
"RTAC Serial Data Subdissector", (build_label_func*)&rtacser_ppi_prompt);
}
/******************************************************************************************************/

View File

@ -158,9 +158,7 @@ dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
next_tvb = tvb_new_subset_length(tvb, CAN_DATA_OFFSET, frame_len);
/* Functionality for choosing subdissector is controlled through Decode As as CAN doesn't
have a unique identifier to determine subdissector */
if (!dissector_try_uint_new(subdissector_table, 0, next_tvb, pinfo, tree, TRUE, &can_id))
if (!dissector_try_payload_new(subdissector_table, next_tvb, pinfo, tree, TRUE, &can_id))
{
call_data_dissector(next_tvb, pinfo, tree);
}
@ -250,9 +248,7 @@ dissect_socketcanfd_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
next_tvb = tvb_new_subset_length(tvb, CAN_DATA_OFFSET, frame_len);
/* Functionality for choosing subdissector is controlled through Decode As as CAN doesn't
have a unique identifier to determine subdissector */
if (!dissector_try_uint_new(subdissector_table, 0, next_tvb, pinfo, tree, TRUE, &can_id))
if (!dissector_try_payload_new(subdissector_table, next_tvb, pinfo, tree, TRUE, &can_id))
{
call_data_dissector(next_tvb, pinfo, tree);
}
@ -388,9 +384,6 @@ proto_register_socketcan(void)
proto_register_field_array(proto_can, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
subdissector_table = register_dissector_table("can.subdissector",
"CAN next level dissector", proto_can, FT_UINT32, BASE_HEX);
can_module = prefs_register_protocol(proto_can, NULL);
prefs_register_obsolete_preference(can_module, "protocol");
@ -399,7 +392,7 @@ proto_register_socketcan(void)
"Whether the CAN ID/flags field should be byte-swapped",
&byte_swap);
register_decode_as_next_proto("can", "Network", "can.subdissector", NULL);
subdissector_table = register_decode_as_next_proto(proto_can, "Network", "can.subdissector", "CAN next level dissector", NULL);
}
void

View File

@ -557,7 +557,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* sent/received is from the perspective of the card reader */
pinfo->p2p_dir = P2P_DIR_SENT;
if (!dissector_try_uint_new(subdissector_table, 0, next_tvb, pinfo, tree, TRUE, usb_conv_info)) {
if (!dissector_try_payload_new(subdissector_table, next_tvb, pinfo, tree, TRUE, usb_conv_info)) {
call_data_dissector(next_tvb, pinfo, tree);
}
break;
@ -581,7 +581,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
next_tvb = tvb_new_subset_length(tvb, 10, payload_len);
pinfo->p2p_dir = P2P_DIR_RECV;
if (!dissector_try_uint_new(subdissector_table, 0, next_tvb, pinfo, tree, TRUE, usb_conv_info)) {
if (!dissector_try_payload_new(subdissector_table, next_tvb, pinfo, tree, TRUE, usb_conv_info)) {
call_data_dissector(next_tvb, pinfo, tree);
}
break;
@ -879,10 +879,7 @@ proto_register_ccid(void)
usb_ccid_handle = register_dissector("usbccid", dissect_ccid, proto_ccid);
subdissector_table = register_dissector_table(
"usbccid.subdissector", "USB CCID payload",
proto_ccid, FT_UINT32, BASE_HEX);
register_decode_as_next_proto("USB CCID", "Transport", "usbccid.subdissector", NULL);
subdissector_table = register_decode_as_next_proto(proto_ccid, "Transport", "usbccid.subdissector", "USB CCID payload", NULL);
}
/* Handler registration */