diff options
author | Rene Treffer <treffer@measite.de> | 2014-06-22 15:29:51 +0200 |
---|---|---|
committer | Rene Treffer <treffer@measite.de> | 2014-06-22 15:29:51 +0200 |
commit | 0e484dd17f85d923891460ff606b13294e8985ba (patch) | |
tree | 01b3835385c9338aec7fb9bdaf5361a25d8b5568 /src/main/java/de/measite/minidns/record | |
parent | 028700efe0345e764f598378cb64c5e57f980e33 (diff) |
Add missing javadoc and review new code
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/measite/minidns/record/A.java | 6 | ||||
-rw-r--r-- | src/main/java/de/measite/minidns/record/AAAA.java | 6 | ||||
-rw-r--r-- | src/main/java/de/measite/minidns/record/CNAME.java | 6 | ||||
-rw-r--r-- | src/main/java/de/measite/minidns/record/Data.java | 18 | ||||
-rw-r--r-- | src/main/java/de/measite/minidns/record/NS.java | 3 | ||||
-rw-r--r-- | src/main/java/de/measite/minidns/record/SRV.java | 54 |
6 files changed, 89 insertions, 4 deletions
diff --git a/src/main/java/de/measite/minidns/record/A.java b/src/main/java/de/measite/minidns/record/A.java index a85a7af0..4311c651 100644 --- a/src/main/java/de/measite/minidns/record/A.java +++ b/src/main/java/de/measite/minidns/record/A.java @@ -5,8 +5,14 @@ import java.io.IOException; import de.measite.minidns.Record.TYPE; +/** + * A record payload (ip pointer). + */ public class A implements Data { + /** + * Target IP. + */ private byte[] ip; @Override diff --git a/src/main/java/de/measite/minidns/record/AAAA.java b/src/main/java/de/measite/minidns/record/AAAA.java index d89147b2..e4fd5ecf 100644 --- a/src/main/java/de/measite/minidns/record/AAAA.java +++ b/src/main/java/de/measite/minidns/record/AAAA.java @@ -5,8 +5,14 @@ import java.io.IOException; import de.measite.minidns.Record.TYPE; +/** + * AAAA payload (an ipv6 pointer). + */ public class AAAA implements Data { + /** + * The ipv6 address. + */ private byte[] ip; @Override diff --git a/src/main/java/de/measite/minidns/record/CNAME.java b/src/main/java/de/measite/minidns/record/CNAME.java index 4657b4a5..1ac27814 100644 --- a/src/main/java/de/measite/minidns/record/CNAME.java +++ b/src/main/java/de/measite/minidns/record/CNAME.java @@ -6,6 +6,9 @@ import java.io.IOException; import de.measite.minidns.Record.TYPE; import de.measite.minidns.util.NameUtil; +/** + * CNAME payload (pointer to another domain / address). + */ public class CNAME implements Data { protected String name; @@ -20,8 +23,7 @@ public class CNAME implements Data { @Override public byte[] toByteArray() { - // TODO Auto-generated method stub - return null; + throw new UnsupportedOperationException("Not implemented yet"); } @Override diff --git a/src/main/java/de/measite/minidns/record/Data.java b/src/main/java/de/measite/minidns/record/Data.java index 9cb80374..7f2db03a 100644 --- a/src/main/java/de/measite/minidns/record/Data.java +++ b/src/main/java/de/measite/minidns/record/Data.java @@ -5,12 +5,30 @@ import java.io.IOException; import de.measite.minidns.Record.TYPE; +/** + * Generic payload class. + */ public interface Data { + /** + * The payload type. + * @return The payload type. + */ TYPE getType(); + /** + * Binary representation of this payload. + * @return The binary representation of this payload. + */ byte[] toByteArray(); + /** + * Parse this payload. + * @param dis The input stream. + * @param data The plain data (needed for name cross references). + * @param length The payload length. + * @throws IOException on io error (read past paket boundary). + */ void parse(DataInputStream dis, byte data[], int length) throws IOException; } diff --git a/src/main/java/de/measite/minidns/record/NS.java b/src/main/java/de/measite/minidns/record/NS.java index bf07e8c4..8ac2d4c3 100644 --- a/src/main/java/de/measite/minidns/record/NS.java +++ b/src/main/java/de/measite/minidns/record/NS.java @@ -2,6 +2,9 @@ package de.measite.minidns.record; import de.measite.minidns.Record.TYPE; +/** + * Nameserver record. + */ public class NS extends CNAME { @Override diff --git a/src/main/java/de/measite/minidns/record/SRV.java b/src/main/java/de/measite/minidns/record/SRV.java index 32b70c4d..707bf3f5 100644 --- a/src/main/java/de/measite/minidns/record/SRV.java +++ b/src/main/java/de/measite/minidns/record/SRV.java @@ -6,49 +6,99 @@ import java.io.IOException; import de.measite.minidns.Record.TYPE; import de.measite.minidns.util.NameUtil; +/** + * SRV record payload (service pointer). + */ public class SRV implements Data { + /** + * The priority of this service. + */ protected int priority; + + /** + * The weight of this service. + */ protected int weight; + + /** + * The target port. + */ protected int port; + + /** + * The target server. + */ protected String name; + /** + * The priority of this service. Lower values mean higher priority. + * @return The priority. + */ public int getPriority() { return priority; } + /** + * Set the priority of this service entry. Lower values have higher priority. + * @param priority The new priority. + */ public void setPriority(int priority) { this.priority = priority; } + /** + * The weight of this service. Services with the same priority should be + * balanced based on weight. + * @return The weight of this service. + */ public int getWeight() { return weight; } + /** + * Set the weight of this service. + * @param weight The new weight of this service. + */ public void setWeight(int weight) { this.weight = weight; } + /** + * The target port of this service. + * @return The target port of this service. + */ public int getPort() { return port; } + /** + * Set the target port of this service. + * @param port The new target port. + */ public void setPort(int port) { this.port = port; } + /** + * The name of the target server. + * @return The target servers name. + */ public String getName() { return name; } + /** + * Set the name of the target server. + * @param name The new target servers name. + */ public void setName(String name) { this.name = name; } @Override public byte[] toByteArray() { - // TODO Auto-generated method stub - return null; + throw new UnsupportedOperationException("Not implemented yet"); } @Override |