TcpSpoof

Package: inet.transportlayer.tcp_common

simple module TcpSpoof

Sends fabricated TCP packets. This is a base implementation, you’ll probably have to customize it in C++ according to what you want to send and when you want to send it.

Compatible with both IPv4 (Ipv4) and IPv6 (Ipv6).

inet.transportlayer.tcp_common.TcpSpoofTcpSpoofsimple

Inheritance diagram

Extends

Name

Type

Description

SimpleModule

simple module

Base module for all INET simple modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“”

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

srcAddress

string

“”

Local address; may be left empty (“”)

destAddress

string

“”

Destination address

srcPort

int

Local port number

destPort

int

Destination port number

seqNo

int

Sequence number (-1 for TCP ISS)

isSYN

bool

true

Whether to set the SYN bit on the packet

t

double

Simulation time to send at

Properties

Name

Value

Description

class

TcpSpoof

display

i=block/square

Gates

Name

Direction

Size

Description

appIn

input

Not used!

appOut

output

Not used!

ipOut

output

ipIn

input

Not used!

Signals

Name

Type

Unit

Description

packetSent

cPacket

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

packetSent

packets sent

packetSent

count,”sum(packetBytes)”,”vector(packetBytes)”

none

Source code

//
// Sends fabricated TCP packets. This is a base implementation,
// you'll probably have to customize it in C++ according to
// what you want to send and when you want to send it.
//
// Compatible with both IPv4 (~Ipv4) and IPv6 (~Ipv6).
//
simple TcpSpoof extends SimpleModule like ITcp
{
    parameters:
        @class(TcpSpoof);
        string srcAddress = default("");  // Local address; may be left empty ("")
        string destAddress = default(""); // Destination address
        int srcPort; // Local port number
        int destPort; // Destination port number
        int seqNo; // Sequence number (-1 for TCP ISS)
        bool isSYN = default(true); // Whether to set the SYN bit on the packet
        double t @unit(s); // Simulation time to send at
        @display("i=block/square");
        @signal[packetSent](type=cPacket);
        @statistic[packetSent](title="packets sent"; source=packetSent; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);

    gates:
        input appIn @labels(TcpCommand/down); // Not used!
        output appOut @labels(TcpCommand/up); // Not used!
        output ipOut @labels(TcpHeader,Ipv4ControlInfo/down,Ipv6ControlInfo/down);
        input ipIn @labels(TcpHeader,Ipv4ControlInfo/up,Ipv6ControlInfo/up); // Not used!
}

File: src/inet/transportlayer/tcp_common/TcpSpoof.ned