Class: Pio::OpenFlow::Action
- Inherits:
-
Object
- Object
- Pio::OpenFlow::Action
show all
- Defined in:
- lib/pio/open_flow/action.rb
Overview
Direct Known Subclasses
Pio::OpenFlow10::Enqueue, Pio::OpenFlow10::SendOutPort, Pio::OpenFlow10::SetDestinationIpAddress, Pio::OpenFlow10::SetDestinationMacAddress, Pio::OpenFlow10::SetSourceIpAddress, Pio::OpenFlow10::SetSourceMacAddress, Pio::OpenFlow10::SetTos, Pio::OpenFlow10::SetTransportDestinationPort, Pio::OpenFlow10::SetTransportSourcePort, Pio::OpenFlow10::SetVlanPriority, Pio::OpenFlow10::SetVlanVid, Pio::OpenFlow10::StripVlanHeader, Pio::OpenFlow13::NiciraRegMove, Pio::OpenFlow13::SendOutPort, Pio::OpenFlow13::SetArpOperation, Pio::OpenFlow13::SetArpSenderHardwareAddress, Pio::OpenFlow13::SetArpSenderProtocolAddress, Pio::OpenFlow13::SetDestinationMacAddress, Pio::OpenFlow13::SetSourceMacAddress, NiciraAction
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(user_options) ⇒ Action
Returns a new instance of Action.
32
33
34
|
# File 'lib/pio/open_flow/action.rb', line 32
def initialize(user_options)
@format = self.class.const_get(:Format).new(user_options)
end
|
Class Method Details
11
12
13
14
15
16
17
18
|
# File 'lib/pio/open_flow/action.rb', line 11
def self.(options)
module_eval do
endian :big
uint16 :action_type, value: options.fetch(:action_type)
uint16 :action_length, value: options.fetch(:action_length)
end
end
|
.inherited(child_klass) ⇒ Object
7
8
9
|
# File 'lib/pio/open_flow/action.rb', line 7
def self.inherited(child_klass)
child_klass.const_set :Format, Class.new(BinData::Record)
end
|
.method_missing(method, *args, &block) ⇒ Object
26
27
28
29
30
|
# File 'lib/pio/open_flow/action.rb', line 26
def self.method_missing(method, *args, &block)
const_get(:Format).__send__ method, *args, &block
return if method == :endian || method == :virtual
define_method(args.first) { @format.__send__ args.first }
end
|
.read(raw_data) ⇒ Object
20
21
22
23
24
|
# File 'lib/pio/open_flow/action.rb', line 20
def self.read(raw_data)
action = allocate
action.instance_variable_set :@format, const_get(:Format).read(raw_data)
action
end
|
Instance Method Details
#to_binary ⇒ Object
36
37
38
|
# File 'lib/pio/open_flow/action.rb', line 36
def to_binary
@format.to_binary_s
end
|