openflow-protocol 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd2320d8d023f99591849dcddf65d34d027d456a
4
- data.tar.gz: 6308d93b14a0dc921a31cd2f95ddb077648bf675
3
+ metadata.gz: 81bc2fa929616168bb6f53936942ea20f20259a1
4
+ data.tar.gz: 99401007e03c7f124a0ccacca7bf2bbf0f692e49
5
5
  SHA512:
6
- metadata.gz: 4a9d598eb11bdbbb763b4e10f9e33c43f6ec05f39f703f27df273783966cd08f2de81bde050e51b54d04a9d7cb6f5ba4dc13b00b38d9316982b1e22476c69f14
7
- data.tar.gz: e01191ffec81b3c5913e28eee27f9f5abc9188f7d331a9717b41e24dd5c074e1abed87e467272c79c2e84e06a322a65ee356392f275cec6130e72db85c207497
6
+ metadata.gz: 22c40db8c808311114b25625cbdc73a3d76947e8041a348a38bf77da9797261101c89815b22087ecd445178aa5d0f1abbbafe349b50270ada4f5efcc293cfc61
7
+ data.tar.gz: ddaa75a769912a5fecc453e7cb32ee9423a17b22316bcd0e9ba96b5ad8866a55ad821c70c1f51eb0a41973a6e520b5d0e84199f8a2df04fe6e5108486ebbf57c
@@ -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
@@ -1,3 +1 @@
1
- Dir[File.expand_path 'messages/**/*.rb', __dir__].each do |file|
2
- require_relative file
3
- end
1
+ require_relative 'messages/parser'
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.2
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-18 00:00:00.000000000 Z
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