Table Of Contents
Table Of Contents

Generating Tokens after Received Packets

The PacketBasedTokenGenerator is a passive packet sink, and generates a configurable number of tokens into a token-based server when receiving a packet.

Packets are generated by an active packet source (ActivePacketSource), and pushed into the token generator (PacketBasedTokenGenerator). The generator generates tokens into a token-based server (TokenBasedServer). When the server has tokens, it pops packets from the connected packet provider (PassivePacketSource), and pushes them into a packet consumer (PassivePacketSink).

network PacketBasedTokenGeneratorTutorialStep
        producer: ActivePacketSource {
        provider: PassivePacketSource {
        server: TokenBasedServer {
        consumer: PassivePacketSink {
        tokenGenerator: PacketBasedTokenGenerator {
            storageModule = "^.server";
    connections allowunconnected:
        producer.out -->;
        provider.out -->;
        server.out -->;
[Config PacketBasedTokenGenerator]
network = PacketBasedTokenGeneratorTutorialStep
sim-time-limit = 10s

*.provider.packetLength = 1B
*.producer.packetLength = 1B
*.producer.productionInterval = 1s