Module: Pio::Dhcp::CommonOptions

Included in:
BootReplyOptions, BootRequestOptions, DhcpTlvOptions
Defined in:
lib/pio/dhcp/common_options.rb

Overview

DHCP Common Options.

Constant Summary collapse

BOOTPC =
68
BOOTPS =
67
QUAD_ZERO_IP_ADDRESS =
IPv4Address.new(0)
BROADCAST_MAC_ADDRESS =
Mac.new(0xffffffffffff)
BROADCAST_IP_ADDRESS =
IPv4Address.new(0xffffffff)

Instance Method Summary collapse

Instance Method Details

#destination_macObject



23
24
25
# File 'lib/pio/dhcp/common_options.rb', line 23

def destination_mac
  Mac.new(@options[:destination_mac] || BROADCAST_MAC_ADDRESS)
end

#dhcp_dataObject



11
12
13
# File 'lib/pio/dhcp/common_options.rb', line 11

def dhcp_data
  Dhcp::DhcpField.new(dhcp_field_values)
end

#ip_address_lease_timeObject



58
59
60
# File 'lib/pio/dhcp/common_options.rb', line 58

def ip_address_lease_time
  @options[:ip_address_lease_time]
end

#ip_destination_addressObject



31
32
33
# File 'lib/pio/dhcp/common_options.rb', line 31

def ip_destination_address
  IPv4Address.new(@options[:ip_destination_address])
end

#ip_source_addressObject



27
28
29
# File 'lib/pio/dhcp/common_options.rb', line 27

def ip_source_address
  IPv4Address.new(@options[:ip_source_address])
end

#rebinding_time_valueObject



54
55
56
# File 'lib/pio/dhcp/common_options.rb', line 54

def rebinding_time_value
  @options[:rebinding_time_value]
end

#renewal_time_valueObject



50
51
52
# File 'lib/pio/dhcp/common_options.rb', line 50

def renewal_time_value
  @options[:renewal_time_value]
end

#requested_ip_addressObject



62
63
64
65
66
# File 'lib/pio/dhcp/common_options.rb', line 62

def requested_ip_address
  IPv4Address.new(
    @options[:requested_ip_address] || QUAD_ZERO_IP_ADDRESS
  )
end

#server_identifierObject



35
36
37
38
39
# File 'lib/pio/dhcp/common_options.rb', line 35

def server_identifier
  IPv4Address.new(
    @options[:server_identifier] || ip_source_address
  )
end

#source_macObject



19
20
21
# File 'lib/pio/dhcp/common_options.rb', line 19

def source_mac
  Mac.new(@options[:source_mac])
end

#subnet_maskObject



41
42
43
44
# File 'lib/pio/dhcp/common_options.rb', line 41

def subnet_mask
  subnet = @options[:subnet_mask]
  IPv4Address.new(subnet) if subnet
end

#transaction_idObject



46
47
48
# File 'lib/pio/dhcp/common_options.rb', line 46

def transaction_id
  @options[:transaction_id]
end

#typeObject



15
16
17
# File 'lib/pio/dhcp/common_options.rb', line 15

def type
  @options[:type]
end