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