Skip to content
Tom Barbette edited this page Nov 25, 2022 · 1 revision

StringMatcher Element Documentation

NAME

StringMatcher — Click element; Matches a packet based on a set of strings

SYNOPSIS

StringMatcher(STRING_1, ..., STRING_1)

Batching: Batching natively supported
Ports: 1 input, 1-2 outputs
Processing: agnostic, but output 1 is push
Drivers: userlevel

DESCRIPTION

Tries to match a packet to one of the strings given in the configuration. If a match is found the packet is sent to output 1. If nothing is connected it is discarded. Packets which do not match any string are sent the output 0.

EXAMPLES

For example,

        ... -> sm::StringMatcher(xnet, text1, test3) -> Discard;
        sm[1] -> ...

Creates an element with 2 outputs. If a packets matches any of the strings (xnet, text1 or test3) it will be send to output 1, otherwise it will be discarded

ELEMENT HANDLERS

  • matches (read-only) — Returns the number of matched packets.
  • reset_count (write-only) — When written, resets the matches.

Generated by click-elem2man from ../elements/ids/stringmatcher.hh:7 on 2022/11/25.

Clone this wiki locally