Home | History | Annotate | Download | only in DNS
      1 // Copyright (c) 1999-2004 Brian Wellington (bwelling (at) xbill.org)
      2 
      3 package org.xbill.DNS;
      4 
      5 /**
      6  * Mail Exchange - specifies where mail to a domain is sent
      7  *
      8  * @author Brian Wellington
      9  */
     10 
     11 public class MXRecord extends U16NameBase {
     12 
     13 private static final long serialVersionUID = 2914841027584208546L;
     14 
     15 MXRecord() {}
     16 
     17 Record
     18 getObject() {
     19 	return new MXRecord();
     20 }
     21 
     22 /**
     23  * Creates an MX Record from the given data
     24  * @param priority The priority of this MX.  Records with lower priority
     25  * are preferred.
     26  * @param target The host that mail is sent to
     27  */
     28 public
     29 MXRecord(Name name, int dclass, long ttl, int priority, Name target) {
     30 	super(name, Type.MX, dclass, ttl, priority, "priority",
     31 	      target, "target");
     32 }
     33 
     34 /** Returns the target of the MX record */
     35 public Name
     36 getTarget() {
     37 	return getNameField();
     38 }
     39 
     40 /** Returns the priority of this MX record */
     41 public int
     42 getPriority() {
     43 	return getU16Field();
     44 }
     45 
     46 void
     47 rrToWire(DNSOutput out, Compression c, boolean canonical) {
     48 	out.writeU16(u16Field);
     49 	nameField.toWire(out, c, canonical);
     50 }
     51 
     52 public Name
     53 getAdditionalName() {
     54 	return getNameField();
     55 }
     56 
     57 }
     58