# File ../../auditor/lib/kasp_auditor/auditor.rb, line 877
    def write_types_to_file(domain, types_covered, last_name, is_glue)
      return if (is_glue && ( types_covered.clone.delete_if{|t| t == Types::A || t == Types::AAAA}.empty? ))
      #      return if (is_glue && ( types_covered.clone.delete_if{|t| t == Types::A || t == Types::AAAA || t == Types::NS}.empty? ))
      return if (types_covered.include?Types::NSEC3) # Only interested in real domains
      #      return if (out_of_zone(domain)) # Only interested in domains which should be here!
      types_string = get_types_string(types_covered)
      salt = ""
      iterations = 0
      hash_alg = Nsec3HashAlgorithms.SHA_1
      if (@nsec3param)
        salt = @nsec3param.salt
        iterations = @nsec3param.iterations
        hash_alg = @nsec3param.hash_alg
      elsif (@first_nsec3)
        salt = @first_nsec3.salt
        iterations = @first_nsec3.iterations
        hash_alg = @first_nsec3.hash_alg
      end
      # Need to add non-glue empty noneterminals here too!
      empty_nonterminals = []
      # Have we skipped any empty nonterminals?
      #    - check the number of labels compared to the expected number of labels
      #    - if more than one different, then there is at least one empty nonterminal
      name_to_check_against = @soa.name
      if (domain.subdomain_of?(last_name))
        # Check the number of labels since last_name
        name_to_check_against = last_name
      else
        # Check the number of labels since the origin
      end
      last = Name.create(domain)
      while (last.labels.length > name_to_check_against.labels.length + 1)
        # Add the empty nonterminal to the list
        last.labels = last.labels[1,last.labels.length]
        if (!@empty_nonterminals.include?last)
          empty_nonterminals.push(last.clone)
          @empty_nonterminals.push(last.clone)
        end

      end

      # If so, should it be covered by an NSEC3 record?
      #    - don't add any NSEC3 for empty nonterminals if this is only glue
      if (!is_glue && empty_nonterminals.length > 0)
        # If so, add the appropriate NSEC3 record to the "expected NSEC3s" file
        empty_nonterminals.each {|empty_nonterminal|
          # Should really check to see if file already includes this name
          if (File.open(@working + "#{File::SEPARATOR}audit.types.#{Process.pid}", "r").grep(/\s#{empty_nonterminal}/).length == 0)
            add_domain_to_types_file(empty_nonterminal, iterations, salt, hash_alg, "")
          end
        }
      end
      add_domain_to_types_file(domain, iterations, salt, hash_alg, types_string)
    end