Skip to content

ostinato.protocols.ip4_pb2 module

To add and configure Ip4 in a stream, add a protocol to the stream, set the protocol id to ost_pb.Protocol.kIp4FieldNumber and access the Ip4 object from the Protocol object's Extensions dictionary using the key ip4_pb2.ip4

from ostinato.protocols import ip4_pb2
...
# stream is an object of type ost_pb.Stream
proto = stream.protocol.add()
proto.protocol_id.id = ost_pb.Protocol.kIp4FieldNumber
my_ip4 = proto.Extensions[ip4_pb2.ip4]

You can then set Ip4 attributes using my_ip4.<attribute>

Ip4 class

Class constants

IpAddrMode

Ip4.e_im_fixed 
Ip4.e_im_inc_host 
Ip4.e_im_dec_host 
Ip4.e_im_random_host 

Class attributes

is_override_ver

Ip4.is_override_ver : boolean

Optional. If not set, defaults to False.

is_override_hdrlen

Ip4.is_override_hdrlen : boolean

Optional. If not set, defaults to False.

is_override_totlen

Ip4.is_override_totlen : boolean

Optional. If not set, defaults to False.

is_override_proto

Ip4.is_override_proto : boolean

Optional. If not set, defaults to False.

is_override_cksum

Ip4.is_override_cksum : boolean

Optional. If not set, defaults to False.

ver_hdrlen

Ip4.ver_hdrlen : long

Optional. If not set, defaults to 69.

tos

Ip4.tos : long

Optional. If not set, defaults to 0.

totlen

Ip4.totlen : long

Optional. If not set, defaults to 0.

id

Ip4.id : long

Optional. If not set, defaults to 1234.

flags

Ip4.flags : long

Optional. If not set, defaults to 0.

frag_ofs

Ip4.frag_ofs : long

Optional. If not set, defaults to 0.

ttl

Ip4.ttl : long

Optional. If not set, defaults to 127.

proto

Ip4.proto : long

Optional. If not set, defaults to 0.

cksum

Ip4.cksum : long

Optional. If not set, defaults to 0.

src_ip

Ip4.src_ip : int

Optional. If not set, defaults to 0.

src_ip_mode

Ip4.src_ip_mode : IpAddrMode

Optional. If not set, defaults to e_im_fixed.

See IpAddrMode

src_ip_count

Ip4.src_ip_count : long

Optional. If not set, defaults to 16.

src_ip_mask

Ip4.src_ip_mask : int

Optional. If not set, defaults to 4294967040.

dst_ip

Ip4.dst_ip : int

Optional. If not set, defaults to 0.

dst_ip_mode

Ip4.dst_ip_mode : IpAddrMode

Optional. If not set, defaults to e_im_fixed.

See IpAddrMode

dst_ip_count

Ip4.dst_ip_count : long

Optional. If not set, defaults to 16.

dst_ip_mask

Ip4.dst_ip_mask : int

Optional. If not set, defaults to 4294967040.

options

Ip4.options : bytes(python3)/str(python2)

Optional. If not set, defaults to "".

Back to top