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