1 // Copyright (c) 1999-2004 Brian Wellington (bwelling (at) xbill.org) 2 3 package org.xbill.DNS; 4 5 import 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 (at) research.att.com> 12 * @author Brian Wellington 13 */ 14 15 public class RPRecord extends Record { 16 17 private static final long serialVersionUID = 8124584364211337460L; 18 19 private Name mailbox; 20 private Name textDomain; 21 22 RPRecord() {} 23 24 Record 25 getObject() { 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 */ 34 public 35 RPRecord(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 42 void 43 rrFromWire(DNSInput in) throws IOException { 44 mailbox = new Name(in); 45 textDomain = new Name(in); 46 } 47 48 void 49 rdataFromString(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 */ 55 String 56 rrToString() { 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 */ 65 public Name 66 getMailbox() { 67 return mailbox; 68 } 69 70 /** Gets the text domain info of the RP Record */ 71 public Name 72 getTextDomain() { 73 return textDomain; 74 } 75 76 void 77 rrToWire(DNSOutput out, Compression c, boolean canonical) { 78 mailbox.toWire(out, null, canonical); 79 textDomain.toWire(out, null, canonical); 80 } 81 82 } 83