openflow-protocol 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/messages/packet_in.rb +6 -0
- data/lib/messages/parser.rb +12 -0
- data/lib/openflow-protocol.rb +1 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81bc2fa929616168bb6f53936942ea20f20259a1
|
4
|
+
data.tar.gz: 99401007e03c7f124a0ccacca7bf2bbf0f692e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c40db8c808311114b25625cbdc73a3d76947e8041a348a38bf77da9797261101c89815b22087ecd445178aa5d0f1abbbafe349b50270ada4f5efcc293cfc61
|
7
|
+
data.tar.gz: ddaa75a769912a5fecc453e7cb32ee9423a17b22316bcd0e9ba96b5ad8866a55ad821c70c1f51eb0a41973a6e520b5d0e84199f8a2df04fe6e5108486ebbf57c
|
data/lib/messages/packet_in.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'packet-protocols'
|
1
2
|
require_relative 'message'
|
2
3
|
|
3
4
|
class OFPacketIn < OFMessage
|
@@ -14,4 +15,9 @@ class OFPacketIn < OFMessage
|
|
14
15
|
def body_length
|
15
16
|
10 + data.length
|
16
17
|
end
|
18
|
+
|
19
|
+
def parsed_data
|
20
|
+
@parsed_data ||= Ethernet.read(data)
|
21
|
+
@parsed_data
|
22
|
+
end
|
17
23
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Dir[File.expand_path '*.rb', __dir__].each do |file|
|
2
|
+
require_relative file
|
3
|
+
end
|
4
|
+
|
5
|
+
class OFParser
|
6
|
+
def self.read(binary)
|
7
|
+
type = OFMessage::TYPES[binary[1].unpack('C')[0].to_i]
|
8
|
+
klass_name = 'OF' + type.to_s.split('_').map(&:capitalize).join
|
9
|
+
klass = Object.const_get(klass_name)
|
10
|
+
klass.read(binary)
|
11
|
+
end
|
12
|
+
end
|
data/lib/openflow-protocol.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openflow-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jérémy Pagé
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An OpenFlow Parser/Serializer.
|
14
14
|
email:
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- lib/messages/message.rb
|
48
48
|
- lib/messages/packet_in.rb
|
49
49
|
- lib/messages/packet_out.rb
|
50
|
+
- lib/messages/parser.rb
|
50
51
|
- lib/messages/port_mod.rb
|
51
52
|
- lib/messages/port_status.rb
|
52
53
|
- lib/messages/set_config.rb
|