-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathMINFORecord.java
More file actions
72 lines (60 loc) · 2.2 KB
/
Copy pathMINFORecord.java
File metadata and controls
72 lines (60 loc) · 2.2 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) 2004 Brian Wellington (bwelling@xbill.org)
package org.xbill.DNS;
import java.io.IOException;
/**
* Mailbox information Record - lists the address responsible for a mailing list/mailbox and the
* address to receive error messages relating to the mailing list/mailbox.
*
* @author Brian Wellington
* @see <a href="https://datatracker.ietf.org/doc/html/rfc883">RFC 883: Domain Names -
* Implementation and Specification</a>
*/
public class MINFORecord extends Record {
private Name responsibleAddress;
private Name errorAddress;
MINFORecord() {}
/**
* Creates an MINFO Record from the given data
*
* @param responsibleAddress The address responsible for the mailing list/mailbox.
* @param errorAddress The address to receive error messages relating to the mailing list/mailbox.
*/
public MINFORecord(Name name, int dclass, long ttl, Name responsibleAddress, Name errorAddress) {
super(name, Type.MINFO, dclass, ttl);
this.responsibleAddress = checkName("responsibleAddress", responsibleAddress);
this.errorAddress = checkName("errorAddress", errorAddress);
}
@Override
protected void rrFromWire(DNSInput in) throws IOException {
responsibleAddress = new Name(in);
errorAddress = new Name(in);
}
@Override
protected void rdataFromString(Tokenizer st, Name origin) throws IOException {
responsibleAddress = st.getName(origin);
errorAddress = st.getName(origin);
}
/** Converts the MINFO Record to a String */
@Override
protected String rrToString() {
StringBuilder sb = new StringBuilder();
sb.append(responsibleAddress);
sb.append(" ");
sb.append(errorAddress);
return sb.toString();
}
/** Gets the address responsible for the mailing list/mailbox. */
public Name getResponsibleAddress() {
return responsibleAddress;
}
/** Gets the address to receive error messages relating to the mailing list/mailbox. */
public Name getErrorAddress() {
return errorAddress;
}
@Override
protected void rrToWire(DNSOutput out, Compression c, boolean canonical) {
responsibleAddress.toWire(out, null, canonical);
errorAddress.toWire(out, null, canonical);
}
}