PacketBasedTokenGenerator¶
Package: inet.queueing.tokengenerator
simple module PacketBasedTokenGenerator
Generates tokens into the configured TokenBasedServer for each consumed packet.
Usage diagram¶
Inheritance diagram¶
Used in compound modules¶
Name |
Type |
Description |
|---|---|---|
compound module |
Contains a configurable pre-composed telnet traffic source and traffic sink as part of a telnet server application. |
|
compound module |
Processes incoming packets one by one in the order they arrive. First, it classifies a packet according to the configured classifier function, then it generates tokens for the selected category in the configured response producer. |
Extends¶
Name |
Type |
Description |
|---|---|---|
simple module |
Base module for various token generator modules. |
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
displayStringTextFormat |
string |
“processed %p pk (%l)\ngenerated %t tk\nto %s” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
storageModule |
string |
Module path of the token storage where the tokens are generated via C++ method call |
|
numTokensPerPacket |
double |
1 |
Number of tokens per consumed packet |
numTokensPerBit |
double |
0 |
Number of tokens per consumed bit |
Properties¶
Name |
Value |
Description |
|---|---|---|
class |
PacketBasedTokenGenerator |
|
display |
i=block/control |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
in |
input |
Signals¶
Name |
Type |
Unit |
Description |
|---|---|---|---|
tokensCreated |
double |
Statistics¶
Name |
Title |
Source |
Record |
Unit |
Interpolation Mode |
Description |
|---|---|---|---|---|---|---|
numTokensCreated |
number of created tokens |
tokensCreated |
sum,vector |
tk |
none |
the statistical value is the number of created tokens |
tokensCreated |
tokens created |
count(tokensCreated) |
count |
tk |
the statistical value is the number of times tokens were created |
Source code¶
//
// Generates tokens into the configured ~TokenBasedServer for each
// consumed packet.
//
simple PacketBasedTokenGenerator extends TokenGeneratorBase like ITokenGenerator, IPassivePacketSink
{
parameters:
volatile double numTokensPerPacket = default(1); // Number of tokens per consumed packet
volatile double numTokensPerBit = default(0); // Number of tokens per consumed bit
displayStringTextFormat = default("processed %p pk (%l)\ngenerated %t tk\nto %s"); // %p number of packets, %l total length
@class(PacketBasedTokenGenerator);
gates:
input in;
}
File: src/inet/queueing/tokengenerator/PacketBasedTokenGenerator.ned