Ethereal-dev: Re: [Ethereal-dev] Request to add function name "dissect_snmp_pdu " to libethere

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 12 Oct 2004 10:19:08 -0700
Liu Chunfang-CCL083 wrote:
It is SNMP running directly over Ethernet,

I.e., regular SNMP, not some protocol that uses SNMP syntax but that shouldn't be thought of as regular SNMP?

but has different Ethernet type defined in packet-snmp.c.
And there are some padding field between Ethernet and SNMP. The protocol stack is:

	----------------
	SNMP
	----------------
	Pad Field
	----------------
	Pad Length
	----------------
	Ethernet Header
	----------------

If it really is regular SNMP, I think you could do that without calling dissect_snmp_pdu() - you could have a dissector that registers in the "ethertype" table with the protocol type for your protocol, that dissects the pad length and pad field, and that then calls the SNMP dissector. You can call the SNMP dissector by doing

	snmp_handle = find_dissector("snmp");

in your dissector's reg_handoff routine (*not* the register routine - that's too early, as SNMP's register routine might not yet have been called), and in your dissector use the "call_dissector()" routine with the "snmp_handle" variable (which should be a static dissector_handle_t variable). That wouldn't require any changes to Ethereal at all.