01: // Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
02:
03: package org.xbill.DNS;
04:
05: /**
06: * Mail Exchange - specifies where mail to a domain is sent
07: *
08: * @author Brian Wellington
09: */
10:
11: public class MXRecord extends U16NameBase {
12:
13: MXRecord() {
14: }
15:
16: Record getObject() {
17: return new MXRecord();
18: }
19:
20: /**
21: * Creates an MX Record from the given data
22: * @param priority The priority of this MX. Records with lower priority
23: * are preferred.
24: * @param target The host that mail is sent to
25: */
26: public MXRecord(Name name, int dclass, long ttl, int priority,
27: Name target) {
28: super (name, Type.MX, dclass, ttl, priority, "priority", target,
29: "target");
30: }
31:
32: /** Returns the target of the MX record */
33: public Name getTarget() {
34: return getNameField();
35: }
36:
37: /** Returns the priority of this MX record */
38: public int getPriority() {
39: return getU16Field();
40: }
41:
42: void rrToWire(DNSOutput out, Compression c, boolean canonical) {
43: out.writeU16(u16Field);
44: nameField.toWire(out, c, canonical);
45: }
46:
47: public Name getAdditionalName() {
48: return getNameField();
49: }
50:
51: }
|