Wireshark-dev: Re: [Wireshark-dev] Modifying the ETH dissector
First, you might try reading through the documentation. README.developer
and README.heuristic ought to provide you with just about all the information
you need to get you started. But to answer your questions: 1) Yes, your plugin will change slightly going from a normal
dissector to a heuristic one. The README’s should explain all of this. 2) You can fetch the Ethernet MAC address from pinfo. See
epan/packet_info.h. 3) The Ethernet dissector will hand off the packet to your
dissector starting with the payload. In other words, your dissector will not
get the 1st 14 bytes of packet, which is the Ethernet header. It is
then up to your dissector to try to figure out, heuristically, whether or not
the payload is actually yours or not to dissect. If it isn’t, return FALSE; if
it is, dissect the packet accordingly and return TRUE. If you need the Ethernet
header information to help determine if it’s yours or not, then you can get all
of it from pinfo. Assuming it’s your data, you should end up with a tree structure
such as: + Frame 1 (xx bytes on wire, yy bytes captured) + Ethernet II, Src: xx:xx:xx:xx:xx:xx, Dst: yy:yy:yy:yy:yy:yy + Your protocol, Your protocol-specific summary information So, I’m not exactly sure what you meant by “may I reuse the Eth
packet analysis”, but you can certainly get the Ethernet related information via
pinfo if you need it, and if you were wondering whether you need to handle
dissection of the Ethernet header or not, you don’t. Your dissector will only
need to populate that last tree. 4) When you’re done dissecting your protocol’s data and assuming
you know the rest is IP, simply call “call_dissector(ip_handle)”. E.g., this
pseudo-code should give you an idea: static dissector_handle_t ip_handle; static gboolean dissect_PROTOABBREV(tvbuff_t *tvb, packet_info *pinfo, proto_tree
*tree) { tvbuff_t *next_tvb; proto_tree *your_tree; handle_heuristics(); dissect_your_stuff(); /* Assuming the rest of the payload is IPv4, create a new tvb
subset and * pass it to the IP dissector. * Offset is the offset into your payload where IPv4 data
begins. * len is the length of the IP data. */ next_tvb = tvb_new_subset(tvb, offset, len, len); call_dissector(ip_handle, next_tvb, pinfo, your_tree); } void proto_reg_handoff_PROTOABBREV(void) { ip_handle = find_dissector("ip"); } - Chris From:
wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of yvanmmailbox-web@xxxxxxxx Hi
all, CONFIDENTIALITY NOTICE: The contents of this email are confidential and for the exclusive use of the intended recipient. If you receive this email in error, please delete it from your system immediately and notify us either by email, telephone or fax. You should not copy, forward, or otherwise disclose the content of the email. |
- Follow-Ups:
- [Wireshark-dev] Re : Modifying the ETH dissector
- From: yvanmmailbox-web
- [Wireshark-dev] Re : Modifying the ETH dissector
- References:
- [Wireshark-dev] Modifying the ETH dissector
- From: yvanmmailbox-web
- [Wireshark-dev] Modifying the ETH dissector
- Prev by Date: [Wireshark-dev] buildbot failure in Wireshark (development) on Solaris-10-SPARC
- Next by Date: Re: [Wireshark-dev] slow startup caused by splash_update?
- Previous by thread: [Wireshark-dev] Modifying the ETH dissector
- Next by thread: [Wireshark-dev] Re : Modifying the ETH dissector
- Index(es):