class Lib::DHCP::Message
Constants
- ACKNOWLEDGE
- BOOTREPLY
- BOOTREQUEST
- DECLINE
- DISCOVER
- INFORM
- LEASE_ACTIVE
- LEASE_QUERY
- LEASE_UNASSIGNED
- LEASE_UNKNOWN
- NAME
- NOT_ACKNOWLEDGE
- OFFER
- RELEASE
- REQUEST
Public Class Methods
unpack(packet)
click to toggle source
Calls superclass method
# File lib/lib/dhcp/messages/message.rb, line 52 def self.unpack(packet) packet = super(packet) # noinspection RubyResolve res = case packet.option53.value.to_i when DISCOVER Lib::DHCP::Message::Discover.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when OFFER Lib::DHCP::Message::Offer.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when REQUEST Lib::DHCP::Message::Request.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when DECLINE Lib::DHCP::Message::Decline.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when ACKNOWLEDGE Lib::DHCP::Message::ACK.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when NOT_ACKNOWLEDGE Lib::DHCP::Message::NACK.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when RELEASE Lib::DHCP::Message::Release.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when INFORM Lib::DHCP::Message::Inform.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when LEASE_QUERY Lib::DHCP::Message::LeaseQuery.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when LEASE_UNASSIGNED Lib::DHCP::Message::LeaseUnassigned.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when LEASE_UNKNOWN Lib::DHCP::Message::LeaseUnknown.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) when LEASE_ACTIVE Lib::DHCP::Message::LeaseActive.new( :htype => packet.htype, :hlen => packet.hlen, :hops => packet.hops, :xid => packet.xid, :secs => packet.secs, :flags => packet.flags, :ciaddr => packet.ciaddr, :yiaddr => packet.yiaddr, :siaddr => packet.siaddr, :giaddr => packet.giaddr, :chaddr => packet.chaddr, :sname => packet.sname, :file => packet.file, :options => packet.options ) else raise ArgumentError, "Unknown DHCP MESSAGE TYPE #{packet.option53.to_i}" end res.send(:sanity_check) res end
Public Instance Methods
name()
click to toggle source
# File lib/lib/dhcp/messages/message.rb, line 44 def name if option53.nil? nil else NAME[option53.to_i] end end
pack()
click to toggle source
Calls superclass method
# File lib/lib/dhcp/messages/message.rb, line 268 def pack sanity_check super end
Protected Instance Methods
sanity_check()
click to toggle source
protected :op= # noinspection RubyResolve protected :option53=
# File lib/lib/dhcp/messages/message.rb, line 280 def sanity_check raise Lib::DHCP::SanityCheck, "Can't pack DHCP Message without Option 53 - Message Type set" if self.option53.nil? end