class Pio::OpenFlow10::Match::Wildcards
Flow wildcards
Constants
- BITS
- FLAGS
- NW_FLAGS
Public Instance Methods
destination_ip_address()
click to toggle source
# File lib/pio/open_flow10/match.rb, line 78 def destination_ip_address get.fetch(:destination_ip_address) rescue KeyError 0 end
get()
click to toggle source
This method smells of :reek:FeatureEnvy
# File lib/pio/open_flow10/match.rb, line 49 def get BITS.each_with_object(Hash.new(0)) do |(key, bit), memo| next if (flags & bit).zero? if /(source_ip_address|destination_ip_address)(\d)/=~ key memo[$LAST_MATCH_INFO[1].to_sym] |= 1 << $LAST_MATCH_INFO[2].to_i else memo[key] = true end end end
set(params)
click to toggle source
# File lib/pio/open_flow10/match.rb, line 60 def set(params) self.flags = params.inject(0) do |memo, (key, val)| memo | case key when :source_ip_address, :destination_ip_address (params.fetch(key) & 31) << (key == :source_ip_address ? 8 : 14) else val ? BITS.fetch(key) : 0 end end end
source_ip_address()
click to toggle source
# File lib/pio/open_flow10/match.rb, line 72 def source_ip_address get.fetch(:source_ip_address) rescue KeyError 0 end