/** Creates a new Message with a random Message ID */ public Message() { this(new Header()); }
/** Creates a new Message with a random Message ID */ public Message() { this(new Header()); }
/** Creates a new Message with a random Message ID */ public Message() { this(new Header()); }
/** Creates a new Message with the specified Message ID */ public Message(int id) { this(new Header(id)); }
/** Creates a new Message with the specified Message ID */ public Message(int id) { this(new Header(id)); }
/** Creates a new Message with the specified Message ID */ public Message(int id) { this(new Header(id)); }
/** Creates a new Message with the specified Message ID */ public Message(int id) { this(new Header(id)); }
/** Creates a new Message with a random Message ID */ public Message() { this(new Header()); }
public Object clone() { Header h = new Header(); h.id = id; h.flags = flags; System.arraycopy(counts, 0, h.counts, 0, counts.length); return h; }
public Object clone() { Header h = new Header(); h.id = id; h.flags = flags; System.arraycopy(counts, 0, h.counts, 0, counts.length); return h; }
public Object clone() { Header h = new Header(); h.id = id; h.flags = flags; System.arraycopy(counts, 0, h.counts, 0, counts.length); return h; }
public Object clone() { Header h = new Header(); h.id = id; h.flags = flags; System.arraycopy(counts, 0, h.counts, 0, counts.length); return h; }
public byte [] formerrMessage(byte [] in) { Header header; try { header = new Header(in); } catch (IOException e) { return null; } return buildErrorMessage(header, Rcode.FORMERR, null); }
public byte[] formerrMessage(final byte[] in) { try { return buildErrorMessage(new Header(in), Rcode.FORMERR, null); } catch (final IOException e) { LOG.debug("unable to build error message", e); return null; } }
public byte[] formerrMessage(byte[] in) { final Header header; try { header = new Header(in); } catch (final IOException ignored) { return null; } return buildErrorMessage(header, Rcode.FORMERR, null); }
byte[] formerrMessage(byte[] in) { Header header; try { header = new Header(in); } catch (IOException e) { return null; } return buildErrorMessage(header, Rcode.FORMERR, null); }
/** * Creates a DNS error response. * * @param in the byte array detailing the error. * @return the error message, in bytes */ public byte[] formErrorMessage(byte[] in) { Header header; try { header = new Header(in); } catch (IOException e) { return null; } return buildErrorMessage(header, Rcode.FORMERR, null); }
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(); }
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(); }
/** * Processes a DNS error condition and creates an appropriate DNS response. * @param request The original DNS request. * @param error The error condition that occured. * @return A response to the DNS request. */ protected Message processError(Message request, DNSError<?> error) { Message errorResponse = null; try { Header respHeader = new Header(request.toWire()); Message response = new Message(); response.setHeader(respHeader); for (int i = 0; i < 4; i++) response.removeAllRecords(i); response.addRecord(request.getQuestion(), Section.QUESTION); response.getHeader().setFlag(Flags.QR); if (request.getHeader().getFlag(Flags.RD)) response.getHeader().setFlag(Flags.RD); respHeader.setRcode(Integer.parseInt(error.getError().toString())); return response; } catch (IOException e) {} return errorResponse; }