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?



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

def header_length_in_bytes
  header_length * 4
end

#lengthObject



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

def length
  total_length
end

#options_length_in_bytesObject



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

def options_length_in_bytes
  header_length_in_bytes - options.rel_offset
end