Class: Pio::OpenFlow10::PacketIn::Reason

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/pio/open_flow10/packet_in/reason.rb

Overview

Why is this packet being sent to the controller? (enum ofp_packet_in_reason)

Constant Summary collapse

REASONS =
{ no_match: 0, action: 1 }.freeze

Instance Method Summary collapse

Instance Method Details

#getObject



13
14
15
# File 'lib/pio/open_flow10/packet_in/reason.rb', line 13

def get
  REASONS.invert.fetch(reason)
end

#set(value) ⇒ Object



17
18
19
# File 'lib/pio/open_flow10/packet_in/reason.rb', line 17

def set(value)
  self.reason = REASONS.fetch(value)
end

#to_bytesObject



21
22
23
# File 'lib/pio/open_flow10/packet_in/reason.rb', line 21

def to_bytes
  reason.to_hex
end