Example #1
0
 void rrFromWire(DNSInput in) throws IOException {
   if (in.remaining() > 0) options = new ArrayList();
   while (in.remaining() > 0) {
     int code = in.readU16();
     int len = in.readU16();
     byte[] data = in.readByteArray(len);
     options.add(new Option(code, data));
   }
 }
  private static Record newRecord(
      Name name, int type, int dclass, long ttl, int length, DNSInput in) throws IOException {
    Record rec;
    int recstart;
    rec = getEmptyRecord(name, type, dclass, ttl, in != null);
    if (in != null) {
      if (in.remaining() < length) throw new WireParseException("truncated record");
      in.setActive(length);

      rec.rrFromWire(in);

      if (in.remaining() > 0) throw new WireParseException("invalid record length");
      in.clearActive();
    }
    return rec;
  }
Example #3
0
 public TypeBitmap(DNSInput in) throws WireParseException {
   this();
   int lastbase = -1;
   while (in.remaining() > 0) {
     if (in.remaining() < 2) throw new WireParseException("invalid bitmap descriptor");
     int mapbase = in.readU8();
     if (mapbase < lastbase) throw new WireParseException("invalid ordering");
     int maplength = in.readU8();
     if (maplength > in.remaining()) throw new WireParseException("invalid bitmap");
     for (int i = 0; i < maplength; i++) {
       int current = in.readU8();
       if (current == 0) continue;
       for (int j = 0; j < 8; j++) {
         if ((current & (1 << (7 - j))) == 0) continue;
         int typecode = mapbase * 256 + +i * 8 + j;
         types.add(Mnemonic.toInteger(typecode));
       }
     }
   }
 }
Example #4
0
 void rrFromWire(DNSInput in) throws IOException {
   address = in.readCountedString();
   if (in.remaining() > 0) subAddress = in.readCountedString();
 }