pio 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +20 -0
- data/Rakefile +2 -2
- data/examples/hello_new.rb +4 -0
- data/examples/hello_read.rb +4 -0
- data/features/arp_read.feature +10 -0
- data/features/dhcp_read.feature +5 -0
- data/features/icmp_read.feature +5 -0
- data/features/lldp_read.feature +10 -0
- data/features/pcap/arp-storm.pcap +0 -0
- data/features/pcap/arp.pcap +0 -0
- data/features/pcap/dhcp.pcap +0 -0
- data/features/pcap/icmp.pcap +0 -0
- data/features/pcap/lldp.detailed.pcap +0 -0
- data/features/pcap/lldp.minimal.pcap +0 -0
- data/features/step_definitions/pcap_steps.rb +18 -0
- data/features/support/env.rb +4 -0
- data/lib/pio.rb +3 -2
- data/lib/pio/dhcp/{type/dhcp_client_id.rb → client_id.rb} +0 -0
- data/lib/pio/dhcp/optional_tlv.rb +3 -4
- data/lib/pio/dhcp/{type/dhcp_param_list.rb → parameter_list.rb} +1 -1
- data/lib/pio/hello.rb +37 -0
- data/lib/pio/hello/format.rb +18 -0
- data/lib/pio/ipv4_address.rb +2 -36
- data/lib/pio/pcap.rb +64 -0
- data/lib/pio/version.rb +1 -1
- data/pio.gemspec +8 -1
- data/spec/pio/hello_spec.rb +58 -0
- metadata +51 -17
- data/lib/pio/dhcp/type/dhcp_string.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7440562aee407d80e2f3f795a40fb065b6a6189a
|
4
|
+
data.tar.gz: f28861cef1a8a0a3e2807b77a62ddd5bbc98ac47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc1f92d485a60ec4e53bb6e260962ed56186d89ddf4e79c4e4abcb4c2a3dd7140101e41a765c93502936d170082bd83fc669c165efcc49c3a0a14c44331dc7d1
|
7
|
+
data.tar.gz: 5af6281ba069a05d1ebd7f7608d5e2a01f2c80c60f5c0d6de22ab0463ae8c377841e11ae41c9faca5c078b5dcfb2e9546ebddbd6aa5361a223d9ded017993b58
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.5.0 (4/14/2014)
|
4
|
+
|
5
|
+
* Added new class `Pio::Hello`.
|
6
|
+
|
7
|
+
### Misc
|
8
|
+
|
9
|
+
* Added new rake task `cucumber`.
|
10
|
+
* Added new rake task `dump_pcap`.
|
11
|
+
|
12
|
+
|
13
|
+
## 0.4.0 (3/31/2014)
|
14
|
+
|
15
|
+
### New features
|
16
|
+
* Added new classes `Pio::Dhcp`, `Pio::Dhcp::Discover`,
|
17
|
+
`Pio::Dhcp::Offer`, `Pio::Dhcp::Request` and `Pio::Dhcp::Ack`.
|
18
|
+
|
19
|
+
### Changes
|
20
|
+
* Added new class alias `Pio::ICMP` => `Pio::Icmp`.
|
21
|
+
* Added new class alias `Pio::ARP` => `Pio::Arp`.
|
22
|
+
* Added new class alias `Pio::LLDP` => `Pio::Lldp`.
|
23
|
+
* Added new class alias `Pio::DHCP` => `Pio::Dhcp`.
|
data/README.md
CHANGED
@@ -16,6 +16,8 @@ supports the following packet formats:
|
|
16
16
|
- ARP
|
17
17
|
- LLDP
|
18
18
|
- DHCP
|
19
|
+
- OpenFlow 1.0 messages
|
20
|
+
- Hello
|
19
21
|
- (…currently there are just a few formats supported but I'm sure this list will grow)
|
20
22
|
|
21
23
|
## Features Overview
|
@@ -158,6 +160,24 @@ Also you can use `Pio::Dhcp::Discover#new`,
|
|
158
160
|
)
|
159
161
|
ack.to_binary # => DHCP Ack frame in binary format
|
160
162
|
|
163
|
+
### Hello
|
164
|
+
|
165
|
+
To parse an OpenFlow 1.0 Hello message, use the API `Pio::Hello.read`
|
166
|
+
and you can access each field of the parsed Hello message.
|
167
|
+
|
168
|
+
require 'pio'
|
169
|
+
|
170
|
+
hello = Pio::Hello.read(binary_data)
|
171
|
+
hello.transaction_id # => 123
|
172
|
+
|
173
|
+
Also you can use `Pio::Hello#new` to generate a Hello message like
|
174
|
+
below:
|
175
|
+
|
176
|
+
require 'pio'
|
177
|
+
|
178
|
+
hello = Pio::Hello.new(transaction_id: 123)
|
179
|
+
hello.to_binary # => HELLO message in binary format.
|
180
|
+
|
161
181
|
## Installation
|
162
182
|
|
163
183
|
The simplest way to install Pio is to use [Bundler](http://gembundler.com/).
|
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ require 'bundler/gem_tasks'
|
|
5
5
|
# rubocop:disable HashSyntax
|
6
6
|
|
7
7
|
task :default => :travis
|
8
|
-
|
9
|
-
task :travis => [:
|
8
|
+
task :test => [:spec, :cucumber]
|
9
|
+
task :travis => [:test, :quality, 'coveralls:push']
|
10
10
|
|
11
11
|
desc 'Check for code quality'
|
12
12
|
task :quality => [:reek, :flog, :flay, :rubocop]
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Pio::Arp.read
|
2
|
+
Scenario: arp.pcap
|
3
|
+
Given a pcap file "arp.pcap"
|
4
|
+
When I try to parse the pcap file with "Arp" class
|
5
|
+
Then it should finish successfully
|
6
|
+
|
7
|
+
Scenario: arp-storm.pcap
|
8
|
+
Given a pcap file "arp-storm.pcap"
|
9
|
+
When I try to parse the pcap file with "Arp" class
|
10
|
+
Then it should finish successfully
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Pio::Lldp.read
|
2
|
+
Scenario: lldp.minimal.pcap
|
3
|
+
Given a pcap file "lldp.minimal.pcap"
|
4
|
+
When I try to parse the pcap file with "Lldp" class
|
5
|
+
Then it should finish successfully
|
6
|
+
|
7
|
+
Scenario: lldp.detailed.pcap
|
8
|
+
Given a pcap file "lldp.detailed.pcap"
|
9
|
+
When I try to parse the pcap file with "Lldp" class
|
10
|
+
Then it should finish successfully
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Given(/^a pcap file "(.*?)"$/) do |pcap|
|
4
|
+
@pcap = File.join(File.dirname(__FILE__), '..', 'pcap', pcap)
|
5
|
+
end
|
6
|
+
|
7
|
+
When(/^I try to parse the pcap file with "(.*?)" class$/) do |parser|
|
8
|
+
File.open(@pcap) do |file|
|
9
|
+
pcap = Pio::Pcap::Frame.read(file)
|
10
|
+
pcap.records.each do |each|
|
11
|
+
Pio.const_get(parser).__send__ :read, each.data
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Then(/^it should finish successfully$/) do
|
17
|
+
# Noop.
|
18
|
+
end
|
data/lib/pio.rb
CHANGED
File without changes
|
@@ -1,8 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'pio/dhcp/
|
4
|
-
require 'pio/dhcp/
|
5
|
-
require 'pio/dhcp/type/dhcp_string'
|
3
|
+
require 'pio/dhcp/parameter_list'
|
4
|
+
require 'pio/dhcp/client_id'
|
6
5
|
require 'pio/type/ip_address'
|
7
6
|
|
8
7
|
module Pio
|
@@ -29,7 +28,7 @@ module Pio
|
|
29
28
|
ip_address Dhcp::REQUESTED_IP_ADDRESS_TLV
|
30
29
|
client_id Dhcp::CLIENT_IDENTIFIER_TLV
|
31
30
|
parameter_list Dhcp::PARAMETERS_LIST_TLV
|
32
|
-
|
31
|
+
string DEFAULT
|
33
32
|
end
|
34
33
|
|
35
34
|
def end_of_dhcptlv?
|
data/lib/pio/hello.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'forwardable'
|
4
|
+
require 'pio/hello/format'
|
5
|
+
|
6
|
+
module Pio
|
7
|
+
# OpenFlow 1.0 Hello message
|
8
|
+
class Hello
|
9
|
+
extend Forwardable
|
10
|
+
|
11
|
+
def_delegators :@data, :version
|
12
|
+
def_delegators :@data, :message_type
|
13
|
+
def_delegators :@data, :message_length
|
14
|
+
def_delegators :@data, :transaction_id
|
15
|
+
def_delegator :@data, :transaction_id, :xid
|
16
|
+
def_delegators :@data, :body
|
17
|
+
def_delegator :@data, :to_binary_s, :to_binary
|
18
|
+
|
19
|
+
def self.read(raw_data)
|
20
|
+
hello = allocate
|
21
|
+
hello.instance_variable_set :@data, Format.read(raw_data)
|
22
|
+
hello
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(user_options = {})
|
26
|
+
@options = user_options.dup
|
27
|
+
handle_option_aliases
|
28
|
+
@data = Format.new(@options)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def handle_option_aliases
|
34
|
+
@options[:transaction_id] ||= @options[:xid]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'bindata'
|
4
|
+
|
5
|
+
module Pio
|
6
|
+
class Hello
|
7
|
+
# OpenFlow 1.0 Hello message
|
8
|
+
class Format < BinData::Record
|
9
|
+
endian :big
|
10
|
+
|
11
|
+
uint8 :version, value: 1
|
12
|
+
uint8 :message_type
|
13
|
+
uint16 :message_length, initial_value: 8
|
14
|
+
uint32 :transaction_id
|
15
|
+
string :body # ignored
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/pio/ipv4_address.rb
CHANGED
@@ -4,18 +4,13 @@ require 'forwardable'
|
|
4
4
|
require 'ipaddr'
|
5
5
|
|
6
6
|
module Pio
|
7
|
-
#
|
8
7
|
# IPv4 Address
|
9
|
-
#
|
10
8
|
class IPv4Address
|
11
9
|
extend Forwardable
|
12
10
|
|
13
|
-
#
|
14
11
|
# @return [IPAddr] value object instance of proxied IPAddr.
|
15
|
-
#
|
16
12
|
attr_reader :value
|
17
13
|
|
18
|
-
#
|
19
14
|
# Creates a {IPv4Address} instance object as a proxy to IPAddr class.
|
20
15
|
#
|
21
16
|
# @overload initialize(addr)
|
@@ -27,7 +22,6 @@ module Pio
|
|
27
22
|
#
|
28
23
|
# @return [IPv4Address] self
|
29
24
|
# a proxy to IPAddr.
|
30
|
-
#
|
31
25
|
def initialize(addr)
|
32
26
|
case addr
|
33
27
|
when Integer
|
@@ -41,26 +35,18 @@ module Pio
|
|
41
35
|
end
|
42
36
|
end
|
43
37
|
|
44
|
-
#
|
45
38
|
# @return [String] the IPv4 address in its text representation.
|
46
|
-
#
|
47
39
|
def_delegator :value, :to_s
|
48
40
|
|
49
|
-
#
|
50
41
|
# @return [Number] the IPv4 address in its numeric representation.
|
51
|
-
#
|
52
42
|
def_delegator :value, :to_i
|
53
43
|
|
54
|
-
#
|
55
44
|
# @return [Range] Creates a Range object for the network address.
|
56
|
-
#
|
57
45
|
def_delegator :value, :to_range
|
58
46
|
|
59
47
|
def_delegator :value, :==
|
60
48
|
|
61
|
-
#
|
62
49
|
# @return [Number] prefix length of IPv4 address.
|
63
|
-
#
|
64
50
|
def prefixlen
|
65
51
|
netmask = to_range.first.to_i ^ to_range.last.to_i
|
66
52
|
if netmask > 0
|
@@ -70,88 +56,68 @@ module Pio
|
|
70
56
|
end
|
71
57
|
end
|
72
58
|
|
73
|
-
#
|
74
59
|
# @return [Array]
|
75
60
|
# an array of decimal numbers converted from IPv4 address.
|
76
|
-
#
|
77
61
|
def to_a
|
78
62
|
to_s.split('.').map do | each |
|
79
63
|
each.to_i
|
80
64
|
end
|
81
65
|
end
|
82
66
|
|
83
|
-
#
|
84
67
|
# @return [Array]
|
85
68
|
# an array of decimal numbers converted from IPv4 address.
|
86
|
-
#
|
87
69
|
def to_ary
|
88
70
|
to_a
|
89
71
|
end
|
90
72
|
|
91
|
-
#
|
73
|
+
# Returns the IPv4 address masked with +masklen+.
|
92
74
|
# @return [IPv4Address]
|
93
|
-
# Returns the IPv4 address masked with masklen.
|
94
|
-
#
|
95
75
|
def mask!(masklen)
|
96
76
|
@value = @value.mask(masklen)
|
97
77
|
self
|
98
78
|
end
|
99
79
|
alias_method :prefix!, :mask!
|
100
80
|
|
101
|
-
#
|
81
|
+
# Returns the IPv4 address masked with +masklen+.
|
102
82
|
# @return [IPv4Address]
|
103
|
-
# Returns the IPv4 address masked with masklen.
|
104
|
-
#
|
105
83
|
def mask(masklen)
|
106
84
|
clone.mask!(masklen)
|
107
85
|
end
|
108
86
|
alias_method :prefix, :mask
|
109
87
|
|
110
|
-
#
|
111
88
|
# @return [bool]
|
112
89
|
# Returns true if the address belongs to class A.
|
113
|
-
#
|
114
90
|
def class_a?
|
115
91
|
mask(1).to_s == '0.0.0.0'
|
116
92
|
end
|
117
93
|
|
118
|
-
#
|
119
94
|
# @return [bool]
|
120
95
|
# Returns true if the address belongs to class B.
|
121
|
-
#
|
122
96
|
def class_b?
|
123
97
|
mask(2).to_s == '128.0.0.0'
|
124
98
|
end
|
125
99
|
|
126
|
-
#
|
127
100
|
# @return [bool]
|
128
101
|
# Returns true if the address belongs to class C.
|
129
|
-
#
|
130
102
|
def class_c?
|
131
103
|
mask(3).to_s == '192.0.0.0'
|
132
104
|
end
|
133
105
|
|
134
|
-
#
|
135
106
|
# @return [bool]
|
136
107
|
# Returns true if the address belongs to class D.
|
137
|
-
#
|
138
108
|
def class_d?
|
139
109
|
mask(4).to_s == '224.0.0.0'
|
140
110
|
end
|
141
111
|
alias_method :multicast?, :class_d?
|
142
112
|
|
143
|
-
#
|
144
113
|
# @return [bool]
|
145
114
|
# Returns true if the address belongs to class E.
|
146
|
-
#
|
147
115
|
def class_e?
|
148
116
|
mask(4).to_s == '240.0.0.0'
|
149
117
|
end
|
150
118
|
|
151
|
-
#
|
152
119
|
# @return [bool]
|
153
120
|
# Returns true if the address is unicast address.
|
154
|
-
#
|
155
121
|
def unicast?
|
156
122
|
class_a? || class_b? || class_c?
|
157
123
|
end
|
data/lib/pio/pcap.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'bindata'
|
4
|
+
|
5
|
+
module Pio
|
6
|
+
# .pcap file parser
|
7
|
+
module Pcap
|
8
|
+
BIG_ENDIAN = 0xa1b2c3d4
|
9
|
+
LITTLE_ENDIAN = 0xd4c3b2a1
|
10
|
+
|
11
|
+
LINKTYPE_ETHERNET = 1
|
12
|
+
|
13
|
+
# Big or little endian?
|
14
|
+
# This code smells of :reek:UncommunicativeModuleName
|
15
|
+
class EndianMagicNumber16 < BinData::Choice
|
16
|
+
int16be BIG_ENDIAN, initial_value: :value
|
17
|
+
int16le LITTLE_ENDIAN, initial_value: :value
|
18
|
+
end
|
19
|
+
|
20
|
+
# Big or little endian?
|
21
|
+
# This code smells of :reek:UncommunicativeModuleName
|
22
|
+
class EndianMagicNumber32 < BinData::Choice
|
23
|
+
int32be BIG_ENDIAN, initial_value: :value
|
24
|
+
int32le LITTLE_ENDIAN, initial_value: :value
|
25
|
+
end
|
26
|
+
|
27
|
+
# .pcap format
|
28
|
+
class Frame < BinData::Record
|
29
|
+
byte_order = -> { file_header.magic }
|
30
|
+
|
31
|
+
struct :file_header do
|
32
|
+
hide :thiszone, :sigfigs
|
33
|
+
|
34
|
+
uint32be :magic,
|
35
|
+
initial_value: 0xa1b2c3d4,
|
36
|
+
assert: -> { value == BIG_ENDIAN || value == LITTLE_ENDIAN }
|
37
|
+
endian_magic_number16 :version_major, value: 2, selection: byte_order
|
38
|
+
endian_magic_number16 :version_minor, value: 4, selection: byte_order
|
39
|
+
endian_magic_number32 :thiszone, value: 0, selection: byte_order
|
40
|
+
endian_magic_number32 :sigfigs, value: 0, selection: byte_order
|
41
|
+
endian_magic_number32 :snaplen, value: 65_535, selection: byte_order
|
42
|
+
endian_magic_number32 :linktype,
|
43
|
+
value: LINKTYPE_ETHERNET,
|
44
|
+
selection: byte_order
|
45
|
+
end
|
46
|
+
|
47
|
+
array :records, read_until: :eof do
|
48
|
+
struct :pkthdr do
|
49
|
+
struct :ts do
|
50
|
+
endian_magic_number32 :sec, value: 0, selection: byte_order
|
51
|
+
endian_magic_number32 :usec, value: 0, selection: byte_order
|
52
|
+
end
|
53
|
+
endian_magic_number32 :caplen,
|
54
|
+
value: -> { data.length },
|
55
|
+
selection: byte_order
|
56
|
+
endian_magic_number32 :len,
|
57
|
+
value: -> { data.length },
|
58
|
+
selection: byte_order
|
59
|
+
end
|
60
|
+
string :data, read_length: -> { pkthdr.caplen }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/pio/version.rb
CHANGED
data/pio.gemspec
CHANGED
@@ -24,8 +24,15 @@ Gem::Specification.new do |gem|
|
|
24
24
|
|
25
25
|
gem.require_paths = ['lib']
|
26
26
|
|
27
|
-
gem.extra_rdoc_files =
|
27
|
+
gem.extra_rdoc_files =
|
28
|
+
[
|
29
|
+
'README.md',
|
30
|
+
'CHANGELOG.md',
|
31
|
+
'LICENSE',
|
32
|
+
'CONTRIBUTING.md'
|
33
|
+
]
|
28
34
|
gem.test_files = Dir.glob('spec/**/*')
|
35
|
+
gem.test_files += Dir.glob('features/**/*')
|
29
36
|
|
30
37
|
gem.required_ruby_version = '>= 1.9.3'
|
31
38
|
gem.add_dependency 'bindata', '~> 2.0.0'
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'pio'
|
4
|
+
|
5
|
+
describe Pio::Hello do
|
6
|
+
describe '.read' do
|
7
|
+
context 'with an hello message' do
|
8
|
+
Given(:hello_dump) { [1, 0, 0, 8, 0, 0, 0, 0].pack('C*') }
|
9
|
+
|
10
|
+
When(:hello) { Pio::Hello.read(hello_dump) }
|
11
|
+
|
12
|
+
Then { hello.class == Pio::Hello }
|
13
|
+
Then { hello.version == 1 }
|
14
|
+
Then { hello.message_type == 0 }
|
15
|
+
Then { hello.message_length == 8 }
|
16
|
+
Then { hello.xid == 0 }
|
17
|
+
Then { hello.body.empty? }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '.new' do
|
22
|
+
context 'with no arguments' do
|
23
|
+
When(:hello) { Pio::Hello.new }
|
24
|
+
|
25
|
+
Then { hello.class == Pio::Hello }
|
26
|
+
Then { hello.version == 1 }
|
27
|
+
Then { hello.message_type == 0 }
|
28
|
+
Then { hello.message_length == 8 }
|
29
|
+
Then { hello.xid == 0 }
|
30
|
+
Then { hello.body.empty? }
|
31
|
+
Then { hello.to_binary == [1, 0, 0, 8, 0, 0, 0, 0].pack('C*') }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'with transaction_id: 123' do
|
35
|
+
When(:hello) { Pio::Hello.new(transaction_id: 123) }
|
36
|
+
|
37
|
+
Then { hello.class == Pio::Hello }
|
38
|
+
Then { hello.version == 1 }
|
39
|
+
Then { hello.message_type == 0 }
|
40
|
+
Then { hello.message_length == 8 }
|
41
|
+
Then { hello.xid == 123 }
|
42
|
+
Then { hello.body.empty? }
|
43
|
+
Then { hello.to_binary == [1, 0, 0, 8, 0, 0, 0, 123].pack('C*') }
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with xid: 123' do
|
47
|
+
When(:hello) { Pio::Hello.new(xid: 123) }
|
48
|
+
|
49
|
+
Then { hello.class == Pio::Hello }
|
50
|
+
Then { hello.version == 1 }
|
51
|
+
Then { hello.message_type == 0 }
|
52
|
+
Then { hello.message_length == 8 }
|
53
|
+
Then { hello.xid == 123 }
|
54
|
+
Then { hello.body.empty? }
|
55
|
+
Then { hello.to_binary == [1, 0, 0, 8, 0, 0, 0, 123].pack('C*') }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yasuhito Takamiya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|
@@ -45,7 +45,11 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files:
|
47
47
|
- README.md
|
48
|
+
- CHANGELOG.md
|
49
|
+
- LICENSE
|
50
|
+
- CONTRIBUTING.md
|
48
51
|
files:
|
52
|
+
- CHANGELOG.md
|
49
53
|
- CONTRIBUTING.md
|
50
54
|
- LICENSE
|
51
55
|
- README.md
|
@@ -54,10 +58,24 @@ files:
|
|
54
58
|
- examples/arp_read.rb
|
55
59
|
- examples/dhcp_new.rb
|
56
60
|
- examples/dhcp_read.rb
|
61
|
+
- examples/hello_new.rb
|
62
|
+
- examples/hello_read.rb
|
57
63
|
- examples/icmp_new.rb
|
58
64
|
- examples/icmp_read.rb
|
59
65
|
- examples/lldp_new.rb
|
60
66
|
- examples/lldp_read.rb
|
67
|
+
- features/arp_read.feature
|
68
|
+
- features/dhcp_read.feature
|
69
|
+
- features/icmp_read.feature
|
70
|
+
- features/lldp_read.feature
|
71
|
+
- features/pcap/arp-storm.pcap
|
72
|
+
- features/pcap/arp.pcap
|
73
|
+
- features/pcap/dhcp.pcap
|
74
|
+
- features/pcap/icmp.pcap
|
75
|
+
- features/pcap/lldp.detailed.pcap
|
76
|
+
- features/pcap/lldp.minimal.pcap
|
77
|
+
- features/step_definitions/pcap_steps.rb
|
78
|
+
- features/support/env.rb
|
61
79
|
- lib/pio.rb
|
62
80
|
- lib/pio/arp.rb
|
63
81
|
- lib/pio/arp/frame.rb
|
@@ -70,6 +88,7 @@ files:
|
|
70
88
|
- lib/pio/dhcp/boot_reply_options.rb
|
71
89
|
- lib/pio/dhcp/boot_request.rb
|
72
90
|
- lib/pio/dhcp/boot_request_options.rb
|
91
|
+
- lib/pio/dhcp/client_id.rb
|
73
92
|
- lib/pio/dhcp/common_options.rb
|
74
93
|
- lib/pio/dhcp/csum_util.rb
|
75
94
|
- lib/pio/dhcp/dhcp_field.rb
|
@@ -80,10 +99,10 @@ files:
|
|
80
99
|
- lib/pio/dhcp/message.rb
|
81
100
|
- lib/pio/dhcp/offer.rb
|
82
101
|
- lib/pio/dhcp/optional_tlv.rb
|
102
|
+
- lib/pio/dhcp/parameter_list.rb
|
83
103
|
- lib/pio/dhcp/request.rb
|
84
|
-
- lib/pio/
|
85
|
-
- lib/pio/
|
86
|
-
- lib/pio/dhcp/type/dhcp_string.rb
|
104
|
+
- lib/pio/hello.rb
|
105
|
+
- lib/pio/hello/format.rb
|
87
106
|
- lib/pio/icmp.rb
|
88
107
|
- lib/pio/icmp/frame.rb
|
89
108
|
- lib/pio/icmp/message.rb
|
@@ -109,6 +128,7 @@ files:
|
|
109
128
|
- lib/pio/message_type_selector.rb
|
110
129
|
- lib/pio/options.rb
|
111
130
|
- lib/pio/parse_error.rb
|
131
|
+
- lib/pio/pcap.rb
|
112
132
|
- lib/pio/type/ethernet_header.rb
|
113
133
|
- lib/pio/type/ip_address.rb
|
114
134
|
- lib/pio/type/ipv4_header.rb
|
@@ -126,6 +146,7 @@ files:
|
|
126
146
|
- spec/pio/dhcp/offer_spec.rb
|
127
147
|
- spec/pio/dhcp/request_spec.rb
|
128
148
|
- spec/pio/dhcp_spec.rb
|
149
|
+
- spec/pio/hello_spec.rb
|
129
150
|
- spec/pio/icmp/reply_spec.rb
|
130
151
|
- spec/pio/icmp/request_spec.rb
|
131
152
|
- spec/pio/icmp_spec.rb
|
@@ -159,22 +180,35 @@ signing_key:
|
|
159
180
|
specification_version: 4
|
160
181
|
summary: Packet parser and generator.
|
161
182
|
test_files:
|
162
|
-
- spec/pio/
|
163
|
-
- spec/pio/
|
164
|
-
- spec/pio/
|
165
|
-
- spec/pio/
|
166
|
-
- spec/pio/arp_spec.rb
|
183
|
+
- spec/pio/ipv4_address_spec.rb
|
184
|
+
- spec/pio/hello_spec.rb
|
185
|
+
- spec/pio/dhcp/request_spec.rb
|
186
|
+
- spec/pio/dhcp/offer_spec.rb
|
167
187
|
- spec/pio/dhcp/ack_spec.rb
|
168
188
|
- spec/pio/dhcp/discover_spec.rb
|
169
|
-
- spec/pio/
|
170
|
-
- spec/pio/
|
171
|
-
- spec/pio/
|
172
|
-
- spec/pio/
|
189
|
+
- spec/pio/arp/request_spec.rb
|
190
|
+
- spec/pio/arp/reply/options_spec.rb
|
191
|
+
- spec/pio/arp/request/options_spec.rb
|
192
|
+
- spec/pio/arp/reply_spec.rb
|
193
|
+
- spec/pio/lldp/options_spec.rb
|
194
|
+
- spec/pio/mac_spec.rb
|
173
195
|
- spec/pio/icmp/request_spec.rb
|
196
|
+
- spec/pio/icmp/reply_spec.rb
|
174
197
|
- spec/pio/icmp_spec.rb
|
175
|
-
- spec/pio/
|
176
|
-
- spec/pio/lldp/options_spec.rb
|
198
|
+
- spec/pio/dhcp_spec.rb
|
177
199
|
- spec/pio/lldp_spec.rb
|
178
|
-
- spec/pio/
|
200
|
+
- spec/pio/arp_spec.rb
|
179
201
|
- spec/spec_helper.rb
|
202
|
+
- features/pcap/dhcp.pcap
|
203
|
+
- features/pcap/arp.pcap
|
204
|
+
- features/pcap/lldp.minimal.pcap
|
205
|
+
- features/pcap/icmp.pcap
|
206
|
+
- features/pcap/arp-storm.pcap
|
207
|
+
- features/pcap/lldp.detailed.pcap
|
208
|
+
- features/support/env.rb
|
209
|
+
- features/icmp_read.feature
|
210
|
+
- features/arp_read.feature
|
211
|
+
- features/step_definitions/pcap_steps.rb
|
212
|
+
- features/lldp_read.feature
|
213
|
+
- features/dhcp_read.feature
|
180
214
|
has_rdoc:
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'bindata'
|
4
|
-
|
5
|
-
module Pio
|
6
|
-
module Type
|
7
|
-
# DHCP String Format.
|
8
|
-
class DhcpString < BinData::Primitive
|
9
|
-
string :dhcp_string,
|
10
|
-
read_length: :tlv_info_length
|
11
|
-
|
12
|
-
def set(value)
|
13
|
-
self.dhcp_string = value
|
14
|
-
end
|
15
|
-
|
16
|
-
def get
|
17
|
-
dhcp_string
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|