1// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org) 2 3package org.xbill.DNS; 4 5import java.io.*; 6 7/** 8 * Responsible Person Record - lists the mail address of a responsible person 9 * and a domain where TXT records are available. 10 * 11 * @author Tom Scola <tscola@research.att.com> 12 * @author Brian Wellington 13 */ 14 15public class RPRecord extends Record { 16 17private static final long serialVersionUID = 8124584364211337460L; 18 19private Name mailbox; 20private Name textDomain; 21 22RPRecord() {} 23 24Record 25getObject() { 26 return new RPRecord(); 27} 28 29/** 30 * Creates an RP Record from the given data 31 * @param mailbox The responsible person 32 * @param textDomain The address where TXT records can be found 33 */ 34public 35RPRecord(Name name, int dclass, long ttl, Name mailbox, Name textDomain) { 36 super(name, Type.RP, dclass, ttl); 37 38 this.mailbox = checkName("mailbox", mailbox); 39 this.textDomain = checkName("textDomain", textDomain); 40} 41 42void 43rrFromWire(DNSInput in) throws IOException { 44 mailbox = new Name(in); 45 textDomain = new Name(in); 46} 47 48void 49rdataFromString(Tokenizer st, Name origin) throws IOException { 50 mailbox = st.getName(origin); 51 textDomain = st.getName(origin); 52} 53 54/** Converts the RP Record to a String */ 55String 56rrToString() { 57 StringBuffer sb = new StringBuffer(); 58 sb.append(mailbox); 59 sb.append(" "); 60 sb.append(textDomain); 61 return sb.toString(); 62} 63 64/** Gets the mailbox address of the RP Record */ 65public Name 66getMailbox() { 67 return mailbox; 68} 69 70/** Gets the text domain info of the RP Record */ 71public Name 72getTextDomain() { 73 return textDomain; 74} 75 76void 77rrToWire(DNSOutput out, Compression c, boolean canonical) { 78 mailbox.toWire(out, null, canonical); 79 textDomain.toWire(out, null, canonical); 80} 81 82} 83