def read_common_header(buf)
      frame = {}
      len_hi, len_lo, type, flags, stream = buf.slice(0, 9).unpack(HEADERPACK)

      frame[:length] = (len_hi << FRAME_LENGTH_HISHIFT) | len_lo
      frame[:type], _ = FRAME_TYPES.find { |_t, pos| type == pos }
      if frame[:type]
        frame[:flags] = FRAME_FLAGS[frame[:type]].each_with_object([]) do |(name, pos), acc|
          acc << name if (flags & (1 << pos)) > 0
        end
      end

      frame[:stream] = stream & RBIT
      frame
    end
def read_common_header(buf)
      frame = {}
      len_hi, len_lo, type, flags, stream = buf.slice(0, 9).unpack(HEADERPACK)

      frame[:length] = (len_hi << FRAME_LENGTH_HISHIFT) | len_lo
      frame[:type], _ = FRAME_TYPES.find { |_t, pos| type == pos }
      if frame[:type]
        frame[:flags] = FRAME_FLAGS[frame[:type]].each_with_object([]) do |(name, pos), acc|
          acc << name if (flags & (1 << pos)) > 0
        end
      end

      frame[:stream] = stream & RBIT
      frame
    end
Decodes common 9-byte header.

 @param buf [Buffer]