On Sep 25, 2003, at 1:01 PM, Sid Sid wrote:
Please, have a look at attachment.
It returns FALSE even if the packet is a session packet, except when it
appears to return a number rather than a true/false value.
The only check it does is to check whether the packet is at least 4
bytes long; that's not enough - that means that it could accept packets
that aren't session-layer packets, which means that other heuristic
dissectors for COTP, such as the SMB dissector, might not get a chance
to check whether the packet is one of theirs.
If it's not possible to have a good heuristic to check for OSI Session
packets, perhaps the COTP dissector should try its heuristics and, if
none of them match, try the session dissector.
It also casts "dissect_ses" to a "void *", which hides the compiler
errors that would have detected the original problem. Remove those
casts, and either fix or remove the lines that get errors or warnings
as a result of that change. (All the lines I saw could just be
removed.)
Note also that you have a number of places where you do a "switch()" on
some value and select a constant string based on the value; that's
probably best done using a value_string table - especially if the value
has a field associated with it, because you can then associate that
value_string table with the field.