예제 #1
0
 public void decode(ByteBuffer buffer) throws IOException {
   getCompression().clear();
   _headerSection.decode(buffer);
   _questionSection.decode(buffer);
   _answerSection.decode(buffer, _headerSection.getAnswerRecords());
   _authoritySection.decode(buffer, _headerSection.getAuthorityRecords());
   _additionalSection.decode(buffer, _headerSection.getAdditionalRecords());
 }
예제 #2
0
 public void encode(ByteBuffer buffer) throws IOException {
   getCompression().clear();
   _headerSection.encode(buffer);
   _questionSection.encode(buffer);
   _answerSection.encode(buffer);
   _authoritySection.encode(buffer);
   _additionalSection.encode(buffer);
 }
예제 #3
0
 public String toString() {
   StringBuilder sb = new StringBuilder();
   _headerSection.append(sb);
   _questionSection.append(sb);
   _answerSection.append(sb, "Answers");
   _authoritySection.append(sb, "Authority name servers");
   _additionalSection.append(sb, "Additional records");
   return sb.toString();
 }
예제 #4
0
 public DnsMessage(Record record) {
   _headerSection.setId(__random.nextInt() & 0xFFFF);
   _headerSection.setOpCode(OpCode.QUERY);
   _questionSection.add(record);
 }