StreamCoderLayer

Package: inet.protocolelement.redundancy

compound module StreamCoderLayer

Combines a stream decoder and a stream encoder into a layer. For incoming packets, the stream decoder determines the stream of the packet. For outgoing packets, the stream encoder determines the VLAN id, etc. of the packet.

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

StreamPolicyLayer

compound module

(no description)

Parameters

Name

Type

Default value

Description

interfaceTableModule

string

Properties

Name

Value

Description

display

i=block/layer

Gates

Name

Direction

Size

Description

upperLayerIn

input

upperLayerOut

output

lowerLayerIn

input

lowerLayerOut

output

Unassigned submodule parameters

Name

Type

Default value

Description

decoder.displayStringTextFormat

string

“processed {numProcessedPackets} pk ({processedTotalLength})”

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

decoder.interfaceTableModule

string

Relative module path of the interface table

decoder.mapping

object

[]

Array of objects, where each object maps a network interface name pattern, a source address, a destination address, a VLAN id, and a PCP value to a stream name, for example [{stream: “s1”, interface: “eth0”, destination: “dest1”, pcp: 3}, …]

encoder.displayStringTextFormat

string

“processed {numProcessedPackets} pk ({processedTotalLength})”

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

encoder.mapping

object

[]

Array of objects, where each object maps a stream name to a VLAN ID and PCP value, for example [{stream: “s1”, vlan: 12, pcp: 7}, …]

Source code

//
// Combines a stream decoder and a stream encoder into a layer. For
// incoming packets, the stream decoder determines the stream of the packet. For
// outgoing packets, the stream encoder determines the VLAN id, etc. of the packet.
//
module StreamCoderLayer like IProtocolLayer
{
    parameters:
        string interfaceTableModule;
        *.interfaceTableModule = default(this.interfaceTableModule);
        @display("i=block/layer");
    gates:
        input upperLayerIn;
        output upperLayerOut;
        input lowerLayerIn;
        output lowerLayerOut;
    submodules:
        decoder: <default("StreamDecoder")> like IPacketFlow if typename != "" {
            @display("p=200,150;i=block/blackboard");
        }
        encoder: <default("StreamEncoder")> like IPacketFlow if typename != "" {
            @display("p=500,150;i=block/blackboard");
        }
    connections:
        upperLayerIn --> { @display("m=n"); } --> encoder.in;
        encoder.out --> { @display("m=s"); } --> lowerLayerOut;

        lowerLayerIn --> { @display("m=s"); } --> decoder.in;
        decoder.out --> { @display("m=n"); } --> upperLayerOut;
}

File: src/inet/protocolelement/redundancy/StreamCoderLayer.ned