Pass the pseudo-header to wtap_encap dissectors via the "data" argument.

Have the "data" argument to dissectors registered in thw wtap_encap
dissector table point to the pseudo-header for the packet.

Use that argument in the Bluetooth dissector.

Change-Id: I022bbfb796ef51d95df09fb952a149960170d631
Reviewed-on: https://code.wireshark.org/review/8951
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-06-16 10:51:47 -07:00
parent 46a9afb462
commit 200c15e96d
2 changed files with 15 additions and 11 deletions

View File

@ -1380,10 +1380,10 @@ dissect_bluetooth_bthci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree);
/*
* Point to the bthci pseudo-header.
* data points to a struct bthci_phdr.
*/
bluetooth_data->previous_protocol_data_type = BT_PD_BTHCI;
bluetooth_data->previous_protocol_data.bthci = &pinfo->pseudo_header->bthci;
bluetooth_data->previous_protocol_data.bthci = (struct bthci_phdr *)data;
if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) {
call_dissector(data_handle, tvb, pinfo, tree);
@ -1403,10 +1403,10 @@ dissect_bluetooth_btmon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree);
/*
* Point to the btmon pseudo-header.
* data points to a struct btmon_phdr.
*/
bluetooth_data->previous_protocol_data_type = BT_PD_BTMON;
bluetooth_data->previous_protocol_data.btmon = &pinfo->pseudo_header->btmon;
bluetooth_data->previous_protocol_data.btmon = (struct btmon_phdr *)data;
if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) {
call_dissector(data_handle, tvb, pinfo, tree);

View File

@ -491,15 +491,20 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
case REC_TYPE_PACKET:
if ((force_docsis_encap) && (docsis_handle)) {
call_dissector(docsis_handle, tvb, pinfo, parent_tree);
call_dissector_with_data(docsis_handle,
tvb, pinfo, parent_tree,
(void *)pinfo->pseudo_header);
} else {
if (!dissector_try_uint(wtap_encap_dissector_table, pinfo->fd->lnk_t,
tvb, pinfo, parent_tree)) {
if (!dissector_try_uint_new(wtap_encap_dissector_table,
pinfo->fd->lnk_t, tvb, pinfo,
parent_tree, TRUE,
(void *)pinfo->pseudo_header)) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP_ENCAP = %d",
pinfo->fd->lnk_t);
call_dissector(data_handle,tvb, pinfo, parent_tree);
call_dissector_with_data(data_handle,
tvb, pinfo, parent_tree,
(void *)pinfo->pseudo_header);
}
}
break;
@ -514,8 +519,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
}
if (!dissector_try_uint(wtap_fts_rec_dissector_table, file_type_subtype,
tvb, pinfo, parent_tree)) {
tvb, pinfo, parent_tree)) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP_ENCAP = %d",
file_type_subtype);