01: // Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)
02:
03: package org.xbill.DNS;
04:
05: import java.io.*;
06:
07: /**
08: * Mailbox information Record - lists the address responsible for a mailing
09: * list/mailbox and the address to receive error messages relating to the
10: * mailing list/mailbox.
11: *
12: * @author Brian Wellington
13: */
14:
15: public class MINFORecord extends Record {
16:
17: private Name responsibleAddress;
18: private Name errorAddress;
19:
20: MINFORecord() {
21: }
22:
23: Record getObject() {
24: return new MINFORecord();
25: }
26:
27: /**
28: * Creates an MINFO Record from the given data
29: * @param responsibleAddress The address responsible for the
30: * mailing list/mailbox.
31: * @param errorAddress The address to receive error messages relating to the
32: * mailing list/mailbox.
33: */
34: public MINFORecord(Name name, int dclass, long ttl,
35: Name responsibleAddress, Name errorAddress) {
36: super (name, Type.MINFO, dclass, ttl);
37:
38: this .responsibleAddress = checkName("responsibleAddress",
39: responsibleAddress);
40: this .errorAddress = checkName("errorAddress", errorAddress);
41: }
42:
43: void rrFromWire(DNSInput in) throws IOException {
44: responsibleAddress = new Name(in);
45: errorAddress = new Name(in);
46: }
47:
48: void rdataFromString(Tokenizer st, Name origin) throws IOException {
49: responsibleAddress = st.getName(origin);
50: errorAddress = st.getName(origin);
51: }
52:
53: /** Converts the MINFO Record to a String */
54: String rrToString() {
55: StringBuffer sb = new StringBuffer();
56: sb.append(responsibleAddress);
57: sb.append(" ");
58: sb.append(errorAddress);
59: return sb.toString();
60: }
61:
62: /** Gets the address responsible for the mailing list/mailbox. */
63: public Name getResponsibleAddress() {
64: return responsibleAddress;
65: }
66:
67: /**
68: * Gets the address to receive error messages relating to the mailing
69: * list/mailbox.
70: */
71: public Name getErrorAddress() {
72: return errorAddress;
73: }
74:
75: void rrToWire(DNSOutput out, Compression c, boolean canonical) {
76: responsibleAddress.toWire(out, null, canonical);
77: errorAddress.toWire(out, null, canonical);
78: }
79:
80: }
|