Hi list,
Are composite TVB's known to work? I can't find a dissector that uses them as an example. I'm using two subtree tvb's and trying to combine them into one composite tvb:
tvbuff_t *ud_tvb = tvb_new_composite();
tvb_composite_append(ud_tvb, udh_tvb);
tvb_composite_append(ud_tvb, body_tvb);
tvb_composite_finalize(ud_tvb);
add_new_data_source(pinfo, ud_tvb, "GSM SMS UD");
call_dissector(gsm_sms_ud_handle, ud_tvb, pinfo, tree);
This seems to work, as in the GUI the new data source can be seen, with the correct bytes. However, something throws an exception pretty quickly which is caught in packet-frame.c and displayed "Malformed Packet".
I do however manage to get the first byte decoded and have noticed that the GUI doesn't automatically switch between the two data sources as it should - is there somewhere in the GUI that asks a data source whether it contains a tvb (and both data sources return true?). If noone knows off hand then I'll dig further...
Replacing the code above with:
guint8 *this_sucks = g_malloc(udh_tvb->length + body_tvb->length);
tvb_memcpy(udh_tvb, this_sucks, 0, udh_tvb->length);
tvb_memcpy(body_tvb, &this_sucks[udh_tvb->length], 0, body_tvb->length);
tvbuff_t *ud_tvb = tvb_new_real_data(this_sucks, udh_tvb->length + body_tvb->length, udh_tvb->length + body_tvb->length);
add_new_data_source(pinfo, ud_tvb, "GSM SMS UD");
call_dissector(gsm_sms_ud_handle, ud_tvb, pinfo, tree);
...works as intended.
Regards,
Chris
--
Chris Wilson <chris@xxxxxxxxxxxxx>
http://www.mxtelecom.com