aboutsummaryrefslogtreecommitdiff
path: root/src/org/xbill/DNS/MINFORecord.java
blob: 4324cdab3f7a05756681125776d6bfe6b746f8a6 (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)

package org.xbill.DNS;

import java.io.*;

/**
 * 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
 */

public class MINFORecord extends Record {

private static final long serialVersionUID = -3962147172340353796L;

private Name responsibleAddress;
private Name errorAddress;

MINFORecord() {}

Record
getObject() {
	return new 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);
}

void
rrFromWire(DNSInput in) throws IOException {
	responsibleAddress = new Name(in);
	errorAddress = new Name(in);
}

void
rdataFromString(Tokenizer st, Name origin) throws IOException {
	responsibleAddress = st.getName(origin);
	errorAddress = st.getName(origin);
}

/** Converts the MINFO Record to a String */
String
rrToString() {
	StringBuffer sb = new StringBuffer();
	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;
}

void
rrToWire(DNSOutput out, Compression c, boolean canonical) {
	responsibleAddress.toWire(out, null, canonical);
	errorAddress.toWire(out, null, canonical);
}

}