TCP¶
-
class
ryu.lib.packet.tcp.
tcp
(src_port=1, dst_port=1, seq=0, ack=0, offset=0, bits=0, window_size=0, csum=0, urgent=0, option=None)¶ TCP (RFC 793) header encoder/decoder class.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute Description src_port Source Port dst_port Destination Port seq Sequence Number ack Acknowledgement Number offset Data Offset (0 means automatically-calculate when encoding) bits Control Bits window_size Window csum Checksum (0 means automatically-calculate when encoding) urgent Urgent Pointer option List of TCPOption
sub-classes or an bytearray containing options. None if no options.-
has_flags
(*flags)¶ Check if flags are set on this packet.
returns boolean if all passed flags is set
Example:
>>> pkt = tcp.tcp(bits=(tcp.TCP_SYN | tcp.TCP_ACK)) >>> pkt.has_flags(tcp.TCP_SYN, tcp.TCP_ACK) True
-