Pio

Gem Version Build Status Code Climate Coverage Status Dependency Status

pio pencil

Pio is a ruby gem to easily parse and generate network packets. It supports the following packet formats:

  • LLDP
  • (...currently there are just a few formats supported but I'm sure this list will grow)

Features Overview

  • Pure Ruby. No additional dependency on other external tools to parse/generate packets.
  • Multi-Platform. Runs on major operating systems (recent Windows, Linux, and MacOSX), and supports all major version of Ruby (1.8.7, 1.9.3, 2.0.0).
  • Clean Code. Pio is built on BinData's declarative binary format DSL so that it is easy to read and debug by human beings.

Example

Its usage is dead simple: to parse an LLDP frame for example, use the API Pio::Lldp.read and you can access each field of the parsed LLDP frame.

require "pio"

lldp = Pio::Lldp.read( binary_data )
lldp.ttl #=> 120

Also you can use Pio::Lldp#new to generate an LLDP frame like below:

require "pio"

lldp = Pio::Lldp.new( 0x123, 12 )  # dpid and port_number
lldp.to_binary  #=> LLDP frame in binary format.

Installation

The simplest way to install Pio is to use Bundler.

Add Pio to your Gemfile:

gem 'pio'

and install it by running Bundler:

$ bundle

Documents

Author

Yasuhito Takamiya (@yasuhito)

Contributors

https://github.com/trema/pio/contributors

Alternatives

License

Trema is released under the GNU General Public License version 3.0: