openflow-protocol 0.0.1 → 0.0.2

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: 1fc576ecfced9806622867b9ec63625e0547bd50
4
- data.tar.gz: ed90aa37d49475ab047c38ae85863ba1f3b8d850
3
+ metadata.gz: cd2320d8d023f99591849dcddf65d34d027d456a
4
+ data.tar.gz: 6308d93b14a0dc921a31cd2f95ddb077648bf675
5
5
  SHA512:
6
- metadata.gz: 679d1d48ba8ee8f06b36d03a2bc0b626b38f8d203c22bdcadc38c34964171011c734427caab89e71d3dfdeaa63d75cda72cfa623b2b22a9ec418183664d7b97c
7
- data.tar.gz: 942c5502894b36f8de79c5b5866d129e25587657dbf6102337616dc242534e78432199323ad5df1249ff56c0aea28dba7489a8f7039e77847cb49c91ce069fc2
6
+ metadata.gz: 4a9d598eb11bdbbb763b4e10f9e33c43f6ec05f39f703f27df273783966cd08f2de81bde050e51b54d04a9d7cb6f5ba4dc13b00b38d9316982b1e22476c69f14
7
+ data.tar.gz: e01191ffec81b3c5913e28eee27f9f5abc9188f7d331a9717b41e24dd5c074e1abed87e467272c79c2e84e06a322a65ee356392f275cec6130e72db85c207497
@@ -1,7 +1,7 @@
1
1
  require_relative 'action'
2
2
 
3
3
  class OFActionSetIpSource < OFAction
4
- ip_address :ip_address
4
+ ipv4_address :ip_address
5
5
 
6
6
  def body_length
7
7
  4
@@ -1,4 +1,5 @@
1
1
  require 'bindata'
2
+ require 'bindata-contrib'
2
3
 
3
4
  class SuperclassBase < BinData::Record
4
5
  attr_reader :type_str
@@ -1,3 +1,3 @@
1
1
  Dir[File.expand_path 'messages/**/*.rb', __dir__].each do |file|
2
- require file
2
+ require_relative file
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require_relative '../structs/match'
2
- require_relative '../helpers/flags'
3
2
 
4
3
  class OFTableStatistics < BinData::Record
5
4
  TABLE_IDS = {emergency: 0xfe, all: 0xff}
data/lib/structs/match.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  require 'English'
2
- require_relative '../helpers/enum'
3
- require_relative '../helpers/mac_address'
4
- require_relative '../helpers/ip_address'
2
+ require 'bindata-contrib'
5
3
  require_relative 'port_number'
6
4
 
7
5
  class OFMatch < BinData::Record
@@ -84,8 +82,8 @@ class OFMatch < BinData::Record
84
82
  }, initial_value: 0
85
83
  uint16 :padding2
86
84
  hide :padding2
87
- ip_address :ip_source
88
- ip_address :ip_destination
85
+ ipv4_address :ip_source
86
+ ipv4_address :ip_destination
89
87
  uint16 :source_port, initial_value: 0
90
88
  uint16 :destination_port, initial_value: 0
91
89
  end
@@ -1,5 +1,5 @@
1
+ require 'bindata-contrib'
1
2
  require_relative 'port_number'
2
- require_relative '../helpers/mac_address'
3
3
 
4
4
  class OFPhysicalPort < BinData::Record
5
5
  CONFIG = [
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openflow-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
- - Jeremy Page
7
+ - Jérémy Pagé
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-07-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An OpenFlow Parser/Serializer.
14
14
  email:
15
- - jeremy@jeremypage.me
15
+ - contact@jeremypage.me
16
16
  executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
@@ -32,10 +32,6 @@ files:
32
32
  - lib/actions/action_strip_vlan.rb
33
33
  - lib/actions/action_vendor.rb
34
34
  - lib/actions/actions.rb
35
- - lib/helpers/enum.rb
36
- - lib/helpers/flags.rb
37
- - lib/helpers/ip_address.rb
38
- - lib/helpers/mac_address.rb
39
35
  - lib/helpers/superclass_base.rb
40
36
  - lib/messages/barrier_reply.rb
41
37
  - lib/messages/barrier_request.rb
@@ -93,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
89
  version: '0'
94
90
  requirements: []
95
91
  rubyforge_project:
96
- rubygems_version: 2.4.6
92
+ rubygems_version: 2.4.8
97
93
  signing_key:
98
94
  specification_version: 4
99
95
  summary: OpenFlow Protocol
data/lib/helpers/enum.rb DELETED
@@ -1,45 +0,0 @@
1
- require 'bindata'
2
-
3
- def _def_enum(size)
4
- eval %(
5
- class Enum#{size} < BinData::Primitive
6
- mandatory_parameter :list
7
-
8
- endian :big
9
- uint#{size} :enum, initial_value: 0
10
-
11
- def get
12
- list.invert.fetch(enum)
13
- rescue KeyError
14
- enum
15
- end
16
-
17
- def set(value)
18
- self.enum = list.fetch(value)
19
- rescue KeyError
20
- self.enum = value
21
- end
22
-
23
- private
24
-
25
- def list
26
- list = eval_parameter(:list)
27
- case list
28
- when Array
29
- shift = 0
30
- list.each_with_object({}) do |each, result|
31
- result[each] = shift
32
- shift += 1
33
- result
34
- end
35
- when Hash
36
- list
37
- end
38
- end
39
- end
40
- )
41
- end
42
-
43
- _def_enum 8
44
- _def_enum 16
45
- _def_enum 32
data/lib/helpers/flags.rb DELETED
@@ -1,49 +0,0 @@
1
- require 'bindata'
2
-
3
- def _def_flags(size)
4
- eval %(
5
- class Flags#{size} < BinData::Primitive
6
- mandatory_parameter :list
7
-
8
- endian :big
9
- uint#{size} :flags, initial_value: 0
10
-
11
- def get
12
- list.each_with_object([]) do |(key, value), result|
13
- result << key if (flags & value != 0) || (flags == value)
14
- result
15
- end
16
- end
17
-
18
- def set(value)
19
- value.each do |each|
20
- fail "Invalid flag: \#{value}" unless list.keys.include?(each)
21
- end
22
- self.flags = value.empty? ?
23
- 0 :
24
- value.map { |each| list[each] }.inject(:|)
25
- end
26
-
27
- private
28
-
29
- def list
30
- list = eval_parameter(:list)
31
- case list
32
- when Array
33
- shift = 0
34
- list.each_with_object({}) do |each, result|
35
- result[each] = 1 << shift
36
- shift += 1
37
- result
38
- end
39
- when Hash
40
- list
41
- end
42
- end
43
- end
44
- )
45
- end
46
-
47
- _def_flags 8
48
- _def_flags 16
49
- _def_flags 32
@@ -1,14 +0,0 @@
1
- require 'bindata'
2
-
3
- class IpAddress < BinData::Primitive
4
- endian :big
5
- array :octets, type: :uint8, initial_length: 4
6
-
7
- def get
8
- octets.map(&:to_s).join('.')
9
- end
10
-
11
- def set(value)
12
- self.octets = value.split('.').map(&:to_i)
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- require 'bindata'
2
-
3
- class MacAddress < BinData::Primitive
4
- endian :big
5
- array :octets, type: :uint8, initial_length: 6
6
-
7
- def get
8
- octets.map { |octet| format('%02x', octet) }.join(':')
9
- end
10
-
11
- def set(value)
12
- self.octets = value.split(':').map(&:hex)
13
- end
14
- end