Class: Xlat::Protocols::Icmp::Error

Inherits:
Base
  • Object
show all
Defined in:
lib/xlat/protocols/icmp/error.rb

Constant Summary collapse

V4_TYPE_DEST_UNREACH =
3
V4_TYPE_TIME_EXCEEDED =
11
V4_TYPE_PARAMETER_PROBLEM =
12
V6_TYPE_DEST_UNREACH =
1
V6_TYPE_PACKET_TOO_BIG =
2
V6_TYPE_TIME_EXCEEDED =
3
V6_TYPE_PARAMETER_PROBLEM =
4

Constants inherited from Base

Base::V4_PROTOCOL_ID, Base::V6_PROTOCOL_ID

Instance Attribute Summary collapse

Attributes inherited from Base

#code, #type

Instance Method Summary collapse

Methods inherited from Base

#initialize, parse, recalculate_checksum

Methods included from Common

sum16be

Constructor Details

This class inherits a constructor from Xlat::Protocols::Icmp::Base

Instance Attribute Details

#payload_bytesObject (readonly)

Returns the value of attribute payload_bytes.



41
42
43
# File 'lib/xlat/protocols/icmp/error.rb', line 41

def payload_bytes
  @payload_bytes
end

#payload_bytes_lengthObject (readonly)

Returns the value of attribute payload_bytes_length.



43
44
45
# File 'lib/xlat/protocols/icmp/error.rb', line 43

def payload_bytes_length
  @payload_bytes_length
end

#payload_bytes_offsetObject (readonly)

Returns the value of attribute payload_bytes_offset.



42
43
44
# File 'lib/xlat/protocols/icmp/error.rb', line 42

def payload_bytes_offset
  @payload_bytes_offset
end

Instance Method Details

#_parseObject



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/xlat/protocols/icmp/error.rb', line 45

def _parse
  super
  # Base.parse ensures packet.l4_bytes_length >= 8

  packet = @packet

  @payload_bytes = packet.l4_bytes
  @payload_bytes_offset = packet.l4_bytes_offset + 8
  @payload_bytes_length = packet.l4_bytes_length - 8

  self
end

#apply(cs_delta) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/xlat/protocols/icmp/error.rb', line 58

def apply(cs_delta)
  # @original.apply

  # # overwrite packet image with orig packet being built
  # @packet.bytes[@packet.l4_start + 8..] = @original.bytes

  # Base.recalculate_checksum(@packet)
end