1 // Copyright (c) 2008 Brian Wellington (bwelling@xbill.org)
2
3 package org.xbill.DNS;
4
5 import java.io.*;
6 import org.xbill.DNS.utils.base64;
7
8 /**
9 * DHCID - Dynamic Host Configuration Protocol (DHCP) ID (RFC 4701)
10 *
11 * @author Brian Wellington
12 */
13
14 public class DHCIDRecord extends Record {
15
16 private static final long serialVersionUID = -8214820200808997707L;
17
18 private byte [] data;
19
DHCIDRecord()20 DHCIDRecord() {}
21
22 Record
getObject()23 getObject() {
24 return new DHCIDRecord();
25 }
26
27 /**
28 * Creates an DHCID Record from the given data
29 * @param data The binary data, which is opaque to DNS.
30 */
31 public
DHCIDRecord(Name name, int dclass, long ttl, byte [] data)32 DHCIDRecord(Name name, int dclass, long ttl, byte [] data) {
33 super(name, Type.DHCID, dclass, ttl);
34 this.data = data;
35 }
36
37 void
rrFromWire(DNSInput in)38 rrFromWire(DNSInput in) throws IOException {
39 data = in.readByteArray();
40 }
41
42 void
rdataFromString(Tokenizer st, Name origin)43 rdataFromString(Tokenizer st, Name origin) throws IOException {
44 data = st.getBase64();
45 }
46
47 void
rrToWire(DNSOutput out, Compression c, boolean canonical)48 rrToWire(DNSOutput out, Compression c, boolean canonical) {
49 out.writeByteArray(data);
50 }
51
52 String
rrToString()53 rrToString() {
54 return base64.toString(data);
55 }
56
57 /**
58 * Returns the binary data.
59 */
60 public byte []
getData()61 getData() {
62 return data;
63 }
64
65 }
66