Sha256: 71592051bb9b2ccd982687818b095cf9e2cc4846d2f9d924cce995bfefa36816

Contents?: true

Size: 716 Bytes

Versions: 3

Compression:

Stored size: 716 Bytes

Contents

class PacketViaDMEM
  class Sent < Packet

    def initialize packet
      @type            = :sent
      @original        = packet
      @header, @packet = parse_packet packet
    end

    private

    def parse_packet pkt
      pop, push = nil, []
      case pkt.first.to_i(16)
      when 0x00 # we're sending to fabric
        # we may send MAC to fabric,byte 6, 7, 9, 11, 21?
        if pkt[5].to_i(16) == 0xf0 # we don't send MAC to fabric
          push = FAKE[:dmac] + FAKE[:smac] + FAKE[:etype_mpls]
          pop = 24
        else # we send MAC to fabric
          pop = 33
        end
      when 0x08 then pop = 13
      else pop = @sent
      end
      header_and_packet pkt, pop, push
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
packet_via_dmem-0.0.6 lib/packet_via_dmem/sent.rb
packet_via_dmem-0.0.5 lib/packet_via_dmem/sent.rb
packet_via_dmem-0.0.4 lib/packet_via_dmem/sent.rb