Ethereal-dev: Re: [Ethereal-dev] tap

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Miha Jemec <m.jemec@xxxxxxxxxxx>
Date: Fri, 07 Feb 2003 10:06:42 +0100
Hi!

In order to make changes (using the tap system) to the RTP plugin I posted some time ago, 2 more questions:

From Jason House:
The other way involves populating the pri paramater from the protocol you
are trying to tap.
 ... having a structure that you define a field for what you want to
access, and then having
 that field sent directly to your tap listener.  The packet-rpc* should be
a good example of that.

1. Is it allowable ("smart" would be better) to change the packet-rtp.c in a way, that when calling tap_queue_packet(rtp_tap, pinfo, *pri) the pri is a structure with information I need (seq.nr, timestemp, ssrc, data,...). That seems to me much faster than doing all the "...g_node_first_child(edt->tree),   "g_node_next_sibling(),... " stuff.


2.my code looks something like:

...
rtp_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, void *pri)
{
       printf("in rtp packet\n");
}

void gtk_rtp_init(void)
{
       if(register_tap_listener("rtp", NULL, NULL, rtp_reset, rtp_packet, rtp_draw)){
               printf("ethereal: rtp_init() failed to attach to tap.\n");
               exit(1);
       }
}

void rtp_analyse_cb(GtkWidget *w _U_) {
       gtk_rtp_init();
}

void
register_tap_listener_gtkrtp(void)
{
       register_ethereal_tap("rtp", gtk_rtp_init, NULL, NULL);
}

If I first click on the button that calls rtp_analyse_cb() which registers the tap, and than do the capturing or opening a file it works OK (I get the printf statement in rtp_packet() ). But the problem for me is: what if I first do the capturing and would then like to do the analysis. How can I force the "rescaning" of the packets, so that I will get the trigger for the RTP packets? Should I call the file_reload_cmd_cb() which reloads the packets or is there another possibility with taps?

Thanks for further help, Miha.