Project

lib-bootp

0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
Set of classes to low level handle the BOOTP protocol
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0
>= 0

Runtime

~> 0.2.3
 Project Readme

Lib::BOOTP

BOOTP Library written in ruby. https://tools.ietf.org/html/rfc951

Installation

Add this line to your application's Gemfile:

gem 'lib-bootp'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lib-bootp

Usage

Creating BOOTP package and sending it to BOOTP server

bootp = Lib::BOOTP::Packet.new(
            op: 1, # BOOTREQUEST = 1, BOOTREPLAY = 2, Default is 1
            htype: 1, # Hardware Address Type, Default 1 is Ethernet (10Mb)
            hlen: 6, # Hardware Address Length, Default is 6
            hops: 0, # Hops count, Default is 0
            xid: 1, # Transaction ID, by default is generate if not specific
            secs: 0, # Second counts, Default is 0
            flags: 0, # Broadcast flags, Default is not set
            ciaddr: '0.0.0.0', # Client IP Address, Default is '0.0.0.0'
            yiaddr: '0.0.0.0', # Your IP Address, Default is '0.0.0.0'
            siaddr: '0.0.0.0', # Server IP Address, Default is '0.0.0.0'
            giaddr: '0.0.0.0', # Gateway IP Address, Default is '0.0.0.0'
            chaddr: '00:11:22:33:44:55', # Client hardware address, Default is not set
            sname: '.', # Optional server host name 
            file: '.', # Boot file name
)

client = UDPSocket.new

packet = bootp.pack # Building BOOTP packet to send via UDP socket

client.send packet, 0, "255.255.255.255", 67

Reading and parsing packet from socket

server = UDPSocket.new
server.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true)
server.bind("127.0.0.1", 67)
data = server.recvfrom(1500)[0]
bootp = Lib::BOOTP::Packet.unpack(data)

# Get Operations code
bootp.op.to_s
#=> 'BOOTREQUEST'

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/pwojcieszonek/lib-bootp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Lib::Bootp project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.