> I have worked up the attached code as a lookup routine for the TCP and UPD
> port based dissectors. Please review it and make comments.
It looks as if it could be the promised generalization of the UDP
hashing routines in "packet-udp.c".
Given that, I would be tempted to
1) have the "port" field be 32 bits (to handle protocols where
there's a discriminator larger than 16 bits);
2) get rid of the wrappers such as "XXXDissectorDelete()" and,
instead, have the code that registers or unregisters a
dissector pass in the dissector array - or pass in a protocol
name and use that as a key to look up a pointer to the
dissector array in a table.
Could, and should, the GLib hash table routines be used here, instead of
doing the hashing ourselves?
> DissectorType *FindTcpDissector( guint16 Port1, guint16 Port2) {
>
> DissectorType *Tmp;
>
> if ( Port1 <= Port2) {
Note that we shouldn't assume that the lower-numbered port is the port
number for the service - I put the "PORT_IS()" macros into
"packet-udp.c" and "packet-tcp.c" because I had a trace in which the
client really *did* use a lower port number than the server, and using
the lower-numbered port number as the service's port caused the trace
not to be dissected correctly.