Table Of Contents
Table Of Contents

Generic Classifier

The PacketClassifier module classifies packets based on the configured packet classifier function.

In this example network, packets are generated by an active packet source (ActivePacketSource). The packets are pushed into a PacketClassifier module, which are connected to two passive packet sinks (PassivePacketSink).

The source generates 1-byte packets, which randomly contain either 0 or 1 as data. The classifier is configured to use the PacketDataClassifier function to classify packets. The function selects the classifier’s output where the output index matches the data contained in the packet. Thus packets with data 0 are pushed to consumer1, and those with data 1 to consumer2.

network GenericClassifierTutorialStep
        producer: ActivePacketSource {
        classifier: PacketClassifier {
        consumer1: PassivePacketSink {
        consumer2: PassivePacketSink {
    connections allowunconnected:
        producer.out -->;
        classifier.out++ -->;
        classifier.out++ -->;
[Config GenericClassifier]
network = GenericClassifierTutorialStep
sim-time-limit = 10s

*.producer.packetLength = 1B
*.producer.packetData = intuniform(0, 1)
*.producer.productionInterval = 1s
*.classifier.classifierClass = "inet::queueing::PacketDataClassifier"