Class: Blondy::DHCPD::Server
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Blondy::DHCPD::Server
- Defined in:
- lib/blondy/dhcpd/server.rb
Overview
Main class for handling connections
Instance Method Summary collapse
-
#initialize ⇒ Server
constructor
A new instance of Server.
-
#receive_data(data) ⇒ Object
Fires up Dispatcher and send reply back by callback.
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
11 12 13 14 |
# File 'lib/blondy/dhcpd/server.rb', line 11 def initialize @buffer = String.new super end |
Instance Method Details
#receive_data(data) ⇒ Object
Fires up Dispatcher and send reply back by callback
16 17 18 19 20 21 22 23 24 |
# File 'lib/blondy/dhcpd/server.rb', line 16 def receive_data(data) @buffer.clear if (@buffer.size + data.size) > 1000 @buffer += data if @buffer.unpack('C4Nn2N4C16C192NC*').include?($DHCP_MAGIC) (@buffer.dup) @buffer.clear end end |