aboutsummaryrefslogtreecommitdiff
path: root/src/org/xbill/DNS/MXRecord.java
blob: 111977d1a2b9eed327069737bf15261618dde5c9 (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
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)

package org.xbill.DNS;

/**
 * Mail Exchange - specifies where mail to a domain is sent
 *
 * @author Brian Wellington
 */

public class MXRecord extends U16NameBase {

private static final long serialVersionUID = 2914841027584208546L;

MXRecord() {}

Record
getObject() {
	return new MXRecord();
}

/**
 * Creates an MX Record from the given data
 * @param priority The priority of this MX.  Records with lower priority
 * are preferred.
 * @param target The host that mail is sent to
 */
public
MXRecord(Name name, int dclass, long ttl, int priority, Name target) {
	super(name, Type.MX, dclass, ttl, priority, "priority",
	      target, "target");
}

/** Returns the target of the MX record */
public Name
getTarget() {
	return getNameField();
}

/** Returns the priority of this MX record */
public int
getPriority() {
	return getU16Field();
}

void
rrToWire(DNSOutput out, Compression c, boolean canonical) {
	out.writeU16(u16Field);
	nameField.toWire(out, c, canonical);
}

public Name
getAdditionalName() {
	return getNameField();
}

}