/** * Returns the TSIG record from the ADDITIONAL section, if one is present. * @see TSIGRecord * @see TSIG * @see Section */ public TSIGRecord getTSIG() { int count = header.getCount(Section.ADDITIONAL); if (count == 0) return null; List l = sections[Section.ADDITIONAL]; Record rec = (Record) l.get(count - 1); if (rec.type != Type.TSIG) return null; return (TSIGRecord) rec; }
/** * Returns the TSIG record from the ADDITIONAL section, if one is present. * @see TSIGRecord * @see TSIG * @see Section */ public TSIGRecord getTSIG() { int count = header.getCount(Section.ADDITIONAL); if (count == 0) return null; List l = sections[Section.ADDITIONAL]; Record rec = (Record) l.get(count - 1); if (rec.type != Type.TSIG) return null; return (TSIGRecord) rec; }
/** * Returns the TSIG record from the ADDITIONAL section, if one is present. * @see TSIGRecord * @see TSIG * @see Section */ public TSIGRecord getTSIG() { int count = header.getCount(Section.ADDITIONAL); if (count == 0) return null; List l = sections[Section.ADDITIONAL]; Record rec = (Record) l.get(count - 1); if (rec.type != Type.TSIG) return null; return (TSIGRecord) rec; }
/** * Returns the TSIG record from the ADDITIONAL section, if one is present. * @see TSIGRecord * @see TSIG * @see Section */ public TSIGRecord getTSIG() { int count = header.getCount(Section.ADDITIONAL); if (count == 0) return null; List l = sections[Section.ADDITIONAL]; Record rec = (Record) l.get(count - 1); if (rec.type != Type.TSIG) return null; return (TSIGRecord) rec; }
String toStringWithRcode(int newrcode) { StringBuffer sb = new StringBuffer(); sb.append(";; ->>HEADER<<- "); sb.append("opcode: " + Opcode.string(getOpcode())); sb.append(", status: " + Rcode.string(newrcode)); sb.append(", id: " + getID()); sb.append("\n"); sb.append(";; flags: " + printFlags()); sb.append("; "); for (int i = 0; i < 4; i++) sb.append(Section.string(i) + ": " + getCount(i) + " "); return sb.toString(); }
String toStringWithRcode(int newrcode) { StringBuffer sb = new StringBuffer(); sb.append(";; ->>HEADER<<- "); sb.append("opcode: " + Opcode.string(getOpcode())); sb.append(", status: " + Rcode.string(newrcode)); sb.append(", id: " + getID()); sb.append("\n"); sb.append(";; flags: " + printFlags()); sb.append("; "); for (int i = 0; i < 4; i++) sb.append(Section.string(i) + ": " + getCount(i) + " "); return sb.toString(); }
String toStringWithRcode(int newrcode) { StringBuffer sb = new StringBuffer(); sb.append(";; ->>HEADER<<- "); sb.append("opcode: " + Opcode.string(getOpcode())); sb.append(", status: " + Rcode.string(newrcode)); sb.append(", id: " + getID()); sb.append("\n"); sb.append(";; flags: " + printFlags()); sb.append("; "); for (int i = 0; i < 4; i++) sb.append(Section.string(i) + ": " + getCount(i) + " "); return sb.toString(); }
String toStringWithRcode(int newrcode) { StringBuffer sb = new StringBuffer(); sb.append(";; ->>HEADER<<- "); sb.append("opcode: " + Opcode.string(getOpcode())); sb.append(", status: " + Rcode.string(newrcode)); sb.append(", id: " + getID()); sb.append("\n"); sb.append(";; flags: " + printFlags()); sb.append("; "); for (int i = 0; i < 4; i++) sb.append(Section.string(i) + ": " + getCount(i) + " "); return sb.toString(); }
static void doAXFR(Message response) throws IOException { System.out.println("; java dig 0.0 <> " + name + " axfr"); if (response.isSigned()) { System.out.print(";; TSIG "); if (response.isVerified()) System.out.println("ok"); else System.out.println("failed"); } if (response.getRcode() != Rcode.NOERROR) { System.out.println(response); return; } Record [] records = response.getSectionArray(Section.ANSWER); for (int i = 0; i < records.length; i++) System.out.println(records[i]); System.out.print(";; done ("); System.out.print(response.getHeader().getCount(Section.ANSWER)); System.out.print(" records, "); System.out.print(response.getHeader().getCount(Section.ADDITIONAL)); System.out.println(" additional)"); }
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 (rec.getType() == Type.TSIG) tsigstart = pos; } } } catch (WireParseException e) { if (!truncated) throw e; } size = in.current(); }
try { for (int i = 0; i < 4; i++) { int count = header.getCount(i); if (count > 0) sections[i] = new ArrayList(count);
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 (rec.getType() == Type.TSIG) tsigstart = pos; if (rec.getType() == Type.SIG && ((SIGRecord) rec).getTypeCovered() == 0) sig0start = pos; } } } catch (WireParseException e) { if (!truncated) throw e; } size = in.current(); }
try { for (int i = 0; i < 4; i++) { int count = header.getCount(i); if (count > 0) sections[i] = new ArrayList(count);
int count = response.getHeader().getCount(section); if (count != Integer.parseInt(expected)) { value = new Integer(count).toString();
if (skipped != 0 && i != Section.ADDITIONAL) { flags = Header.setFlag(flags, Flags.TC, true); out.writeU16At(header.getCount(i) - skipped, startpos + 4 + 2 * i); for (int j = i + 1; j < Section.ADDITIONAL; j++) additionalCount = header.getCount(i) - skipped; out.writeU16At(flags, startpos + 2); if (additionalCount != header.getCount(Section.ADDITIONAL)) out.writeU16At(additionalCount, startpos + 10);
if (i != Section.ADDITIONAL) newheader.setFlag(Flags.TC); int count = newheader.getCount(i); newheader.setCount(i, count - skipped); for (int j = i + 1; j < 4; j++)
newheader = (Header) header.clone(); newheader.setFlag(Flags.TC); int count = newheader.getCount(i); newheader.setCount(i, count - skipped); for (int j = i + 1; j < 4; j++)
if (i != Section.ADDITIONAL) newheader.setFlag(Flags.TC); int count = newheader.getCount(i); newheader.setCount(i, count - skipped); for (int j = i + 1; j < 4; j++)