Custom bluetooth transport implementation
Hi
I work with device that implements HCI interface over vendor specific USB protocol. I would be able to create dissector plugin if function:
static bluetooth_data_t *
dissect_bluetooth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
...was not private to packet-bluetooth.c.
Currently supported transports are coupled with bluetooth protocol inside function proto_reg_handoff_bluetooth()
(and some static functions called inside) and use disset_bluetooth_common()
that I would also like to use.
I wander if exporting function dissect_bluetooth_common() would be a problem or there is other recommended way to create data of type bluetooth_data_t
needed later for actual HCI command/event dissectors?
Or maybe I need to integrate some strange protocol into packet-bluetooth.c?
Thanks for advise.
I'm not very familiar with bluetooth so might be missing the point as to where your protocol fits in, but the bluetooth dissector creates a number of tables that subdissectors can register with to be called when the common routine locates a packet of interest, e.g. the HCI Vendor table "bluetooth.vendor", do any of these fit your needs? Hint, look for
register_dissector_table()
calls to see the tables available.Various bluetooth dissectors expect that
void *data
passed to them is of typebluetooth_data_t *
the only function that actually creates this isdissect_bluetooth_common()
. Protocol that I'm working with can register itself but at some point it wants to call bluetooth dissectors like thiscall_dissector_with_data(bthci_cmd_handle, next_tvb, pinfo, tree, bluetooth_data);
first argument I can get using find_dissector_add_dependency() without need to modify packet-bluetooth.h but the last one bluetooth_data is only created in one file for various transports see functions dissect_bluetooth()dissect_bluetooth_bthci()dissect_bluetooth_btmon()dissect_bluetooth_usb()dissect_bluetooth_ubertooth() So I would like to pass data down to correct dissector but required data is not created so I guess I can't find it in any table.Sorry for being an idiot, but I don't follow the protocol stack you have. Are you saying you have something like:
If not, can you explain the protocol stack?
its like this
it is very similar to what usb_hci does
So basically it replaces Bluetooth standardized USB transport. Bleutooth over USB normally uses some set of USB endpoints for various purposes while this custom transport uses different endpoints configuration and also handled some non-bluetooth traffic. Wireshark handles usb_hci in in packet-hci_usb.c and packet-bluetooth.c.
Given the stack you describe, why can't your dissector call the bluetooth top-level dissector (
dissect_bluetooth
) which calls the internal functiondissect_bluetooth_common
? Maybe because that isn't registered via a call toregister_dissector
. <br\><br/> The dissector is registered in thewtap_encap
table (and theusb.product
andusb.protocol
tables for thedissect_bluetooth_usb
function) for various tabel values so could be located there and then called.