Wireshark mailing list archives
Re: Getting data extracted by my dissector into another
From: Chris Maynard <Chris.Maynard () gtech com>
Date: Wed, 6 Jul 2011 19:30:24 +0000 (UTC)
Colin Helliwell <colin.helliwell@...> writes:
I’ve developed a number of dissectors which dissect payload from those below
and decode their own protocol. Now I want to pass my payload ‘ownward’ to
another (the JSON dissector). I’d appreciate any tips on how to
initialise/register my protocol such that the JSON dissector sees it and/or how
to pass the payload on to it. A summary of the calls used would probably do –
enough to get me going in the right direction.
You may want to make use of find_dissector() and call_dissector(). ie.,
something like:
static dissector_handle_t json_handle;
static void
dissect_yourproto(...)
{
tvbuff_t *next_tvb;
...
/* All done processing your stuff, so hand off dissection to json,
* (assuming you know the payload is for the json dissector) */
next_tvb = tvb_new_subset(tvb, offset, length, length);
/* ... or next_tvb = tvb_new_subset_remaining( ... ); */
call_dissector(json_handle, next_tvb, pinfo, some_tree);
}
void
proto_reg_handoff_yourproto(void)
{
json_handle = find_dissector("json");
}
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives: http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Re: Getting data extracted by my dissector into another Chris Maynard (Jul 06)
