Table Of Contents
Table Of Contents

Content-Based Filtering (Active Source)

The ContentBasedFilter module filters packets according to the configured packet filter and packet data filter. Packets that match the filter expressions are pushed/popped on the output; non-maching packets are dropped.

In this example network, an active packet source (ActivePacketSource) generates 1-byte and 2-byte packets randomly. The source pushes packets into a filter (ContentBasedFilter), which pushes 1-byte packets into a passive packet sink (PassivePacketSink) and drops 2-byte ones.

network Filter1TutorialStep
        producer: ActivePacketSource {
        filter: ContentBasedFilter {
        consumer: PassivePacketSink {
    connections allowunconnected:
        producer.out -->;
        filter.out -->;
[Config Filter1]
network = Filter1TutorialStep
sim-time-limit = 10s

*.producer.packetLength = intuniform(1B, 2B)
*.producer.productionInterval = 1s
*.filter.packetFilter = expr(totalLength == 1B)