Class: PacketProtocols::Ipv4

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/packet-protocols/ipv4.rb

Constant Summary collapse

PROTOCOLS =
{ icmp: 1, tcp: 6, udp: 17 }

Instance Method Summary collapse

Instance Method Details

#header_length_in_bytesObject

virtual assert: :checksum_valid?



36
37
38
# File 'lib/packet-protocols/ipv4.rb', line 36

def header_length_in_bytes
  header_length * 4
end

#lengthObject



44
45
46
# File 'lib/packet-protocols/ipv4.rb', line 44

def length
  total_length
end

#options_length_in_bytesObject



40
41
42
# File 'lib/packet-protocols/ipv4.rb', line 40

def options_length_in_bytes
  header_length_in_bytes - options.rel_offset
end