Class: SimpleCapture::ICMPHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_capture/header/icmp_header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bytes: nil) ⇒ ICMPHeader

Returns a new instance of ICMPHeader.

Parameters:

  • [10, (Array<Integer>)

    46, …]



6
7
8
# File 'lib/simple_capture/header/icmp_header.rb', line 6

def initialize(bytes: nil)
  convert_bytes_to_header(bytes) unless bytes.nil?
end

Instance Attribute Details

#checksumObject (readonly)

Returns the value of attribute checksum.



3
4
5
# File 'lib/simple_capture/header/icmp_header.rb', line 3

def checksum
  @checksum
end

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/simple_capture/header/icmp_header.rb', line 3

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/simple_capture/header/icmp_header.rb', line 3

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/simple_capture/header/icmp_header.rb', line 3

def id
  @id
end

#seq_numberObject (readonly)

Returns the value of attribute seq_number.



3
4
5
# File 'lib/simple_capture/header/icmp_header.rb', line 3

def seq_number
  @seq_number
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/simple_capture/header/icmp_header.rb', line 3

def type
  @type
end

Instance Method Details

#dumpObject



10
11
12
13
14
15
16
17
18
# File 'lib/simple_capture/header/icmp_header.rb', line 10

def dump
  puts "■icmp--------------------------------------".blue
  print_checksum
  print_code
  print_type
  print_id
  print_seqnumber
  print_data
end