RequestConsumer

Package: inet.queueing.sink

compound module RequestConsumer

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.

See also: ResponseProducer

RequestConsumerin --> queue.inqueue.out --> server.inserver.out --> classifier.inclassifier.out++ --> tokenGenerator[i].in for i=0..sizeof(tokenGenerator) - 1⦀queue: inet.queueing.queue.PacketQueue (like IPacketQueue) PacketQueue: Implements a configurable packet queue, which is suitable for use in MAC protocols, traffic condi... IPacketQueue: Interface for packet queue modules. Source: queue: <default("PacketQueue")> like IPacketQueue { @display("p=200,100"); }queueserver: inet.queueing.server.TokenBasedServer (like IPacketServer) TokenBasedServer: Repeatedly pulls packets from the connected packet provider and it pushes them into the connected... IPacketServer: Interface for packet server modules. Source: server: <default("TokenBasedServer")> like IPacketServer { initialNumTokens = default(1); @display("p=200,225"); }serverclassifier: inet.queueing.classifier.PacketClassifier (like IPacketClassifier) PacketClassifier: Connects one packet producer to multiple packet consumers. IPacketClassifier: Interface for packet classifier modules. Source: classifier: <default("PacketClassifier")> like IPacketClassifier { @display("p=200,350"); }classifiertokenGenerator[numKind]: inet.queueing.tokengenerator.PacketBasedTokenGenerator (like IPassivePacketSink) PacketBasedTokenGenerator: Generates tokens into the configured ~TokenBasedServer for each consumed packet. IPassivePacketSink: Interface for passive packet sink modules. Source: tokenGenerator[numKind]: <default("PacketBasedTokenGenerator")> like IPassivePacketSink { storageModule = default("^." + parent.responseProducerModule + ".server[" + string(index) + "]"); @display("p=200,475,row,300"); }tokenGenerator[numKind]

Usage diagram

Inheritance diagram

Parameters

Name

Type

Default value

Description

numKind

int

responseProducerModule

string

“^.source”

Properties

Name

Value

Description

display

i=block/sink

Gates

Name

Direction

Size

Description

in

input

Unassigned submodule parameters

Name

Type

Default value

Description

queue.displayStringTextFormat

string

“contains %p pk (%l) pushed %u\npulled %o removed %r dropped %d”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

queue.packetCapacity

int

-1

Maximum number of packets in the queue, no limit by default

queue.dataCapacity

int

-1b

Maximum total length of packets in the queue, no limit by default

queue.dropperClass

string

“”

Determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

queue.comparatorClass

string

“”

Determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class

queue.bufferModule

string

“”

Relative module path to the IPacketBuffer module used by this queue, implicit buffer by default

server.displayStringTextFormat

string

“contains {numTokens} tk\nserved {numProcessedPackets} pk ({processedTotalLength})”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

server.initialNumTokens

double

1

Initial number of tokens

server.maxNumTokens

double

nan

Maximum number of tokens

server.tokenConsumptionPerPacket

double

1

How many tokens are consumed per processed packet

server.tokenConsumptionPerBit

double

0

How many tokens are consumed per processed bit

classifier.displayStringTextFormat

string

“classified %p pk (%l)”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

classifier.reverseOrder

bool

false

classifier.classifierClass

string

Determines the output queue of packets, the parameter must be the name of a C++ class which implements the IPacketClassifierFunction interface and is registered via Register_Class

tokenGenerator.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

tokenGenerator.storageModule

string

“^.” + parent.responseProducerModule + “.server[” + string(index) + “]”

Module path of the token storage where the tokens are generated via C++ method call

tokenGenerator.numTokensPerPacket

double

1

Number of tokens per consumed packet

tokenGenerator.numTokensPerBit

double

0

Number of tokens per consumed bit

Source code

//
// 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.
//
// @see ~ResponseProducer
//
module RequestConsumer like IPassivePacketSink
{
    parameters:
        int numKind;
        string responseProducerModule = default("^.source");
        @display("i=block/sink");
    gates:
        input in;
    submodules:
        queue: <default("PacketQueue")> like IPacketQueue {
            @display("p=200,100");
        }
        server: <default("TokenBasedServer")> like IPacketServer {
            initialNumTokens = default(1);
            @display("p=200,225");
        }
        classifier: <default("PacketClassifier")> like IPacketClassifier {
            @display("p=200,350");
        }
        tokenGenerator[numKind]: <default("PacketBasedTokenGenerator")> like IPassivePacketSink {
            storageModule = default("^." + parent.responseProducerModule + ".server[" + string(index) + "]");
            @display("p=200,475,row,300");
        }
    connections:
        in --> queue.in;
        queue.out --> server.in;
        server.out --> classifier.in;
        for i=0..sizeof(tokenGenerator) - 1 {
            classifier.out++ --> tokenGenerator[i].in;
        }
}

File: src/inet/queueing/sink/RequestConsumer.ned