TcpRequestResponseApp

Package: inet.applications.tcpapp

compound module TcpRequestResponseApp

A generic request/response based server application. For each request it receives, it generates a different traffic based on the data the request contains. The client application can be any source that is capable of generating packets with different data. The first byte of the packet data determines the response traffic, which can be configured to produce complex streams of packets with various data and timing distributions.

TcpRequestResponseAppsource.out --> tagger.in inherited from TcpServerConnection conditional: exists(source)?tagger.out --> measurementStarter.in inherited from TcpServerConnectionmeasurementStarter.out --> io.trafficIn inherited from TcpServerConnectionio.socketOut --> socketOut inherited from TcpServerConnectionsocketIn --> io.socketIn inherited from TcpServerConnectionio.trafficOut --> measurementRecorder.in inherited from TcpServerConnectionmeasurementRecorder.out --> sink.in inherited from TcpServerConnection conditional: exists(sink)?source: inet.queueing.source.ResponseProducer (like IActivePacketSource) inherited from TcpServerConnection ResponseProducer: Generates several different streams of packets, one after the other. IActivePacketSource: Interface for active packet source modules. Source: source: <default("ActivePacketSource")> like IActivePacketSource if typename != "" { parameters: @display("p=200,150"); }sourcetagger: inet.queueing.contract.IPacketFlow (like IPacketFlow) inherited from TcpServerConnection IPacketFlow: Interface for packet flows. Source: tagger: <default("")> like IPacketFlow { parameters: @display("p=200,300"); }taggermeasurementStarter: inet.queueing.contract.IPacketFlow (like IPacketFlow) inherited from TcpServerConnection IPacketFlow: Interface for packet flows. Source: measurementStarter: <default("")> like IPacketFlow { parameters: @display("p=200,450"); }measurementStartersink: inet.queueing.sink.RequestConsumer (like IPassivePacketSink) inherited from TcpServerConnection RequestConsumer: Processes incoming packets one by one in the order they arrive. IPassivePacketSink: Interface for passive packet sink modules. Source: sink: <default("PassivePacketSink")> like IPassivePacketSink if typename != "" { parameters: @display("p=500,150"); }sinkmeasurementRecorder: inet.queueing.contract.IPacketFlow (like IPacketFlow) inherited from TcpServerConnection IPacketFlow: Interface for packet flows. Source: measurementRecorder: <default("")> like IPacketFlow { parameters: @display("p=500,450"); }measurementRecorderio: inet.applications.tcpapp.TcpServerSocketIo inherited from TcpServerConnection Manages an established TCP connection. Source: io: TcpServerSocketIo { parameters: @display("p=350,600"); }io

Inheritance diagram

Extends

Name

Type

Description

TcpServerConnection

compound module

This is a pre-assembled module type to be used in TcpServerApp. One instance of this module type is launched by TcpServerListener for each incoming connection. It is composed of a traffic source, a traffic sink, a socket I/O and other modules, and most of the module types are parametric. The traffic source and traffic sink modules can be built from queueing model elements.

Parameters

Name

Type

Default value

Description

numKind

int

2

Properties

Name

Value

Description

application

display

i=block/cogwheel

Gates

Name

Direction

Size

Description

socketIn

input

socketOut

output

Unassigned submodule parameters

Name

Type

Default value

Description

source.provider.displayStringTextFormat

string

“created %p pk (%l)”

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

source.provider.packetNameFormat

string

“%a-%c”

See directives in module documentation

source.provider.packetRepresentation

string

“byteCount”

Determines the chunk of the packet data

source.provider.packetProtocol

string

“unknown”

source.provider.packetLength

int

source.provider.packetData

int

-1

source.provider.attachCreationTimeTag

bool

true

source.provider.attachIdentityTag

bool

true

source.provider.attachDirectionTag

bool

true

source.provider.clockModule

string

“”

Relative path of a module that implements IClock(1,:ref:2 <neddoc-msg-inet-iclock>); optional

source.provider.initialProvidingOffset

double

0s

Initial duration before which packets are not provided

source.provider.providingInterval

double

0s

Elapsed time between subsequent packets allowed to be pulled by the connected packet collector, 0 means any number of packets can be pulled at the same simulation time

source.provider.scheduleForAbsoluteTime

bool

true

When a clock is used, relative means that setting the clock will not affect the simulation time of the event

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

source.server.initialNumTokens

double

0

Initial number of tokens

source.server.maxNumTokens

double

nan

Maximum number of tokens

source.server.tokenConsumptionPerPacket

double

1

How many tokens are consumed per processed packet

source.server.tokenConsumptionPerBit

double

0

How many tokens are consumed per processed bit

source.multiplexer.displayStringTextFormat

string

“passed %p pk (%l)”

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

source.multiplexer.forwardServiceRegistration

bool

true

source.multiplexer.forwardProtocolRegistration

bool

true

source.tokenGenerator.displayStringTextFormat

string

“generated {numTokensGenerated} tk\nto {storageModule}”

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

source.tokenGenerator.storageModule

string

“^.” + parent.requestConsumerModule + “.server”

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

source.tokenGenerator.subscriptionModule

string

“^”

source.tokenGenerator.signals

string

“tokensDepleted”

source.tokenGenerator.intSignalValue

int

-1

source.tokenGenerator.doubleSignalValue

double

nan

source.tokenGenerator.numTokens

double

1

Number of tokens generated repeatedly

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

sink.queue.packetCapacity

int

-1

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

sink.queue.dataCapacity

int

-1b

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

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

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

sink.queue.bufferModule

string

“”

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

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

sink.server.initialNumTokens

double

1

Initial number of tokens

sink.server.maxNumTokens

double

nan

Maximum number of tokens

sink.server.tokenConsumptionPerPacket

double

1

How many tokens are consumed per processed packet

sink.server.tokenConsumptionPerBit

double

0

How many tokens are consumed per processed bit

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

sink.classifier.reverseOrder

bool

false

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

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

sink.tokenGenerator.storageModule

string

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

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

sink.tokenGenerator.numTokensPerPacket

double

1

Number of tokens per consumed packet

sink.tokenGenerator.numTokensPerBit

double

0

Number of tokens per consumed bit

io.displayStringTextFormat

string

“”

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

io.readSize

int

-1B

Used only with autoRead==false

io.readDelay

double

-1s

Used only with autoRead==false; delay for issuing a READ command after previous READ was satisfied; -1 means immediately, 0 means zero delay

Source code

//
// A generic request/response based server application. For each
// request it receives, it generates a different traffic based on the data the
// request contains. The client application can be any source that is capable
// of generating packets with different data. The first byte of the packet data
// determines the response traffic, which can be configured to produce complex
// streams of packets with various data and timing distributions.
//
module TcpRequestResponseApp extends TcpServerConnection
{
    parameters:
        int numKind = default(2);
        sink.typename = default("RequestConsumer");
        sink.numKind = this.numKind;
        sink.responseProducerModule = default("^.source");
        sink.classifier.classifierClass = default("inet::queueing::PacketDataClassifier");
        source.typename = default("ResponseProducer");
        source.numKind = this.numKind;
}

File: src/inet/applications/tcpapp/TcpRequestResponseApp.ned