Class: FFI::PCap::DataLink

Inherits:
Object
  • Object
show all
Defined in:
lib/pcap/data_link.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ DataLink

Creates a new DataLink object with the specified value.



14
15
16
17
# File 'lib/pcap/data_link.rb', line 14

def initialize(value)
  @value = value
  @name = PCap.pcap_datalink_val_to_name(@value)
end

Instance Attribute Details

#nameObject (readonly)

DataLink name



9
10
11
# File 'lib/pcap/data_link.rb', line 9

def name
  @name
end

#valueObject (readonly)

PCap datalink numeric value



6
7
8
# File 'lib/pcap/data_link.rb', line 6

def value
  @value
end

Class Method Details

.[](name) ⇒ Object



19
20
21
# File 'lib/pcap/data_link.rb', line 19

def self.[](name)
  PCap.pcap_datalink_name_to_val(name.to_s.downcase)
end

Instance Method Details

#descriptionObject

Returns the description of the datalink.



26
27
28
# File 'lib/pcap/data_link.rb', line 26

def description
  PCap.pcap_datalink_val_to_description(@value)
end

#inspectObject

Inspects the datalink.



47
48
49
# File 'lib/pcap/data_link.rb', line 47

def inspect
  "#<#{self.class}: #{@name}>"
end

#to_iObject

Returns the numeric value of the datalink.



33
34
35
# File 'lib/pcap/data_link.rb', line 33

def to_i
  @value
end

#to_sObject

Returns the String form of the datalink.



40
41
42
# File 'lib/pcap/data_link.rb', line 40

def to_s
  @name
end