Class: Pio::OpenFlow::Action
- Inherits:
-
Object
- Object
- Pio::OpenFlow::Action
show all
- Extended by:
- ActiveSupport::DescendantsTracker
- 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::CopyTtlInwards, Pio::OpenFlow13::CopyTtlOutwards, Pio::OpenFlow13::DecrementIpTtl, Pio::OpenFlow13::SendOutPort, Pio::OpenFlow13::SetArpOperation, Pio::OpenFlow13::SetArpSenderHardwareAddress, Pio::OpenFlow13::SetArpSenderProtocolAddress, Pio::OpenFlow13::SetDestinationMacAddress, Pio::OpenFlow13::SetIpTtl, Pio::OpenFlow13::SetMetadata, Pio::OpenFlow13::SetSourceMacAddress, Pio::OpenFlow13::WriteMetadata, NiciraAction
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(user_options) ⇒ Action
Returns a new instance of Action.
38
39
40
|
# File 'lib/pio/open_flow/action.rb', line 38
def initialize(user_options)
@format = self.class.const_get(:Format).new(user_options)
end
|
Class Method Details
12
13
14
15
16
17
18
19
|
# File 'lib/pio/open_flow/action.rb', line 12
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
|
.method_missing(method, *args, &block) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/pio/open_flow/action.rb', line 27
def self.method_missing(method, *args, &block)
begin
const_get(:Format).__send__ method, *args, &block
rescue NameError
const_set :Format, Class.new(BinData::Record)
retry
end
return if method == :endian || method == :virtual
define_method(args.first) { @format.__send__ args.first }
end
|
.read(raw_data) ⇒ Object
21
22
23
24
25
|
# File 'lib/pio/open_flow/action.rb', line 21
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
42
43
44
|
# File 'lib/pio/open_flow/action.rb', line 42
def to_binary
@format.to_binary_s
end
|