Comment # 13
on bug 8506
from Anders Broman
(In reply to comment #12)
> Are you talking about changing dissector_add_uint() to
> dissector_add_handle()?
That's a posibillity but then ypu'd always have to do "decode as" if insted you
add a port preference and default it to zero. Your dissector will not interfere
with the assigned protocol for that port, but you can then change the
preference to whatever port you like. ther are numerous examples on how to do
that.
Something like
void proto_reg_handoff_foo(void)
{
static int foo_prefs_initialized = FALSE;
static guint foo_port1;
static guint foo_port2;
if(foo_prefs_initialized == FALSE)
{
foo_handle = create_dissector_handle(dissect_foo_udp_pdu, proto_foo);
foo_port1 = global_foo1_port;
foo_port2 = global_foo2_port;
foo_prefs_initialized = TRUE;
}
else
{
dissector_delete_uint("udp.port", foo_port1, foo_handle);
dissector_delete_uint("udp.port", foo_port2, foo_handle);
}
if(global_foo1_port != 0 ){
dissector_add_uint("udp.port", global_foo1_port, foo_handle);
}
if(global_foo2_port != 0 ){
dissector_add_uint("udp.port", global_foo2_port, foo_handle);
}
foo_port1 = global_foo1_port;
foo_port2 = global_foo2_port;
}
with the code of adding the uint preference of course.
You are receiving this mail because:
- You are watching all bug changes.