Message(DNSInput in) throws IOException { this(new Header(in)); boolean isUpdate = (header.getOpcode() == Opcode.UPDATE); boolean truncated = header.getFlag(Flags.TC); try { for (int i = 0; i < 4; i++) { int count = header.getCount(i); if (count > 0) sections[i] = new ArrayList(count); for (int j = 0; j < count; j++) { int pos = in.current(); Record rec = Record.fromWire(in, i, isUpdate); sections[i].add(rec); if (i == Section.ADDITIONAL) { if (rec.getType() == Type.TSIG) tsigstart = pos; if (rec.getType() == Type.SIG) { SIGRecord sig = (SIGRecord) rec; if (sig.getTypeCovered() == 0) sig0start = pos; } } } } } catch (WireParseException e) { if (!truncated) throw e; } size = in.current(); }
private static void digestSIG(DataByteOutputStream out, SIGRecord sig) { out.writeShort(sig.getTypeCovered()); out.writeByte(sig.getAlgorithm()); out.writeByte(sig.getLabels()); out.writeUnsignedInt(sig.getOrigTTL()); out.writeInt((int) (sig.getExpire().getTime() / 1000)); out.writeInt((int) (sig.getTimeSigned().getTime() / 1000)); out.writeShort(sig.getFootprint()); sig.getSigner().toWireCanonical(out); }