-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathRPRecord.java
More file actions
72 lines (60 loc) · 1.89 KB
/
Copy pathRPRecord.java
File metadata and controls
72 lines (60 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
package org.xbill.DNS;
import java.io.IOException;
/**
* Responsible Person Record - lists the mail address of a responsible person and a domain where TXT
* records are available.
*
* @author Tom Scola (tscola@research.att.com)
* @author Brian Wellington
* @see <a href="https://datatracker.ietf.org/doc/html/rfc1183">RFC 1183: New DNS RR Definitions</a>
*/
public class RPRecord extends Record {
private Name mailbox;
private Name textDomain;
RPRecord() {}
/**
* Creates an RP Record from the given data
*
* @param mailbox The responsible person
* @param textDomain The address where TXT records can be found
*/
public RPRecord(Name name, int dclass, long ttl, Name mailbox, Name textDomain) {
super(name, Type.RP, dclass, ttl);
this.mailbox = checkName("mailbox", mailbox);
this.textDomain = checkName("textDomain", textDomain);
}
@Override
protected void rrFromWire(DNSInput in) throws IOException {
mailbox = new Name(in);
textDomain = new Name(in);
}
@Override
protected void rdataFromString(Tokenizer st, Name origin) throws IOException {
mailbox = st.getName(origin);
textDomain = st.getName(origin);
}
/** Converts the RP Record to a String */
@Override
protected String rrToString() {
StringBuilder sb = new StringBuilder();
sb.append(mailbox);
sb.append(" ");
sb.append(textDomain);
return sb.toString();
}
/** Gets the mailbox address of the RP Record */
public Name getMailbox() {
return mailbox;
}
/** Gets the text domain info of the RP Record */
public Name getTextDomain() {
return textDomain;
}
@Override
protected void rrToWire(DNSOutput out, Compression c, boolean canonical) {
mailbox.toWire(out, null, canonical);
textDomain.toWire(out, null, canonical);
}
}