Sha256: 0bbd13606ce35a18e2eb3de0ab483095d1f806f19f00813638c2b5c58ee245f7
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require 'bindata' require 'pio/open_flow' module Pio class PacketIn < Pio::OpenFlow::Message # Why is this packet being sent to the controller? # (enum ofp_packet_in_reason) class Reason < BinData::Primitive REASONS = { no_match: 0, action: 1 } uint8 :reason def get REASONS.invert.fetch(reason) end def set(value) self.reason = REASONS.fetch(value) end end # Message body of Packet-In. class Body < BinData::Record endian :big uint32 :buffer_id uint16 :total_len, value: -> { data.length } uint16 :in_port reason :reason uint8 :padding hide :padding string :data, read_length: :total_len def empty? false end def length 10 + data.length end end # OpenFlow 1.0 Packet-In message parser and generator. class Format < BinData::Record include Pio::OpenFlow::Type endian :big open_flow_header :open_flow_header, message_type_value: PACKET_IN virtual assert: -> { open_flow_header.message_type == PACKET_IN } body :body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pio-0.9.0 | lib/pio/packet_in/format.rb |