module DHCP

Constants

BOOTREPLY
BOOTREQUEST

BOOTP TYPES:

DHCPACK
DHCPDECLINE
DHCPDISCOVER

DHCP MESSAGE TYPES:

DHCPFORCERENEW
DHCPINFORM
DHCPLEASEACTIVE
DHCPLEASEQUERY

LEASEQUERY extensions:

DHCPLEASEUNASSIGNED
DHCPLEASEUNKNOWN
DHCPNAK
DHCPOFFER
DHCPRELEASE
DHCPREQUEST
HTYPE

HARDWARE TYPES: [htype code, hlen length]

MAGIC

DHCP MAGIC:

MSG_STR_TO_TYPE

Map message type string to integer type:

MSG_TYPE_TO_OP

Map message type to correct packet operation (BOOTREQUEST/BOOTREPLY):

MSG_TYPE_TO_STR

Map message integer type to string:

OPTIONS

Options 0-18 and 254 are defined in RFC 1497 (BOOTP) TODO: Add in as yet unhandled options

Public Class Methods

make_opt(opt, data=nil) click to toggle source

Create a new DHCP option object based on the option number:

# File lib/dhcp/options.rb, line 613
def self.make_opt(opt, data=nil)
  OPTIONS.each do |name, info|
    return info[1].new(info[0], name, data) if info[0] == opt
  end
  return nil
end
make_opt_name(name, data=nil) click to toggle source

Create a new DHCP option object based on the symbolic name:

# File lib/dhcp/options.rb, line 607
def self.make_opt_name(name, data=nil)
  raise "Unknown/unhandled option '#{name}'" unless OPTIONS.key?(name)
  OPTIONS[name][1].new(OPTIONS[name][0], name, data)
end