Home | History | Annotate | Download | only in DNS
      1 // Copyright (c) 1999-2004 Brian Wellington (bwelling (at) xbill.org)
      2 package org.xbill.DNS;
      3 
      4 import java.io.*;
      5 
      6 import org.xbill.DNS.utils.base16;
      7 
      8 /**
      9  * An EDNSOption with no internal structure.
     10  *
     11  * @author Ming Zhou <mizhou (at) bnivideo.com>, Beaumaris Networks
     12  * @author Brian Wellington
     13  */
     14 public class GenericEDNSOption extends EDNSOption {
     15 
     16 private byte [] data;
     17 
     18 GenericEDNSOption(int code) {
     19 	super(code);
     20 }
     21 
     22 /**
     23  * Construct a generic EDNS option.
     24  * @param data The contents of the option.
     25  */
     26 public
     27 GenericEDNSOption(int code, byte [] data) {
     28 	super(code);
     29 	this.data = Record.checkByteArrayLength("option data", data, 0xFFFF);
     30 }
     31 
     32 void
     33 optionFromWire(DNSInput in) throws IOException {
     34 	data = in.readByteArray();
     35 }
     36 
     37 void
     38 optionToWire(DNSOutput out) {
     39 	out.writeByteArray(data);
     40 }
     41 
     42 String
     43 optionToString() {
     44 	return "<" + base16.toString(data) + ">";
     45 }
     46 
     47 }
     48