Exemplo n.º 1
0
  // this is needed for overriding in the OPTRecord, which needs to reuse the CLASS as payload.
  protected void toWireCanonical(DNSOutput out, Name inName, int inType, int inClass, long inTtl) {

    inName.toWireCanonical(out);
    out.writeU16(inType);
    out.writeU16(inClass);
    out.writeU32(inTtl);

    int lengthPosition = out.current();
    out.writeU16(0); /* until we know better */
    rrToWire(out, null, true);
    int rrlength = out.current() - lengthPosition - 2;
    out.writeU16At(rrlength, lengthPosition);
  }
Exemplo n.º 2
0
  protected void toWire(
      DNSOutput out, int section, Compression c, Name inName, int inType, int inClass, long inTtl) {

    inName.toWire(out, c);
    out.writeU16(inType);
    out.writeU16(inClass);
    if (section == Section.QUESTION) {
      return;
    }
    out.writeU32(inTtl);
    int lengthPosition = out.current();
    out.writeU16(0); /* until we know better */
    rrToWire(out, c, false);
    int rrlength = out.current() - lengthPosition - 2;
    out.writeU16At(rrlength, lengthPosition);
  }
Exemplo n.º 3
0
 /**
  * Converts the rdata in a Record into canonical DNS uncompressed wire format (all names are
  * converted to lowercase).
  */
 public byte[] rdataToWireCanonical() {
   DNSOutput out = new DNSOutput();
   rrToWire(out, null, true);
   return out.toByteArray();
 }
Exemplo n.º 4
0
 /*
  * Converts a Record into canonical DNS uncompressed wire format (all names
  * are converted to lowercase), optionally ignoring the TTL.
  */
 protected byte[] toWireCanonical(boolean noTTL) {
   DNSOutput out = new DNSOutput();
   toWireCanonical(out, noTTL);
   return out.toByteArray();
 }
Exemplo n.º 5
0
 /** Converts a Record into DNS uncompressed wire format. */
 public byte[] toWire(int section) {
   DNSOutput out = new DNSOutput();
   toWire(out, section, null);
   return out.toByteArray();
 }