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: Liu Chunfang-CCL083 <ChunfangLiu@xxxxxxxxxxxx>
Date: Tue, 12 Oct 2004 15:09:16 -0500
I've tried the way to use "call_dissector()" to call snmp dissector in my dissector. But it does not work. Because packet-snmp.c reigster routine use "create_dissector_handle(dissect_snmp, proto_snmp)" to register(create an anonymous handle for a dissector). When I use snmp_handle = find_dissector("snmp") in my dissector handoff routine, I'll get snmp_handle=NULL.

I do not know why some dissectors use create_dissector_handle()and others use register_dissector() routine to register.

After I tried the way above, I think maybe I can call dissect_snmp_pdu() directly in my plug-in dissector. It works fine in UNIX, but need to modify plugin-API or libethereal.def on windows.

So I submitted this request to add "dissect_snmp_pdu " to libethereal.def in new version ethereal. Or someone can change packet-snmp.c to register snmp dissector using routine register_dissector(). Either way is OK for me.

-----Original Message-----
From: ethereal-dev-bounces@xxxxxxxxxxxx [mailto:ethereal-dev-bounces@xxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: Tuesday, October 12, 2004 12:19 PM
To: Ethereal development
Subject: Re: [Ethereal-dev] Request to add function name "dissect_snmp_pdu " to libethereal.de f in new version ethereal


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.

_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx http://www.ethereal.com/mailman/listinfo/ethereal-dev