Ethereal-dev: Re: [Ethereal-dev] Patch for tethereal taps

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

From: Jason House <jhouse@xxxxxxxxx>
Date: Tue, 29 Oct 2002 10:36:52 -0500
Cool... I was hoping to see a tap registration system.

Now for commentary on the specific implementation :)
I like the cleanup to tethereal, but would still prefer to see a slightly
different implementation.  I'm thinking that tethereal should not know about
tap_list and that the tap_listeners should not know about '-z' for tethereal.
The second item should allow the registration to work for both tethereal and
ethereal.

consider replacing:
for(tli=tap_list;tli;tli=tli->next){
   if(!strncmp(tli->cmd,optarg,strlen(tli->cmd))){
     (*tli->func)(optarg);
     break;
  }
}

with something like:
for (int i=0;i<strlen(optarg); i++){
    if (optarg[i] == ','){
        optarg[i] = '\0';
        char *error_message = init_tap_listener( optarg, &optarg[i+1]  );
        if (error_message != NULL){
            printf("error using -z, %s config error: %s", optarg,
error_message);
        }
        break;
    }
}

    This mechanism will shelter tethereal from any and all internal tap
implementation changes.  init_tap_listener() hides all details.  It is also
easily conceivable to have a call to init_tap_listener() in multiple places
within ethereal... at startup like in tethereal as well as via a very basic
GUI.
    A simple window where you select a tap listener from a combo box, and have
one or two string inputs.  For the one string input case, the string would be
everything after the ',' in the -z command line option.  For two strings, one
string would be the tap-specific config and the second string would be for
filter expression (with all relevant helper features like normal filter
expressions).
    I could also imagine that the taps could have a preference registration
mechanism similar to the protocol dissectors.  A  function to convert the
preferences into a tap listener configuration string would force tethereal to
be at least as capable as ethereal... I'm sure there can be plenty more to this
discussion, for the moment a preference registration seems a bit of overkill
with so few tap listeners... but maybe that's the whole reason to implement it
now...


Pia Sahlberg wrote:

> Hi list.
>
> Please apply.
>
> Attached is a patch for tethereal and the tap-listeners for tethereal.
>
> It changes tethereal to have a simple registration interface for which taps
> are available
> similar to register.c for dissectors.
>
> Note: you must change the make-tapreg-dotc script to be executable in order
> to compile ethereal.
>
> Future tap additions to tethereal wil not need any changes to tethereal.c
> itself.
> When this is checked in I will look at doing something similar to gtk/gtk2
> versions of ethereal.
>
> best regards
>    ronnie sahlberg
>
> _________________________________________________________________
> Get faster connections -- switch to MSN Internet Access!
> http://resourcecenter.msn.com/access/plans/default.asp
>
>   ------------------------------------------------------------------------
>                      Name: tapreg.diff.gz
>    tapreg.diff.gz    Type: unspecified type (application/octet-stream)
>                  Encoding: base64