I thought that might be the case, but I've noticed some dissectors that
don't do this... at least not the way you suggest below. That's why I
was a bit confused.
--kan--
-----Original Message-----
From: Martin Regner [mailto:martin.regner@xxxxxxxxx]
Sent: Tuesday, 16 September, 2003 1:26 AM
To: Kevin A. Noll
Subject: Re: [Ethereal-dev] New dissector...
Hi,
You'll need to reload the capture after you have changed the preference
setting. Have you tried that?
The MGCP dissector handles configurable port numbers (see
/plugins/mgcp/packet-mgcp.c) and I think I remember that is
working.
If you follow the example in the MGCP dissector your code could would look
something like below.
I think that there is similar solution in some other dissectors
(packet-beep.c, packet-cops.c , ...)
-----------
static unsigned int rtp_event_payload_type_value = 101;
static int rtp_event_pl_type = 0;
:
:
/* The registration hand-off routine */
void
proto_reg_handoff_rtp_events(void)
{
static int rtp_events_prefs_initialized = FALSE;
static dissector_handle_t rtp_events_handle;
if (!rtp_events_prefs_initialized) {
rtp_events_handle = create_dissector_handle(dissect_rtp_events,
proto_rtp_events);
rtp_events_prefs_initialized = TRUE;
}
else {
dissector_delete("rtp.pt", rtp_event_pl_type, rtp_event_handle);
}
rtp_event_pl_type = rtp_event_payload_type_value;
/* rtp_event_payload_type_value is the variable set from preferences */
dissector_add("rtp.pt", rtp_event_pl_type, rtp_events_handle);
}
-----Original Message-----
From: Kevin A. Noll <kevin.noll@xxxxxxxxxxxxxxxx>
To: ethereal-dev@xxxxxxxxxxxx <ethereal-dev@xxxxxxxxxxxx>
Date: Tuesday, September 16, 2003 4:14 AM
Subject: [Ethereal-dev] New dissector...
Please excuse me if this hasa been discussed, but I could not
find anything that answered my question.
I have written a dissector for RTP events (RFC 2833). The dissector
works asa expected. However, since the payload type is specified to
be a range, I can't simply update the payload type tables in rtp-pt.h
and call the new dissector using that.
Instead, I would like to use a user preference.
Using other dissectors as examples, I am able to register the preference
and I can change the value in the preferences dialog. However,
when I change the value that I want to use, the decode does not change
appropriately.
So, how do I get the decode to use the preference that I am setting?
The dissector source is included below.
BTW - I am not a very experienced programmer/developer, so suggestions on
how to better implement this are welcome.