Class: Ipv4

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/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?



35
36
37
# File 'lib/ipv4.rb', line 35

def header_length_in_bytes
  header_length * 4
end

#lengthObject



43
44
45
# File 'lib/ipv4.rb', line 43

def length
  total_length
end

#options_length_in_bytesObject



39
40
41
# File 'lib/ipv4.rb', line 39

def options_length_in_bytes
  header_length_in_bytes - options.rel_offset
end