Sha256: 21f97ff676faec65d399e6a8ad01ea5b8b3934cfb0ee8393e974f5fba4e90dfc

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

require_relative 'header/received'
class PacketViaDMEM
  class Received < Packet

    def initialize packet, debug
      @debug                    = debug
      @type                     = :received
      @original                 = packet.dup
      @header                   = Header::Received.new
      @popped, @packet          = parse_packet packet
    end

    private

    def parse_packet pkt
      head = pkt.shift(4).join.to_i(16)

      @header.msg_type = (head & 0xffffffff) >> 28
      @header.table    = (head & 0xfffffff)  >> 15
      @header.stream   = (head & 0x7fff)     >> 4
      @header.offset   = (head & 0xe)        >> 1
      @header.size     = (head & 0x1)        << 16
      @header.size    += pkt.shift(2).join.to_i(16) if @header.msg_type == PACKET_HEAD

      pop, push = get_pop_push pkt, @header
      popped_and_packet pkt, pop, push
    end

    PACKET      = 0
    PACKET_HEAD = 1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
packet_via_dmem-0.0.12 lib/packet_via_dmem/received.rb