Skip to content

ostinato.protocols.tcp_pb2 module

Configure TCP protocol attributes for packet stream customization in Ostinato. Access and set parameters such as source and destination ports, sequence numbers, checksums, flags, and more using the Tcp object

To add and configure Tcp in a stream, add a protocol to the stream, set the protocol id to ost_pb.Protocol.kTcpFieldNumber and access the Tcp object from the Protocol object's Extensions dictionary using the key tcp_pb2.tcp

from ostinato.protocols import tcp_pb2
...
# stream is an object of type ost_pb.Stream
proto = stream.protocol.add()
proto.protocol_id.id = ost_pb.Protocol.kTcpFieldNumber
my_tcp = proto.Extensions[tcp_pb2.tcp]
You can then set Tcp attributes using my_tcp.<attribute>

Tcp class

Class attributes

is_override_src_port

Tcp.is_override_src_port : boolean
Optional. If not set, defaults to False.

is_override_dst_port

Tcp.is_override_dst_port : boolean
Optional. If not set, defaults to False.

is_override_hdrlen

Tcp.is_override_hdrlen : boolean
Optional. If not set, defaults to False.

is_override_cksum

Tcp.is_override_cksum : boolean
Optional. If not set, defaults to False.

src_port

Tcp.src_port : long
Optional. If not set, defaults to 49152.

dst_port

Tcp.dst_port : long
Optional. If not set, defaults to 49153.

seq_num

Tcp.seq_num : long
Optional. If not set, defaults to 129018.

ack_num

Tcp.ack_num : long
Optional. If not set, defaults to 0.

hdrlen_rsvd

Tcp.hdrlen_rsvd : long
Optional. If not set, defaults to 80.

flags

Tcp.flags : long
Optional. If not set, defaults to 0.

window

Tcp.window : long
Optional. If not set, defaults to 1024.

cksum

Tcp.cksum : long
Optional. If not set, defaults to 0.

urg_ptr

Tcp.urg_ptr : long
Optional. If not set, defaults to 0.

Back to top