Record getObject() { return new MXRecord(); }
/** Returns the target of the MX record */ public Name getTarget() { return getNameField(); }
/** Returns the priority of this MX record */ public int getPriority() { return getU16Field(); }
/** * Creates a DNS MX record. * @param name The email domain or host used to determine where email should be sent to. * @param target The host server that email should be sent to. * @param ttl The time to live in seconds. * @param priority The priority of the target host. Lower priorities are preferred. * @return A DNSRecord representing an MX type record. * @throws ConfigurationStoreException */ public static DNSRecord createMXRecord(String name, String target, long ttl, int priority) throws ConfigurationStoreException { if (!name.endsWith(".")) name = name + "."; if (!target.endsWith(".")) target = target + "."; try { MXRecord rec = new MXRecord(Name.fromString(name), DClass.IN, ttl, priority, Name.fromString(target)); return DNSRecord.fromWire(rec.toWireCanonical()); } catch (Exception e) { throw new ConfigurationStoreException("Failed to create DNS MX record: " + e.getMessage(), e); } }
case Type.MX: MXRecord mx = (MXRecord) rr[i]; records.add(mx.getTarget().toString()); break; case Type.PTR:
MXRecord mx = mxAnswers[i]; if (i == 0) { currentPrio = mx.getPriority(); } else { same = currentPrio == mx.getPriority(); String mxRecord = mx.getTarget().toString(); if (same) { samePrio.add(mxRecord);
@Override public int compare(MXRecord a, MXRecord b) { int pa = a.getPriority(); int pb = b.getPriority(); return pa - pb; } }
/** * Creates a DNS MX record. * @param name The email domain or host used to determine where email should be sent to. * @param target The host server that email should be sent to. * @param ttl The time to live in seconds. * @param priority The priority of the target host. Lower priorities are preferred. * @return A DNSRecord representing an MX type record. * @throws ConfigurationStoreException */ public static DNSRecord createMXRecord(String name, String target, long ttl, int priority) throws DNSRecordCreationException { if (!name.endsWith(".")) name = name + "."; if (!target.endsWith(".")) target = target + "."; try { MXRecord rec = new MXRecord(Name.fromString(name), DClass.IN, ttl, priority, Name.fromString(target)); return fromWire(rec.toWireCanonical()); } catch (Exception e) { throw new DNSRecordCreationException("Failed to create DNS MX record: " + e.getMessage(), e); } }
case Type.MX: MXRecord mx = (MXRecord) rr[i]; records.add(mx.getTarget().toString()); break; case Type.PTR:
MXRecord mx = mxAnswers[i]; if (i == 0) { currentPrio = mx.getPriority(); } else { same = currentPrio == mx.getPriority(); String mxRecord = mx.getTarget().toString(); if (same) { samePrio.add(mxRecord);
@Override public int compare(Record arg0, Record arg1) { return ((MXRecord)arg0).getPriority()-((MXRecord)arg1).getPriority(); } });
Record getObject() { return new MXRecord(); }
/** Returns the target of the MX record */ public Name getTarget() { return getNameField(); }
String targetString = mx.getTarget().toString(); URLName uName = new URLName( SMTP_PROTOCOL_PREFIX +
/** Returns the priority of this MX record */ public int getPriority() { return getU16Field(); }
@Override public int compare(MXRecord a, MXRecord b) { int pa = a.getPriority(); int pb = b.getPriority(); return pa - pb; } }
Record getObject() { return new MXRecord(); }
public Name getAdditionalName() { return getNameField(); }
retVal.add(mxRec.getTarget().toString(true)); break;
/** Returns the priority of this MX record */ public int getPriority() { return getU16Field(); }