/** * True if this record is suppressed by the answers in a message. */ boolean suppressedBy(DNSIncoming msg) { try { for (int i = msg.numAnswers; i-- > 0;) { if (suppressedBy((DNSRecord) msg.answers.get(i))) { return true; } } return false; } catch (ArrayIndexOutOfBoundsException e) { logger.log(Level.WARNING, "suppressedBy() message " + msg + " exception ", e); // msg.print(true); return false; } }
/** * Add an additional answer to the record. Omit if there is no room. */ void addAdditionalAnswer(DNSIncoming in, DNSRecord rec) throws IOException { if ((off < DNSConstants.MAX_MSG_TYPICAL - 200) && !rec.suppressedBy(in)) { writeRecord(rec, 0); numAdditionals++; } }
/** * Add an answer if it is not suppressed. */ void addAnswer(DNSIncoming in, DNSRecord rec) throws IOException { if (numAuthorities > 0 || numAdditionals > 0) { throw new IllegalStateException("Answers must be added before authorities and additionals"); } if (!rec.suppressedBy(in)) { addAnswer(rec, 0); } }