https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2688
--- Comment #16 from Travis Dawson <travis.dawson@xxxxxxxxxx> 2008-08-25 20:38:27 PDT ---
> A few other comments:
>
> - port 4001 is not IANA assigned so this dissector really should be a "new
> style" one: that is, it should do some heuristics and if it finds the packet
> doesn't belong to it, it should return 0 (it also would need to register with
> new_create_dissector_handle()--see README.developer)
I think I know how to do 'some' of this (basically once I determine if the
packet is NOT a mojito packet, just return 0). But is there any way to make it
look at every udp packet to find out if something IS mojito, like say 'look at
byte offset x and if its 0x44 then its Mojito'???
I'll work on this now.
>
> - More (sub-)functions, please!
Not really a need to do this much, but I will put some of the contact tree
stuff in subfunctions.
>
> - I noticed a couple cases where the values "IPV4" or "IPV6" were used instead
> of the #defines
IPV4 and IPv6 are defines.
>
> - A few switch statements have no default case--is that really the behavior you
> want if the packet is wrong/munged? (The answer may be yes but I just wanted
> to make sure you'd thought of it; this may also relate to the
> it-can't-be-Mojito comment)
I think I will just put a BAIL for those, that ok. A return 0.
>
> - by the time you get to this code:
>
> if (!initialized) {
> mojito_handle = create_dissector_handle(dissect_mojito,
> proto_mojito);
> initialized = TRUE;
> } else {
> dissector_delete("udp.port", global_mojito_port,
> mojito_handle);
> }
>
> dissector_add("udp.port", global_mojito_port, mojito_handle);
>
> 'global_mojito_port' will already have the new value--so the delete won't work.
> That's why you need a 2nd variable (check some of the other dissectors for
> examples.
I think I get it, can you point out a quick example so I know what it is
exactly.
>
>
> (That's all I had time for now; one other thing I didn't have time to finish
> looking at: it looks like there is only 1 possible subtree (ett_mojito) which
> makes for an awfully flat tree. But maybe that's the way the protocol is?)
I have a bunch of subtree's under the main tree.
I think that's what your asking.
--
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.