Skip to content

click fastclassifier

Tom Barbette edited this page Aug 6, 2018 · 1 revision

click-fastclassifier

specializes Classifier code in a Click configuration

Synopsis

click-fastclassifier [options] [param=value ...] [router-file]

Description

The click-fastclassifier tool speeds up a Click configuration by creating fast versions of all its Classifier, IPClassifier, and IPFilter elements. It reads a router configuration file in the click language and creates specialized C++ source code for each Classifier-like element. A Classifier is expanded into a series of if statements; for example, the expansion of ‘Classifier(0/80, -)’ contains something like this function:

inline void
FastClassifier_a_ac::length_unchecked_push(Packet *p)
{
  const unsigned *data = (const unsigned *)(p->data() - 0);
 step_0:
  if ((data[0] & 255U) == 128U) {
    output(0).push(p);
    return;
  }
  output(1).push(p);
  return;
}

After creating the source code, click-fastclassifier will optionally compile it into dynamically loadable packages. The Classifier elements in the input configuration are changed to use new FastClassifier elements, and the resulting configuration, plus source code and any compiled packages, are combined into an archive and written to the standard output. You can install such an archive into the click.o Linux kernel module with click-install:

  % click-fastclassifier -k CONFIGURATION | click-install
The

click user level driver can read the archives directly.

The click-fastclassifier transformation can be reversed with the --reverse option.

Options

If any filename argument is a single dash "-", click-fastclassifier will use the standard input or output instead, as appropriate.

  • -f file

  • --file file

    Read the router configuration to transform from file. The default is the standard input.

  • -e expr

  • --expression expr

    Use expr, a string in the Click language, as the router configuration to transform.

  • -o file

  • --output file

    Write the output router configuration to file. The default is the standard output.

  • -k, --kernel

    Generate a dynamically loadable package for the click.o Linux kernel module.

  • -u, --user

    Generate a dynamically loadable package for the click user-level driver.

  • -s, --source

    Output only the source code for the FastClassifier elements.

  • -c, --config

    Output only the new configuration (the one that includes FastClassifiers).

  • -r, --reverse

    Reverse the tranformation. That is, remove any existing FastClassifier elements and replace them with equivalent Classifiers.

  • -q, --quiet

    Compile code quietly (without echoing commands or top-level warnings).

  • --help

    Print usage information and exit.

  • --version

    Print the version number and some quickie warranty information and exit.

See Also

click, click-devirtualize, click-install, click, click.o, Classifier, IPClassifier, IPFilter

Author

Eddie Kohler, kohler@seas.harvard.edu
https://github.com/tbarbette/fastclick

Clone this wiki locally