Table Of Contents
Table Of Contents

Requesting Protocol-Specific Behavior Based on Packet Data

The ContentBasedTagger module, similarly to PacketTagger, attaches protocol-specific request tags to packets based on their content, according to the configured packet filter and packet data filter.

In this example network, an active packet source (ActivePacketSource) generates 1-byte and 2-byte packets randomly. The packet source pushes packets into the tagger (ContentBasedTagger), which is configured to attach a hop limit tag to 1-byte packets. Packets are consumed by a passive packet sink (PassivePacketSink).

../../../_images/ContentBasedTagger.png
network ContentBasedTaggerTutorialStep
{
    @display("bgb=600,200");
    submodules:
        producer: ActivePacketSource {
            @display("p=100,100");
        }
        tagger: ContentBasedTagger {
            @display("p=300,100");
        }
        consumer: PassivePacketSink {
            @display("p=500,100");
        }
    connections:
        producer.out --> tagger.in;
        tagger.out --> consumer.in;
}
[Config ContentBasedTagger]
network = ContentBasedTaggerTutorialStep
sim-time-limit = 10s

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